diff options
| author | Gabriel A. Giovanini <mail@gabrielgio.me> | 2025-11-01 18:34:04 +0100 |
|---|---|---|
| committer | Gabriel A. Giovanini <mail@gabrielgio.me> | 2025-11-01 18:34:04 +0100 |
| commit | c6f77e08b8a26ec740f3121edbb7a9d06c04ce20 (patch) | |
| tree | 7155f98f89a8d7ba310416ca13170b3af172a509 /pkg | |
| parent | 49fc8733129028ff4a3537b9eb20f548f0e3e9e6 (diff) | |
| download | cerrado-c6f77e08b8a26ec740f3121edbb7a9d06c04ce20.tar.gz cerrado-c6f77e08b8a26ec740f3121edbb7a9d06c04ce20.tar.bz2 cerrado-c6f77e08b8a26ec740f3121edbb7a9d06c04ce20.zip | |
feat: Add session variable
This will allow the css to be refreshed once the server is restarted.
This allows the admin to update the theme configuration and have it
reflected in the browser.
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/handler/router.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/pkg/handler/router.go b/pkg/handler/router.go index cb5d6f5..1fbc4e3 100644 --- a/pkg/handler/router.go +++ b/pkg/handler/router.go @@ -55,7 +55,11 @@ func MountHandler( } mux.HandleFunc("/static/{file}", staticHandler) - mux.HandleFunc(fmt.Sprintf("/static/theme%s.css", templates.Slug), cssStaticHandler) // add slug so css file can be cached forever. + // add slug and session so css file can be cached forever. + // Slug follow commit id, which is update every new version + // Session is update every time server restarts, this allows the css to be + // cached forever but refresh if the admin updates the server configuration. + mux.HandleFunc(fmt.Sprintf("/static/theme.%s%s.css", templates.Session, templates.Slug), cssStaticHandler) mux.HandleFunc("/{name}/about/{$}", gitHandler.About) mux.HandleFunc("/{name}", gitHandler.Multiplex) mux.HandleFunc("/{name}/{rest...}", gitHandler.Multiplex) |
