@davoodmehraban89 / Factor-easy-2 Mirror · read-only / commits / 83b514f
Fork 0

سامانه صدور فاکتور و حسابداری

Mirrored from https://github.com/davoodmehraban89/Factor-easy.git

Synced Dec 3, 15:45 UTC

fix(login): retry slow extension assets once with bounded wait (#139)

davoodmehraban89 committed Oct 14, 2026 at 19:41 UTC 83b514f9a5e7cd568669739f7dabc6eeeed76aeb
1 file changed +12 -2
js/bootstrap.js
+12 -2
@@ -19,8 +19,9 @@ const FINORA_EXTENSION_SCRIPTS=[
19 "js/taxpayer-print.js?v=20261003-reference-v2"
20 ];
21 const FINORA_EXTENSION_BUNDLE_URL=null;
22 -const FINORA_EXTENSION_WAIT_MS=18000;
23 -function finoraLoadScript(src){
22 +const FINORA_EXTENSION_WAIT_MS=6500;
23 +const FINORA_EXTENSION_MAX_ATTEMPTS=2;
24 +function finoraLoadScriptOnce(src){
25 return new Promise((resolve,reject)=>{
26 const script=document.createElement('script');
27 script.async=false;
@@ -39,6 +40,14 @@ function finoraLoadScript(src){
40 document.head.appendChild(script);
41 });
42 }
43 +async function finoraLoadScript(src){
44 + for(let attempt=1;attempt<=FINORA_EXTENSION_MAX_ATTEMPTS;attempt++){
45 + try{return await finoraLoadScriptOnce(src);}
46 + catch(error){
47 + if(attempt===FINORA_EXTENSION_MAX_ATTEMPTS)throw error;
48 + }
49 + }
50 +}
51 // Optional remote font must never block authentication or application scripts.
52 // This handler is installed from a local JS file because Pages strips inline
53 // HTML event handlers under its strict CSP. Tahoma remains a usable fallback.
@@ -58,6 +67,7 @@ window.addEventListener('DOMContentLoaded',async()=>{
67 failedExtensionCount:FINORA_EXTENSION_BUNDLE_URL&&failed.length?FINORA_EXTENSION_SCRIPTS.length:failed.length,
68 extensionBundle:!!FINORA_EXTENSION_BUNDLE_URL,
69 extensionLoadMs:Math.round(performance.now()-started),
70 + extensionRetryEnabled:true,
71 extensionsReady:true
72 });
73 if(failed.length){