aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorKushBlazingJudah <59340248+KushBlazingJudah@users.noreply.github.com>2021-08-18 00:26:02 -0300
committerKushBlazingJudah <59340248+KushBlazingJudah@users.noreply.github.com>2021-08-18 00:26:02 -0300
commit9e782ba01620997becc3118433e3d1961a88b2c3 (patch)
tree14219adaa719d6c6fb913dd9a2cf73ba3a09df71 /main.go
parent17e54854794dacac8409cd10ffb77005d74b8dbe (diff)
rudimentary theme switching
Diffstat (limited to 'main.go')
-rw-r--r--main.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/main.go b/main.go
index 6502cda..dd73510 100644
--- a/main.go
+++ b/main.go
@@ -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)))