From 58752cea3e0a9aed1332a2c130b1247bdd7a184e Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 7 Oct 2021 11:14:36 +0100 Subject: [PATCH 1/8] fix view export --- .../src/components/backend/DataTable/ViewDataTable.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/builder/src/components/backend/DataTable/ViewDataTable.svelte b/packages/builder/src/components/backend/DataTable/ViewDataTable.svelte index 9913333054..a52fbdb177 100644 --- a/packages/builder/src/components/backend/DataTable/ViewDataTable.svelte +++ b/packages/builder/src/components/backend/DataTable/ViewDataTable.svelte @@ -68,5 +68,5 @@ {/if} - + From 0fb17e41b7bf158f064ab70b1e6cb8e961de7ca7 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 7 Oct 2021 11:26:09 +0100 Subject: [PATCH 2/8] fix table view export in prod --- packages/server/src/api/controllers/view/utils.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/server/src/api/controllers/view/utils.js b/packages/server/src/api/controllers/view/utils.js index 1f3b980882..27fccaf47f 100644 --- a/packages/server/src/api/controllers/view/utils.js +++ b/packages/server/src/api/controllers/view/utils.js @@ -2,6 +2,8 @@ const { ViewNames, generateMemoryViewID, getMemoryViewParams, + DocumentTypes, + SEPARATOR, } = require("../../../db/utils") const env = require("../../../environment") @@ -10,6 +12,11 @@ exports.getView = async (db, viewName) => { const designDoc = await db.get("_design/database") return designDoc.views[viewName] } else { + // This is a table view, don't read the view from the DB + if (viewName.startsWith(DocumentTypes.TABLE + SEPARATOR)) { + return null + } + const viewDoc = await db.get(generateMemoryViewID(viewName)) return viewDoc.view } From b9d067f9518690b0ce88c7555fd50f46e5195d23 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 7 Oct 2021 11:48:38 +0100 Subject: [PATCH 3/8] CSS fixes for template themes --- packages/builder/src/components/start/TemplateList.svelte | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/components/start/TemplateList.svelte b/packages/builder/src/components/start/TemplateList.svelte index 576415762a..deddd92880 100644 --- a/packages/builder/src/components/start/TemplateList.svelte +++ b/packages/builder/src/components/start/TemplateList.svelte @@ -33,7 +33,10 @@ {/each}
onSelect(null)}> -
+
Start from scratch @@ -74,7 +77,7 @@ align-items: center; cursor: pointer; border-radius: 4px; - background: #1a1a1a; + background: var(--background-alt); padding: 8px 16px; } From f6a52ad92ae10a67888cdeb943cff648acf44650 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 7 Oct 2021 12:03:08 +0100 Subject: [PATCH 4/8] fix intercom createdAt --- packages/builder/src/stores/portal/auth.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/builder/src/stores/portal/auth.js b/packages/builder/src/stores/portal/auth.js index f522095473..7beb25a1b4 100644 --- a/packages/builder/src/stores/portal/auth.js +++ b/packages/builder/src/stores/portal/auth.js @@ -56,7 +56,7 @@ export function createAuthStore() { analytics.identify(user._id, user) analytics.showChat({ email: user.email, - created_at: user.createdAt || Date.now(), + created_at: (user.createdAt || Date.now()) / 1000, name: user.name, user_id: user._id, tenant: user.tenantId, From dea2c95d804ff2805a95fdfed2f37b25c4c27429 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 7 Oct 2021 12:15:05 +0100 Subject: [PATCH 5/8] fix user ping event --- packages/server/src/api/controllers/analytics.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/server/src/api/controllers/analytics.js b/packages/server/src/api/controllers/analytics.js index e6e5d6a748..0c0761840e 100644 --- a/packages/server/src/api/controllers/analytics.js +++ b/packages/server/src/api/controllers/analytics.js @@ -21,9 +21,12 @@ exports.endUserPing = async ctx => { return } - posthogClient.capture("budibase:end_user_ping", { - userId: ctx.user && ctx.user._id, - appId: ctx.appId, + posthogClient.capture({ + event: "budibase:end_user_ping", + distinctId: ctx.user && ctx.user._id, + properties: { + appId: ctx.appId, + }, }) ctx.body = { From f32266df83a8d2f0f017769e4765151a2a6474fe Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 7 Oct 2021 15:39:22 +0100 Subject: [PATCH 6/8] remove currentapp stuff --- packages/server/src/middleware/currentapp.js | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/packages/server/src/middleware/currentapp.js b/packages/server/src/middleware/currentapp.js index e523850e1d..99f9d2318c 100644 --- a/packages/server/src/middleware/currentapp.js +++ b/packages/server/src/middleware/currentapp.js @@ -4,13 +4,9 @@ const { Cookies } = require("@budibase/auth").constants const { getRole } = require("@budibase/auth/roles") const { BUILTIN_ROLE_IDS } = require("@budibase/auth/roles") const { generateUserMetadataID } = require("../db/utils") -const { dbExists, getTenantIDFromAppID } = require("@budibase/auth/db") -const { getTenantId } = require("@budibase/auth/tenancy") +const { dbExists } = require("@budibase/auth/db") const { getCachedSelf } = require("../utilities/global") const CouchDB = require("../db") -const env = require("../environment") - -const DEFAULT_TENANT_ID = "default" module.exports = async (ctx, next) => { // try to get the appID from the request @@ -55,15 +51,6 @@ module.exports = async (ctx, next) => { return next() } - // If user and app tenant Ids do not match, 403 - if (env.MULTI_TENANCY && ctx.user) { - const userTenantId = getTenantId() - const tenantId = getTenantIDFromAppID(appId) || DEFAULT_TENANT_ID - if (tenantId !== userTenantId) { - ctx.throw(403, "Cannot access application.") - } - } - ctx.appId = appId if (roleId) { ctx.roleId = roleId From 815f2c98d3b6128f94b3501bbd2134a2b4e1b17c Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Thu, 7 Oct 2021 15:41:53 +0100 Subject: [PATCH 7/8] Remove update screen in the cloud --- .../builder/src/pages/builder/portal/_layout.svelte | 13 +++++++++---- .../src/pages/builder/portal/settings/update.svelte | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/builder/src/pages/builder/portal/_layout.svelte b/packages/builder/src/pages/builder/portal/_layout.svelte index 02f49bec5a..8fca18d29d 100644 --- a/packages/builder/src/pages/builder/portal/_layout.svelte +++ b/packages/builder/src/pages/builder/portal/_layout.svelte @@ -46,11 +46,16 @@ title: "Theming", href: "/builder/portal/settings/theming", }, - { - title: "Updates", - href: "/builder/portal/settings/update", - }, ]) + + if (!$adminStore.cloud) { + menu = menu.concat([ + { + title: "Updates", + href: "/builder/portal/settings/update", + }, + ]) + } } else { menu = menu.concat([ { diff --git a/packages/builder/src/pages/builder/portal/settings/update.svelte b/packages/builder/src/pages/builder/portal/settings/update.svelte index 3931203f44..5deb724a7c 100644 --- a/packages/builder/src/pages/builder/portal/settings/update.svelte +++ b/packages/builder/src/pages/builder/portal/settings/update.svelte @@ -10,14 +10,14 @@ Label, } from "@budibase/bbui" import api from "builderStore/api" - import { auth } from "stores/portal" + import { auth, admin } from "stores/portal" import { redirect } from "@roxi/routify" let version // Only admins allowed here $: { - if (!$auth.isAdmin) { + if (!$auth.isAdmin || $admin.cloud) { $redirect("../../portal") } } From 1d55b5ece2d30bb1f281529146b8d88b7360890d Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 7 Oct 2021 20:57:50 +0100 Subject: [PATCH 8/8] adding made in budibase tag --- .../design/AppPreview/iframeTemplate.js | 2 +- .../src/components/MadeInBudibase.svelte | 42 +++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 packages/client/src/components/MadeInBudibase.svelte diff --git a/packages/builder/src/components/design/AppPreview/iframeTemplate.js b/packages/builder/src/components/design/AppPreview/iframeTemplate.js index d992be8cd7..58557273f2 100644 --- a/packages/builder/src/components/design/AppPreview/iframeTemplate.js +++ b/packages/builder/src/components/design/AppPreview/iframeTemplate.js @@ -64,7 +64,7 @@ export default ` appId, theme, customTheme, - previewDevice + previewDevice, } = parsed // Set some flags so the app knows we're in the builder diff --git a/packages/client/src/components/MadeInBudibase.svelte b/packages/client/src/components/MadeInBudibase.svelte new file mode 100644 index 0000000000..2e5d6336f1 --- /dev/null +++ b/packages/client/src/components/MadeInBudibase.svelte @@ -0,0 +1,42 @@ + +
+ Budibase +

Made In Budibase

+
+
+ +