From c6f77e08b8a26ec740f3121edbb7a9d06c04ce20 Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Sat, 1 Nov 2025 18:34:04 +0100 Subject: 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. --- templates/base.qtpl | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'templates/base.qtpl') diff --git a/templates/base.qtpl b/templates/base.qtpl index 1dddb57..6ff3d53 100644 --- a/templates/base.qtpl +++ b/templates/base.qtpl @@ -1,11 +1,28 @@ This is a base page template. All the other template pages implement this interface. {% import "context" %} +{% import "crypto/rand" %} +{% import "encoding/hex" %} {% import "strconv" %} {% import "time" %} -{% code +{% code + var Slug = "" + var Session = "" + + func init() { + Session = hex.EncodeToString(generateSmallTimeID()) +} + +func generateSmallTimeID() []byte { + b := make([]byte, 4) + _, err := rand.Read(b) + if err != nil { + panic(err) + } + return b +} %} {% interface @@ -58,9 +75,9 @@ Page prints a page implementing Page interface. - {%= p.Title(ctx) %} + {%= p.Title(ctx) %} - + -- cgit v1.2.3