Pass API origin to apps

This commit is contained in:
Nariman Jelveh 2024-03-28 19:10:03 -07:00
parent fc5bdf6115
commit fe0cd891e1

View File

@ -1932,7 +1932,6 @@ window.launch_app = async (options)=>{
iframe_url.searchParams.append('puter.item.name', options.filename); iframe_url.searchParams.append('puter.item.name', options.filename);
iframe_url.searchParams.append('puter.item.path', options.file_path ? `~/` + options.file_path.split('/').slice(1).join('/') : undefined); iframe_url.searchParams.append('puter.item.path', options.file_path ? `~/` + options.file_path.split('/').slice(1).join('/') : undefined);
iframe_url.searchParams.append('puter.item.read_url', options.readURL); iframe_url.searchParams.append('puter.item.read_url', options.readURL);
// iframe_url.searchParams.append('puter.item.write_url', file_signature.write_url);
iframe_url.searchParams.append('puter.domain', window.app_domain); iframe_url.searchParams.append('puter.domain', window.app_domain);
} }
@ -1948,6 +1947,9 @@ window.launch_app = async (options)=>{
iframe_url.searchParams.append('puter.auth.token', options.token); iframe_url.searchParams.append('puter.auth.token', options.token);
} }
if(api_origin)
iframe_url.searchParams.append('puter.api_origin', api_origin);
// Try to acquire app token from the server // Try to acquire app token from the server
else{ else{
let response = await fetch(window.api_origin + "/auth/get-user-app-token", { let response = await fetch(window.api_origin + "/auth/get-user-app-token", {