added plugin validation

This commit is contained in:
NEOLPAR 2022-09-09 11:13:18 +01:00
parent a3b3163ab9
commit 9038bdcd1d
2 changed files with 5 additions and 17 deletions

View File

@ -7,6 +7,7 @@ import {
uploadedFilePlugin, uploadedFilePlugin,
} from "./plugin/utils" } from "./plugin/utils"
import { getGlobalDB } from "@budibase/backend-core/tenancy" import { getGlobalDB } from "@budibase/backend-core/tenancy"
import { validate } from "@budibase/backend-core/plugins"
import { generatePluginID, getPluginParams } from "../../db/utils" import { generatePluginID, getPluginParams } from "../../db/utils"
import { import {
uploadDirectory, uploadDirectory,
@ -80,13 +81,16 @@ export async function create(ctx: any) {
directory = directoryGithub directory = directoryGithub
break break
case "url": case "url":
const headersObj = JSON.parse(headers || null) || {}
const { metadata: metadataUrl, directory: directoryUrl } = const { metadata: metadataUrl, directory: directoryUrl } =
await uploadedUrlPlugin(url, name, headers) await uploadedUrlPlugin(url, name, headersObj)
metadata = metadataUrl metadata = metadataUrl
directory = directoryUrl directory = directoryUrl
break break
} }
validate(metadata?.schema)
const doc = await storePlugin(metadata, directory, source) const doc = await storePlugin(metadata, directory, source)
ctx.body = { ctx.body = {

View File

@ -568,15 +568,6 @@
magic-string "^0.25.7" magic-string "^0.25.7"
resolve "^1.17.0" resolve "^1.17.0"
"@rollup/plugin-inject@^4.0.0":
version "4.0.4"
resolved "https://registry.yarnpkg.com/@rollup/plugin-inject/-/plugin-inject-4.0.4.tgz#fbeee66e9a700782c4f65c8b0edbafe58678fbc2"
integrity sha512-4pbcU4J/nS+zuHk+c+OL3WtmEQhqxlZ9uqfjQMQDOHOPld7PsCd8k5LWs8h5wjwJN7MgnAn768F2sDxEP4eNFQ==
dependencies:
"@rollup/pluginutils" "^3.1.0"
estree-walker "^2.0.1"
magic-string "^0.25.7"
"@rollup/plugin-json@^4.1.0": "@rollup/plugin-json@^4.1.0":
version "4.1.0" version "4.1.0"
resolved "https://registry.yarnpkg.com/@rollup/plugin-json/-/plugin-json-4.1.0.tgz#54e09867ae6963c593844d8bd7a9c718294496f3" resolved "https://registry.yarnpkg.com/@rollup/plugin-json/-/plugin-json-4.1.0.tgz#54e09867ae6963c593844d8bd7a9c718294496f3"
@ -3796,13 +3787,6 @@ rollup-plugin-node-resolve@^5.2.0:
resolve "^1.11.1" resolve "^1.11.1"
rollup-pluginutils "^2.8.1" rollup-pluginutils "^2.8.1"
rollup-plugin-polyfill-node@^0.10.2:
version "0.10.2"
resolved "https://registry.yarnpkg.com/rollup-plugin-polyfill-node/-/rollup-plugin-polyfill-node-0.10.2.tgz#b2128646851fcb9475ddfd5bc22ca1a8c568738d"
integrity sha512-5GMywXiLiuQP6ZzED/LO/Q0HyDi2W6b8VN+Zd3oB0opIjyRs494Me2ZMaqKWDNbGiW4jvvzl6L2n4zRgxS9cSQ==
dependencies:
"@rollup/plugin-inject" "^4.0.0"
rollup-plugin-terser@^7.0.2: rollup-plugin-terser@^7.0.2:
version "7.0.2" version "7.0.2"
resolved "https://registry.yarnpkg.com/rollup-plugin-terser/-/rollup-plugin-terser-7.0.2.tgz#e8fbba4869981b2dc35ae7e8a502d5c6c04d324d" resolved "https://registry.yarnpkg.com/rollup-plugin-terser/-/rollup-plugin-terser-7.0.2.tgz#e8fbba4869981b2dc35ae7e8a502d5c6c04d324d"