From e4ab17cbc9d063bdd356b86e58d1844e8f2bbde6 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Wed, 2 Mar 2022 14:44:40 -0500 Subject: [PATCH] allow setting local.js --- views/honk.html | 2 +- views/honkpage.html | 3 +++ web.go | 9 ++++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/views/honk.html b/views/honk.html index 5866412..4783eb2 100644 --- a/views/honk.html +++ b/views/honk.html @@ -54,7 +54,7 @@ in reply to: {{ .RID }}
{{ .HTPrecis }}

{{ .HTPrecis }} -

{{ .HTML }} +

{{ .HTML }} {{ with .Time }}

Time: {{ .StartTime.Local.Format "03:04PM EDT Mon Jan 02"}} {{ if .Duration }}
Duration: {{ .Duration }}{{ end }} diff --git a/views/honkpage.html b/views/honkpage.html index 8c700f1..c5d575e 100644 --- a/views/honkpage.html +++ b/views/honkpage.html @@ -29,6 +29,9 @@ function playit(elem, word, wordlist, xid) { }) } +{{ if .LocalJSParam }} + +{{ end }} {{ if and .HonkCSRF (not .IsPreview) }}

diff --git a/web.go b/web.go index 71898a5..be74cd9 100644 --- a/web.go +++ b/web.go @@ -78,6 +78,7 @@ func getInfo(r *http.Request) map[string]interface{} { templinfo["StyleParam"] = getassetparam(viewDir + "/views/style.css") templinfo["LocalStyleParam"] = getassetparam(dataDir + "/views/local.css") templinfo["JSParam"] = getassetparam(viewDir + "/views/honkpage.js") + templinfo["LocalJSParam"] = getassetparam(dataDir + "/views/local.js") templinfo["ServerName"] = serverName templinfo["IconName"] = iconName templinfo["UserSep"] = userSep @@ -2470,7 +2471,12 @@ func serve() { viewDir+"/views/honkpage.js", ) if !develMode { - assets := []string{viewDir + "/views/style.css", dataDir + "/views/local.css", viewDir + "/views/honkpage.js"} + assets := []string{ + viewDir + "/views/style.css", + dataDir + "/views/local.css", + viewDir + "/views/honkpage.js", + dataDir + "/views/local.js", + } for _, s := range assets { savedassetparams[s] = getassetparam(s) } @@ -2521,6 +2527,7 @@ func serve() { getters.HandleFunc("/honkpage.js", serveviewasset) getters.HandleFunc("/wonk.js", serveviewasset) getters.HandleFunc("/local.css", servedataasset) + getters.HandleFunc("/local.js", servedataasset) getters.HandleFunc("/icon.png", servedataasset) getters.HandleFunc("/favicon.ico", servedataasset)