Compare commits

...

2 commits

Author SHA1 Message Date
MiTHRAL
a308aa1987 feat: remove nav logo, transparent icon bg, fix login screen SVG branding
All checks were successful
Build & Release / build (push) Successful in 2m28s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-21 21:20:01 -04:00
MiTHRAL
2703cac433 fix: broaden logo detection to catch login/logout screen Revolt logo
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-21 21:03:24 -04:00
2 changed files with 59 additions and 7 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 47 KiB

View file

@ -138,6 +138,8 @@ export function createMainWindow() {
) { ) {
event.preventDefault(); event.preventDefault();
mainWindow.webContents.reload(); mainWindow.webContents.reload();
} else if (input.key === "F12") {
mainWindow.webContents.toggleDevTools();
} }
}); });
@ -214,18 +216,67 @@ function injectBranding(wc: Electron.WebContents) {
const BRAND_RE = /\\b(Revolt|Stoat)\\b/g; const BRAND_RE = /\\b(Revolt|Stoat)\\b/g;
const SKIP_TAGS = new Set(['SCRIPT','STYLE','TEXTAREA','INPUT','CODE','PRE']); const SKIP_TAGS = new Set(['SCRIPT','STYLE','TEXTAREA','INPUT','CODE','PRE']);
function isLogoImg(img) {
var src = img.getAttribute('src') || '';
var alt = (img.getAttribute('alt') || '').toLowerCase();
// explicit brand name in src or alt
if (src.includes('revolt') || src.includes('stoat')) return true;
if (alt === 'revolt' || alt === 'stoat') return true;
// any asset image whose alt contains logo/brand keywords
if (/revolt|stoat|logo/i.test(alt)) return true;
// hashed asset paths with no alt — likely a logo if it's an svg or small png
// and sits inside a known logo/brand container
var parent = img.closest('[class*="logo"],[class*="Logo"],[class*="brand"],[class*="Brand"],[class*="wordmark"],[class*="Wordmark"],[class*="header"],[class*="auth"],[class*="login"],[class*="splash"]');
if (parent && /\\.(svg|png|webp)/.test(src)) return true;
return false;
}
function patchImages() { function patchImages() {
document.querySelectorAll('img').forEach(function(img) { document.querySelectorAll('img').forEach(function(img) {
var src = img.getAttribute('src') || ''; if (img.dataset.sanctumPatched) return;
var alt = (img.getAttribute('alt') || '').toLowerCase(); if (isLogoImg(img)) {
if (
src.includes('revolt') || src.includes('stoat') ||
alt === 'revolt' || alt === 'stoat' ||
(src.startsWith('/') && /\\.(svg|png|webp)/.test(src) && /revolt|stoat|logo/i.test(alt))
) {
img.src = LOGO; img.src = LOGO;
img.removeAttribute('srcset'); img.removeAttribute('srcset');
img.alt = 'Sanctum'; img.alt = 'Sanctum';
img.dataset.sanctumPatched = '1';
}
});
}
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);
}
} }
}); });
} }
@ -251,6 +302,7 @@ function injectBranding(wc: Electron.WebContents) {
function patch(root) { function patch(root) {
patchImages(); patchImages();
patchSVGs();
patchText(root || document.body); patchText(root || document.body);
patchTitle(); patchTitle();
} }