Merge branch 'master' of https://github.com/Budibase/budibase into property-panel/master

This commit is contained in:
Conor_Mack 2020-05-25 15:24:47 +01:00
commit 98e590e586
28 changed files with 312 additions and 120 deletions

View File

@ -1,8 +1,8 @@
name: Budibase Release
on:
# Trigger the workflow on push,
# but only for the release branch
# Trigger the workflow on push with tags,
# but only for the master branch
push:
branches:
- master
@ -25,10 +25,10 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- run: yarn
# - run: yarn lint
- run: yarn lint
- run: yarn bootstrap
- run: yarn build
# - run: yarn test
- run: yarn test
- name: Prepare for app notarization (macOS)
if: startsWith(matrix.os, 'macos')

View File

@ -30,4 +30,4 @@
"@material/icon-button": "4.0.0",
"date-fns": "^2.10.0"
}
}
}

View File

@ -4,4 +4,5 @@ node_modules_win
package-lock.json
yarn.lock
release/
dist/
dist/
routify

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.1.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 128 128" style="enable-background:new 0 0 128 128;" xml:space="preserve">
<style type="text/css">
.st0{fill:#393C44;}
.st1{fill:#FFFFFF;}
</style>
<g>
<path class="st0" d="M117.33,128H10.67C4.78,128,0,123.22,0,117.33V10.67C0,4.78,4.78,0,10.67,0h106.67
C123.22,0,128,4.78,128,10.67v106.67C128,123.22,123.22,128,117.33,128z"/>
<g>
<path class="st1" d="M75.94,32v27.84c3.14-3.38,7.07-5.07,11.79-5.07c2.8,0,5.37,0.54,7.7,1.63c2.33,1.09,4.32,2.55,5.97,4.39
c1.65,1.84,2.93,4.01,3.87,6.51c0.93,2.5,1.4,5.16,1.4,7.98c0,2.87-0.48,5.57-1.44,8.09c-0.96,2.52-2.3,4.72-4.02,6.58
c-1.72,1.87-3.75,3.34-6.08,4.43C92.8,95.46,90.28,96,87.58,96c-4.91,0-8.79-1.84-11.64-5.52v4.31H62.6V32H75.94z M92.74,75.5
c0-1.21-0.22-2.36-0.66-3.44c-0.44-1.08-1.06-2.03-1.84-2.84c-0.79-0.81-1.7-1.45-2.73-1.93c-1.03-0.48-2.16-0.72-3.39-0.72
c-1.18,0-2.28,0.23-3.32,0.68c-1.03,0.45-1.93,1.09-2.69,1.89c-0.76,0.81-1.38,1.75-1.84,2.84c-0.47,1.09-0.7,2.23-0.7,3.44
s0.22,2.34,0.66,3.4c0.44,1.06,1.06,1.98,1.84,2.76c0.79,0.78,1.71,1.41,2.76,1.89c1.06,0.48,2.17,0.72,3.35,0.72
c1.18,0,2.28-0.23,3.32-0.68c1.03-0.45,1.93-1.08,2.69-1.89c0.76-0.81,1.37-1.74,1.84-2.8C92.51,77.77,92.74,76.66,92.74,75.5z"/>
</g>
<g>
<path class="st1" d="M34.67,32v27.84c3.14-3.38,7.07-5.07,11.79-5.07c2.8,0,5.37,0.54,7.7,1.63c2.33,1.09,4.32,2.55,5.97,4.39
c1.65,1.84,2.93,4.01,3.87,6.51c0.93,2.5,1.4,5.16,1.4,7.98c0,2.87-0.48,5.57-1.44,8.09c-0.96,2.52-2.3,4.72-4.02,6.58
c-1.72,1.87-3.75,3.34-6.08,4.43C51.53,95.46,49.01,96,46.31,96c-4.91,0-8.79-1.84-11.64-5.52v4.31H21.33V32H34.67z M51.47,75.5
c0-1.21-0.22-2.36-0.66-3.44c-0.44-1.08-1.06-2.03-1.84-2.84c-0.79-0.81-1.7-1.45-2.73-1.93c-1.03-0.48-2.16-0.72-3.39-0.72
c-1.18,0-2.28,0.23-3.32,0.68c-1.03,0.45-1.93,1.09-2.69,1.89c-0.76,0.81-1.38,1.75-1.84,2.84c-0.47,1.09-0.7,2.23-0.7,3.44
s0.22,2.34,0.66,3.4c0.44,1.06,1.06,1.98,1.84,2.76c0.79,0.78,1.71,1.41,2.76,1.89c1.06,0.48,2.17,0.72,3.35,0.72
c1.18,0,2.28-0.23,3.32-0.68c1.03-0.45,1.93-1.08,2.69-1.89c0.76-0.81,1.37-1.74,1.84-2.8C51.24,77.77,51.47,76.66,51.47,75.5z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -4,11 +4,11 @@
"license": "AGPL-3.0",
"private": true,
"scripts": {
"build": "rollup -c",
"start": "routify -c rollup",
"build": "routify --routify-dir routify -b && rollup -c",
"start": "routify --routify-dir routify -c rollup",
"test": "jest",
"test:watch": "jest --watchAll",
"dev:builder": "routify -c rollup",
"dev:builder": "routify --routify-dir routify -c rollup",
"rollup": "rollup -c -w"
},
"jest": {
@ -60,7 +60,7 @@
"@babel/runtime": "^7.5.5",
"@rollup/plugin-alias": "^3.0.1",
"@rollup/plugin-json": "^4.0.3",
"@sveltech/routify": "1.5.0-beta.40",
"@sveltech/routify": "1.7.11",
"babel-jest": "^24.8.0",
"browser-sync": "^2.26.7",
"http-proxy-middleware": "^0.19.1",
@ -83,4 +83,4 @@
"svelte-color-picker": "^1.0.7"
},
"gitHead": "115189f72a850bfb52b65ec61d932531bf327072"
}
}

View File

@ -2,7 +2,7 @@
import Modal from "svelte-simple-modal"
import { onMount } from "svelte"
import { Router, basepath } from "@sveltech/routify"
import { routes } from "@sveltech/routify/tmp/routes"
import { routes } from "../routify/routes"
import { store, initialise } from "builderStore"
import AppNotification, {
showAppNotification,

View File

@ -62,14 +62,14 @@
margin: 5px 20px 5px 0px;
border-radius: 0 5px 5px 0;
display: flex;
align-items: baseline;
align-items: center;
font-weight: 500;
font-size: 13px;
}
.budibase__nav-item.selected {
color: var(--button-text);
background: #fafafa !important;
background: #f1f4fc;
}
.budibase__nav-item:hover {

View File

@ -51,7 +51,6 @@
</script>
<div class="root">
{#each _screens as screen}
<div
class="budibase__nav-item component"

View File

@ -1,5 +1,20 @@
:root {
--white: #FFFFFF;
--blue: #0055ff;
--blue-light: #F1F4FC;
--blue-dark: #2F4C9B;
--ink: #393C44;
--ink-light: #808192;
--ink-lighter: #ADAEC4;
--grey: #F2F2F2;
--grey-light: #FBFBFB;
--grey-dark: #E6E6E6;
--primary100: #0055ff;
--primary80: rgba(0, 85, 255, 0.8);
--primary60: #rgba(0, 85, 255, 0.6);
@ -9,7 +24,7 @@
--primary5: #rgba(0, 85, 255, 0.05);
--primarydark: #0044cc;
--secondary100:#000333;
--secondary100:#393C44;
--secondary80: rgba(0, 3, 51, 0.8);
--secondary60: rgba(0, 3, 51, 0.6);
--secondary40: rgba(0, 3, 51, 0.4);
@ -34,7 +49,7 @@
--deletion10: #F2545B1A;
--deletiondark: #CF4046;
--white: #FFFFFF;
--darkslate: #1a202c;
--slate: #d8d8d8;
--lightslate: #f9f9f9;

View File

@ -11,6 +11,7 @@
<link rel='icon' type='image/png' href='/_builder/favicon.png'>
<link rel='stylesheet' href='/_builder/global.css'>
<link rel='stylesheet' href='/_builder/codemirror.css'>
<link rel='stylesheet' href='/_builder/budibase.css'>
<link rel='stylesheet' href='/_builder/monokai.css'>
<link rel='stylesheet' href='/_builder/bundle.css'>
<link rel='stylesheet' href='/_builder/fonts.css'>

View File

@ -2,7 +2,7 @@
import { store } from "builderStore"
import { fade } from "svelte/transition"
import { isActive, goto, context } from "@sveltech/routify"
import { isActive, goto, layout } from "@sveltech/routify"
import { SettingsIcon, PreviewIcon } from "components/common/Icons/"
import IconButton from "components/common/IconButton.svelte"
@ -23,8 +23,6 @@
throw new Error(pkg)
}
}
$: ({ component } = $context)
$: list = component.parent.children.filter(child => child.isIndexable)
</script>
<div class="root">
@ -33,17 +31,17 @@
<div class="topleftnav">
<button class="home-logo">
<img
src="/_builder/assets/budibase-emblem-white.svg"
src="/_builder/assets/bb-logo.svg"
alt="budibase icon" />
</button>
<!-- This gets all indexable subroutes and sticks them in the top nav. -->
{#each list as { path, prettyName, children, meta }}
{#each $layout.children as { path, title }}
<span
class:active={$isActive(path)}
class="topnavitem"
on:click={() => $goto(path)}>
{prettyName}
{title}
</span>
{/each}
<!-- <IconButton icon="home"
@ -87,13 +85,14 @@
.top-nav {
flex: 0 0 auto;
height: 48px;
background: #0d203b;
height: 60px;
background: #fff;
padding: 0px 20px 0 20px;
display: flex;
box-sizing: border-box;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid var(--grey);
}
.content > div {
@ -112,8 +111,8 @@
.topnavitem {
cursor: pointer;
color: rgb(255, 255, 255, 0.6);
margin: 0px 10px;
color: var(--ink-lighter);
margin: 0px 00px 0px 20px;
padding-top: 4px;
font-weight: 500;
font-size: 1rem;
@ -123,19 +122,19 @@
}
.topnavitem:hover {
color: rgb(255, 255, 255, 0.8);
color: var(--ink-light);
font-weight: 500;
}
.active {
color: white;
font-weight: 600;
color: var(--ink);
font-weight: 500;
}
.topnavitemright {
cursor: pointer;
color: rgb(255, 255, 255, 0.6);
margin: 0px 5px;
color: var(--ink-light);
margin: 0px 20px 0px 0px;
padding-top: 4px;
font-weight: 500;
font-size: 1rem;
@ -157,7 +156,8 @@
cursor: pointer;
outline: none;
height: 40px;
padding: 8px 10px 8px 0;
padding: 0px 10px 8px 0;
align-items: center;
}
.home-logo:hover {
@ -169,7 +169,7 @@
}
.home-logo img {
height: 100%;
height: 40px;
}
span:first-letter {
text-transform: capitalize;

View File

@ -11,9 +11,7 @@ module.exports = opts => {
const run = async opts => {
try {
opts.dir = xPlatHomeDir(opts.dir)
const bbconfig = dotenv.config({ path: resolve(opts.dir, ".env") })
console.log(bbconfig)
setup(opts)
await createAppInstance(opts)
await createEmptyAppPackage(opts)
exec(`cd ${join(opts.dir, opts.applicationId)} && npm install`)
@ -25,6 +23,13 @@ const run = async opts => {
}
}
const setup = opts => {
opts.dir = xPlatHomeDir(opts.dir)
process.env.BUDIBASE_DIR = opts.dir
const bbconfig = dotenv.config({ path: resolve(opts.dir, ".env") })
console.log(JSON.stringify(bbconfig))
}
const createAppInstance = async opts => {
const createAppCtx = {
params: { clientId: process.env.CLIENT_ID },
@ -45,7 +50,7 @@ const createAppInstance = async opts => {
// this cannot be a top level require as it will cause
// the environment module to be loaded prematurely
const instanceController = require("@budibase/server/src/api/controllers/instance")
await instanceController.create({
const createInstCtx = {
params: {
clientId: process.env.CLIENT_ID,
applicationId: opts.applicationId,
@ -53,9 +58,11 @@ const createAppInstance = async opts => {
request: {
body: { name: `dev-${process.env.CLIENT_ID}` },
},
})
}
await instanceController.create(createInstCtx)
console.log(chalk.green(`Default Instance Created`))
console.log(JSON.stringify(createInstCtx.body))
}
const createEmptyAppPackage = async opts => {

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.1.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 128 128" style="enable-background:new 0 0 128 128;" xml:space="preserve">
<style type="text/css">
.st0{fill:#393C44;}
.st1{fill:#FFFFFF;}
</style>
<g>
<path class="st0" d="M117.33,128H10.67C4.78,128,0,123.22,0,117.33V10.67C0,4.78,4.78,0,10.67,0h106.67
C123.22,0,128,4.78,128,10.67v106.67C128,123.22,123.22,128,117.33,128z"/>
<g>
<path class="st1" d="M75.94,32v27.84c3.14-3.38,7.07-5.07,11.79-5.07c2.8,0,5.37,0.54,7.7,1.63c2.33,1.09,4.32,2.55,5.97,4.39
c1.65,1.84,2.93,4.01,3.87,6.51c0.93,2.5,1.4,5.16,1.4,7.98c0,2.87-0.48,5.57-1.44,8.09c-0.96,2.52-2.3,4.72-4.02,6.58
c-1.72,1.87-3.75,3.34-6.08,4.43C92.8,95.46,90.28,96,87.58,96c-4.91,0-8.79-1.84-11.64-5.52v4.31H62.6V32H75.94z M92.74,75.5
c0-1.21-0.22-2.36-0.66-3.44c-0.44-1.08-1.06-2.03-1.84-2.84c-0.79-0.81-1.7-1.45-2.73-1.93c-1.03-0.48-2.16-0.72-3.39-0.72
c-1.18,0-2.28,0.23-3.32,0.68c-1.03,0.45-1.93,1.09-2.69,1.89c-0.76,0.81-1.38,1.75-1.84,2.84c-0.47,1.09-0.7,2.23-0.7,3.44
s0.22,2.34,0.66,3.4c0.44,1.06,1.06,1.98,1.84,2.76c0.79,0.78,1.71,1.41,2.76,1.89c1.06,0.48,2.17,0.72,3.35,0.72
c1.18,0,2.28-0.23,3.32-0.68c1.03-0.45,1.93-1.08,2.69-1.89c0.76-0.81,1.37-1.74,1.84-2.8C92.51,77.77,92.74,76.66,92.74,75.5z"/>
</g>
<g>
<path class="st1" d="M34.67,32v27.84c3.14-3.38,7.07-5.07,11.79-5.07c2.8,0,5.37,0.54,7.7,1.63c2.33,1.09,4.32,2.55,5.97,4.39
c1.65,1.84,2.93,4.01,3.87,6.51c0.93,2.5,1.4,5.16,1.4,7.98c0,2.87-0.48,5.57-1.44,8.09c-0.96,2.52-2.3,4.72-4.02,6.58
c-1.72,1.87-3.75,3.34-6.08,4.43C51.53,95.46,49.01,96,46.31,96c-4.91,0-8.79-1.84-11.64-5.52v4.31H21.33V32H34.67z M51.47,75.5
c0-1.21-0.22-2.36-0.66-3.44c-0.44-1.08-1.06-2.03-1.84-2.84c-0.79-0.81-1.7-1.45-2.73-1.93c-1.03-0.48-2.16-0.72-3.39-0.72
c-1.18,0-2.28,0.23-3.32,0.68c-1.03,0.45-1.93,1.09-2.69,1.89c-0.76,0.81-1.38,1.75-1.84,2.84c-0.47,1.09-0.7,2.23-0.7,3.44
s0.22,2.34,0.66,3.4c0.44,1.06,1.06,1.98,1.84,2.76c0.79,0.78,1.71,1.41,2.76,1.89c1.06,0.48,2.17,0.72,3.35,0.72
c1.18,0,2.28-0.23,3.32-0.68c1.03-0.45,1.93-1.08,2.69-1.89c0.76-0.81,1.37-1.74,1.84-2.8C51.24,77.77,51.47,76.66,51.47,75.5z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128"><path fill="#F0DB4F" d="M1.408 1.408h125.184v125.185h-125.184z"/><path fill="#323330" d="M116.347 96.736c-.917-5.711-4.641-10.508-15.672-14.981-3.832-1.761-8.104-3.022-9.377-5.926-.452-1.69-.512-2.642-.226-3.665.821-3.32 4.784-4.355 7.925-3.403 2.023.678 3.938 2.237 5.093 4.724 5.402-3.498 5.391-3.475 9.163-5.879-1.381-2.141-2.118-3.129-3.022-4.045-3.249-3.629-7.676-5.498-14.756-5.355l-3.688.477c-3.534.893-6.902 2.748-8.877 5.235-5.926 6.724-4.236 18.492 2.975 23.335 7.104 5.332 17.54 6.545 18.873 11.531 1.297 6.104-4.486 8.08-10.234 7.378-4.236-.881-6.592-3.034-9.139-6.949-4.688 2.713-4.688 2.713-9.508 5.485 1.143 2.499 2.344 3.63 4.26 5.795 9.068 9.198 31.76 8.746 35.83-5.176.165-.478 1.261-3.666.38-8.581zm-46.885-37.793h-11.709l-.048 30.272c0 6.438.333 12.34-.714 14.149-1.713 3.558-6.152 3.117-8.175 2.427-2.059-1.012-3.106-2.451-4.319-4.485-.333-.584-.583-1.036-.667-1.071l-9.52 5.83c1.583 3.249 3.915 6.069 6.902 7.901 4.462 2.678 10.459 3.499 16.731 2.059 4.082-1.189 7.604-3.652 9.448-7.401 2.666-4.915 2.094-10.864 2.07-17.444.06-10.735.001-21.468.001-32.237z"/></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -23,7 +23,7 @@
}
},
"scripts": {
"test": "jest",
"test": "jest routes --runInBand",
"test:integration": "jest routes --runInBand",
"test:watch": "jest -w",
"initialise": "node ../cli/bin/budi init -b local -q",
@ -55,11 +55,12 @@
"koa": "^2.7.0",
"koa-body": "^4.1.0",
"koa-compress": "^4.0.1",
"koa-logger": "^3.2.1",
"koa-pino-logger": "^3.0.0",
"koa-send": "^5.0.0",
"koa-session": "^5.12.0",
"koa-static": "^5.0.0",
"lodash": "^4.17.13",
"pino-pretty": "^4.0.0",
"pouchdb": "^7.2.1",
"pouchdb-all-dbs": "^1.0.2",
"squirrelly": "^7.5.0",
@ -82,7 +83,9 @@
},
"jest": {
"testEnvironment": "node",
"setupFiles": ["./scripts/jestSetup.js"]
"setupFiles": [
"./scripts/jestSetup.js"
]
},
"gitHead": "b1f4f90927d9e494e513220ef060af28d2d42455"
}

View File

@ -5,7 +5,3 @@ process.env.JWT_SECRET = "test-jwtsecret"
process.env.CLIENT_ID = "test-client-id"
process.env.BUDIBASE_DIR = tmpdir("budibase-unittests")
process.env.ADMIN_SECRET = "test-admin-secret"
// makes the output of the tests messy
// but please temporarily enable for debugging :)
process.env.LOGGER = "off"

View File

@ -1,7 +1,7 @@
const CouchDB = require("../../db")
const ClientDb = require("../../db/clientDb")
const { getPackageForBuilder } = require("../../utilities/builder")
const uuid = require("uuid")
const newid = require("../../db/newid")
const env = require("../../environment")
exports.fetch = async function(ctx) {
@ -24,7 +24,7 @@ exports.create = async function(ctx) {
const db = new CouchDB(ClientDb.name(env.CLIENT_ID))
const newApplication = {
_id: uuid.v4().replace(/-/g, ""),
_id: newid(),
type: "app",
instances: [],
userInstanceMap: {},

View File

@ -1,12 +1,12 @@
const CouchDB = require("../../db")
const client = require("../../db/clientDb")
const uuid = require("uuid")
const newid = require("../../db/newid")
const env = require("../../environment")
exports.create = async function(ctx) {
const instanceName = ctx.request.body.name
const uid = uuid.v4().replace(/-/g, "")
const instanceId = `inst_${ctx.params.applicationId.substring(0, 7)}_${uid}`
const appShortId = ctx.params.applicationId.substring(0, 7)
const instanceId = `inst_${appShortId}_${newid()}`
const { applicationId } = ctx.params
const clientId = env.CLIENT_ID
const db = new CouchDB(instanceId)

View File

@ -1,5 +1,5 @@
const CouchDB = require("../../db")
const uuid = require("uuid")
const newid = require("../../db/newid")
exports.fetch = async function(ctx) {
const db = new CouchDB(ctx.params.instanceId)
@ -15,7 +15,7 @@ exports.create = async function(ctx) {
const newModel = {
type: "model",
...ctx.request.body,
_id: uuid.v4().replace(/-/g, ""),
_id: newid(),
}
const result = await db.post(newModel)

View File

@ -1,6 +1,6 @@
const CouchDB = require("../../db")
const Ajv = require("ajv")
const uuid = require("uuid")
const newid = require("../../db/newid")
const ajv = new Ajv()
@ -9,7 +9,7 @@ exports.save = async function(ctx) {
const record = ctx.request.body
if (!record._rev && !record._id) {
record._id = uuid.v4().replace(/-/, "")
record._id = newid()
}
// validation with ajv

View File

@ -48,7 +48,7 @@ router.use(async (ctx, next) => {
try {
await next()
} catch (err) {
if (env.LOGGER !== "off") console.trace(err)
ctx.log.error(err)
ctx.status = err.status || err.statusCode || 500
ctx.body = {
message: err.message,

View File

@ -8,22 +8,8 @@ const TEST_CLIENT_ID = "test-client-id"
exports.supertest = async () => {
let request
let port = 4002
let started = false
let server
while (!started && port < 4020) {
try {
server = await app(port)
started = true
} catch (err) {
if (err.code === "EADDRINUSE") {
port = port + 1
} else {
throw err
}
}
}
if (!started) throw Error("Application failed to start")
server = await app(port)
request = supertest(server)
return { request, server }

View File

@ -1,31 +1,29 @@
const Koa = require("koa")
const logger = require("koa-logger")
const api = require("./api")
const koaBody = require("koa-body")
const env = require("./environment")
const logger = require("koa-pino-logger")
const http = require("http")
const api = require("./api")
const env = require("./environment")
const app = new Koa()
// set up top level koa middleware
app.use(koaBody({ multipart: true }))
if (env.LOGGER !== "off") app.use(logger())
app.use(
logger({
prettyPrint: {
levelFirst: true,
},
level: process.env.NODE_ENV === "jest" ? "silent" : "info",
})
)
// api routes
app.use(api.routes())
module.exports = async port => {
port = port || env.PORT || 4001
const serverPort = port || env.PORT
const server = http.createServer(app.callback())
return new Promise((resolve, reject) => {
server.on("error", e => {
if (e.code === "EADDRINUSE") {
reject(e)
}
})
server.listen({ port }, () => {
resolve(server)
})
})
return server.listen(serverPort || 4001)
}

View File

@ -0,0 +1,5 @@
const { v4 } = require("uuid")
module.exports = function() {
return v4().replace(/-/g, "")
}

View File

@ -13,13 +13,13 @@ if (isDev) {
})
}
const APP_URL = "http://localhost:4001"
const APP_URL = "http://localhost:4001/_builder"
const APP_TITLE = "Budibase Builder"
let win
function createWindow() {
app.server = require("./app")
async function createWindow() {
app.server = await require("./app")()
win = new BrowserWindow({ width: 1920, height: 1080 })
win.setTitle(APP_TITLE)
win.loadURL(APP_URL)

View File

@ -3,14 +3,7 @@ const STATUS_CODES = require("../utilities/statusCodes")
const env = require("../environment")
module.exports = async (ctx, next) => {
const authHeader = ctx.get("Authorization")
if (
authHeader &&
authHeader.startsWith("Basic") &&
authHeader.split(" ")[1] === env.ADMIN_SECRET
) {
ctx.isAuthenticated = true
if (ctx.path === "/_builder") {
await next()
return
}

View File

@ -239,6 +239,11 @@
global-agent "^2.0.2"
global-tunnel-ng "^2.7.1"
"@hapi/bourne@^2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@hapi/bourne/-/bourne-2.0.0.tgz#5bb2193eb685c0007540ca61d166d4e1edaf918d"
integrity sha512-WEezM1FWztfbzqIUbsDzFRVMxSoLy3HugVcux6KDDtTqzPsLE8NDRHfXvev66aH1i2oOKKar3/XDjbvh/OUBdg==
"@jest/console@^24.7.1", "@jest/console@^24.9.0":
version "24.9.0"
resolved "https://registry.yarnpkg.com/@jest/console/-/console-24.9.0.tgz#79b1bc06fb74a8cfb01cbdedf945584b1b9707f0"
@ -785,6 +790,16 @@ argparse@^1.0.7:
dependencies:
sprintf-js "~1.0.2"
args@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/args/-/args-5.0.1.tgz#4bf298df90a4799a09521362c579278cc2fdd761"
integrity sha512-1kqmFCFsPffavQFGt8OxJdIcETti99kySRUPMpOhaGjL6mRJn8HFU1OxKY5bMqfZKUwTQc1mZkAjmGYaVOHFtQ==
dependencies:
camelcase "5.0.0"
chalk "2.4.2"
leven "2.1.0"
mri "1.1.4"
argsarray@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/argsarray/-/argsarray-0.0.1.tgz#6e7207b4ecdb39b0af88303fa5ae22bda8df61cb"
@ -877,6 +892,11 @@ atob@^2.1.2:
resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9"
integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==
atomic-sleep@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/atomic-sleep/-/atomic-sleep-1.0.0.tgz#eb85b77a601fc932cfe432c5acd364a9e2c9075b"
integrity sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==
aws-sign2@~0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8"
@ -1128,7 +1148,7 @@ builder-util@22.6.0:
stat-mode "^1.0.0"
temp-file "^3.3.7"
bytes@3.1.0, bytes@^3.0.0, bytes@^3.1.0:
bytes@3.1.0, bytes@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6"
integrity sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==
@ -1174,6 +1194,11 @@ callsites@^3.0.0:
resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73"
integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==
camelcase@5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.0.0.tgz#03295527d58bd3cd4aa75363f35b2e8d97be2f42"
integrity sha512-faqwZqnWxbxn+F1d399ygeamQNy3lPp/H9H6rNrqYh4FSVCtcY+3cub1MxA8o9mDd55mM8Aghuu/kuyYA6VTsA==
camelcase@^5.0.0, camelcase@^5.3.1:
version "5.3.1"
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320"
@ -1191,7 +1216,7 @@ caseless@~0.12.0:
resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc"
integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=
chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.4.2:
chalk@2.4.2, chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.4.2:
version "2.4.2"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"
integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==
@ -1537,6 +1562,11 @@ date-fns@^1.29.0:
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.30.1.tgz#2e71bf0b119153dbb4cc4e88d9ea5acfb50dc05c"
integrity sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==
dateformat@^3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae"
integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==
debug@^2.2.0, debug@^2.3.3, debug@^2.6.9:
version "2.6.9"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
@ -2298,6 +2328,23 @@ fast-levenshtein@~2.0.6:
resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917"
integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=
fast-redact@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/fast-redact/-/fast-redact-2.0.0.tgz#17bb8f5e1f56ecf4a38c8455985e5eab4c478431"
integrity sha512-zxpkULI9W9MNTK2sJ3BpPQrTEXFNESd2X6O1tXMFpK/XM0G5c5Rll2EVYZH2TqI3xRGK/VaJ+eEOt7pnENJpeA==
fast-safe-stringify@^2.0.7:
version "2.0.7"
resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz#124aa885899261f68aedb42a7c080de9da608743"
integrity sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA==
fast-url-parser@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/fast-url-parser/-/fast-url-parser-1.1.3.tgz#f4af3ea9f34d8a271cf58ad2b3759f431f0b318d"
integrity sha1-9K8+qfNNiicc9YrSs3WfQx8LMY0=
dependencies:
punycode "^1.3.2"
fb-watchman@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.1.tgz#fc84fb39d2709cf3ff6d743706157bb5708a8a85"
@ -2387,6 +2434,11 @@ flat-cache@^2.0.1:
rimraf "2.6.3"
write "1.0.3"
flatstr@^1.0.12:
version "1.0.12"
resolved "https://registry.yarnpkg.com/flatstr/-/flatstr-1.0.12.tgz#c2ba6a08173edbb6c9640e3055b95e287ceb5931"
integrity sha512-4zPxDyhCyiN2wIAtSLI6gc82/EjqZc1onI4Mz/l0pWrAlsSfYH/2ZIcU+e3oA2wDwbzIWNKwa23F8rh6+DRWkw==
flatted@^2.0.0:
version "2.0.2"
resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138"
@ -2774,11 +2826,6 @@ http-signature@~1.2.0:
jsprim "^1.2.2"
sshpk "^1.7.0"
humanize-number@0.0.2:
version "0.0.2"
resolved "https://registry.yarnpkg.com/humanize-number/-/humanize-number-0.0.2.tgz#11c0af6a471643633588588048f1799541489c18"
integrity sha1-EcCvakcWQ2M1iFiASPF5lUFInBg=
iconv-lite@0.4.24, iconv-lite@^0.4.24, iconv-lite@^0.4.5:
version "0.4.24"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
@ -3571,6 +3618,16 @@ jest@^24.8.0:
import-local "^2.0.0"
jest-cli "^24.9.0"
jmespath@^0.15.0:
version "0.15.0"
resolved "https://registry.yarnpkg.com/jmespath/-/jmespath-0.15.0.tgz#a3f222a9aae9f966f5d27c796510e28091764217"
integrity sha1-o/Iiqarp+Wb10nx5ZRDigJF2Qhc=
joycon@^2.2.5:
version "2.2.5"
resolved "https://registry.yarnpkg.com/joycon/-/joycon-2.2.5.tgz#8d4cf4cbb2544d7b7583c216fcdfec19f6be1615"
integrity sha512-YqvUxoOcVPnCp0VU1/56f+iKSdvIRJYPznH22BdXV3xMk75SFXhWeJkZ8C9XxUWt1b5x2X1SxuFygW1U0FmkEQ==
"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
@ -3830,15 +3887,12 @@ koa-is-json@^1.0.0:
resolved "https://registry.yarnpkg.com/koa-is-json/-/koa-is-json-1.0.0.tgz#273c07edcdcb8df6a2c1ab7d59ee76491451ec14"
integrity sha1-JzwH7c3Ljfaiwat9We52SRRR7BQ=
koa-logger@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/koa-logger/-/koa-logger-3.2.1.tgz#ab9db879526db3837cc9ce4fd983c025b1689f22"
integrity sha512-MjlznhLLKy9+kG8nAXKJLM0/ClsQp/Or2vI3a5rbSQmgl8IJBQO0KI5FA70BvW+hqjtxjp49SpH2E7okS6NmHg==
koa-pino-logger@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/koa-pino-logger/-/koa-pino-logger-3.0.0.tgz#27600b4f3639e8767dfc6b66493109c5457f53ba"
integrity sha512-teJsT88JLRBYH7pJACGAwAHfl2y/x5u5aSPD03Z/HW6QDMAWyRxk4dsY0/UbtM8wgaXIaxZgIFUxxvgiQFr6WQ==
dependencies:
bytes "^3.1.0"
chalk "^2.4.2"
humanize-number "0.0.2"
passthrough-counter "^1.0.0"
pino-http "^5.0.1"
koa-send@^5.0.0:
version "5.0.0"
@ -4022,6 +4076,11 @@ levelup@^4.3.2:
level-supports "~1.0.0"
xtend "~4.0.0"
leven@2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/leven/-/leven-2.1.0.tgz#c2e7a9f772094dee9d34202ae8acce4687875580"
integrity sha1-wuep93IJTe6dNCAq6KzORoeHVYA=
leven@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2"
@ -4324,6 +4383,11 @@ mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@^0.5.4:
dependencies:
minimist "^1.2.5"
mri@1.1.4:
version "1.1.4"
resolved "https://registry.yarnpkg.com/mri/-/mri-1.1.4.tgz#7cb1dd1b9b40905f1fac053abe25b6720f44744a"
integrity sha512-6y7IjGPm8AzlvoUrwAaw1tLnUBudaS3752vcd8JtrpGGQn+rXIe63LFVHm/YMwtqAuh+LJPCFdlLYPWM1nYn6w==
ms@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
@ -4708,11 +4772,6 @@ pascalcase@^0.1.1:
resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14"
integrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=
passthrough-counter@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/passthrough-counter/-/passthrough-counter-1.0.0.tgz#1967d9e66da572b5c023c787db112a387ab166fa"
integrity sha1-GWfZ5m2lcrXAI8eH2xEqOHqxZvo=
path-exists@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515"
@ -4777,6 +4836,49 @@ pify@^4.0.1:
resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231"
integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==
pino-http@^5.0.1:
version "5.1.0"
resolved "https://registry.yarnpkg.com/pino-http/-/pino-http-5.1.0.tgz#8c3b9f0377aa7951cfcc9c8cd70171f059c95f1d"
integrity sha512-75LX9GxvauF6g+XqXo/yEIltEppSdMnk0xT+oz3j28hNDIaxiQHFaZKxvnvunfUZRq/xQJdTcEHFOMhb8IxHjw==
dependencies:
fast-url-parser "^1.1.3"
pino "^6.0.0"
pino-std-serializers "^2.4.0"
pino-pretty@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/pino-pretty/-/pino-pretty-4.0.0.tgz#afbff81f946342b9d6eabc434942fe490e02faa9"
integrity sha512-YLy/n3dMXYWOodSm530gelkSAJGmEp29L9pqiycInlIae5FEJPWAkMRO3JFMbIFtjD2Ve4SH2aBcz2aRreGpBQ==
dependencies:
"@hapi/bourne" "^2.0.0"
args "^5.0.1"
chalk "^3.0.0"
dateformat "^3.0.3"
fast-safe-stringify "^2.0.7"
jmespath "^0.15.0"
joycon "^2.2.5"
pump "^3.0.0"
readable-stream "^3.6.0"
split2 "^3.1.1"
strip-json-comments "^3.0.1"
pino-std-serializers@^2.4.0, pino-std-serializers@^2.4.2:
version "2.4.2"
resolved "https://registry.yarnpkg.com/pino-std-serializers/-/pino-std-serializers-2.4.2.tgz#cb5e3e58c358b26f88969d7e619ae54bdfcc1ae1"
integrity sha512-WaL504dO8eGs+vrK+j4BuQQq6GLKeCCcHaMB2ItygzVURcL1CycwNEUHTD/lHFHs/NL5qAz2UKrjYWXKSf4aMQ==
pino@^6.0.0:
version "6.2.1"
resolved "https://registry.yarnpkg.com/pino/-/pino-6.2.1.tgz#d2b86306b3998e8f6bb33bdf23910d418ed696cf"
integrity sha512-5F5A+G25Ex2rMOBEe3XYGyLSF4dikQZsFvPojwsqnDBX+rfg7+kw9s5i7pHuVAJImekjwb+MR9jQyHWPLENlvQ==
dependencies:
fast-redact "^2.0.0"
fast-safe-stringify "^2.0.7"
flatstr "^1.0.12"
pino-std-serializers "^2.4.2"
quick-format-unescaped "^4.0.1"
sonic-boom "^1.0.0"
pirates@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.1.tgz#643a92caf894566f91b2b986d2c66950a8e2fb87"
@ -5010,6 +5112,11 @@ pump@^3.0.0:
end-of-stream "^1.1.0"
once "^1.3.1"
punycode@^1.3.2:
version "1.4.1"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e"
integrity sha1-wNWmOycYgArY4esPpSachN1BhF4=
punycode@^2.1.0, punycode@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
@ -5037,6 +5144,11 @@ qs@~6.5.2:
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36"
integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==
quick-format-unescaped@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/quick-format-unescaped/-/quick-format-unescaped-4.0.1.tgz#437a5ea1a0b61deb7605f8ab6a8fd3858dbeb701"
integrity sha512-RyYpQ6Q5/drsJyOhrWHYMWTedvjTIat+FTwv0K4yoUxzvekw2aRHMQJLlnvt8UantkZg2++bEzD9EdxXqkWf4A==
raw-body@^2.2.0:
version "2.4.1"
resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.4.1.tgz#30ac82f98bb5ae8c152e67149dac8d55153b168c"
@ -5119,7 +5231,7 @@ readable-stream@1.0.33:
isarray "0.0.1"
string_decoder "~0.10.x"
"readable-stream@2 || 3", readable-stream@^3.1.1, readable-stream@^3.4.0:
"readable-stream@2 || 3", readable-stream@^3.0.0, readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198"
integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==
@ -5580,6 +5692,14 @@ snapdragon@^0.8.1:
source-map-resolve "^0.5.0"
use "^3.1.0"
sonic-boom@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/sonic-boom/-/sonic-boom-1.0.1.tgz#a5fdfcab1ddea31732ce9c7c054f3a5751eee089"
integrity sha512-o9tx+bonVEXSaPtptyXQXpP8l6UV9Bi3im2geZskvWw2a/o/hrbWI7EBbbv+rOx6Hubnzun9GgH4WfbgEA3MFQ==
dependencies:
atomic-sleep "^1.0.0"
flatstr "^1.0.12"
source-map-resolve@^0.5.0:
version "0.5.3"
resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.3.tgz#190866bece7553e1f8f267a2ee82c606b5509a1a"
@ -5674,6 +5794,13 @@ split-string@^3.0.1, split-string@^3.0.2:
dependencies:
extend-shallow "^3.0.0"
split2@^3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/split2/-/split2-3.1.1.tgz#c51f18f3e06a8c4469aaab487687d8d956160bb6"
integrity sha512-emNzr1s7ruq4N+1993yht631/JH+jaj0NYBosuKmLcq+JkGQ9MmTw1RB1fGaTCzUuseRIClrlSLHRNYGwWQ58Q==
dependencies:
readable-stream "^3.0.0"
sprintf-js@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.1.2.tgz#da1765262bf8c0f571749f2ad6c26300207ae673"

View File

@ -41,4 +41,4 @@ A work in progress, lives here: https://docs.budibase.com
## Contributing
Contributers, see [CONTRIBUTING.md](./CONTRIBUTING.md)
Contributors, see [CONTRIBUTING.md](./CONTRIBUTING.md)