From 7be7822d92fbe16e2c32a554e627905d3daa9451 Mon Sep 17 00:00:00 2001 From: Ecio Date: Sat, 20 Jun 2026 17:31:07 -0300 Subject: [PATCH] fix: replace logo via JS img.src instead of CSS content: url() content: url() on is unreliable in modern Chrome; setting src directly in JS is the approach that works in whatsapp-api. Co-Authored-By: Claude Sonnet 4.6 --- src/routes.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/routes.js b/src/routes.js index 6fc335d..f49b3b8 100644 --- a/src/routes.js +++ b/src/routes.js @@ -97,7 +97,6 @@ if (enableSwagger) { align-items: center; } .swagger-ui .topbar .topbar-wrapper .link img { - content: url("./custom-logo.png"); height: 56px; width: auto; grid-column: 1; @@ -320,6 +319,8 @@ if (enableSwagger) { } var observer = new MutationObserver(function () { + var img = document.querySelector('.swagger-ui .topbar-wrapper .link img') + if (img && img.src.indexOf('custom-logo') === -1) fixLogo() if (!document.querySelector('.neuralsys-filter-container') && document.querySelector('.opblock-tag-section')) { installFilter() @@ -396,7 +397,16 @@ if (enableSwagger) { document.body.appendChild(footer) } + function fixLogo() { + var img = document.querySelector('.swagger-ui .topbar-wrapper .link img') + if (!img) { return setTimeout(fixLogo, 100) } + if (img.src.indexOf('custom-logo') === -1) { + img.src = '/api-docs/custom-logo.png' + } + } + function boot() { + fixLogo() installFilter() translateCopyButtons() installFooter()