loading user agreement from a "resource" now

This commit is contained in:
2026-03-04 16:34:19 -07:00
parent 573707587d
commit e158af99f1
10 changed files with 124 additions and 42 deletions
+19
View File
@@ -16,6 +16,7 @@ import (
"io"
"io/fs"
"net/http"
"path/filepath"
"strings"
"github.com/labstack/echo/v4"
@@ -25,6 +26,13 @@ import (
//go:embed static/*
var static_data embed.FS
//go:embed resources/*
var static_resources embed.FS
func setupResources() {
// do nothing yet
}
// AmStaticFileHandler returns a handler for the files in the static embedded filesystem.
func AmStaticFileHandler() echo.HandlerFunc {
fsys, err := fs.Sub(static_data, "static")
@@ -85,6 +93,17 @@ func breakUpHTML(r io.Reader) (string, string, error) {
return title, body, nil
}
// AmLoadHTMLResource loads an HTML resource and splits it into title and body.
func AmLoadHTMLResource(resourceName string) (string, string, error) {
f, err := static_resources.Open(filepath.Join("resources", resourceName))
if err != nil {
return "", "", err
}
title, body, err := breakUpHTML(f)
f.Close()
return title, body, err
}
/* AmStaticFramePage generates a handler that will serve up data from an external filesystem "framed" inside
* the frame with the template engine.
* Parameters: