aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <fred@miniflux.net>2018-01-29 20:46:01 -0800
committerGravatar Frédéric Guillot <fred@miniflux.net>2018-01-29 20:47:09 -0800
commitc8138351c9737e3286a128c78f39e4f8a23e7bc9 (patch)
tree3d496f051524a10e1c398f7575d3e8a6e683fae8
parent24a2f472ec8593b4734e91ac15ee5503d16ae63a (diff)
Keep code base tidy
-rw-r--r--cli/cli.go1
-rw-r--r--logger/logger.go15
-rw-r--r--scheduler/worker.go2
-rw-r--r--ui/static/js.go14
-rw-r--r--ui/subscription.go2
5 files changed, 16 insertions, 18 deletions
diff --git a/cli/cli.go b/cli/cli.go
index 80231bf..ebcb83d 100644
--- a/cli/cli.go
+++ b/cli/cli.go
@@ -67,6 +67,5 @@ func Parse() {
logger.EnableDebug()
}
- // start daemon
daemon.Run(cfg, store)
}
diff --git a/logger/logger.go b/logger/logger.go
index 01d041c..a7ef3c1 100644
--- a/logger/logger.go
+++ b/logger/logger.go
@@ -12,24 +12,23 @@ import (
var requestedLevel = InfoLevel
-// LogLevel type
+// LogLevel type.
type LogLevel uint32
const (
- // FatalLevel should be used in fatal situations, the app will exit
+ // FatalLevel should be used in fatal situations, the app will exit.
FatalLevel LogLevel = iota
- // ErrorLevel should be used when someone should really look at the error
+ // ErrorLevel should be used when someone should really look at the error.
ErrorLevel
- // InfoLevel should be used during normal operations
+ // InfoLevel should be used during normal operations.
InfoLevel
- // DebugLevel should be used only during development
+ // DebugLevel should be used only during development.
DebugLevel
)
-// Convert the Level to a string.
func (level LogLevel) String() string {
switch level {
case DebugLevel:
@@ -40,9 +39,9 @@ func (level LogLevel) String() string {
return "ERROR"
case FatalLevel:
return "FATAL"
+ default:
+ return "UNKNOWN"
}
-
- return "UNKNOWN"
}
// EnableDebug increases logging, more verbose (debug)
diff --git a/scheduler/worker.go b/scheduler/worker.go
index 8c3999e..934f31c 100644
--- a/scheduler/worker.go
+++ b/scheduler/worker.go
@@ -20,7 +20,7 @@ type Worker struct {
// Run wait for a job and refresh the given feed.
func (w *Worker) Run(c chan model.Job) {
- logger.Debug("[Worker] #%d started", w.id)
+ logger.Info("[Worker] #%d started", w.id)
for {
job := <-c
diff --git a/ui/static/js.go b/ui/static/js.go
index 7665a2f..45fc161 100644
--- a/ui/static/js.go
+++ b/ui/static/js.go
@@ -1,5 +1,5 @@
// Code generated by go generate; DO NOT EDIT.
-// 2018-01-20 13:23:40.729553481 -0800 PST m=+0.015026127
+// 2018-01-29 20:38:56.472493026 -0800 PST m=+0.027898185
package static
@@ -44,10 +44,9 @@ return "";}
execute(){fetch(new Request(this.url,this.options)).then((response)=>{if(this.callback){this.callback(response);}});}}
class UnreadCounterHandler{static decrement(n){this.updateValue((current)=>{return current-n;});}
static increment(n){this.updateValue((current)=>{return current+n;});}
-static updateValue(callback){let counterElements=document.querySelectorAll("span.unread-counter");counterElements.forEach((element)=>{let oldValue=parseInt(element.textContent,10);element.innerHTML=callback(oldValue);});}}
-class EntryHandler{static updateEntriesStatus(entryIDs,status,callback){let url=document.body.dataset.entriesStatusUrl;let request=new RequestBuilder(url);request.withBody({entry_ids:entryIDs,status:status});request.withCallback(callback);request.execute();}
-static toggleEntryStatus(element){let entryID=parseInt(element.dataset.id,10);let statuses={read:"unread",unread:"read"};for(let currentStatus in statuses){let newStatus=statuses[currentStatus];if(element.classList.contains("item-status-"+currentStatus)){element.classList.remove("item-status-"+currentStatus);element.classList.add("item-status-"+newStatus);this.updateEntriesStatus([entryID],newStatus);if(newStatus==="read"){UnreadCounterHandler.decrement(1);}else{UnreadCounterHandler.increment(1);}
-let link=element.querySelector("a[data-toggle-status]");if(link){this.toggleLinkStatus(link);}
+static updateValue(callback){let counterElements=document.querySelectorAll("span.unread-counter");counterElements.forEach((element)=>{let oldValue=parseInt(element.textContent,10);element.innerHTML=callback(oldValue);});if(window.location.href.endsWith('/unread')){let oldValue=parseInt(document.title.split('(')[1],10);let newValue=callback(oldValue);document.title=document.title.replace(/(.*?)\(\d+\)(.*?)/,function(match,prefix,suffix,offset,string){return prefix+'('+newValue+')'+suffix;});}}}
+class EntryHandler{static updateEntriesStatus(entryIDs,status,callback){let url=document.body.dataset.entriesStatusUrl;let request=new RequestBuilder(url);request.withBody({entry_ids:entryIDs,status:status});request.withCallback(callback);request.execute();if(status==="read"){UnreadCounterHandler.decrement(1);}else{UnreadCounterHandler.increment(1);}}
+static toggleEntryStatus(element){let entryID=parseInt(element.dataset.id,10);let statuses={read:"unread",unread:"read"};for(let currentStatus in statuses){let newStatus=statuses[currentStatus];if(element.classList.contains("item-status-"+currentStatus)){element.classList.remove("item-status-"+currentStatus);element.classList.add("item-status-"+newStatus);this.updateEntriesStatus([entryID],newStatus);let link=element.querySelector("a[data-toggle-status]");if(link){this.toggleLinkStatus(link);}
break;}}}
static toggleLinkStatus(link){if(link.dataset.value==="read"){link.innerHTML=link.dataset.labelRead;link.dataset.value="unread";}else{link.innerHTML=link.dataset.labelUnread;link.dataset.value="read";}}
static toggleBookmark(element){element.innerHTML=element.dataset.labelLoading;let request=new RequestBuilder(element.dataset.bookmarkUrl);request.withCallback(()=>{if(element.dataset.value==="star"){element.innerHTML=element.dataset.labelStar;element.dataset.value="unstar";}else{element.innerHTML=element.dataset.labelUnstar;element.dataset.value="star";}});request.execute();}
@@ -74,7 +73,8 @@ let currentItem=document.querySelector(".current-item");if(currentItem!==null){t
toggleBookmarkLink(parent){let bookmarkLink=parent.querySelector("a[data-toggle-bookmark]");if(bookmarkLink){EntryHandler.toggleBookmark(bookmarkLink);}}
openOriginalLink(){let entryLink=document.querySelector(".entry h1 a");if(entryLink!==null){DomHelper.openNewTab(entryLink.getAttribute("href"));return;}
let currentItemOriginalLink=document.querySelector(".current-item a[data-original-link]");if(currentItemOriginalLink!==null){DomHelper.openNewTab(currentItemOriginalLink.getAttribute("href"));let currentItem=document.querySelector(".current-item");this.goToNextListItem();EntryHandler.markEntryAsRead(currentItem);}}
-openSelectedItem(){let currentItemLink=document.querySelector(".current-item .item-title a");if(currentItemLink!==null){window.location.href=currentItemLink.getAttribute("href");}}
+openSelectedItem(){let currentItemLink=document.querySelector(".current-item .item-title a");if(currentItemLink!==null){let currentItemOriginalLink=document.querySelector(".current-item a[data-original-link]");if(currentItemOriginalLink!==null){let currentItem=document.querySelector(".current-item");EntryHandler.markEntryAsRead(currentItem);}
+window.location.href=currentItemLink.getAttribute("href");}}
goToPage(page,fallbackSelf){let element=document.querySelector("a[data-page="+page+"]");if(element){document.location.href=element.href;}else if(fallbackSelf){window.location.reload();}}
goToPrevious(){if(this.isListView()){this.goToPreviousListItem();}else{this.goToPage("previous");}}
goToNext(){if(this.isListView()){this.goToNextListItem();}else{this.goToPage("next");}}
@@ -91,5 +91,5 @@ document.addEventListener("DOMContentLoaded",function(){FormHandler.handleSubmit
}
var JavascriptChecksums = map[string]string{
- "app": "aa432d89d424abf0d19278f72e75ffd98cba203cf3cccb40b80e6d91e7609a17",
+ "app": "cfeb45231fd784b9eaceefb12ecf7f2543e4c871fb3af3cebf25757446e3eae7",
}
diff --git a/ui/subscription.go b/ui/subscription.go
index ad323ad..a6cb23c 100644
--- a/ui/subscription.go
+++ b/ui/subscription.go
@@ -69,7 +69,7 @@ func (c *Controller) SubmitSubscription(ctx *handler.Context, request *handler.R
return
}
- logger.Info("[UI:SubmitSubscription] %s", subscriptions)
+ logger.Debug("[UI:SubmitSubscription] %s", subscriptions)
n := len(subscriptions)
switch {