mirror of https://github.com/Budibase/budibase.git
committed by
GitHub
18 changed files with 292 additions and 19 deletions
@ -0,0 +1,4 @@ |
|||
module.exports = async (ctx, next) => { |
|||
// Placeholder for audit log middleware
|
|||
return next() |
|||
} |
|||
@ -0,0 +1,70 @@ |
|||
<script> |
|||
import { |
|||
Layout, |
|||
Heading, |
|||
Body, |
|||
Button, |
|||
Divider, |
|||
Label, |
|||
Input, |
|||
Toggle, |
|||
Dropzone, |
|||
notifications, |
|||
} from "@budibase/bbui" |
|||
import { auth, organisation } from "stores/portal" |
|||
import { post, get } from "builderStore/api" |
|||
import analytics from "analytics" |
|||
import { writable } from "svelte/store" |
|||
import { redirect } from "@roxi/routify" |
|||
|
|||
// Only admins allowed here |
|||
$: { |
|||
if (!$auth.isAdmin) { |
|||
$redirect("../../portal") |
|||
} |
|||
} |
|||
|
|||
async function updateBudibase() { |
|||
try { |
|||
notifications.info("Updating budibase..") |
|||
const response = await fetch("/v1/update", { |
|||
headers: { |
|||
Authorization: "Bearer budibase", |
|||
}, |
|||
}) |
|||
notifications.success("Your budibase installation is up to date.") |
|||
} catch (err) { |
|||
notifications.error(`Error installing budibase update ${err}`) |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
{#if $auth.isAdmin} |
|||
<Layout> |
|||
<Layout gap="XS" noPadding> |
|||
<Heading size="M">Update</Heading> |
|||
<Body> |
|||
Keep your budibase installation up to date to take advantage of the |
|||
latest features, security updates and much more. |
|||
</Body> |
|||
</Layout> |
|||
<Divider size="S" /> |
|||
<div class="fields"> |
|||
<div class="field"> |
|||
<Button cta on:click={updateBudibase}>Check For Updates</Button> |
|||
</div> |
|||
</div> |
|||
</Layout> |
|||
{/if} |
|||
|
|||
<style> |
|||
.fields { |
|||
display: grid; |
|||
grid-gap: var(--spacing-m); |
|||
} |
|||
.field { |
|||
display: grid; |
|||
grid-template-columns: 33% 1fr; |
|||
align-items: center; |
|||
} |
|||
</style> |
|||
@ -0,0 +1,62 @@ |
|||
const { execSync } = require("child_process") |
|||
const { processStringSync } = require("@budibase/string-templates") |
|||
|
|||
module.exports.definition = { |
|||
name: "Bash Scripting", |
|||
tagline: "Execute a bash command", |
|||
icon: "ri-terminal-box-line", |
|||
description: "Run a bash script", |
|||
type: "ACTION", |
|||
stepId: "EXECUTE_BASH", |
|||
inputs: {}, |
|||
schema: { |
|||
inputs: { |
|||
properties: { |
|||
code: { |
|||
type: "string", |
|||
customType: "code", |
|||
title: "Code", |
|||
}, |
|||
}, |
|||
required: ["code"], |
|||
}, |
|||
outputs: { |
|||
properties: { |
|||
stdout: { |
|||
type: "string", |
|||
description: "Standard output of your bash command or script.", |
|||
}, |
|||
}, |
|||
}, |
|||
required: ["stdout"], |
|||
}, |
|||
} |
|||
|
|||
module.exports.run = async function ({ inputs, context }) { |
|||
if (inputs.code == null) { |
|||
return { |
|||
stdout: "Budibase bash automation failed: Invalid inputs", |
|||
} |
|||
} |
|||
|
|||
try { |
|||
const command = processStringSync(inputs.code, context) |
|||
|
|||
let stdout |
|||
try { |
|||
stdout = execSync(command, { timeout: 500 }) |
|||
} catch (err) { |
|||
stdout = err.message |
|||
} |
|||
|
|||
return { |
|||
stdout, |
|||
} |
|||
} catch (err) { |
|||
console.error(err) |
|||
return { |
|||
success: false, |
|||
response: err, |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue