@budibase/worker 2.6.19-alpha.52 → 2.6.19-alpha.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@budibase/worker",
3
3
  "email": "hi@budibase.com",
4
- "version": "2.6.19-alpha.52",
4
+ "version": "2.6.19-alpha.53",
5
5
  "description": "Budibase background service",
6
6
  "main": "src/index.ts",
7
7
  "repository": {
@@ -38,10 +38,10 @@
38
38
  "author": "Budibase",
39
39
  "license": "GPL-3.0",
40
40
  "dependencies": {
41
- "@budibase/backend-core": "2.6.19-alpha.52",
42
- "@budibase/pro": "2.6.19-alpha.52",
43
- "@budibase/string-templates": "2.6.19-alpha.52",
44
- "@budibase/types": "2.6.19-alpha.52",
41
+ "@budibase/backend-core": "2.6.19-alpha.53",
42
+ "@budibase/pro": "2.6.19-alpha.53",
43
+ "@budibase/string-templates": "2.6.19-alpha.53",
44
+ "@budibase/types": "2.6.19-alpha.53",
45
45
  "@koa/router": "8.0.8",
46
46
  "@sentry/node": "6.17.7",
47
47
  "@techpass/passport-openidconnect": "0.3.2",
@@ -103,5 +103,5 @@
103
103
  "typescript": "4.7.3",
104
104
  "update-dotenv": "1.1.1"
105
105
  },
106
- "gitHead": "77a332e4cedddef2472c9aa5aa28e206ae560090"
106
+ "gitHead": "928dca07cec105d10ed13c35561f9687d819dc80"
107
107
  }
@@ -23,6 +23,7 @@ import {
23
23
  isSettingsConfig,
24
24
  isSMTPConfig,
25
25
  OIDCConfigs,
26
+ SettingsBrandingConfig,
26
27
  SettingsInnerConfig,
27
28
  SSOConfig,
28
29
  SSOConfigType,
@@ -142,13 +143,29 @@ async function hasActivatedConfig(ssoConfigs?: SSOConfigs) {
142
143
  return !!Object.values(ssoConfigs).find(c => c?.activated)
143
144
  }
144
145
 
145
- async function verifySettingsConfig(config: SettingsInnerConfig) {
146
+ async function verifySettingsConfig(
147
+ config: SettingsInnerConfig & SettingsBrandingConfig,
148
+ existingConfig?: SettingsInnerConfig & SettingsBrandingConfig
149
+ ) {
146
150
  if (config.isSSOEnforced) {
147
151
  const valid = await hasActivatedConfig()
148
152
  if (!valid) {
149
153
  throw new Error("Cannot enforce SSO without an activated configuration")
150
154
  }
151
155
  }
156
+
157
+ // always preserve file attributes
158
+ // these should be set via upload instead
159
+ // only allow for deletion by checking empty string to bypass this behaviour
160
+
161
+ if (existingConfig && config.logoUrl !== "") {
162
+ config.logoUrl = existingConfig.logoUrl
163
+ config.logoUrlEtag = existingConfig.logoUrlEtag
164
+ }
165
+ if (existingConfig && config.faviconUrl !== "") {
166
+ config.faviconUrl = existingConfig.faviconUrl
167
+ config.faviconUrlEtag = existingConfig.faviconUrlEtag
168
+ }
152
169
  }
153
170
 
154
171
  async function verifySSOConfig(type: SSOConfigType, config: SSOConfig) {
@@ -198,7 +215,7 @@ export async function save(ctx: UserCtx<Config>) {
198
215
  await email.verifyConfig(config)
199
216
  break
200
217
  case ConfigType.SETTINGS:
201
- await verifySettingsConfig(config)
218
+ await verifySettingsConfig(config, existingConfig?.config)
202
219
  break
203
220
  case ConfigType.GOOGLE:
204
221
  await verifyGoogleConfig(config)
@@ -320,14 +337,15 @@ export async function publicSettings(
320
337
  )
321
338
  }
322
339
 
323
- if (branding.faviconUrl && branding.faviconUrl !== "") {
324
- // @ts-ignore
325
- config.faviconUrl = objectStore.getGlobalFileUrl(
326
- "settings",
327
- "faviconUrl",
328
- branding.faviconUrl
329
- )
330
- }
340
+ // enrich the favicon url - empty url means deleted
341
+ const faviconUrl =
342
+ branding.faviconUrl && branding.faviconUrl !== ""
343
+ ? objectStore.getGlobalFileUrl(
344
+ "settings",
345
+ "faviconUrl",
346
+ branding.faviconUrlEtag
347
+ )
348
+ : undefined
331
349
 
332
350
  // google
333
351
  const googleConfig = await configs.getGoogleConfig()
@@ -352,6 +370,7 @@ export async function publicSettings(
352
370
  config: {
353
371
  ...config,
354
372
  ...branding,
373
+ ...{ faviconUrl },
355
374
  google,
356
375
  googleDatasourceConfigured,
357
376
  oidc,