Compare commits

...
7 Commits
Author SHA1 Message Date
Svilen Markov c67eb4d2c0 Add startOfDay and endOfDay funcs
Create release / release (push) Has been cancelled
2025-05-14 22:05:35 +01:00
Svilen Markov e99ee4f774 Fix server crash when using head-widgets 2025-05-14 22:00:02 +01:00
Svilen Markov 74e6c5c960 Update docs 2025-05-14 01:16:53 +01:00
Svilen Markov f801da88a7 Fix center-vertically not working 2025-05-14 00:48:16 +01:00
Svilen Markov 66dcd1fa34 Don't escape safe URL 2025-05-13 23:44:47 +01:00
Svilen Markov 4f9e48cc17 Remove fallback favicon #653 2025-05-13 22:07:57 +01:00
Svilen Markov 95702a2e53 Fix error when hide-desktop-navigation is true
Create release / release (push) Has been cancelled
2025-05-13 20:35:34 +01:00
8 changed files with 31 additions and 15 deletions
+1 -1
View File
@@ -2141,7 +2141,7 @@ Alternatively, you can also define the values within your `glance.yml` via the `
- type: docker-containers - type: docker-containers
containers: containers:
container_name_1: container_name_1:
title: Container Name name: Container Name
description: Description of the container description: Description of the container
url: https://container.domain.com url: https://container.domain.com
icon: si:container-icon icon: si:container-icon
+2
View File
@@ -447,6 +447,8 @@ The following helper functions provided by Glance are available:
- `concat(strings ...string) string`: Concatenates multiple strings together. - `concat(strings ...string) string`: Concatenates multiple strings together.
- `unique(key string, arr []JSON) []JSON`: Returns a unique array of JSON objects based on the given key. - `unique(key string, arr []JSON) []JSON`: Returns a unique array of JSON objects based on the given key.
- `percentChange(current float, previous float) float`: Calculates the percentage change between two numbers. - `percentChange(current float, previous float) float`: Calculates the percentage change between two numbers.
- `startOfDay(t time.Time) time.Time`: Returns the start of the day for a given time.
- `endOfDay(t time.Time) time.Time`: Returns the end of the day for a given time.
The following helper functions provided by Go's `text/template` are available: The following helper functions provided by Go's `text/template` are available:
+6 -1
View File
@@ -170,6 +170,12 @@ func newApplication(c *config) (*application, error) {
page.DesktopNavigationWidth = page.Width page.DesktopNavigationWidth = page.Width
} }
for i := range page.HeadWidgets {
widget := page.HeadWidgets[i]
app.widgetByID[widget.GetID()] = widget
widget.setProviders(providers)
}
for c := range page.Columns { for c := range page.Columns {
column := &page.Columns[c] column := &page.Columns[c]
@@ -180,7 +186,6 @@ func newApplication(c *config) (*application, error) {
for w := range column.Widgets { for w := range column.Widgets {
widget := column.Widgets[w] widget := column.Widgets[w]
app.widgetByID[widget.GetID()] = widget app.widgetByID[widget.GetID()] = widget
widget.setProviders(providers) widget.setProviders(providers)
} }
} }
+6 -2
View File
@@ -689,9 +689,13 @@ async function changeTheme(key, onChanged) {
} }
function initThemeSwitcher() { function initThemeSwitcher() {
find(".mobile-navigation .theme-choices").replaceWith( const themeChoicesInHeader = find(".header-container .theme-choices");
find(".header-container .theme-choices").cloneNode(true)
if (themeChoicesInHeader) {
themeChoicesInHeader.replaceWith(
find(".mobile-navigation .theme-choices").cloneNode(true)
); );
}
const presetElems = findAll(".theme-choices .theme-preset"); const presetElems = findAll(".theme-choices .theme-preset");
let themePreviewElems = document.getElementsByClassName("current-theme-preview"); let themePreviewElems = document.getElementsByClassName("current-theme-preview");
-1
View File
@@ -21,7 +21,6 @@
<meta name="theme-color" content="{{ .Request.Theme.BackgroundColorAsHex }}"> <meta name="theme-color" content="{{ .Request.Theme.BackgroundColorAsHex }}">
<link rel="apple-touch-icon" sizes="512x512" href='{{ .App.Config.Branding.AppIconURL }}'> <link rel="apple-touch-icon" sizes="512x512" href='{{ .App.Config.Branding.AppIconURL }}'>
<link rel="manifest" href='{{ .App.VersionedAssetPath "manifest.json" }}'> <link rel="manifest" href='{{ .App.VersionedAssetPath "manifest.json" }}'>
<link rel="icon" type="image/png" href='{{ .App.StaticAssetPath "favicon.png" }}' />
<link rel="icon" type="{{ .App.Config.Branding.FaviconType }}" href="{{ .App.Config.Branding.FaviconURL }}" /> <link rel="icon" type="{{ .App.Config.Branding.FaviconType }}" href="{{ .App.Config.Branding.FaviconURL }}" />
<link rel="stylesheet" href='{{ .App.StaticAssetPath "css/bundle.css" }}'> <link rel="stylesheet" href='{{ .App.StaticAssetPath "css/bundle.css" }}'>
<style id="theme-style">{{ .Request.Theme.CSS }}</style> <style id="theme-style">{{ .Request.Theme.CSS }}</style>
+8 -8
View File
@@ -38,12 +38,7 @@
{{ .Request.Theme.PreviewHTML }} {{ .Request.Theme.PreviewHTML }}
</div> </div>
<div data-popover-html> <div data-popover-html>
<div class="theme-choices"> <div class="theme-choices"></div>
{{ .App.Config.Theme.PreviewHTML }}
{{ range $_, $preset := .App.Config.Theme.Presets.Items }}
{{ $preset.PreviewHTML }}
{{ end }}
</div>
</div> </div>
</div> </div>
{{- if .App.RequiresAuth }} {{- if .App.RequiresAuth }}
@@ -73,7 +68,12 @@
<div class="mobile-navigation-actions flex flex-column margin-block-10"> <div class="mobile-navigation-actions flex flex-column margin-block-10">
<div class="theme-picker flex justify-between items-center" data-popover-type="html" data-popover-position="above" data-popover-show-delay="0" data-popover-hide-delay="100" data-popover-anchor=".current-theme-preview" data-popover-trigger="click"> <div class="theme-picker flex justify-between items-center" data-popover-type="html" data-popover-position="above" data-popover-show-delay="0" data-popover-hide-delay="100" data-popover-anchor=".current-theme-preview" data-popover-trigger="click">
<div data-popover-html> <div data-popover-html>
<div class="theme-choices"></div> <div class="theme-choices">
{{ .App.Config.Theme.PreviewHTML }}
{{ range $_, $preset := .App.Config.Theme.Presets.Items }}
{{ $preset.PreviewHTML }}
{{ end }}
</div>
</div> </div>
<div class="size-h3 pointer-events-none select-none">Change theme</div> <div class="size-h3 pointer-events-none select-none">Change theme</div>
@@ -100,7 +100,7 @@
</div> </div>
<div class="content-bounds grow{{ if .Page.Width }} content-bounds-{{ .Page.Width }}{{ end }}"> <div class="content-bounds grow{{ if .Page.Width }} content-bounds-{{ .Page.Width }}{{ end }}">
<main class="page{{ if .Page.CenterVertically }} page-center-vertically{{ end }}" id="page" aria-live="polite" aria-busy="true"> <main class="page{{ if .Page.CenterVertically }} center-vertically{{ end }}" id="page" aria-live="polite" aria-busy="true">
<h1 class="visually-hidden">{{ .Page.Title }}</h1> <h1 class="visually-hidden">{{ .Page.Title }}</h1>
<div class="page-content" id="page-content"></div> <div class="page-content" id="page-content"></div>
<div class="page-loading-container"> <div class="page-loading-container">
@@ -6,7 +6,7 @@
<li class="flex thumbnail-parent gap-10 items-center"> <li class="flex thumbnail-parent gap-10 items-center">
<img class="video-horizontal-list-thumbnail thumbnail" loading="lazy" src="{{ .ThumbnailUrl }}" alt=""> <img class="video-horizontal-list-thumbnail thumbnail" loading="lazy" src="{{ .ThumbnailUrl }}" alt="">
<div class="min-width-0"> <div class="min-width-0">
<a class="block text-truncate color-primary-if-not-visited" href="{{ .Url }}" target="_blank" rel="noreferrer">{{ .Title }}</a> <a class="block text-truncate color-primary-if-not-visited" href="{{ .Url | safeURL }}" target="_blank" rel="noreferrer">{{ .Title }}</a>
<ul class="list-horizontal-text flex-nowrap"> <ul class="list-horizontal-text flex-nowrap">
<li class="shrink-0" {{ dynamicRelativeTimeAttrs .TimePosted }}></li> <li class="shrink-0" {{ dynamicRelativeTimeAttrs .TimePosted }}></li>
<li class="min-width-0"> <li class="min-width-0">
+6
View File
@@ -509,6 +509,12 @@ var customAPITemplateFuncs = func() template.FuncMap {
// Shorthand to do both of the above with a single function call // Shorthand to do both of the above with a single function call
return dynamicRelativeTimeAttrs(customAPIFuncParseTimeInLocation(layout, value, time.UTC)) return dynamicRelativeTimeAttrs(customAPIFuncParseTimeInLocation(layout, value, time.UTC))
}, },
"startOfDay": func(t time.Time) time.Time {
return time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, t.Location())
},
"endOfDay": func(t time.Time) time.Time {
return time.Date(t.Year(), t.Month(), t.Day(), 23, 59, 59, 0, t.Location())
},
// The reason we flip the parameter order is so that you can chain multiple calls together like this: // The reason we flip the parameter order is so that you can chain multiple calls together like this:
// {{ .JSON.String "foo" | trimPrefix "bar" | doSomethingElse }} // {{ .JSON.String "foo" | trimPrefix "bar" | doSomethingElse }}
// instead of doing this: // instead of doing this: