diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index dc1bfc3f4e..9a7df903b9 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -4,11 +4,7 @@ on:
push:
branches:
- master
- pull_request:
- branches:
- - master
-
-
+
jobs:
release:
runs-on: ubuntu-latest
@@ -36,6 +32,7 @@ jobs:
- name: Build/release Docker images
run: |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
+ yarn build
yarn build:docker
env:
DOCKER_USER: ${{ secrets.DOCKER_USERNAME }}
diff --git a/hosting/docker-compose.yaml b/hosting/docker-compose.yaml
index 73bbcfc39b..b609f5d962 100644
--- a/hosting/docker-compose.yaml
+++ b/hosting/docker-compose.yaml
@@ -5,8 +5,7 @@ version: "3"
services:
app-service:
restart: always
- #build: ./build/server
- image: budibase/budibase-apps
+ image: budibase/apps
ports:
- "${APP_PORT}:4002"
environment:
@@ -30,8 +29,7 @@ services:
worker-service:
restart: always
- #build: ./build/worker
- image: budibase/budibase-worker
+ image: budibase/worker
ports:
- "${WORKER_PORT}:4003"
environment:
diff --git a/hosting/envoy.yaml b/hosting/envoy.yaml
index 95db418352..463b32ab60 100644
--- a/hosting/envoy.yaml
+++ b/hosting/envoy.yaml
@@ -21,15 +21,27 @@ static_resources:
cluster: app-service
prefix_rewrite: "/"
- - match: { path: "/" }
+ - match: { prefix: "/builder/" }
+ route:
+ cluster: app-service
+
+ - match: { prefix: "/builder" }
+ route:
+ cluster: app-service
+
+ - match: { prefix: "/app_" }
route:
cluster: app-service
# special case for worker admin API
- - match: { path: "/api/admin" }
+ - match: { prefix: "/api/admin/" }
route:
cluster: worker-service
-
+
+ - match: { path: "/" }
+ route:
+ cluster: app-service
+
# special case for when API requests are made, can just forward, not to minio
- match: { prefix: "/api/" }
route:
diff --git a/hosting/scripts/linux/release-to-docker-hub.sh b/hosting/scripts/linux/release-to-docker-hub.sh
index c66faf1b89..a011ee1f13 100755
--- a/hosting/scripts/linux/release-to-docker-hub.sh
+++ b/hosting/scripts/linux/release-to-docker-hub.sh
@@ -3,20 +3,14 @@
tag=$1
tag=${tag:-latest}
-
-pushd ../../build
-docker-compose build --force app-service
-docker-compose build --force worker-service
-
echo "Tagging images with SHA: $GITHUB_SHA and version: $BUDIBASE_VERSION"
-docker tag build_app-service budibase/apps:$tag
-docker tag build_worker-service budibase/worker:$tag
+docker tag app-service budibase/apps:$tag
+docker tag worker-service budibase/worker:$tag
# Tag with git sha
-docker tag build_app-service budibase/apps:$GITHUB_SHA
-docker tag build_worker-service budibase/worker:$GITHUB_SHA
+docker tag app-service budibase/apps:$GITHUB_SHA
+docker tag worker-service budibase/worker:$GITHUB_SHA
docker push budibase/apps
docker push budibase/worker
-popd
diff --git a/lerna.json b/lerna.json
index 90690dbf98..fa5307c017 100644
--- a/lerna.json
+++ b/lerna.json
@@ -1,5 +1,5 @@
{
- "version": "0.8.18",
+ "version": "0.9.1",
"npmClient": "yarn",
"packages": [
"packages/*"
diff --git a/package.json b/package.json
index e2ca53a5dc..71296665c7 100644
--- a/package.json
+++ b/package.json
@@ -38,7 +38,7 @@
"format": "prettier --write \"{,!(node_modules)/**/}*.{js,jsx,svelte}\"",
"test:e2e": "lerna run cy:test",
"test:e2e:ci": "lerna run cy:ci",
- "build:docker": "cd hosting/scripts/linux/ && ./release-to-docker-hub.sh && cd -",
+ "build:docker": "lerna run build:docker && cd hosting/scripts/linux/ && ./release-to-docker-hub.sh && cd -",
"build:docker:staging": "cd hosting/scripts/linux/ && ./release-to-docker-hub.sh staging && cd -"
},
"dependencies": {
diff --git a/packages/auth/package.json b/packages/auth/package.json
index 42bc76f3f4..d8003df421 100644
--- a/packages/auth/package.json
+++ b/packages/auth/package.json
@@ -1,6 +1,6 @@
{
"name": "@budibase/auth",
- "version": "0.18.6",
+ "version": "0.9.1",
"description": "Authentication middlewares for budibase builder and apps",
"main": "src/index.js",
"author": "Budibase",
@@ -24,5 +24,6 @@
},
"devDependencies": {
"ioredis-mock": "^5.5.5"
- }
+ },
+ "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc"
}
diff --git a/packages/bbui/package.json b/packages/bbui/package.json
index c4c7e14b4b..18e2924198 100644
--- a/packages/bbui/package.json
+++ b/packages/bbui/package.json
@@ -1,7 +1,7 @@
{
"name": "@budibase/bbui",
"description": "A UI solution used in the different Budibase projects.",
- "version": "1.58.13",
+ "version": "0.9.1",
"license": "AGPL-3.0",
"svelte": "src/index.js",
"module": "dist/bbui.es.js",
@@ -77,5 +77,6 @@
"dayjs": "^1.10.4",
"svelte-flatpickr": "^3.1.0",
"svelte-portal": "^1.0.0"
- }
+ },
+ "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc"
}
diff --git a/packages/builder/package.json b/packages/builder/package.json
index 7d86c79c70..acc8c71a10 100644
--- a/packages/builder/package.json
+++ b/packages/builder/package.json
@@ -1,6 +1,6 @@
{
"name": "@budibase/builder",
- "version": "0.8.18",
+ "version": "0.9.1",
"license": "AGPL-3.0",
"private": true,
"scripts": {
@@ -65,10 +65,10 @@
}
},
"dependencies": {
- "@budibase/bbui": "^1.58.13",
- "@budibase/client": "^0.8.18",
+ "@budibase/bbui": "^0.9.1",
+ "@budibase/client": "^0.9.1",
"@budibase/colorpicker": "1.1.2",
- "@budibase/string-templates": "^0.8.18",
+ "@budibase/string-templates": "^0.9.1",
"@sentry/browser": "5.19.1",
"@spectrum-css/page": "^3.0.1",
"@spectrum-css/vars": "^3.0.1",
diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/LogIn.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/LogIn.svelte
deleted file mode 100644
index d64fd1e654..0000000000
--- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/LogIn.svelte
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
- (parameters.email = value.detail)}
- {bindings}
- />
-
- (parameters.password = value.detail)}
- {bindings}
- />
-
-
-
diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/LogOut.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/LogOut.svelte
deleted file mode 100644
index 8782127243..0000000000
--- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/LogOut.svelte
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
- This action doesn't require any additional settings.
-
-
-
diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/index.js b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/index.js
index 4700ea5c8f..e851bdb4be 100644
--- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/index.js
+++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/index.js
@@ -4,8 +4,6 @@ import DeleteRow from "./DeleteRow.svelte"
import ExecuteQuery from "./ExecuteQuery.svelte"
import TriggerAutomation from "./TriggerAutomation.svelte"
import ValidateForm from "./ValidateForm.svelte"
-import LogIn from "./LogIn.svelte"
-import LogOut from "./LogOut.svelte"
// defines what actions are available, when adding a new one
// the component is the setup panel for the action
@@ -37,12 +35,4 @@ export default [
name: "Validate Form",
component: ValidateForm,
},
- {
- name: "Log In",
- component: LogIn,
- },
- {
- name: "Log Out",
- component: LogOut,
- },
]
diff --git a/packages/builder/src/pages/builder/_layout.svelte b/packages/builder/src/pages/builder/_layout.svelte
index 06bf6b3797..43a5d205d9 100644
--- a/packages/builder/src/pages/builder/_layout.svelte
+++ b/packages/builder/src/pages/builder/_layout.svelte
@@ -28,7 +28,8 @@
!$isActive("./auth") &&
!$isActive("./invite")
) {
- $redirect("./auth/login")
+ const returnUrl = encodeURIComponent(window.location.pathname)
+ $redirect("./auth/login?", { returnUrl })
} else if ($auth?.user?.forceResetPassword) {
$redirect("./auth/reset")
}
diff --git a/packages/builder/src/pages/builder/auth/_layout.svelte b/packages/builder/src/pages/builder/auth/_layout.svelte
new file mode 100644
index 0000000000..ac224a41db
--- /dev/null
+++ b/packages/builder/src/pages/builder/auth/_layout.svelte
@@ -0,0 +1,18 @@
+
+
+{#if !$auth.user}
+
+{/if}
diff --git a/packages/builder/src/pages/builder/portal/_layout.svelte b/packages/builder/src/pages/builder/portal/_layout.svelte
index b6bc1b07bf..2137ccc199 100644
--- a/packages/builder/src/pages/builder/portal/_layout.svelte
+++ b/packages/builder/src/pages/builder/portal/_layout.svelte
@@ -37,11 +37,13 @@
onMount(async () => {
// Prevent non-builders from accessing the portal
- if (!$auth.user?.builder?.global) {
- $redirect("../")
- } else {
- await organisation.init()
- loaded = true
+ if ($auth.user) {
+ if (!$auth.user?.builder?.global) {
+ $redirect("../")
+ } else {
+ await organisation.init()
+ loaded = true
+ }
}
})
diff --git a/packages/cli/package.json b/packages/cli/package.json
index 0630d0b0c9..ab3766c3e2 100644
--- a/packages/cli/package.json
+++ b/packages/cli/package.json
@@ -1,6 +1,6 @@
{
- "name": "cli",
- "version": "0.8.18",
+ "name": "@budibase/cli",
+ "version": "0.9.1",
"description": "Budibase CLI, for developers, self hosting and migrations.",
"main": "src/index.js",
"bin": {
diff --git a/packages/client/package.json b/packages/client/package.json
index f5f4632de9..b4ab3754a0 100644
--- a/packages/client/package.json
+++ b/packages/client/package.json
@@ -1,6 +1,6 @@
{
"name": "@budibase/client",
- "version": "0.8.18",
+ "version": "0.9.1",
"license": "MPL-2.0",
"module": "dist/budibase-client.js",
"main": "dist/budibase-client.js",
@@ -18,15 +18,15 @@
"dev:builder": "rollup -cw"
},
"dependencies": {
- "@budibase/string-templates": "^0.8.18",
+ "@budibase/string-templates": "^0.9.1",
"regexparam": "^1.3.0",
"shortid": "^2.2.15",
"svelte-spa-router": "^3.0.5"
},
"devDependencies": {
+ "@budibase/standard-components": "^0.9.1",
"@rollup/plugin-commonjs": "^18.0.0",
"@rollup/plugin-node-resolve": "^11.2.1",
- "@budibase/standard-components": "^0.8.18",
"fs-extra": "^8.1.0",
"jsdom": "^16.0.1",
"postcss": "^8.2.9",
@@ -40,5 +40,5 @@
"rollup-plugin-terser": "^7.0.2",
"svelte": "^3.38.2"
},
- "gitHead": "4b6efc42ed3273595c7a129411f4d883733d3321"
+ "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc"
}
diff --git a/packages/client/src/components/ClientApp.svelte b/packages/client/src/components/ClientApp.svelte
index 5d07754f49..a375852dab 100644
--- a/packages/client/src/components/ClientApp.svelte
+++ b/packages/client/src/components/ClientApp.svelte
@@ -10,6 +10,8 @@
initialise,
screenStore,
authStore,
+ routeStore,
+ builderStore,
} from "../store"
import { TableNames, ActionTypes } from "../constants"
@@ -18,13 +20,13 @@
setContext("component", writable({}))
setContext("context", createContextStore())
- let loaded = false
+ let dataLoaded = false
// Load app config
onMount(async () => {
await initialise()
await authStore.actions.fetchUser()
- loaded = true
+ dataLoaded = true
})
// Register this as a refreshable datasource so that user changes cause
@@ -36,9 +38,22 @@
metadata: { dataSource: { type: "table", tableId: TableNames.USERS } },
},
]
+
+ // Redirect to home layout if no matching route
+ $: {
+ if (dataLoaded && $routeStore.routerLoaded && !$routeStore.activeRoute) {
+ if ($authStore) {
+ routeStore.actions.navigate("/")
+ } else {
+ const returnUrl = `${window.location.pathname}${window.location.hash}`
+ const encodedUrl = encodeURIComponent(returnUrl)
+ window.location = `/builder/auth/login?returnUrl=${encodedUrl}`
+ }
+ }
+ }
-{#if loaded && $screenStore.activeLayout}
+{#if dataLoaded && $screenStore.activeLayout}
diff --git a/packages/client/src/components/Router.svelte b/packages/client/src/components/Router.svelte
index ddbe7b77e9..545fae79d6 100644
--- a/packages/client/src/components/Router.svelte
+++ b/packages/client/src/components/Router.svelte
@@ -3,6 +3,7 @@
import Router from "svelte-spa-router"
import { routeStore } from "../store"
import Screen from "./Screen.svelte"
+ import { onMount } from "svelte"
const { styleable } = getContext("sdk")
const component = getContext("component")
diff --git a/packages/client/src/components/Screen.svelte b/packages/client/src/components/Screen.svelte
index e0e6cdb62e..f97fcb52af 100644
--- a/packages/client/src/components/Screen.svelte
+++ b/packages/client/src/components/Screen.svelte
@@ -1,8 +1,8 @@
diff --git a/packages/client/src/store/routes.js b/packages/client/src/store/routes.js
index aa86718ec0..d0e848b68e 100644
--- a/packages/client/src/store/routes.js
+++ b/packages/client/src/store/routes.js
@@ -8,6 +8,7 @@ const createRouteStore = () => {
routeParams: {},
activeRoute: null,
routeSessionId: Math.random(),
+ routerLoaded: false,
}
const store = writable(initialState)
@@ -47,10 +48,19 @@ const createRouteStore = () => {
})
}
const navigate = push
+ const setRouterLoaded = () => {
+ store.update(state => ({ ...state, routerLoaded: true }))
+ }
return {
subscribe: store.subscribe,
- actions: { fetchRoutes, navigate, setRouteParams, setActiveRoute },
+ actions: {
+ fetchRoutes,
+ navigate,
+ setRouteParams,
+ setActiveRoute,
+ setRouterLoaded,
+ },
}
}
diff --git a/packages/client/src/store/screens.js b/packages/client/src/store/screens.js
index 49927db9d7..04ed9ca52f 100644
--- a/packages/client/src/store/screens.js
+++ b/packages/client/src/store/screens.js
@@ -18,12 +18,11 @@ const createScreenStore = () => {
activeLayout = $builderStore.layout
activeScreen = $builderStore.screen
} else {
- // Otherwise find the correct screen by matching the current route
+ activeLayout = { props: { _component: "screenslot" } }
+
+ // Find the correct screen by matching the current route
const { screens, layouts } = $config
- activeLayout = layouts[0]
- if (screens.length === 1) {
- activeScreen = screens[0]
- } else if ($routeStore.activeRoute) {
+ if ($routeStore.activeRoute) {
activeScreen = screens.find(
screen => screen._id === $routeStore.activeRoute.screenId
)
diff --git a/packages/server/package.json b/packages/server/package.json
index d16368a144..5afb4db968 100644
--- a/packages/server/package.json
+++ b/packages/server/package.json
@@ -1,7 +1,7 @@
{
"name": "@budibase/server",
"email": "hi@budibase.com",
- "version": "0.8.18",
+ "version": "0.9.1",
"description": "Budibase Web Server",
"main": "src/electron.js",
"repository": {
@@ -35,6 +35,7 @@
"test": "jest --testPathIgnorePatterns=routes && yarn run test:integration",
"test:integration": "jest --coverage --detectOpenHandles",
"test:watch": "jest --watch",
+ "build:docker": "docker build . -t app-service",
"run:docker": "node src/index",
"dev:stack:up": "node scripts/dev/manage.js up",
"dev:stack:down": "node scripts/dev/manage.js down",
@@ -79,9 +80,9 @@
"author": "Budibase",
"license": "AGPL-3.0-or-later",
"dependencies": {
- "@budibase/auth": "^0.18.6",
- "@budibase/client": "^0.8.18",
- "@budibase/string-templates": "^0.8.18",
+ "@budibase/auth": "^0.9.1",
+ "@budibase/client": "^0.9.1",
+ "@budibase/string-templates": "^0.9.1",
"@elastic/elasticsearch": "7.10.0",
"@koa/router": "8.0.0",
"@sendgrid/mail": "7.1.1",
@@ -131,7 +132,7 @@
"zlib": "1.0.5"
},
"devDependencies": {
- "@budibase/standard-components": "^0.8.18",
+ "@budibase/standard-components": "^0.9.1",
"@jest/test-sequencer": "^24.8.0",
"docker-compose": "^0.23.6",
"eslint": "^6.8.0",
@@ -141,5 +142,5 @@
"pouchdb-adapter-memory": "^7.2.1",
"supertest": "^4.0.2"
},
- "gitHead": "4b6efc42ed3273595c7a129411f4d883733d3321"
+ "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc"
}
diff --git a/packages/server/src/api/controllers/application.js b/packages/server/src/api/controllers/application.js
index 2956e45b11..386c0f1d7a 100644
--- a/packages/server/src/api/controllers/application.js
+++ b/packages/server/src/api/controllers/application.js
@@ -22,10 +22,7 @@ const {
} = require("../../db/utils")
const { BUILTIN_ROLE_IDS, AccessController } = require("@budibase/auth/roles")
const { BASE_LAYOUTS } = require("../../constants/layouts")
-const {
- createHomeScreen,
- createLoginScreen,
-} = require("../../constants/screens")
+const { createHomeScreen } = require("../../constants/screens")
const { cloneDeep } = require("lodash/fp")
const { processObject } = require("@budibase/string-templates")
const { getAllApps } = require("../../utilities")
@@ -208,7 +205,6 @@ exports.create = async function (ctx) {
ctx.status = 200
ctx.body = newApplication
- ctx.message = `Application ${ctx.request.body.name} created successfully`
}
exports.update = async function (ctx) {
@@ -229,13 +225,11 @@ exports.update = async function (ctx) {
data._rev = response.rev
ctx.status = 200
- ctx.message = `Application ${application.name} updated successfully.`
ctx.body = response
}
exports.delete = async function (ctx) {
const db = new CouchDB(ctx.params.appId)
- const app = await db.get(DocumentTypes.APP_METADATA)
const result = await db.destroy()
/* istanbul ignore next */
if (!env.isTest()) {
@@ -243,7 +237,6 @@ exports.delete = async function (ctx) {
}
ctx.status = 200
- ctx.message = `Application ${app.name} deleted successfully.`
ctx.body = result
}
@@ -260,9 +253,5 @@ const createEmptyAppPackage = async (ctx, app) => {
homeScreen._id = generateScreenID()
screensAndLayouts.push(homeScreen)
- const loginScreen = createLoginScreen(app)
- loginScreen._id = generateScreenID()
- screensAndLayouts.push(loginScreen)
-
await db.bulkDocs(screensAndLayouts)
}
diff --git a/packages/server/src/api/controllers/auth.js b/packages/server/src/api/controllers/auth.js
index 2ac3d30e48..92d731cfbb 100644
--- a/packages/server/src/api/controllers/auth.js
+++ b/packages/server/src/api/controllers/auth.js
@@ -4,9 +4,6 @@ const { InternalTables } = require("../../db/utils")
const { getFullUser } = require("../../utilities/users")
exports.fetchSelf = async ctx => {
- if (!ctx.user) {
- ctx.throw(403, "No user logged in")
- }
const appId = ctx.appId
const { userId } = ctx.user
/* istanbul ignore next */
diff --git a/packages/server/src/api/routes/tests/application.spec.js b/packages/server/src/api/routes/tests/application.spec.js
index 2ca0601d38..9783079124 100644
--- a/packages/server/src/api/routes/tests/application.spec.js
+++ b/packages/server/src/api/routes/tests/application.spec.js
@@ -28,7 +28,6 @@ describe("/applications", () => {
.set(config.defaultHeaders())
.expect('Content-Type', /json/)
.expect(200)
- expect(res.res.statusMessage).toEqual("Application My App created successfully")
expect(res.body._id).toBeDefined()
})
@@ -74,7 +73,7 @@ describe("/applications", () => {
.expect('Content-Type', /json/)
.expect(200)
// should have empty packages
- expect(res.body.screens.length).toEqual(2)
+ expect(res.body.screens.length).toEqual(1)
expect(res.body.layouts.length).toEqual(2)
})
})
@@ -87,7 +86,7 @@ describe("/applications", () => {
.expect('Content-Type', /json/)
.expect(200)
expect(res.body.application).toBeDefined()
- expect(res.body.screens.length).toEqual(2)
+ expect(res.body.screens.length).toEqual(1)
expect(res.body.layouts.length).toEqual(2)
})
})
diff --git a/packages/server/src/api/routes/tests/screen.spec.js b/packages/server/src/api/routes/tests/screen.spec.js
index 5533bc5e59..6a47b78853 100644
--- a/packages/server/src/api/routes/tests/screen.spec.js
+++ b/packages/server/src/api/routes/tests/screen.spec.js
@@ -21,7 +21,7 @@ describe("/screens", () => {
.set(config.defaultHeaders())
.expect("Content-Type", /json/)
.expect(200)
- expect(res.body.length).toEqual(3)
+ expect(res.body.length).toEqual(2)
expect(res.body.some(s => s._id === screen._id)).toEqual(true)
})
diff --git a/packages/server/src/constants/screens.js b/packages/server/src/constants/screens.js
index 55f493c362..eb9dc8f702 100644
--- a/packages/server/src/constants/screens.js
+++ b/packages/server/src/constants/screens.js
@@ -1,6 +1,5 @@
const { BUILTIN_ROLE_IDS } = require("@budibase/auth/roles")
const { BASE_LAYOUT_PROP_IDS } = require("./layouts")
-const { LOGO_URL } = require("../constants")
exports.createHomeScreen = () => ({
description: "",
@@ -49,60 +48,3 @@ exports.createHomeScreen = () => ({
},
name: "home-screen",
})
-
-exports.createLoginScreen = app => ({
- description: "",
- url: "",
- layoutId: BASE_LAYOUT_PROP_IDS.PUBLIC,
- props: {
- _instanceName: "LoginScreenContainer",
- _id: "5beb4c7b-3c8b-49b2-b8b3-d447dc76dda7",
- _component: "@budibase/standard-components/container",
- _styles: {
- normal: {
- flex: "1 1 auto",
- display: "flex",
- "flex-direction": "column",
- "justify-content": "center",
- "align-items": "center",
- },
- hover: {},
- active: {},
- selected: {},
- },
- _transition: "fade",
- type: "div",
- _children: [
- {
- _id: "781e497e-2e7c-11eb-adc1-0242ac120002",
- _component: "@budibase/standard-components/login",
- _styles: {
- normal: {
- padding: "64px",
- background: "rgba(255, 255, 255, 0.4)",
- "border-radius": "0.5rem",
- "margin-top": "0px",
- "box-shadow":
- "0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)",
- "font-size": "16px",
- "font-family": "Inter",
- flex: "0 1 auto",
- },
- hover: {},
- active: {},
- selected: {},
- },
- logo: LOGO_URL,
- title: `Log in to ${app.name}`,
- buttonText: "Log In",
- _children: [],
- _instanceName: "Login",
- },
- ],
- },
- routing: {
- route: "/",
- roleId: BUILTIN_ROLE_IDS.PUBLIC,
- },
- name: "login-screen",
-})
diff --git a/packages/server/src/db/client.js b/packages/server/src/db/client.js
index 3e3a4f50fe..fbc25986d5 100644
--- a/packages/server/src/db/client.js
+++ b/packages/server/src/db/client.js
@@ -12,7 +12,6 @@ PouchDB.adapter("writableStream", replicationStream.adapters.writableStream)
let POUCH_DB_DEFAULTS = {
prefix: COUCH_DB_URL,
- skip_setup: env.isProd(),
}
if (env.isTest()) {
diff --git a/packages/server/src/db/utils.js b/packages/server/src/db/utils.js
index eacf0cbc6f..81686ea267 100644
--- a/packages/server/src/db/utils.js
+++ b/packages/server/src/db/utils.js
@@ -160,7 +160,7 @@ exports.generateUserMetadataID = globalId => {
*/
exports.getGlobalIDFromUserMetadataID = id => {
const prefix = `${DocumentTypes.ROW}${SEPARATOR}${InternalTables.USER_METADATA}${SEPARATOR}`
- if (!id.includes(prefix)) {
+ if (!id || !id.includes(prefix)) {
return id
}
return id.split(prefix)[1]
diff --git a/packages/server/src/integrations/postgres.js b/packages/server/src/integrations/postgres.js
index c6a24577b3..d567db7ba0 100644
--- a/packages/server/src/integrations/postgres.js
+++ b/packages/server/src/integrations/postgres.js
@@ -1,4 +1,6 @@
-const { Client } = require("pg")
+const { Pool } = require("pg")
+
+let pool
const SCHEMA = {
docs: "https://node-postgres.com",
@@ -51,31 +53,39 @@ const SCHEMA = {
class PostgresIntegration {
constructor(config) {
this.config = config
- this.client = new Client(config)
- this.connect()
+ if (!pool) {
+ pool = new Pool(this.config)
+ }
}
- async connect() {
- return this.client.connect()
+ async query(sql) {
+ try {
+ this.client = await pool.connect()
+ return await this.client.query(sql)
+ } catch (err) {
+ throw new Error(err)
+ } finally {
+ this.client.release()
+ }
}
async create({ sql }) {
- const response = await this.client.query(sql)
+ const response = await this.query(sql)
return response.rows.length ? response.rows : [{ created: true }]
}
async read({ sql }) {
- const response = await this.client.query(sql)
+ const response = await this.query(sql)
return response.rows
}
async update({ sql }) {
- const response = await this.client.query(sql)
+ const response = await this.query(sql)
return response.rows.length ? response.rows : [{ updated: true }]
}
async delete({ sql }) {
- const response = await this.client.query(sql)
+ const response = await this.query(sql)
return response.rows.length ? response.rows : [{ deleted: true }]
}
}
diff --git a/packages/server/src/middleware/authorized.js b/packages/server/src/middleware/authorized.js
index 513572ddff..b22fe245d5 100644
--- a/packages/server/src/middleware/authorized.js
+++ b/packages/server/src/middleware/authorized.js
@@ -18,6 +18,11 @@ const WEBHOOK_ENDPOINTS = new RegExp(
async function checkDevAppLocks(ctx) {
const appId = ctx.appId
+ // if any public usage, don't proceed
+ if (!ctx.user._id && !ctx.user.userId) {
+ return
+ }
+
// not a development app, don't need to do anything
if (!appId || !appId.startsWith(APP_DEV_PREFIX)) {
return
diff --git a/packages/server/src/middleware/tests/authorized.spec.js b/packages/server/src/middleware/tests/authorized.spec.js
index 1f36b6b512..d51ce4cc4d 100644
--- a/packages/server/src/middleware/tests/authorized.spec.js
+++ b/packages/server/src/middleware/tests/authorized.spec.js
@@ -108,6 +108,7 @@ describe("Authorization middleware", () => {
it("passes on to next() middleware if user is an admin", async () => {
config.setUser({
+ _id: "user",
role: {
_id: "ADMIN",
}
diff --git a/packages/standard-components/package.json b/packages/standard-components/package.json
index 6d58d25144..d85097aa21 100644
--- a/packages/standard-components/package.json
+++ b/packages/standard-components/package.json
@@ -29,11 +29,11 @@
"keywords": [
"svelte"
],
- "version": "0.8.18",
+ "version": "0.9.1",
"license": "MIT",
- "gitHead": "4b6efc42ed3273595c7a129411f4d883733d3321",
+ "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc",
"dependencies": {
- "@budibase/bbui": "^1.58.13",
+ "@budibase/bbui": "^0.9.1",
"@spectrum-css/page": "^3.0.1",
"@spectrum-css/vars": "^3.0.1",
"apexcharts": "^3.22.1",
diff --git a/packages/standard-components/src/Navigation.svelte b/packages/standard-components/src/Navigation.svelte
index 2062a9d982..b0f043b75c 100644
--- a/packages/standard-components/src/Navigation.svelte
+++ b/packages/standard-components/src/Navigation.svelte
@@ -5,13 +5,6 @@
const component = getContext("component")
export let logoUrl
-
- const logOut = async () => {
- if ($builderStore.inBuilder) {
- return
- }
- await authStore.actions.logOut()
- }
@@ -21,9 +14,6 @@
{/if}
-