Initial commit: thbd-portal, duplicated from elmi-portal

Rebranded for Thunderbird Portal (THBD): numbering prefix EL->TH, all
"ELMI"/"ЭЛМИ" UI strings genericized, ELMI's real contract templates and
company legal/bank details removed (not applicable to this company), fresh
VAPID keypair and encryption key, fresh single-migration schema history.
Same architecture as elmi-portal: Web Push notifications, unread-chat app
badge, cookie-session auth.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gh2UXUQUVBWroWEnn1FLFG
This commit is contained in:
ogrechkoandClaude Sonnet 5 committed 2026-08-31 16:33:30 +00:00
commit 579528edf7
197 files changed
+25022

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

+14
View File
@@ -0,0 +1,14 @@
{
"name": "Thunderbird Portal",
"short_name": "THBD",
"description": "Единый портал THBD: запросы, заявки, слежение, финансы.",
"start_url": "/inquiries",
"scope": "/",
"display": "standalone",
"background_color": "#f8f7fb",
"theme_color": "#6d28d9",
"icons": [
{ "src": "/icon-192.png", "sizes": "192x192", "type": "image/png", "purpose": "any" },
{ "src": "/icon-512.png", "sizes": "512x512", "type": "image/png", "purpose": "any" }
]
}
+53
View File
@@ -0,0 +1,53 @@
// Web Push service worker. Deliberately minimal — no offline caching, no
// asset interception. Its only job is to keep receiving push events even
// when the page's own tab is frozen or closed, and turn them into an OS
// notification.
self.addEventListener("push", (event) => {
let payload = { title: "Thunderbird Portal", body: "", url: "/inquiries" };
try {
if (event.data) payload = { ...payload, ...event.data.json() };
} catch {
// malformed payload — fall back to the generic notification above
}
event.waitUntil(
(async () => {
await self.registration.showNotification(payload.title, {
body: payload.body,
icon: "/icon-192.png",
data: { url: payload.url },
});
// badgeCount is only present on payloads that affect the unread chat
// count — other event types omit it entirely so the badge is left
// alone. Android/desktop only; iOS Safari has no Badging API (the
// calls just don't exist there, so this is a no-op, not an error).
if (typeof payload.badgeCount === "number" && "setAppBadge" in self.navigator) {
if (payload.badgeCount > 0) {
await self.navigator.setAppBadge(payload.badgeCount);
} else {
await self.navigator.clearAppBadge();
}
}
})(),
);
});
self.addEventListener("notificationclick", (event) => {
event.notification.close();
const url = event.notification.data && event.notification.data.url ? event.notification.data.url : "/inquiries";
event.waitUntil(
(async () => {
const clientsList = await self.clients.matchAll({ type: "window", includeUncontrolled: true });
const existing = clientsList.find((c) => "focus" in c);
if (existing) {
await existing.navigate(url);
await existing.focus();
return;
}
await self.clients.openWindow(url);
})(),
);
});