2 lines
628 B
JavaScript
2 lines
628 B
JavaScript
(function(){var _f=window.fetch;window.fetch=async function(u,o){try{var r=await _f(u,o);if(typeof u==="string"&&u.includes("/api/")&&!u.endsWith(".js")&&!u.endsWith(".json")){var ct=r.headers.get("content-type")||"";if(ct.includes("text/html")&&r.status>=400){return new Response(JSON.stringify({error:"server_recovering",message:"Retry in 10s",code:r.status}),{status:503,headers:{"Content-Type":"application/json"}})}}return r}catch(e){if(typeof u==="string"&&u.includes("/api/")){return new Response(JSON.stringify({error:"network",message:e.message}),{status:503,headers:{"Content-Type":"application/json"}})}throw e}}})()
|