37 lines
1.6 KiB
JavaScript
37 lines
1.6 KiB
JavaScript
// The plugin "gear" on Settings -> Plugins always opens /plugins/configure/<name>,
|
|
// which renders THIS workflow's form (the core configure route has no redirect
|
|
// hook -- server/routes/plugins.js). dev-deploy's real settings live in its own
|
|
// dashboard, so this single step bounces straight there with NO extra click.
|
|
//
|
|
// NOTE: blurb MUST be an ARRAY -- the array path is rendered raw (form.ts join),
|
|
// whereas a string blurb is run through the text() XSS whitelist, which strips
|
|
// <script>/<meta>. CSP allows 'unsafe-inline', so the inline script redirect is
|
|
// the primary path; the <noscript> meta-refresh and the visible button are
|
|
// fallbacks (the link is what shows if script/meta are ever stripped).
|
|
|
|
const Workflow = require("@saltcorn/data/models/workflow");
|
|
const Form = require("@saltcorn/data/models/form");
|
|
|
|
const DASHBOARD_URL = "/admin/dev-deploy/";
|
|
|
|
|
|
const configurationWorkflow = () =>
|
|
new Workflow({
|
|
steps: [
|
|
{
|
|
name: "dev-deploy",
|
|
form: async () =>
|
|
new Form({
|
|
blurb: [
|
|
`<script>window.location.replace(${JSON.stringify(DASHBOARD_URL)});</script>`,
|
|
`<noscript><meta http-equiv="refresh" content="0; url=${DASHBOARD_URL}"></noscript>`,
|
|
`<p>Opening the dev-deploy dashboard… <a class="btn btn-primary" role="button" href="${DASHBOARD_URL}">Open the dev-deploy dashboard</a></p>`,
|
|
],
|
|
fields: []
|
|
})
|
|
}
|
|
]
|
|
});
|
|
|
|
|
|
module.exports = { configurationWorkflow };
|