current branding

This commit is contained in:
Raven Scott
2026-05-30 21:01:31 -04:00
parent 841d814f13
commit 416c678471
101 changed files with 689 additions and 121 deletions
+13 -10
View File
@@ -32,7 +32,7 @@ async function serveFile(filePath, res) {
}
async function serveAdminFrontendAsset(urlPath, res) {
if (!/^\/(?:ui\/[\w.-]+\.js|[\w.-]+\.(?:css|js|svg|ico|png|json|webmanifest))$/.test(urlPath)) {
if (!/^\/(?:ui\/[\w.-]+\.js|branding\/[\w.-]+\.png|[\w.-]+\.(?:css|js|svg|ico|png|json|webmanifest))$/.test(urlPath)) {
return false;
}
@@ -90,16 +90,12 @@ async function handleStaticRoutes(req, res) {
return true;
}
if (method === 'GET') {
const served = await serveAdminFrontendAsset(urlPath, res);
if (served) {
return true;
}
}
if (method === 'GET' && urlPath === '/favicon.ico') {
if (method === 'GET' && (urlPath === '/favicon.ico' || urlPath === '/apple-touch-icon.png')) {
const faviconFile = urlPath === '/favicon.ico'
? pathModule.join(ADMIN_FRONTEND_DIR, 'favicon.ico')
: pathModule.join(ADMIN_FRONTEND_DIR, 'branding', 'p2ns-favicon-192.png');
try {
await serveFile(pathModule.join(ADMIN_FRONTEND_DIR, 'favicon.svg'), res);
await serveFile(faviconFile, res);
} catch (err) {
res.writeHead(404, { 'Content-Type': 'text/plain; charset=utf-8' });
res.end('Not Found');
@@ -107,6 +103,13 @@ async function handleStaticRoutes(req, res) {
return true;
}
if (method === 'GET') {
const served = await serveAdminFrontendAsset(urlPath, res);
if (served) {
return true;
}
}
return false;
}