diff --git a/README.md b/README.md index af7ba8d..1142e55 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ This repository contains a static single-page application used as a front page f - **autobrr** - **OpenSpeedTest** - **Muse** (Discord music bot) +- **AutoMorph** The page is intentionally framework-free: plain HTML, CSS, and vanilla JavaScript. That keeps it fast, portable, and easy to host on GitHub Pages or any static @@ -78,6 +79,7 @@ server. ├── js/ │ └── app.js # UI logic, i18n, status polling └── ops/ + ├── automorph-status/ # Caddy health-check snippet └── muse-status/ # Host probe, systemd/Caddy templates, and tests ``` @@ -100,14 +102,25 @@ Service endpoints are defined in `js/app.js`: - `https://autobrr.adiker.eu/api/healthz/liveness` - `https://speedtest.adiker.eu/health` - `https://muse.adiker.eu/health` +- `https://automorph.adiker.eu/health` -Service responses, including errors, advertise `Alt-Svc: h3=":8443"; ma=2592000` +The five existing service domains, including their error responses, advertise `Alt-Svc: h3=":8443"; ma=2592000` for HTTP/3. If that path becomes unavailable, use `Alt-Svc: clear` on all five service domains, including error responses, and verify HTTPS over TCP. A browser that cached the old alternative but cannot connect to receive an updated header may need its network/alternative-service cache cleared or a fresh browser profile. +The AutoMorph health endpoint probes the local `/index-v2.json` and returns +only `200 {"status":"online"}` or `503 {"status":"offline"}`. It checks index +availability, not patching or scheduling. The panel remains behind Basic Auth; +the existing public index and APK paths remain available. Install the snippet as +`/etc/caddy/snippets/automorph-health.caddy` and import that absolute path inside +the AutoMorph site block before its other handlers. Validate the full Caddy +configuration and reload Caddy. +The snippet has its own error handler; merge it with an existing site error +handler if one is added later. + The Muse endpoint returns `200 {"status":"online"}` only when the local container is running, has logged `Ready!` after its current start, and has an established TCP connection to `gateway.discord.gg`. Otherwise it returns @@ -219,6 +232,7 @@ główna dla: - **autobrr** - **OpenSpeedTest** - **Muse** (bot muzyczny Discorda) +- **AutoMorph** Strona celowo nie używa frameworków: to czysty HTML, CSS i vanilla JavaScript. Dzięki temu pozostaje szybka, przenośna i łatwa w hostowaniu na GitHub Pages @@ -258,6 +272,7 @@ albo dowolnym serwerze statycznym. ├── js/ │ └── app.js # Logika UI, i18n, odpytywanie statusów └── ops/ + ├── automorph-status/ # Fragment Caddy dla statusu └── muse-status/ # Sonda hosta, szablony systemd/Caddy i testy ``` @@ -280,14 +295,25 @@ Endpointy usług są zdefiniowane w `js/app.js`: - `https://autobrr.adiker.eu/api/healthz/liveness` - `https://speedtest.adiker.eu/health` - `https://muse.adiker.eu/health` +- `https://automorph.adiker.eu/health` -Odpowiedzi usług, także błędy, ogłaszają dla HTTP/3 +Odpowiedzi pięciu wcześniejszych usług, także błędy, ogłaszają dla HTTP/3 `Alt-Svc: h3=":8443"; ma=2592000`. Jeśli ta ścieżka przestanie działać, ustaw `Alt-Svc: clear` dla wszystkich pięciu domen usług, również w odpowiedziach błędów, i sprawdź HTTPS przez TCP. Jeśli przeglądarka zapamiętała poprzedni adres i nie może połączyć się z usługą, aby odebrać nowy nagłówek, wyczyść jej pamięć sieciową/alternatywnych usług albo użyj nowego profilu przeglądarki. +Endpoint AutoMorph sprawdza lokalny `/index-v2.json` i zwraca wyłącznie +`200 {"status":"online"}` albo `503 {"status":"offline"}`. Sprawdza dostępność +indeksu, a nie działanie patchowania lub harmonogramu. Panel nadal jest chroniony +Basic Auth; istniejące publiczne ścieżki indeksu i APK pozostają dostępne. +Zainstaluj fragment jako `/etc/caddy/snippets/automorph-health.caddy` i zaimportuj +tę ścieżkę wewnątrz bloku AutoMorph przed pozostałymi handlerami. Sprawdź całą +konfigurację i przeładuj Caddy. +Fragment zawiera obsługę błędów; jeśli później powstanie inna obsługa błędów +tej strony, połącz je. + Endpoint Muse zwraca `200 {"status":"online"}` tylko wtedy, gdy lokalny kontener działa, po bieżącym uruchomieniu zalogował `Ready!` i ma aktywne połączenie TCP z `gateway.discord.gg`. W przeciwnym razie zwraca diff --git a/index.html b/index.html index 7223d3a..acf08c8 100644 --- a/index.html +++ b/index.html @@ -59,6 +59,9 @@

adiker.eu

+
@@ -79,7 +82,7 @@

Service status

Live measurements from this browser

- 0/5 online + 0/6 online Last update: --
@@ -114,6 +117,12 @@

Service status

Checking… -- ms +
+ + AutoMorph + Checking… + -- ms +
Recent measurements @@ -163,6 +172,14 @@

Service status

Avg: -- ms +
+
+ AutoMorph + No data yet +
+ + Avg: -- ms +
@@ -281,6 +298,29 @@

Muse

+ +
diff --git a/js/app.js b/js/app.js index 84bd2ed..bfd2c95 100644 --- a/js/app.js +++ b/js/app.js @@ -18,7 +18,8 @@ const SERVICE_STATE = { fb: { status: 'checking', online: false, latency: null, failCount: 0, nextDelay: 5000, warmedUp: false, latencySamples: [], history: [] }, ab: { status: 'checking', online: false, latency: null, failCount: 0, nextDelay: 5000, warmedUp: false, latencySamples: [], history: [] }, st: { status: 'checking', online: false, latency: null, failCount: 0, nextDelay: 5000, warmedUp: false, latencySamples: [], history: [] }, - mu: { status: 'checking', online: false, latency: null, failCount: 0, nextDelay: 5000, warmedUp: false, latencySamples: [], history: [] } + mu: { status: 'checking', online: false, latency: null, failCount: 0, nextDelay: 5000, warmedUp: false, latencySamples: [], history: [] }, + am: { status: 'checking', online: false, latency: null, failCount: 0, nextDelay: 5000, warmedUp: false, latencySamples: [], history: [] } }; const SERVICES = [ @@ -26,7 +27,8 @@ const SERVICES = [ { key: 'fb', url: 'https://files.adiker.eu/health' }, { key: 'ab', url: 'https://autobrr.adiker.eu/api/healthz/liveness' }, { key: 'st', url: 'https://speedtest.adiker.eu/health' }, - { key: 'mu', url: 'https://muse.adiker.eu/health' } + { key: 'mu', url: 'https://muse.adiker.eu/health' }, + { key: 'am', url: 'https://automorph.adiker.eu/health' } ]; const STR = { @@ -37,14 +39,16 @@ const STR = { filebrowser: 'Filebrowser', autobrr: 'Autobrr', openspeedtest: 'OpenSpeedTest', - muse: 'Muse' + muse: 'Muse', + automorph: 'AutoMorph' }, navCompact: { jellyfin: 'Jellyfin', filebrowser: 'Files', autobrr: 'autobrr', openspeedtest: 'Speed', - muse: 'Muse' + muse: 'Muse', + automorph: 'AutoMorph' }, subtitle: 'My Playground', availability: 'Usually available: 9:00 AM – 1:00 AM CEST', @@ -83,6 +87,7 @@ const STR = { ab: { title: 'autobrr', sub: 'Automated torrent management', open: 'Open autobrr in a new tab', short: 'autobrr' }, st: { title: 'OpenSpeedTest', sub: 'Network speed test', open: 'Open OpenSpeedTest in a new tab', short: 'OpenSpeedTest' }, mu: { title: 'Muse', sub: 'Discord music bot', note: 'Status only · no web interface', short: 'Muse' }, + am: { title: 'AutoMorph', sub: 'Android app patching', open: 'Open AutoMorph in a new tab', short: 'AutoMorph' }, projects: { eyebrow: 'OPEN SOURCE / GITHUB', title: 'Selected projects', @@ -144,14 +149,16 @@ const STR = { filebrowser: 'Filebrowser', autobrr: 'Autobrr', openspeedtest: 'OpenSpeedTest', - muse: 'Muse' + muse: 'Muse', + automorph: 'AutoMorph' }, navCompact: { jellyfin: 'Jellyfin', filebrowser: 'Pliki', autobrr: 'autobrr', openspeedtest: 'Speed', - muse: 'Muse' + muse: 'Muse', + automorph: 'AutoMorph' }, subtitle: 'Mój plac zabaw', availability: 'Zwykle dostępny: 09:00 – 01:00 CEST', @@ -190,6 +197,7 @@ const STR = { ab: { title: 'autobrr', sub: 'Automatyzacja torrentów', open: 'Otwórz autobrr w nowej karcie', short: 'autobrr' }, st: { title: 'OpenSpeedTest', sub: 'Test prędkości sieci', open: 'Otwórz OpenSpeedTest w nowej karcie', short: 'OpenSpeedTest' }, mu: { title: 'Muse', sub: 'Bot muzyczny Discorda', note: 'Tylko status · brak interfejsu WWW', short: 'Muse' }, + am: { title: 'AutoMorph', sub: 'Modyfikowanie aplikacji Android', open: 'Otwórz AutoMorph w nowej karcie', short: 'AutoMorph' }, projects: { eyebrow: 'OPEN SOURCE / GITHUB', title: 'Wybrane projekty', @@ -598,6 +606,8 @@ function applyLang(lang) { setText('mu-title', L.mu.title); setText('mu-sub', L.mu.sub); setText('mu-note', L.mu.note); + setText('am-title', L.am.title); + setText('am-sub', L.am.sub); setText('projects-eyebrow', L.projects.eyebrow); setText('projects-title', L.projects.title); @@ -625,16 +635,19 @@ function applyLang(lang) { const fbBtn = document.getElementById('fb-btn'); const abBtn = document.getElementById('ab-btn'); const stBtn = document.getElementById('st-btn'); + const amBtn = document.getElementById('am-btn'); if (jfBtn) jfBtn.setAttribute('aria-label', L.jf.open); if (fbBtn) fbBtn.setAttribute('aria-label', L.fb.open); if (abBtn) abBtn.setAttribute('aria-label', L.ab.open); if (stBtn) stBtn.setAttribute('aria-label', L.st.open); + if (amBtn) amBtn.setAttribute('aria-label', L.am.open); setTabLabel('tab-jellyfin', L.nav.jellyfin, L.navCompact.jellyfin); setTabLabel('tab-filebrowser', L.nav.filebrowser, L.navCompact.filebrowser); setTabLabel('tab-autobrr', L.nav.autobrr, L.navCompact.autobrr); setTabLabel('tab-speedtest', L.nav.openspeedtest, L.navCompact.openspeedtest); setTabLabel('tab-muse', L.nav.muse, L.navCompact.muse); + setTabLabel('tab-automorph', L.nav.automorph, L.navCompact.automorph); const tabsNav = document.querySelector('nav.tabs'); if (tabsNav) tabsNav.setAttribute('aria-label', L.ui.sections); @@ -791,13 +804,14 @@ async function refreshService(service) { } function initTabs() { - const tabIds = ['tab-jellyfin', 'tab-filebrowser', 'tab-autobrr', 'tab-speedtest', 'tab-muse']; + const tabIds = ['tab-jellyfin', 'tab-filebrowser', 'tab-autobrr', 'tab-speedtest', 'tab-muse', 'tab-automorph']; const map = { 'tab-jellyfin': 'section-jf', 'tab-filebrowser': 'section-fb', 'tab-autobrr': 'section-ab', 'tab-speedtest': 'section-st', - 'tab-muse': 'section-muse' + 'tab-muse': 'section-muse', + 'tab-automorph': 'section-am' }; const tabs = tabIds.map((id) => document.getElementById(id)).filter(Boolean); diff --git a/ops/automorph-status/health.caddy b/ops/automorph-status/health.caddy new file mode 100644 index 0000000..f19a7aa --- /dev/null +++ b/ops/automorph-status/health.caddy @@ -0,0 +1,37 @@ +# Import inside the existing automorph.adiker.eu site block, before other handles. +@automorph_health { + path /health + method GET HEAD +} +handle @automorph_health { + header Access-Control-Allow-Origin "https://adiker.eu" + header Cache-Control "no-store" + header Content-Type "application/json; charset=utf-8" + reverse_proxy 127.0.0.1:8081 { + method GET + rewrite /index-v2.json + @healthy status 200 + handle_response @healthy { + respond `{"status":"online"}` 200 + } + handle_response { + respond `{"status":"offline"}` 503 + } + } +} +handle_errors { + @automorph_health_error { + path /health + method GET HEAD + expression {http.error.status_code} == 502 + } + handle @automorph_health_error { + header Access-Control-Allow-Origin "https://adiker.eu" + header Cache-Control "no-store" + header Content-Type "application/json; charset=utf-8" + respond `{"status":"offline"}` 503 + } + handle { + respond "{http.error.status_code} {http.error.status_text}" {http.error.status_code} + } +}