From 3029cc1450e612f93844f5232b0f84244d2fc27e Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Wed, 3 Apr 2024 13:59:45 +0100 Subject: [PATCH] Use correct variable for API Origin Previously we were reading `config.source` and then removing the trailing slash. However, this doesn't include the port, which we use when running locally. `config['puter.api_origin']` is actually what we want, which does have the port if it's set, and doesn't include the trailing slash either. --- src/main_puter.js | 5 +---- src/puter-shell/main.js | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/main_puter.js b/src/main_puter.js index ccd99ff..b27faf4 100644 --- a/src/main_puter.js +++ b/src/main_puter.js @@ -58,10 +58,7 @@ window.main_shell = async () => { if ( config['puter.auth.token'] ) { await puterSDK.setAuthToken(config['puter.auth.token']); } - const source_without_trailing_slash = - (config.source && config.source.replace(/\/$/, '')) - || 'https://api.puter.com'; - await puterSDK.setAPIOrigin(source_without_trailing_slash); + await puterSDK.setAPIOrigin(config['puter.api_origin']); const ptt = new XDocumentPTT(); await launchPuterShell(new Context({ diff --git a/src/puter-shell/main.js b/src/puter-shell/main.js index 8ccbf54..6c5675e 100644 --- a/src/puter-shell/main.js +++ b/src/puter-shell/main.js @@ -76,10 +76,7 @@ export const launchPuterShell = async (ctx) => { const sdkv2 = globalThis.puter; if ( ctx.platform.name !== 'node' ) { await sdkv2.setAuthToken(config['puter.auth.token']); - const source_without_trailing_slash = - (config.source && config.source.replace(/\/$/, '')) - || 'https://api.puter.com'; - await sdkv2.setAPIOrigin(source_without_trailing_slash); + await sdkv2.setAPIOrigin(config['puter.api_origin']); } // const commandProvider = new BuiltinCommandProvider();