diff --git a/cmd/willow.go b/cmd/willow.go index 6229cfc..bebbf64 100644 --- a/cmd/willow.go +++ b/cmd/willow.go @@ -105,11 +105,11 @@ func main() { } mux := http.NewServeMux() - mux.HandleFunc("/", wsHandler.RootHandler) - mux.HandleFunc("/static", ws.StaticHandler) + mux.HandleFunc("/static/", ws.StaticHandler) mux.HandleFunc("/new", wsHandler.NewHandler) mux.HandleFunc("/login", wsHandler.LoginHandler) mux.HandleFunc("/logout", wsHandler.LogoutHandler) + mux.HandleFunc("/", wsHandler.RootHandler) httpServer := &http.Server{ Addr: config.Server.Listen, diff --git a/ws/static/home.html b/ws/static/home.html index 75d5d7d..51a2187 100644 --- a/ws/static/home.html +++ b/ws/static/home.html @@ -4,39 +4,29 @@ Willow - - + + + + + + + + + + + +

Willow

Track a new project

+
{{- range . -}} -
-

{{ .Name }}   Delete?

-

Currently running {{ .Running }}.

- {{- if ne .Running (index .Releases 0).Tag -}} -

New release available: {{ (index .Releases 0).Tag }}. Update?

+
+

{{ .Name }}   Delete?

+

Currently running {{ .Running }}.

+ {{- if ne .Running (index .Releases 0).Tag -}} +

New release available: {{ (index .Releases 0).Tag }}. Update?

Expand release notes @@ -49,7 +39,8 @@ html { {{- end -}}

- {{- end -}} + {{- end -}} +
{{- end -}} diff --git a/ws/static/login.html b/ws/static/login.html index bcb3b4d..4f7bdf1 100644 --- a/ws/static/login.html +++ b/ws/static/login.html @@ -4,17 +4,22 @@ Willow - - + + + + + + + + + + + +

Willow

-
+
diff --git a/ws/static/new.html b/ws/static/new.html index 80889e8..4d10525 100644 --- a/ws/static/new.html +++ b/ws/static/new.html @@ -4,13 +4,18 @@ Willow - - + + + + + + + + + + + +

Willow

diff --git a/ws/static/reset.css b/ws/static/reset.css new file mode 100644 index 0000000..1894962 --- /dev/null +++ b/ws/static/reset.css @@ -0,0 +1,70 @@ +/* Box sizing rules */ +*, +*::before, +*::after { + box-sizing: border-box; +} + +/* Prevent font size inflation */ +html { + -moz-text-size-adjust: none; + -webkit-text-size-adjust: none; + text-size-adjust: none; +} + +/* Remove default margin in favour of better control in authored CSS */ +body, h1, h2, h3, h4, p, +figure, blockquote, dl, dd { + margin-block-end: 0; +} + +/* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */ +ul[role='list'], +ol[role='list'] { + list-style: none; +} + +/* Set core body defaults */ +body { + line-height: 1.5; +} + +/* Set shorter line heights on headings and interactive elements */ +h1, h2, h3, h4, +button, input, label { + line-height: 1.1; +} + +/* Balance text wrapping on headings */ +h1, h2, +h3, h4 { + text-wrap: balance; +} + +/* A elements that don't have a class get default styles */ +a:not([class]) { + text-decoration-skip-ink: auto; +} + +/* Make images easier to work with */ +img, +picture { + max-width: 100%; + display: block; +} + +/* Inherit fonts for inputs and buttons */ +input, button, +textarea, select { + font: inherit; +} + +/* Make sure textareas without a rows attribute are not tiny */ +textarea:not([rows]) { + min-height: 10em; +} + +/* Anything that has been anchored to should have extra scroll margin */ +:target { + scroll-margin-block: 5ex; +} \ No newline at end of file diff --git a/ws/static/select-release.html b/ws/static/select-release.html index 0889250..10ea7a8 100644 --- a/ws/static/select-release.html +++ b/ws/static/select-release.html @@ -4,13 +4,18 @@ Willow - - + + + + + + + + + + + +

Willow

diff --git a/ws/static/styles.css b/ws/static/styles.css new file mode 100644 index 0000000..7473248 --- /dev/null +++ b/ws/static/styles.css @@ -0,0 +1,63 @@ +html { + max-width: 500px; + margin: auto auto; + color: #2f2f2f; + background: white; +} + +a { + color: #0640e0; +} + +a:visited { + color: #0640e0; +} + +.project { + max-width: 500px; + border: 2px solid #ccc; + background: #f8f8f8; + border-radius: 5px; + margin-top: 20px; + padding: 20px 20px 0 20px; +} + +.project > h2 { + margin-top: 0; +} + +.project > h2 > span { + float: right; +} + +.project > details > pre { + overflow: scroll; +} + +summary { + cursor: pointer; +} + +details summary > * { + display: inline; +} + +@media (prefers-color-scheme: dark) { + html { + background: #171717; + color: #ccc; + } + + a { + color: #5582ff; + } + + a:visited { + color: #5582ff; + } + + .project { + border: 2px solid #444; + background: #1c1c1c; + } +} \ No newline at end of file diff --git a/ws/ws.go b/ws/ws.go index 6ae344b..58c34bf 100644 --- a/ws/ws.go +++ b/ws/ws.go @@ -271,7 +271,6 @@ func (h Handler) isAuthorised(r *http.Request) bool { func StaticHandler(writer http.ResponseWriter, request *http.Request) { resource := strings.TrimPrefix(request.URL.Path, "/") - // if path ends in .css, set content type to text/css if strings.HasSuffix(resource, ".css") { writer.Header().Set("Content-Type", "text/css") } else if strings.HasSuffix(resource, ".js") {