From b8e968644ad4b1f8e99782911ef7d72f70306d5e Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 4 Oct 2021 13:31:53 +0100 Subject: [PATCH] Fixing issue with direct app request in self host not working when un-authenticated (doesn't re-direct to login). --- packages/server/src/api/controllers/application.js | 2 +- packages/server/src/api/controllers/hosting.js | 2 +- packages/server/src/api/controllers/static/index.js | 2 +- packages/server/src/utilities/workerRequests.js | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/server/src/api/controllers/application.js b/packages/server/src/api/controllers/application.js index 3a0b0f8ed8..6608ba0cac 100644 --- a/packages/server/src/api/controllers/application.js +++ b/packages/server/src/api/controllers/application.js @@ -82,7 +82,7 @@ async function getAppUrlIfNotInUse(ctx) { if (!env.SELF_HOSTED) { return url } - const deployedApps = await getDeployedApps(ctx) + const deployedApps = await getDeployedApps() if ( url && deployedApps[url] != null && diff --git a/packages/server/src/api/controllers/hosting.js b/packages/server/src/api/controllers/hosting.js index aa8664cd92..6b47dc8634 100644 --- a/packages/server/src/api/controllers/hosting.js +++ b/packages/server/src/api/controllers/hosting.js @@ -18,5 +18,5 @@ exports.fetchUrls = async ctx => { } exports.getDeployedApps = async ctx => { - ctx.body = await getDeployedApps(ctx) + ctx.body = await getDeployedApps() } diff --git a/packages/server/src/api/controllers/static/index.js b/packages/server/src/api/controllers/static/index.js index 36d8423219..cc463aefdb 100644 --- a/packages/server/src/api/controllers/static/index.js +++ b/packages/server/src/api/controllers/static/index.js @@ -40,7 +40,7 @@ async function prepareUpload({ s3Key, bucket, metadata, file }) { async function checkForSelfHostedURL(ctx) { // the "appId" component of the URL may actually be a specific self hosted URL let possibleAppUrl = `/${encodeURI(ctx.params.appId).toLowerCase()}` - const apps = await getDeployedApps(ctx) + const apps = await getDeployedApps() if (apps[possibleAppUrl] && apps[possibleAppUrl].appId) { return apps[possibleAppUrl].appId } else { diff --git a/packages/server/src/utilities/workerRequests.js b/packages/server/src/utilities/workerRequests.js index 88771ef006..c07c93ba70 100644 --- a/packages/server/src/utilities/workerRequests.js +++ b/packages/server/src/utilities/workerRequests.js @@ -58,11 +58,11 @@ exports.sendSmtpEmail = async (to, from, subject, contents, automation) => { return response.json() } -exports.getDeployedApps = async ctx => { +exports.getDeployedApps = async () => { try { const response = await fetch( checkSlashesInUrl(env.WORKER_URL + `/api/apps`), - request(ctx, { + request(null, { method: "GET", }) )