caterium-app/public/core/hotfix-v1763.js
2026-09-18 21:15:26 +03:00

41 lines
1.3 KiB
JavaScript

(()=>{
'use strict';
if(window.SunHotfixV1763)return;
const VERSION='17.6.3';
function patchDeveloperOpen(){
const dev=window.SunDeveloperV22;
if(!dev||dev.__sunV1763SafeOpen||typeof dev.open!=='function')return false;
const original=dev.open.bind(dev);
dev.open=(source=null)=>original(source instanceof HTMLElement?source:null);
Object.defineProperty(dev,'__sunV1763SafeOpen',{value:true,configurable:true});
return true;
}
// Authentication screens belong to the unified auth gate. Never replace
// its loading/error state with an old developer-only login card.
function interceptSaasAdmin(event){
const button=event.target?.closest?.('[data-saas-admin]');
if(!button)return;
const dev=window.SunDeveloperV22;
if(!dev)return;
event.preventDefault();
event.stopImmediatePropagation();
patchDeveloperOpen();
dev.open?.();
}
function maintain(){
patchDeveloperOpen();
}
document.addEventListener('click',interceptSaasAdmin,true);
window.addEventListener('sun:cloud-permissions-changed',()=>setTimeout(maintain,0));
window.addEventListener('sun:cloud-state-applied',()=>setTimeout(maintain,0));
setTimeout(maintain,0);
setInterval(()=>{if(!document.hidden)maintain();},10000);
window.SunHotfixV1763={VERSION,patchDeveloperOpen};
})();