revert: back out the api.caterium.ru fetch rewrite for now
The previous commit accidentally carried over an uncommitted proxy cutover (supabaseProxyFetch wired into createClient's global.fetch) that was left sitting in the working tree from an earlier, paused verification session - it was never meant to ship without first completing the full checklist (auth, clients, orders, Storage, Functions) against the live proxy. Reverting just that piece so main goes back to calling cksuehzcimitsxmeloes.supabase.co directly, keeping the "Загрузить из облака" button fix from the same commit. The proxy cutover will come back once it's actually been verified end-to-end. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
38a4ba47eb
commit
4afde880d2
@ -1988,22 +1988,6 @@ window.SUN_LEGACY_CATALOG_V175=[{"id":"1","name":"Фуршетный бокс
|
||||
|
||||
const DEFAULT_SUPABASE_URL = 'https://cksuehzcimitsxmeloes.supabase.co';
|
||||
const DEFAULT_SUPABASE_KEY = 'sb_publishable_v8Z3hEBnu7zsDwAb5KCWcg_T96IejsM';
|
||||
// REST/Auth/Storage/Functions traffic to DEFAULT_SUPABASE_URL is routed through a
|
||||
// same-region reverse proxy on Timeweb so it isn't a direct request to *.supabase.co
|
||||
// (some Russian ISPs throttle/drop those). Realtime keeps using DEFAULT_SUPABASE_URL
|
||||
// directly - a PHP proxy can't handle a WebSocket upgrade - and the app already
|
||||
// degrades gracefully when Realtime can't connect.
|
||||
const SUPABASE_API_PROXY = 'https://api.caterium.ru';
|
||||
function supabaseProxyFetch(input, init) {
|
||||
try {
|
||||
const url = typeof input === 'string' ? input : input?.url;
|
||||
if (url && url.indexOf(DEFAULT_SUPABASE_URL) === 0) {
|
||||
const proxied = SUPABASE_API_PROXY + url.slice(DEFAULT_SUPABASE_URL.length);
|
||||
input = typeof input === 'string' ? proxied : new Request(proxied, input);
|
||||
}
|
||||
} catch (_) {}
|
||||
return fetch(input, init);
|
||||
}
|
||||
|
||||
let config = loadConfig();
|
||||
let client = null;
|
||||
@ -2957,7 +2941,7 @@ window.SUN_LEGACY_CATALOG_V175=[{"id":"1","name":"Фуршетный бокс
|
||||
await loadSupabaseLibrary();
|
||||
const signature=`${config.url}|${config.key}`;
|
||||
if(!client||signature!==clientSignature){
|
||||
client=window.supabase.createClient(config.url,config.key,{auth:{persistSession:true,autoRefreshToken:true,detectSessionInUrl:true},global:{fetch:supabaseProxyFetch}});clientSignature=signature;
|
||||
client=window.supabase.createClient(config.url,config.key,{auth:{persistSession:true,autoRefreshToken:true,detectSessionInUrl:true}});clientSignature=signature;
|
||||
client.auth.onAuthStateChange((_event,next)=>{session=next;membershipsLoading=Boolean(next?.user);membershipsLoaded=!next?.user;setTimeout(async()=>{try{if(!next?.user){const sw=await switchTenantLocal('');if(sw.changed){location.reload();return;}}else{const sw=await loadMemberships();if(sw){location.reload();return;}}}finally{renderCloudUI();updatePill();}},0);});
|
||||
}
|
||||
const {data,error}=await client.auth.getSession();if(error)throw error;session=data.session||null;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user