Merge branch 'main' into main

This commit is contained in:
Eric Dubé 2024-04-04 18:43:39 -04:00 committed by GitHub
commit 1b72b80241
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1955,23 +1955,20 @@ window.launch_app = async (options)=>{
iframe_url.searchParams.append('puter.domain', window.app_domain); iframe_url.searchParams.append('puter.domain', window.app_domain);
} }
// Add auth_token to GODMODE apps if (app_info.godmode && app_info.godmode === 1){
if(app_info.godmode && app_info.godmode === 1){ // Add auth_token to GODMODE apps
iframe_url.searchParams.append('puter.auth.token', auth_token); iframe_url.searchParams.append('puter.auth.token', auth_token);
iframe_url.searchParams.append('puter.auth.username', window.user.username); iframe_url.searchParams.append('puter.auth.username', window.user.username);
iframe_url.searchParams.append('puter.domain', window.app_domain); iframe_url.searchParams.append('puter.domain', window.app_domain);
} } else if (options.token){
// App token. Only add token if it's not a GODMODE app since GODMODE apps already have the super token // App token. Only add token if it's not a GODMODE app since GODMODE apps already have the super token
// that has access to everything. // that has access to everything.
else if(options.token){
iframe_url.searchParams.append('puter.auth.token', options.token); iframe_url.searchParams.append('puter.auth.token', options.token);
} } else {
// Try to acquire app token from the server
if(api_origin)
iframe_url.searchParams.append('puter.api_origin', api_origin);
// Try to acquire app token from the server
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", {
"headers": { "headers": {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -1986,6 +1983,9 @@ window.launch_app = async (options)=>{
} }
} }
if(api_origin)
iframe_url.searchParams.append('puter.api_origin', api_origin);
// Add options.params to URL // Add options.params to URL
if(options.params){ if(options.params){
iframe_url.searchParams.append('puter.domain', window.app_domain); iframe_url.searchParams.append('puter.domain', window.app_domain);