feat: remove nav logo, transparent icon bg, fix login screen SVG branding
All checks were successful
Build & Release / build (push) Successful in 2m28s
All checks were successful
Build & Release / build (push) Successful in 2m28s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
2703cac433
commit
a308aa1987
2 changed files with 41 additions and 0 deletions
Binary file not shown.
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 47 KiB |
|
|
@ -138,6 +138,8 @@ export function createMainWindow() {
|
|||
) {
|
||||
event.preventDefault();
|
||||
mainWindow.webContents.reload();
|
||||
} else if (input.key === "F12") {
|
||||
mainWindow.webContents.toggleDevTools();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -241,6 +243,44 @@ function injectBranding(wc: Electron.WebContents) {
|
|||
});
|
||||
}
|
||||
|
||||
function replaceSvgWithLogo(svg) {
|
||||
var box = svg.getBoundingClientRect();
|
||||
if (box.height > 0 && box.height < 48) { svg.parentNode.removeChild(svg); return; }
|
||||
var size = '96px';
|
||||
var wrap = document.createElement('div');
|
||||
wrap.style.cssText = 'display:flex;align-items:center;justify-content:center;width:100%;';
|
||||
var img = document.createElement('img');
|
||||
img.src = LOGO;
|
||||
img.alt = 'Sanctum';
|
||||
img.style.cssText = 'width:' + size + ';height:' + size + ';object-fit:contain;flex-shrink:0;';
|
||||
img.dataset.sanctumPatched = '1';
|
||||
wrap.appendChild(img);
|
||||
svg.parentNode.replaceChild(wrap, svg);
|
||||
}
|
||||
|
||||
function patchSVGs() {
|
||||
document.querySelectorAll('svg').forEach(function(svg) {
|
||||
if (svg.dataset.sanctumPatched) return;
|
||||
// Match the Revolt wordmark SVG by its unique path data fingerprint
|
||||
var paths = svg.querySelectorAll('path');
|
||||
for (var i = 0; i < paths.length; i++) {
|
||||
var d = paths[i].getAttribute('d') || '';
|
||||
if (d.includes('M478.909') || d.includes('M5.063') || d.includes('Revolt')) {
|
||||
replaceSvgWithLogo(svg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Also catch any wide wordmark-style SVG in an auth/login container
|
||||
var parent = svg.closest('[class*="logo"],[class*="Logo"],[class*="brand"],[class*="Brand"],[class*="wordmark"],[class*="Wordmark"],[class*="auth"],[class*="login"],[class*="splash"],[class*="Landing"]');
|
||||
if (parent) {
|
||||
var box = svg.getBoundingClientRect();
|
||||
if (box.width > 80 && box.width / (box.height || 1) > 2) {
|
||||
replaceSvgWithLogo(svg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function patchText(root) {
|
||||
var walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT);
|
||||
var node;
|
||||
|
|
@ -262,6 +302,7 @@ function injectBranding(wc: Electron.WebContents) {
|
|||
|
||||
function patch(root) {
|
||||
patchImages();
|
||||
patchSVGs();
|
||||
patchText(root || document.body);
|
||||
patchTitle();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue