Skip to content

Commit 96870af

Browse files
committed
feat: Embeds favicon as base64 data URL
1 parent a5277b0 commit 96870af

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

tools/server/webui/vite.config.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,27 @@ function llamaCppBuildPlugin() {
3333
return;
3434
}
3535

36-
// Read, normalize line endings, and prefix with guide banner
3736
let content = readFileSync(indexPath, 'utf-8');
3837

38+
const faviconPath = resolve('static/favicon.svg');
39+
if (existsSync(faviconPath)) {
40+
const faviconContent = readFileSync(faviconPath, 'utf-8');
41+
const faviconBase64 = Buffer.from(faviconContent).toString('base64');
42+
const faviconDataUrl = `data:image/svg+xml;base64,${faviconBase64}`;
43+
44+
content = content.replace(
45+
/href="[^"]*favicon\.svg"/g,
46+
`href="${faviconDataUrl}"`
47+
);
48+
49+
console.log('✓ Inlined favicon.svg as base64 data URL');
50+
}
51+
3952
content = content.replace(/\r/g, '');
4053
content = GUIDE_FOR_FRONTEND + '\n' + content;
4154

42-
// Gzip with fflate (level 9) and normalize header for reproducibility
4355
const compressed = fflate.gzipSync(Buffer.from(content, 'utf-8'), { level: 9 });
4456

45-
// Zero gzip mtime and OS bytes for deterministic output
4657
compressed[0x4] = 0;
4758
compressed[0x5] = 0;
4859
compressed[0x6] = 0;

0 commit comments

Comments
 (0)