Keep Studio business branding in verified client storage

This commit is contained in:
khondokartowsif171
2026-10-19 11:54:13 +06:00
parent 165320cc9f
commit 54091f4578
11 changed files with 151 additions and 38 deletions
+2 -3
View File
@@ -4,7 +4,7 @@ const { createHash } = require('node:crypto');
const { gzipSync } = require('node:zlib');
const MIME = { '.html': 'text/html; charset=utf-8', '.js': 'application/javascript; charset=utf-8', '.css': 'text/css; charset=utf-8', '.json': 'application/json; charset=utf-8', '.png': 'image/png', '.jpg': 'image/jpeg', '.jpeg': 'image/jpeg', '.webp': 'image/webp', '.svg': 'image/svg+xml', '.ico': 'image/x-icon', '.woff': 'font/woff', '.woff2': 'font/woff2' };
const ROOT_FILES = new Set(['index.html', 'app.js', 'workspace.js', 'style.css', 'sw.js', 'manifest.json', 'gt_full_catalog.json']);
const ROOT_FILES = new Set(['index.html', 'app.js', 'workspace.js', 'style.css', 'sw.js', 'manifest.json']);
function createStaticHandler(publicDirectory, { maxCacheBytes = 16 * 1024 * 1024 } = {}) {
const root = path.resolve(publicDirectory), cache = new Map();
@@ -20,8 +20,7 @@ function createStaticHandler(publicDirectory, { maxCacheBytes = 16 * 1024 * 1024
if (pathname.includes('\\') || pathname.includes('\0') || pathname.split('/').some(p => p.startsWith('.'))) return missing(response);
let relative = pathname === '/' ? 'index.html' : pathname.replace(/^\/+/, '');
const asset = relative.startsWith('assets/') && MIME[path.extname(relative).toLowerCase()];
const legacyData = relative === 'data/synced_stores.json';
if (!ROOT_FILES.has(relative) && !asset && !legacyData) {
if (!ROOT_FILES.has(relative) && !asset) {
if (!path.extname(relative) && !/^(?:server|docs|test|data|node_modules)(?:\/|$)/.test(relative) && String(request.headers.accept || '').includes('text/html')) relative = 'index.html';
else return missing(response);
}