From c7a4503dd2b7fc11d025b9d9a8ac86bf13f6db5b Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Wed, 2 Dec 2020 17:42:59 +0000 Subject: [PATCH 1/2] serve app assets --- packages/server/src/api/controllers/static/index.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/packages/server/src/api/controllers/static/index.js b/packages/server/src/api/controllers/static/index.js index c5bd80098a..50b1253e92 100644 --- a/packages/server/src/api/controllers/static/index.js +++ b/packages/server/src/api/controllers/static/index.js @@ -190,15 +190,7 @@ exports.serveAttachment = async function(ctx) { exports.serveAppAsset = async function(ctx) { // default to homedir - const mainOrAuth = - ctx.auth.authenticated === AuthTypes.APP ? "main" : "unauthenticated" - - const appPath = resolve( - budibaseAppsDir(), - ctx.user.appId, - "public", - mainOrAuth - ) + const appPath = resolve(budibaseAppsDir(), ctx.user.appId, "public") await send(ctx, ctx.file, { root: ctx.devPath || appPath }) } From eb5e1ea6d416fd424db88fbb37a637adbbaf1785 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 2 Dec 2020 18:07:17 +0000 Subject: [PATCH 2/2] Quick fix and making sure CSS temp files in app directory don't get uploaded. --- packages/server/src/api/controllers/deploy/aws.js | 11 ++++++++++- packages/server/src/constants/screens.js | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/server/src/api/controllers/deploy/aws.js b/packages/server/src/api/controllers/deploy/aws.js index 5c788a9dcc..626a768964 100644 --- a/packages/server/src/api/controllers/deploy/aws.js +++ b/packages/server/src/api/controllers/deploy/aws.js @@ -7,6 +7,8 @@ const { budibaseAppsDir } = require("../../../utilities/budibaseDir") const PouchDB = require("../../../db") const env = require("../../../environment") +const EXCLUDED_DIRECTORIES = ["css"] + /** * Finalises the deployment, updating the quota for the user API key * The verification process returns the levels to update to. @@ -140,10 +142,17 @@ exports.uploadAppAssets = async function({ appId, bucket, accountId }) { // Upload HTML, CSS and JS of the web app walkDir(appAssetsPath, function(filePath) { + const filePathParts = filePath.split("/") + const publicIndex = filePathParts.indexOf("public") + const directory = filePathParts[publicIndex + 1] + // don't include these top level directories + if (EXCLUDED_DIRECTORIES.indexOf(directory) !== -1) { + return + } const appAssetUpload = prepareUploadForS3({ file: { path: filePath, - name: [...filePath.split("/")].pop(), + name: filePathParts.pop(), }, s3Key: filePath.replace(appAssetsPath, `assets/${appId}`), s3, diff --git a/packages/server/src/constants/screens.js b/packages/server/src/constants/screens.js index 88a87c2aec..6d11351415 100644 --- a/packages/server/src/constants/screens.js +++ b/packages/server/src/constants/screens.js @@ -123,7 +123,7 @@ exports.LOGIN_SCREEN = { }, routing: { route: "/", - accessLevelId: BUILTIN_LEVEL_IDS.PUBLIC, + accessLevelId: BUILTIN_ROLE_IDS.PUBLIC, }, name: "login-screen", }