From 5086a4d0c9566a073de5f3a53f1f2d528f301e86 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 9 Jun 2021 17:38:24 +0100 Subject: [PATCH 1/7] Super quick fix for attachments, keeping in correct object store directory. --- hosting/docker-compose.dev.yaml | 1 - packages/server/src/api/controllers/static/index.js | 2 +- packages/server/src/api/routes/tests/row.spec.js | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/hosting/docker-compose.dev.yaml b/hosting/docker-compose.dev.yaml index 3b99ef796c..eaced64e06 100644 --- a/hosting/docker-compose.dev.yaml +++ b/hosting/docker-compose.dev.yaml @@ -14,7 +14,6 @@ services: environment: MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY} MINIO_SECRET_KEY: ${MINIO_SECRET_KEY} - MINIO_BROWSER: "off" command: server /data healthcheck: test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] diff --git a/packages/server/src/api/controllers/static/index.js b/packages/server/src/api/controllers/static/index.js index 64cfb122f7..8eac910261 100644 --- a/packages/server/src/api/controllers/static/index.js +++ b/packages/server/src/api/controllers/static/index.js @@ -71,7 +71,7 @@ exports.uploadFile = async function (ctx) { return prepareUpload({ file, - s3Key: `assets/${ctx.appId}/attachments/${processedFileName}`, + s3Key: `/${ctx.appId}/attachments/${processedFileName}`, bucket: ObjectStoreBuckets.APPS, }) }) diff --git a/packages/server/src/api/routes/tests/row.spec.js b/packages/server/src/api/routes/tests/row.spec.js index ce7d76100b..60796e56f1 100644 --- a/packages/server/src/api/routes/tests/row.spec.js +++ b/packages/server/src/api/routes/tests/row.spec.js @@ -385,7 +385,7 @@ describe("/rows", () => { name: "test", description: "test", attachment: [{ - key: `${config.getAppId()}/attachment/test/thing.csv`, + key: `${config.getAppId()}/attachments/test/thing.csv`, }], tableId: table._id, }) @@ -393,7 +393,7 @@ describe("/rows", () => { await setup.switchToSelfHosted(async () => { const enriched = await outputProcessing(config.getAppId(), table, [row]) expect(enriched[0].attachment[0].url).toBe( - `/prod-budi-app-assets/${config.getAppId()}/attachment/test/thing.csv` + `/prod-budi-app-assets/${config.getAppId()}/attachments/test/thing.csv` ) }) }) From 86f13557cac526831b371215a60c825c6e085b6a Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Thu, 10 Jun 2021 11:25:06 +0100 Subject: [PATCH 2/7] Adding options to SMTP form for configuring TLS/STARTTLS. --- .../builder/portal/manage/email/index.svelte | 43 ++++++++++++++----- packages/worker/src/utilities/email.js | 7 ++- 2 files changed, 39 insertions(+), 11 deletions(-) diff --git a/packages/builder/src/pages/builder/portal/manage/email/index.svelte b/packages/builder/src/pages/builder/portal/manage/email/index.svelte index 46af44ec93..f38f922bb8 100644 --- a/packages/builder/src/pages/builder/portal/manage/email/index.svelte +++ b/packages/builder/src/pages/builder/portal/manage/email/index.svelte @@ -5,16 +5,18 @@ Heading, Divider, Label, - Page, notifications, Layout, Input, + Select, Body, Table, + Checkbox, } from "@budibase/bbui" import { email } from "stores/portal" import TemplateLink from "./_components/TemplateLink.svelte" import api from "builderStore/api" + import { cloneDeep } from "lodash/fp" const ConfigTypes = { SMTP: "smtp", @@ -36,10 +38,16 @@ let smtpConfig let loading + let requireAuth = false async function saveSmtp() { + // clone it so we can remove stuff if required + const smtp = cloneDeep(smtpConfig) + if (!requireAuth) { + delete smtp.config.auth + } // Save your SMTP config - const response = await api.post(`/api/admin/configs`, smtpConfig) + const response = await api.post(`/api/admin/configs`, smtp) if (response.status !== 200) { const error = await response.text() @@ -66,6 +74,7 @@ smtpConfig = { type: ConfigTypes.SMTP, config: { + secure: true, auth: { type: "login", }, @@ -75,6 +84,7 @@ smtpConfig = smtpDoc } loading = false + requireAuth = smtpConfig.config.auth != null } fetchSmtp() @@ -103,22 +113,35 @@ +
+ +
-
- - -
-
- - -
+ + {#if requireAuth} +
+ + +
+
+ + +
+ {/if}
diff --git a/packages/worker/src/utilities/email.js b/packages/worker/src/utilities/email.js index 4e48844843..534456fe15 100644 --- a/packages/worker/src/utilities/email.js +++ b/packages/worker/src/utilities/email.js @@ -20,11 +20,16 @@ const FULL_EMAIL_PURPOSES = [ function createSMTPTransport(config) { let options + let secure = config.secure + // default it if not specified + if (secure == null) { + secure = config.port === 465 + } if (!TEST_MODE) { options = { port: config.port, host: config.host, - secure: config.secure || false, + secure: secure, auth: config.auth, } options.tls = { From 2ce312b5b088a20218fec0f15a718c7fd5d8f6fd Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Thu, 10 Jun 2021 11:28:03 +0100 Subject: [PATCH 3/7] Making sure auth section of form can always be filled in. --- .../src/pages/builder/portal/manage/email/index.svelte | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/builder/src/pages/builder/portal/manage/email/index.svelte b/packages/builder/src/pages/builder/portal/manage/email/index.svelte index f38f922bb8..9e3f3c2147 100644 --- a/packages/builder/src/pages/builder/portal/manage/email/index.svelte +++ b/packages/builder/src/pages/builder/portal/manage/email/index.svelte @@ -75,9 +75,6 @@ type: ConfigTypes.SMTP, config: { secure: true, - auth: { - type: "login", - }, }, } } else { @@ -85,6 +82,11 @@ } loading = false requireAuth = smtpConfig.config.auth != null + // always attach the auth for the forms purpose - + // this will be removed later if required + smtpConfig.config.auth = { + type: "login", + } } fetchSmtp() From 21d463ce4368161db6c90a0707779ef37ac64645 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Thu, 10 Jun 2021 11:30:24 +0100 Subject: [PATCH 4/7] Spelling error. --- .../builder/src/pages/builder/portal/manage/email/index.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/builder/src/pages/builder/portal/manage/email/index.svelte b/packages/builder/src/pages/builder/portal/manage/email/index.svelte index 9e3f3c2147..681a9e3a79 100644 --- a/packages/builder/src/pages/builder/portal/manage/email/index.svelte +++ b/packages/builder/src/pages/builder/portal/manage/email/index.svelte @@ -116,7 +116,7 @@
- +