Keep code base tidy
This commit is contained in:
parent
24a2f472ec
commit
c8138351c9
5 changed files with 16 additions and 18 deletions
|
@ -67,6 +67,5 @@ func Parse() {
|
||||||
logger.EnableDebug()
|
logger.EnableDebug()
|
||||||
}
|
}
|
||||||
|
|
||||||
// start daemon
|
|
||||||
daemon.Run(cfg, store)
|
daemon.Run(cfg, store)
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,24 +12,23 @@ import (
|
||||||
|
|
||||||
var requestedLevel = InfoLevel
|
var requestedLevel = InfoLevel
|
||||||
|
|
||||||
// LogLevel type
|
// LogLevel type.
|
||||||
type LogLevel uint32
|
type LogLevel uint32
|
||||||
|
|
||||||
const (
|
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
|
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
|
ErrorLevel
|
||||||
|
|
||||||
// InfoLevel should be used during normal operations
|
// InfoLevel should be used during normal operations.
|
||||||
InfoLevel
|
InfoLevel
|
||||||
|
|
||||||
// DebugLevel should be used only during development
|
// DebugLevel should be used only during development.
|
||||||
DebugLevel
|
DebugLevel
|
||||||
)
|
)
|
||||||
|
|
||||||
// Convert the Level to a string.
|
|
||||||
func (level LogLevel) String() string {
|
func (level LogLevel) String() string {
|
||||||
switch level {
|
switch level {
|
||||||
case DebugLevel:
|
case DebugLevel:
|
||||||
|
@ -40,9 +39,9 @@ func (level LogLevel) String() string {
|
||||||
return "ERROR"
|
return "ERROR"
|
||||||
case FatalLevel:
|
case FatalLevel:
|
||||||
return "FATAL"
|
return "FATAL"
|
||||||
}
|
default:
|
||||||
|
|
||||||
return "UNKNOWN"
|
return "UNKNOWN"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// EnableDebug increases logging, more verbose (debug)
|
// EnableDebug increases logging, more verbose (debug)
|
||||||
|
|
|
@ -20,7 +20,7 @@ type Worker struct {
|
||||||
|
|
||||||
// Run wait for a job and refresh the given feed.
|
// Run wait for a job and refresh the given feed.
|
||||||
func (w *Worker) Run(c chan model.Job) {
|
func (w *Worker) Run(c chan model.Job) {
|
||||||
logger.Debug("[Worker] #%d started", w.id)
|
logger.Info("[Worker] #%d started", w.id)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
job := <-c
|
job := <-c
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Code generated by go generate; DO NOT EDIT.
|
// 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
|
package static
|
||||||
|
|
||||||
|
@ -44,10 +44,9 @@ return "";}
|
||||||
execute(){fetch(new Request(this.url,this.options)).then((response)=>{if(this.callback){this.callback(response);}});}}
|
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;});}
|
class UnreadCounterHandler{static decrement(n){this.updateValue((current)=>{return current-n;});}
|
||||||
static increment(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);});}}
|
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();}
|
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);if(newStatus==="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);}
|
||||||
let link=element.querySelector("a[data-toggle-status]");if(link){this.toggleLinkStatus(link);}
|
|
||||||
break;}}}
|
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 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();}
|
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);}}
|
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;}
|
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);}}
|
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();}}
|
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");}}
|
goToPrevious(){if(this.isListView()){this.goToPreviousListItem();}else{this.goToPage("previous");}}
|
||||||
goToNext(){if(this.isListView()){this.goToNextListItem();}else{this.goToPage("next");}}
|
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{
|
var JavascriptChecksums = map[string]string{
|
||||||
"app": "aa432d89d424abf0d19278f72e75ffd98cba203cf3cccb40b80e6d91e7609a17",
|
"app": "cfeb45231fd784b9eaceefb12ecf7f2543e4c871fb3af3cebf25757446e3eae7",
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ func (c *Controller) SubmitSubscription(ctx *handler.Context, request *handler.R
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Info("[UI:SubmitSubscription] %s", subscriptions)
|
logger.Debug("[UI:SubmitSubscription] %s", subscriptions)
|
||||||
|
|
||||||
n := len(subscriptions)
|
n := len(subscriptions)
|
||||||
switch {
|
switch {
|
||||||
|
|
Loading…
Reference in a new issue