aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorr <r@freesoftwareextremist.com>2023-10-15 15:46:54 +0000
committerr <r@freesoftwareextremist.com>2023-10-15 15:46:54 +0000
commited521dd33d0d002c577a75e349136fed25b7fda5 (patch)
treee591517207ee9283e450a032530668d3b81ff9e7
parent927072e26a470ed3084e36ae2413f4dfd088905f (diff)
downloadbloat-ed521dd33d0d002c577a75e349136fed25b7fda5.tar.gz
bloat-ed521dd33d0d002c577a75e349136fed25b7fda5.zip
Restrict instance level custom CSS to static directory
-rw-r--r--bloat.conf1
-rw-r--r--main.go9
-rw-r--r--templates/header.tmpl2
3 files changed, 2 insertions, 10 deletions
diff --git a/bloat.conf b/bloat.conf
index f29e553..9bd2781 100644
--- a/bloat.conf
+++ b/bloat.conf
@@ -38,5 +38,4 @@ post_formats=PlainText:text/plain,HTML:text/html,Markdown:text/markdown,BBCode:t
# single_instance=pl.mydomain.com
# Path to custom CSS. Value can be a file path relative to the static directory.
-# or a URL starting with either "http://" or "https://".
# custom_css=custom.css
diff --git a/main.go b/main.go
index 657912d..9e9ba4e 100644
--- a/main.go
+++ b/main.go
@@ -8,7 +8,6 @@ import (
"net/http"
"os"
"path/filepath"
- "strings"
"bloat/config"
"bloat/renderer"
@@ -47,14 +46,8 @@ func main() {
errExit(err)
}
- customCSS := config.CustomCSS
- if len(customCSS) > 0 && !strings.HasPrefix(customCSS, "http://") &&
- !strings.HasPrefix(customCSS, "https://") {
- customCSS = "/static/" + customCSS
- }
-
s := service.NewService(config.ClientName, config.ClientScope,
- config.ClientWebsite, customCSS, config.SingleInstance,
+ config.ClientWebsite, config.CustomCSS, config.SingleInstance,
config.PostFormats, renderer)
handler := service.NewHandler(s, *verbose, config.StaticDirectory)
diff --git a/templates/header.tmpl b/templates/header.tmpl
index 8a1b0ca..7ebf65e 100644
--- a/templates/header.tmpl
+++ b/templates/header.tmpl
@@ -20,7 +20,7 @@
<title> {{if gt .Count 0}}({{.Count}}){{end}} {{.Title}} </title>
<link rel="stylesheet" href="/static/style.css">
{{if .CustomCSS}}
- <link rel="stylesheet" href="{{.CustomCSS}}">
+ <link rel="stylesheet" href="/static/{{.CustomCSS}}">
{{end}}
{{if $.Ctx.FluorideMode}}
<script src="/static/fluoride.js"></script>