mirror of
https://github.com/HeyPuter/puter
synced 2024-11-14 22:06:00 +00:00
Attempt to open apps from URL only if user is authenticated and desktop is loaded
This commit is contained in:
parent
d1d0a9cccc
commit
18cfef65b8
@ -1022,6 +1022,29 @@ async function UIDesktop(options){
|
||||
// adjust window container to take into account the toolbar height
|
||||
$('.window-container').css('top', window.toolbar_height);
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Determine if an app was launched from URL
|
||||
// i.e. https://puter.com/app/<app_name>
|
||||
//--------------------------------------------------------------------------------------
|
||||
if(window.url_paths[0]?.toLocaleLowerCase() === 'app' && window.url_paths[1]){
|
||||
window.app_launched_from_url = window.url_paths[1];
|
||||
// get app metadata
|
||||
try{
|
||||
window.app_launched_from_url = await puter.apps.get(window.url_paths[1])
|
||||
window.is_fullpage_mode = window.app_launched_from_url.metadata?.fullpage_on_landing ?? false;
|
||||
}catch(e){
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
// get query params, any param that doesn't start with 'puter.' will be passed to the app
|
||||
window.app_query_params = {};
|
||||
for (let [key, value] of window.url_query_params) {
|
||||
if(!key.startsWith('puter.'))
|
||||
window.app_query_params[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------
|
||||
// Run apps from insta-login URL
|
||||
// ---------------------------------------------
|
||||
|
@ -188,30 +188,7 @@ window.initgui = async function(options){
|
||||
// will hold the result of the whoami API call
|
||||
let whoami;
|
||||
|
||||
const url_paths = window.location.pathname.split('/').filter(element => element);
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Determine if an app was launched from URL
|
||||
// i.e. https://puter.com/app/<app_name>
|
||||
//--------------------------------------------------------------------------------------
|
||||
if(url_paths[0]?.toLocaleLowerCase() === 'app' && url_paths[1]){
|
||||
window.app_launched_from_url = url_paths[1];
|
||||
|
||||
// get app metadata
|
||||
try{
|
||||
window.app_launched_from_url = await puter.apps.get(window.app_launched_from_url)
|
||||
window.is_fullpage_mode = window.app_launched_from_url.metadata?.fullpage_on_landing ?? false;
|
||||
}catch(e){
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
// get query params, any param that doesn't start with 'puter.' will be passed to the app
|
||||
window.app_query_params = {};
|
||||
for (let [key, value] of window.url_query_params) {
|
||||
if(!key.startsWith('puter.'))
|
||||
window.app_query_params[key] = value;
|
||||
}
|
||||
}
|
||||
window.url_paths = window.location.pathname.split('/').filter(element => element);
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Extract 'action' from URL
|
||||
@ -235,7 +212,6 @@ window.initgui = async function(options){
|
||||
window.is_fullpage_mode = true;
|
||||
}
|
||||
|
||||
|
||||
// Launch services before any UI is rendered
|
||||
await launch_services(options);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user