diff --git a/main.go b/main.go index 852e6c6..b878684 100644 --- a/main.go +++ b/main.go @@ -49,6 +49,7 @@ func setupEcho() *echo.Echo { e.GET("/TODO/*", fn) e.POST("/TODO/*", fn) e.GET("/img/*", ui.AmWrap(ui.AmServeImage)) + e.GET("/static/*", ui.AmStaticFileHandler()) e.GET("/", ui.AmWrap(TopPage)) e.GET("/about", ui.AmWrap(AboutPage)) diff --git a/ui/static.go b/ui/static.go new file mode 100644 index 0000000..333e505 --- /dev/null +++ b/ui/static.go @@ -0,0 +1,31 @@ +/* + * Amsterdam Web Communities System + * Copyright (c) 2025 Erbosoft Metaverse Design Solutions, All Rights Reserved + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +// Package ui holds the support for the Amsterdam user interface, wrapping Echo and Jet templates. +package ui + +import ( + "embed" + "io/fs" + "net/http" + + "github.com/labstack/echo/v4" +) + +//go:embed static/* +var static_data embed.FS + +// AmStaticFileHandler returns a handler for the files in the static embedded filesystem. +func AmStaticFileHandler() echo.HandlerFunc { + fsys, err := fs.Sub(static_data, "static") + if err != nil { + panic(err) + } + return echo.WrapHandler(http.StripPrefix("/static/", http.FileServer(http.FS(fsys)))) +} diff --git a/ui/static/css/ams_style.css b/ui/static/css/ams_style.css new file mode 100644 index 0000000..88943b8 --- /dev/null +++ b/ui/static/css/ams_style.css @@ -0,0 +1,13 @@ +/* + * Amsterdam Web Communities System + * Copyright (c) 2025 Erbosoft Metaverse Design Solutions, All Rights Reserved + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ +pre.amsPost a { + --tw-text-opacity: 1; + color: rgb(29 78 216 / var(--tw-text-opacity, 1)); + text-decoration: underline; +} diff --git a/ui/views/frame.jet b/ui/views/frame.jet index 34a32e6..05d5367 100644 --- a/ui/views/frame.jet +++ b/ui/views/frame.jet @@ -18,6 +18,7 @@ {{ end }} + diff --git a/ui/views/new_topic.jet b/ui/views/new_topic.jet index ea78e94..65e0b17 100644 --- a/ui/views/new_topic.jet +++ b/ui/views/new_topic.jet @@ -41,7 +41,7 @@
-
{{ previewPb | raw }}
+
{{ previewPb | raw }}