From 8284f35b93011550075fc72e3858e0db283d71b1 Mon Sep 17 00:00:00 2001 From: Nariman Jelveh Date: Sun, 9 Aug 2026 18:06:58 -0700 Subject: [PATCH] fix(gui): honor godmode file_paths launches now that /apps returns booleans MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The godmode gate in ExecService.launchApp checked `godmode === 1`, but GET /apps/:name serializes the flag as a boolean, so the check always failed and file_paths launches (e.g. Dev Center opening a worker's source in the editor, #2218) silently dropped the file. Accept both shapes, matching the existing guard in launch_app.js. Also fix the two issues hiding behind that gate: - puter.apps.get returns `uid`, not `uuid`, so the /sign call for the target app sent app_uid undefined — no write grant and no user-app token for the launched app. Use `uid` with a `uuid` fallback. - The closeApp IPC handler had the same `godmode === 1` comparison, preventing godmode apps from closing other apps' windows. --- src/gui/src/IPC.js | 5 +++-- src/gui/src/services/ExecService.js | 12 ++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/gui/src/IPC.js b/src/gui/src/IPC.js index 1ff6f9beb..dddc39adc 100644 --- a/src/gui/src/IPC.js +++ b/src/gui/src/IPC.js @@ -1977,9 +1977,10 @@ const ipc_listener = async (event, handled) => { return true; } - // God-mode apps can close anything + // God-mode apps can close anything. `godmode` arrives as a + // boolean from /apps but was historically 0/1 — accept both. const app_info = await window.get_apps(app_name); - if ( app_info.godmode === 1 ) { + if ( app_info.godmode === true || app_info.godmode === 1 ) { console.log(`⚠️ Allowing GODMODE app ${appInstanceID} to close app ${targetAppInstanceID}`); return true; } diff --git a/src/gui/src/services/ExecService.js b/src/gui/src/services/ExecService.js index 9ee686f2c..6e20d0de0 100644 --- a/src/gui/src/services/ExecService.js +++ b/src/gui/src/services/ExecService.js @@ -118,8 +118,10 @@ export class ExecService extends Service { const caller_app_name = process.name; const caller_app_info = await window.get_apps(caller_app_name); - // Check if caller is in godmode - if ( caller_app_info && caller_app_info.godmode === 1 ) { + // Check if caller is in godmode. The /apps endpoint serializes + // `godmode` as a boolean while older shapes used 0/1, so + // accept both (same guard as launch_app.js). + if ( caller_app_info && (caller_app_info.godmode === true || caller_app_info.godmode === 1) ) { // Get target app info to create file signatures const target_app_info = await puter.apps.get(app_name); @@ -137,8 +139,10 @@ export class ExecService extends Service { // Get file stats to verify it exists const file_stat = await puter.fs.stat({ path: first_file_path, consistency: 'eventual' }); - // Create file signature for the target app - const file_signature_result = await puter.fs.sign(target_app_info.uuid, { + // Create file signature for the target app. + // puter.apps.get returns `uid`; `uuid` is kept as + // a fallback for any older cached shape. + const file_signature_result = await puter.fs.sign(target_app_info.uid ?? target_app_info.uuid, { path: first_file_path, action: 'write', });