2 Commits

Author SHA1 Message Date
c14a86b190 Add PWA manifest and SW
All checks were successful
Build & Release / build-docker-image (push) Successful in 1m51s
Build & Release / deploy-to-production (push) Successful in 8s
2026-04-10 21:08:45 +02:00
fdbde62a25 Fix docker image name
All checks were successful
Build & Release / build-docker-image (push) Successful in 1m48s
Build & Release / deploy-to-production (push) Successful in 8s
2026-04-08 20:24:37 +02:00
6 changed files with 42 additions and 1 deletions

View File

@@ -7,7 +7,7 @@ on:
env:
ENDPOINT: services-3
STACK: misc
IMAGE: john/daily-counter
IMAGE: docker/daily-counter
TAG: ${{ gitea.ref_name }}
CACHE_NAME: cache-python-dependencies-daily-counter
RUNNER_TOOL_CACHE: /toolcache

View File

@@ -1,12 +1,14 @@
[server]
port = 8501
address = "0.0.0.0"
enableStaticServing = true
[browser]
gatherUsageStats = false
[logger]
level = "info"
hideWelcomeMessage = true
[client]
toolbarMode = "viewer"

21
app/components/pwa.py Normal file
View File

@@ -0,0 +1,21 @@
import streamlit as st
init = st.components.v2.component(
name="pwa",
isolate_styles=False,
js = """
export default function() {
// Manifest
const link = document.createElement("link");
link.rel = "manifest";
link.href = "./app/static/manifest.json";
document.head.appendChild(link);
// Service Worker
navigator.serviceWorker.register('./app/static/service-worker.js')
.then(reg => console.log('SW registered', reg))
.catch(err => console.log('SW registration failed', err));
}
""",
)

8
app/static/manifest.json Normal file
View File

@@ -0,0 +1,8 @@
{
"short_name": "Daily Counter",
"name": "Daily Counter",
"start_url": ".",
"display": "standalone",
"theme_color": "white",
"background_color": "white"
}

View File

@@ -0,0 +1,7 @@
self.addEventListener('fetch', event => {
event.respondWith(
caches.match(event.request).then(response => {
return response || fetch(event.request);
})
);
});

View File

@@ -2,6 +2,9 @@ import streamlit as st
from logger import init_logger
from styles import init_styles
from components import pwa
pwa.init()
init_logger()
init_styles()