diff options
author | KushBlazingJudah <59340248+KushBlazingJudah@users.noreply.github.com> | 2021-08-18 00:26:02 -0300 |
---|---|---|
committer | KushBlazingJudah <59340248+KushBlazingJudah@users.noreply.github.com> | 2021-08-18 00:26:02 -0300 |
commit | 9e782ba01620997becc3118433e3d1961a88b2c3 (patch) | |
tree | 14219adaa719d6c6fb913dd9a2cf73ba3a09df71 /main.go | |
parent | 17e54854794dacac8409cd10ffb77005d74b8dbe (diff) |
rudimentary theme switching
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -19,6 +19,7 @@ import ( "net/url" "os" "os/exec" + "path" "regexp" "strconv" "strings" @@ -51,6 +52,8 @@ var MediaHashs = make(map[string]string) var ActorCache = make(map[string]Actor) +var Themes []string + func main() { CreatedNeededDirectories() @@ -84,6 +87,22 @@ func main() { } } + // get list of themes + themes, err := ioutil.ReadDir("./static/css/themes") + if err != nil { + panic(err) + } + + for _, f := range themes { + if f.Name() == "default" { + continue + } + + if e := path.Ext(f.Name()); e == ".css" { + Themes = append(Themes, strings.TrimSuffix(f.Name(), e)) + } + } + // Allow access to public media folder fileServer := http.FileServer(http.Dir("./public")) http.Handle("/public/", http.StripPrefix("/public", neuter(fileServer))) |