@budibase/server 2.4.27-alpha.8 → 2.4.27-alpha.9

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/server",
3
3
  "email": "hi@budibase.com",
4
- "version": "2.4.27-alpha.8",
4
+ "version": "2.4.27-alpha.9",
5
5
  "description": "Budibase Web Server",
6
6
  "main": "src/index.ts",
7
7
  "repository": {
@@ -44,12 +44,12 @@
44
44
  "license": "GPL-3.0",
45
45
  "dependencies": {
46
46
  "@apidevtools/swagger-parser": "10.0.3",
47
- "@budibase/backend-core": "2.4.27-alpha.8",
48
- "@budibase/client": "2.4.27-alpha.8",
49
- "@budibase/pro": "2.4.27-alpha.7",
50
- "@budibase/shared-core": "2.4.27-alpha.8",
51
- "@budibase/string-templates": "2.4.27-alpha.8",
52
- "@budibase/types": "2.4.27-alpha.8",
47
+ "@budibase/backend-core": "2.4.27-alpha.9",
48
+ "@budibase/client": "2.4.27-alpha.9",
49
+ "@budibase/pro": "2.4.27-alpha.8",
50
+ "@budibase/shared-core": "2.4.27-alpha.9",
51
+ "@budibase/string-templates": "2.4.27-alpha.9",
52
+ "@budibase/types": "2.4.27-alpha.9",
53
53
  "@bull-board/api": "3.7.0",
54
54
  "@bull-board/koa": "3.9.4",
55
55
  "@elastic/elasticsearch": "7.10.0",
@@ -176,5 +176,5 @@
176
176
  "optionalDependencies": {
177
177
  "oracledb": "5.3.0"
178
178
  },
179
- "gitHead": "daeec6f5201291037b1ba89e7db3b587a09bd2e1"
179
+ "gitHead": "b48f6ecdc939ed804ef5645c7e0869ccfbf2ec74"
180
180
  }
@@ -11,10 +11,12 @@ import {
11
11
  } from "../../../utilities/fileSystem"
12
12
  import env from "../../../environment"
13
13
  import { DocumentType } from "../../../db/utils"
14
- import { context, objectStore, utils } from "@budibase/backend-core"
14
+ import { context, objectStore, utils, configs } from "@budibase/backend-core"
15
15
  import AWS from "aws-sdk"
16
16
  import fs from "fs"
17
17
  import sdk from "../../../sdk"
18
+ import * as pro from "@budibase/pro"
19
+
18
20
  const send = require("koa-send")
19
21
 
20
22
  async function prepareUpload({ s3Key, bucket, metadata, file }: any) {
@@ -98,33 +100,74 @@ export const deleteObjects = async function (ctx: any) {
98
100
  }
99
101
 
100
102
  export const serveApp = async function (ctx: any) {
101
- const db = context.getAppDB({ skip_setup: true })
102
- const appInfo = await db.get(DocumentType.APP_METADATA)
103
- let appId = context.getAppId()
103
+ //Public Settings
104
+ const { config } = await configs.getSettingsConfigDoc()
105
+ const branding = await pro.branding.getBrandingConfig(config)
104
106
 
105
- if (!env.isJest()) {
106
- const App = require("./templates/BudibaseApp.svelte").default
107
- const plugins = objectStore.enrichPluginURLs(appInfo.usedPlugins)
108
- const { head, html, css } = App.render({
109
- metaImage:
110
- "https://res.cloudinary.com/daog6scxm/image/upload/v1666109324/meta-images/budibase-meta-image_uukc1m.png",
111
- title: appInfo.name,
112
- production: env.isProd(),
113
- appId,
114
- clientLibPath: objectStore.clientLibraryUrl(appId!, appInfo.version),
115
- usedPlugins: plugins,
116
- })
107
+ let db
108
+ try {
109
+ db = context.getAppDB({ skip_setup: true })
110
+ const appInfo = await db.get(DocumentType.APP_METADATA)
111
+ let appId = context.getAppId()
117
112
 
118
- const appHbs = loadHandlebarsFile(`${__dirname}/templates/app.hbs`)
119
- ctx.body = await processString(appHbs, {
120
- head,
121
- body: html,
122
- style: css.code,
123
- appId,
124
- })
125
- } else {
126
- // just return the app info for jest to assert on
127
- ctx.body = appInfo
113
+ if (!env.isJest()) {
114
+ const App = require("./templates/BudibaseApp.svelte").default
115
+ const plugins = objectStore.enrichPluginURLs(appInfo.usedPlugins)
116
+ const { head, html, css } = App.render({
117
+ metaImage:
118
+ branding?.metaImageUrl ||
119
+ "https://res.cloudinary.com/daog6scxm/image/upload/v1666109324/meta-images/budibase-meta-image_uukc1m.png",
120
+ metaDescription: branding?.metaDescription || "",
121
+ metaTitle:
122
+ branding?.metaTitle || `${appInfo.name} - built with Budibase`,
123
+ title: appInfo.name,
124
+ production: env.isProd(),
125
+ appId,
126
+ clientLibPath: objectStore.clientLibraryUrl(appId!, appInfo.version),
127
+ usedPlugins: plugins,
128
+ favicon:
129
+ branding.faviconUrl !== ""
130
+ ? objectStore.getGlobalFileUrl("settings", "faviconUrl")
131
+ : "",
132
+ logo:
133
+ config?.logoUrl !== ""
134
+ ? objectStore.getGlobalFileUrl("settings", "logoUrl")
135
+ : "",
136
+ })
137
+ const appHbs = loadHandlebarsFile(`${__dirname}/templates/app.hbs`)
138
+ ctx.body = await processString(appHbs, {
139
+ head,
140
+ body: html,
141
+ style: css.code,
142
+ appId,
143
+ })
144
+ } else {
145
+ // just return the app info for jest to assert on
146
+ ctx.body = appInfo
147
+ }
148
+ } catch (error) {
149
+ if (!env.isJest()) {
150
+ const App = require("./templates/BudibaseApp.svelte").default
151
+ const { head, html, css } = App.render({
152
+ title: branding?.metaTitle,
153
+ metaTitle: branding?.metaTitle,
154
+ metaImage:
155
+ branding?.metaImageUrl ||
156
+ "https://res.cloudinary.com/daog6scxm/image/upload/v1666109324/meta-images/budibase-meta-image_uukc1m.png",
157
+ metaDescription: branding?.metaDescription || "",
158
+ favicon:
159
+ branding.faviconUrl !== ""
160
+ ? objectStore.getGlobalFileUrl("settings", "faviconUrl")
161
+ : "",
162
+ })
163
+
164
+ const appHbs = loadHandlebarsFile(`${__dirname}/templates/app.hbs`)
165
+ ctx.body = await processString(appHbs, {
166
+ head,
167
+ body: html,
168
+ style: css.code,
169
+ })
170
+ }
128
171
  }
129
172
  }
130
173
 
@@ -1,7 +1,10 @@
1
1
  <script>
2
2
  export let title = ""
3
3
  export let favicon = ""
4
+
4
5
  export let metaImage = ""
6
+ export let metaTitle = ""
7
+ export let metaDescription = ""
5
8
 
6
9
  export let clientLibPath
7
10
  export let usedPlugins
@@ -13,18 +16,33 @@
13
16
  name="viewport"
14
17
  content="width=device-width, initial-scale=1.0, viewport-fit=cover"
15
18
  />
19
+
20
+ <!-- Primary Meta Tags -->
21
+ <meta name="title" content={metaTitle} />
22
+ <meta name="description" content={metaDescription} />
23
+
16
24
  <!-- Opengraph Meta Tags -->
17
- <meta name="twitter:card" content="summary_large_image" />
18
- <meta name="twitter:site" content="@budibase" />
19
- <meta name="twitter:image" content={metaImage} />
20
- <meta name="twitter:title" content="{title} - built with Budibase" />
21
25
  <meta property="og:site_name" content="Budibase" />
22
26
  <meta property="og:title" content="{title} - built with Budibase" />
27
+ <meta property="og:description" content={metaDescription} />
23
28
  <meta property="og:type" content="website" />
24
29
  <meta property="og:image" content={metaImage} />
25
30
 
31
+ <!-- Twitter -->
32
+ <meta property="twitter:card" content="summary_large_image" />
33
+ <meta property="twitter:site" content="@budibase" />
34
+ <meta property="twitter:image" content={metaImage} />
35
+ <meta property="twitter:image:alt" content="{title} - built with Budibase" />
36
+ <meta property="twitter:title" content="{title} - built with Budibase" />
37
+ <meta property="twitter:description" content={metaDescription} />
38
+
26
39
  <title>{title}</title>
27
- <link rel="icon" type="image/png" href={favicon} />
40
+ {#if favicon !== ""}
41
+ <link rel="icon" type="image/png" href={favicon} />
42
+ {:else}
43
+ <link rel="icon" type="image/png" href="https://i.imgur.com/Xhdt1YP.png" />
44
+ {/if}
45
+
28
46
  <link rel="stylesheet" href="https://rsms.me/inter/inter.css" />
29
47
  <link rel="preconnect" href="https://fonts.gstatic.com" />
30
48
  <link
@@ -83,11 +101,16 @@
83
101
 
84
102
  <body id="app">
85
103
  <div id="error">
86
- <h1>There was an error loading your app</h1>
87
- <h2>
88
- The Budibase client library could not be loaded. Try republishing your
89
- app.
90
- </h2>
104
+ {#if clientLibPath}
105
+ <h1>There was an error loading your app</h1>
106
+ <h2>
107
+ The Budibase client library could not be loaded. Try republishing your
108
+ app.
109
+ </h2>
110
+ {:else}
111
+ <h2>We couldn't find that application</h2>
112
+ <p />
113
+ {/if}
91
114
  </div>
92
115
  <script type="application/javascript">
93
116
  window.INIT_TIME = Date.now()
Binary file