1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-12-12 05:20:26 +00:00

Allow adding styles in addition to default to /static/custom.css

This commit is contained in:
bouncepaw 2021-02-02 22:28:26 +05:00
parent 1604278819
commit dcd12a4a6d

View File

@ -119,12 +119,15 @@ func handlerRandom(w http.ResponseWriter, rq *http.Request) {
func handlerStyle(w http.ResponseWriter, rq *http.Request) {
log.Println(rq.URL)
if _, err := os.Stat(WikiDir + "/static/common.css"); err == nil {
http.ServeFile(w, rq, WikiDir+"/static/common.css")
if _, err := os.Stat(util.WikiDir + "/static/common.css"); err == nil {
http.ServeFile(w, rq, util.WikiDir+"/static/common.css")
} else {
w.Header().Set("Content-Type", "text/css;charset=utf-8")
w.Write([]byte(templates.DefaultCSS()))
}
if bytes, err := ioutil.ReadFile(util.WikiDir + "/static/custom.css"); err == nil {
w.Write(bytes)
}
}
func handlerIcon(w http.ResponseWriter, rq *http.Request) {