Customize HTML page title

The existing customize feature only changed the title in the navbar.
This commit is contained in:
Vic Demuzere 2023-08-10 17:07:17 +02:00
parent 48d16f3543
commit faccb174e3
No known key found for this signature in database
GPG Key ID: 5B9EA1616690CF94
3 changed files with 8 additions and 1 deletions

View File

@ -49,6 +49,12 @@ func loadCustomize(filename string) (customize, error) {
)
}
func (c *customize) defaults() {
if len(c.AppTitle) == 0 {
c.AppTitle = "OTS - One Time Secrets"
}
}
func (c customize) ToJSON() (string, error) {
j, err := json.Marshal(c)
return string(j), errors.Wrap(err, "marshalling JSON")

View File

@ -30,7 +30,7 @@
rel="stylesheet"
>
<title>OTS - One Time Secrets</title>
<title>{{ .Customize.AppTitle }}</title>
<script nonce="{{ .InlineContentNonce }}">
window.getTheme = () => localStorage.getItem('set-color-scheme') || (window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark')

View File

@ -73,6 +73,7 @@ func initApp() error {
if cust, err = loadCustomize(cfg.Customize); err != nil {
return errors.Wrap(err, "loading customizations")
}
cust.defaults()
frontendFS, err := fs.Sub(embeddedAssets, "frontend")
if err != nil {