Merge branch 'feature/page-refactor' of github.com:Budibase/budibase into feature/page-refactor
This commit is contained in:
commit
2986579846
|
@ -7,6 +7,8 @@ const { budibaseAppsDir } = require("../../../utilities/budibaseDir")
|
||||||
const PouchDB = require("../../../db")
|
const PouchDB = require("../../../db")
|
||||||
const env = require("../../../environment")
|
const env = require("../../../environment")
|
||||||
|
|
||||||
|
const EXCLUDED_DIRECTORIES = ["css"]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finalises the deployment, updating the quota for the user API key
|
* Finalises the deployment, updating the quota for the user API key
|
||||||
* The verification process returns the levels to update to.
|
* 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
|
// Upload HTML, CSS and JS of the web app
|
||||||
walkDir(appAssetsPath, function(filePath) {
|
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({
|
const appAssetUpload = prepareUploadForS3({
|
||||||
file: {
|
file: {
|
||||||
path: filePath,
|
path: filePath,
|
||||||
name: [...filePath.split("/")].pop(),
|
name: filePathParts.pop(),
|
||||||
},
|
},
|
||||||
s3Key: filePath.replace(appAssetsPath, `assets/${appId}`),
|
s3Key: filePath.replace(appAssetsPath, `assets/${appId}`),
|
||||||
s3,
|
s3,
|
||||||
|
|
|
@ -190,15 +190,7 @@ exports.serveAttachment = async function(ctx) {
|
||||||
|
|
||||||
exports.serveAppAsset = async function(ctx) {
|
exports.serveAppAsset = async function(ctx) {
|
||||||
// default to homedir
|
// default to homedir
|
||||||
const mainOrAuth =
|
const appPath = resolve(budibaseAppsDir(), ctx.user.appId, "public")
|
||||||
ctx.auth.authenticated === AuthTypes.APP ? "main" : "unauthenticated"
|
|
||||||
|
|
||||||
const appPath = resolve(
|
|
||||||
budibaseAppsDir(),
|
|
||||||
ctx.user.appId,
|
|
||||||
"public",
|
|
||||||
mainOrAuth
|
|
||||||
)
|
|
||||||
|
|
||||||
await send(ctx, ctx.file, { root: ctx.devPath || appPath })
|
await send(ctx, ctx.file, { root: ctx.devPath || appPath })
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue