mirror of
https://github.com/HeyPuter/puter.git
synced 2026-07-21 06:21:47 +00:00
Merge pull request #1441 from HeyPuter/launchapp-imrpvements
send source app data to opened app
This commit is contained in:
@@ -207,6 +207,20 @@ const launch_app = async (options)=>{
|
||||
iframe_url.searchParams.append('puter.parent_instance_id', options.parent_pseudo_id);
|
||||
}
|
||||
|
||||
// add source app metadata to URL
|
||||
if (options.source_app_title) {
|
||||
iframe_url.searchParams.append('puter.source_app.title', options.source_app_title);
|
||||
}
|
||||
if (options.source_app_id) {
|
||||
iframe_url.searchParams.append('puter.source_app.id', options.source_app_id);
|
||||
}
|
||||
if (options.source_app_icon) {
|
||||
iframe_url.searchParams.append('puter.source_app.icon', options.source_app_icon);
|
||||
}
|
||||
if (options.source_app_name) {
|
||||
iframe_url.searchParams.append('puter.source_app.name', options.source_app_name);
|
||||
}
|
||||
|
||||
if(file_signature){
|
||||
iframe_url.searchParams.append('puter.item.uid', file_signature.uid);
|
||||
iframe_url.searchParams.append('puter.item.path', privacy_aware_path(options.file_path) || file_signature.path);
|
||||
|
||||
@@ -68,6 +68,30 @@ export class ExecService extends Service {
|
||||
Object.assign(params, provider());
|
||||
}
|
||||
|
||||
// Collect source app metadata if available
|
||||
let source_app_metadata = {};
|
||||
if (app) {
|
||||
// Get the source app information
|
||||
try {
|
||||
const source_app_info = await window.get_apps(process?.name);
|
||||
if (source_app_info && !Array.isArray(source_app_info)) {
|
||||
source_app_metadata = {
|
||||
source_app_title: source_app_info.title || process?.name,
|
||||
source_app_id: source_app_info.uuid || source_app_info.uid,
|
||||
source_app_icon: source_app_info.icon,
|
||||
source_app_name: source_app_info?.name || process?.name,
|
||||
};
|
||||
}
|
||||
} catch (error) {
|
||||
// If we can't get app info, use basic process info
|
||||
source_app_metadata = {
|
||||
source_app_title: process?.name,
|
||||
source_app_id: process?.uuid,
|
||||
source_app_name: process?.name,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Handle file paths if provided and caller is in godmode
|
||||
let launch_options = {
|
||||
launched_by_exec_service: true,
|
||||
@@ -77,6 +101,7 @@ export class ExecService extends Service {
|
||||
parent_instance_id: app?.appInstanceID,
|
||||
uuid: child_instance_id,
|
||||
params,
|
||||
...source_app_metadata,
|
||||
...(connection ? {
|
||||
parent_pseudo_id: connection.backward.uuid,
|
||||
} : {}),
|
||||
|
||||
Reference in New Issue
Block a user