1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00

Kill more globals

This commit is contained in:
Daniel Heath 2018-04-28 12:12:10 +10:00
parent 9cf0d0e129
commit 2e80633cd4

View File

@ -25,8 +25,6 @@ import (
const minutesToUnlock = 10.0 const minutesToUnlock = 10.0
var defaultLock string var defaultLock string
var debounceTime int
var diaryMode bool
var allowFileUploads bool var allowFileUploads bool
var needSitemapUpdate = true var needSitemapUpdate = true
var pathToData string var pathToData string
@ -190,12 +188,6 @@ func (s Site) Router() *gin.Engine {
defaultLock = HashPassword(s.DefaultPassword) defaultLock = HashPassword(s.DefaultPassword)
} }
// set the debounce time
debounceTime = s.Debounce
// set diary mode
diaryMode = s.Diary
// Allow iframe/scripts in markup? // Allow iframe/scripts in markup?
allowInsecureHtml = s.AllowInsecure allowInsecureHtml = s.AllowInsecure
return router return router
@ -520,8 +512,8 @@ func (s Site) handlePageRequest(c *gin.Context) {
"RecentlyEdited": getRecentlyEdited(page, c), "RecentlyEdited": getRecentlyEdited(page, c),
"IsPublished": p.IsPublished, "IsPublished": p.IsPublished,
"CustomCSS": len(s.Css) > 0, "CustomCSS": len(s.Css) > 0,
"Debounce": debounceTime, "Debounce": s.Debounce,
"DiaryMode": diaryMode, "DiaryMode": s.Diary,
"Date": time.Now().Format("2006-01-02"), "Date": time.Now().Format("2006-01-02"),
"UnixTime": time.Now().Unix(), "UnixTime": time.Now().Unix(),
"ChildPageNames": p.ChildPageNames(), "ChildPageNames": p.ChildPageNames(),