Expose 'install-dompurify' and 'install-colorbox'
This commit exposes the install dompurify and install colorbox javascript libraries via the browser.
This commit is contained in:
parent
b2231f6307
commit
0ab8d3a4e4
9 changed files with 179 additions and 88 deletions
|
|
@ -1,6 +1,15 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "=> Setting up filesystem permissions"
|
||||
chmod 777 /var/www/data/project/web/sites/default/
|
||||
trap "chmod 755 /var/www/data/project/web/sites/default/" EXIT
|
||||
|
||||
echo "=> Creating 'sites/default/libraries/colorbox/' directory"
|
||||
mkdir -p /var/www/data/project/web/sites/default/libraries/colorbox
|
||||
|
||||
echo "=> Downloading 'jquery.colorbox-min.js' and 'LICENSE.md'"
|
||||
curl -L https://raw.githubusercontent.com/jackmoore/colorbox/master/LICENSE.md -o /var/www/data/project/web/sites/default/libraries/colorbox/LICENSE.md
|
||||
curl -L https://raw.githubusercontent.com/jackmoore/colorbox/master/jquery.colorbox-min.js -o /var/www/data/project/web/sites/default/libraries/colorbox/jquery.colorbox-min.js
|
||||
|
||||
echo "=> Done"
|
||||
|
|
@ -1,5 +1,11 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
mkdir -p /var/www/data/project/web/libraries/DOMPurify/dist/
|
||||
curl -L https://raw.githubusercontent.com/cure53/DOMPurify/main/dist/purify.min.js -o /var/www/data/project/web/libraries/DOMPurify/dist/purify.min.js
|
||||
echo "=> Creating 'sites/default/libraries/dompurity/dist/' directory"
|
||||
mkdir -p /var/www/data/project/web/libraries/dompurity/dist/
|
||||
|
||||
echo "=> Downloading 'purify.min.js' and 'LICENSE'"
|
||||
curl -L https://raw.githubusercontent.com/cure53/DOMPurify/main/dist/purify.min.js -o /var/www/data/project/web/libraries/DOMPurify/dist/purify.min.js
|
||||
curl -L https://raw.githubusercontent.com/cure53/DOMPurify/main/LICENSE -o /var/www/data/project/web/libraries/DOMPurify/LICENSE
|
||||
|
||||
echo "=> Done"
|
||||
|
|
@ -45,6 +45,17 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="pure-u-1">
|
||||
<h2 id="info">Drupal Utilities</h2>
|
||||
</div>
|
||||
|
||||
<div class="pure-u-1">
|
||||
<button class="remote-action pure-button pure-button-action" data-action="install-colorbox-js" data-param="{{ .Instance.Slug }}" data-buffer="1000" data-force-reload>Install Colorbox JavaScript</button>
|
||||
<button class="remote-action pure-button pure-button-action" data-action="install-dompurify-js" data-param="{{ .Instance.Slug }}" data-buffer="1000" data-force-reload>Install DOMPurify JavaScript</button>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="pure-u-1">
|
||||
<h2 id="requirements">Status Report</h2>
|
||||
<p>
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ func (admin *Admin) instanceTabs(slug string, active string) templating.FlagFunc
|
|||
{Title: "Overview", Path: template.URL("/admin/instance/" + slug), Active: active == "overview"},
|
||||
{Title: "Rebuild", Path: template.URL("/admin/instance/" + slug + "/rebuild"), Active: active == "rebuild"},
|
||||
{Title: "Users & Grants", Path: template.URL("/admin/instance/" + slug + "/users"), Active: active == "users"},
|
||||
{Title: "Drupal Status", Path: template.URL("/admin/instance/" + slug + "/drupal"), Active: active == "drupal"},
|
||||
{Title: "Drupal", Path: template.URL("/admin/instance/" + slug + "/drupal"), Active: active == "drupal"},
|
||||
{Title: "WissKI Data", Path: template.URL("/admin/instance/" + slug + "/data"), Active: active == "data"},
|
||||
{Title: "WissKI Stats", Path: template.URL("/admin/instance/" + slug + "/stats"), Active: active == "stats"},
|
||||
{Title: "SSH", Path: template.URL("/admin/instance/" + slug + "/ssh"), Active: active == "ssh"},
|
||||
|
|
|
|||
|
|
@ -91,8 +91,8 @@ func (admin *Admin) instanceDrupal(ctx context.Context) http.Handler {
|
|||
|
||||
return ctx, []templating.FlagFunc{
|
||||
templating.ReplaceCrumb(menuInstance, component.MenuItem{Title: "Instance", Path: template.URL("/admin/instance/" + ctx.Instance.Slug)}),
|
||||
templating.ReplaceCrumb(menuDrupal, component.MenuItem{Title: "Drupal Status", Path: template.URL("/admin/instance/" + ctx.Instance.Slug + "/drupal")}),
|
||||
templating.Title(ctx.Instance.Slug + " - Drupal Status"),
|
||||
templating.ReplaceCrumb(menuDrupal, component.MenuItem{Title: "Drupal", Path: template.URL("/admin/instance/" + ctx.Instance.Slug + "/drupal")}),
|
||||
templating.Title(ctx.Instance.Slug + " - Drupal"),
|
||||
admin.instanceTabs(slug, "drupal"),
|
||||
}, nil
|
||||
})
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
package actions
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/auth/scopes"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/wisski"
|
||||
"github.com/tkw1536/pkglib/stream"
|
||||
)
|
||||
|
||||
// installing additional javascript libraries
|
||||
|
||||
type InstallColorboxJS struct {
|
||||
component.Base
|
||||
}
|
||||
|
||||
var (
|
||||
_ WebsocketInstanceAction = (*InstallColorboxJS)(nil)
|
||||
)
|
||||
|
||||
func (*InstallColorboxJS) Action() InstanceAction {
|
||||
return InstanceAction{
|
||||
Action: Action{
|
||||
Name: "install-colorbox-js",
|
||||
Scope: scopes.ScopeUserAdmin,
|
||||
NumParams: 0,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (*InstallColorboxJS) Act(ctx context.Context, instance *wisski.WissKI, in io.Reader, out io.Writer, params ...string) error {
|
||||
return instance.Barrel().Shell(ctx, stream.NewIOStream(out, out, nil), "/runtime/install_colorbox.sh")
|
||||
}
|
||||
|
||||
type InstallDompurifyJS struct {
|
||||
component.Base
|
||||
}
|
||||
|
||||
var (
|
||||
_ WebsocketInstanceAction = (*InstallDompurifyJS)(nil)
|
||||
)
|
||||
|
||||
func (*InstallDompurifyJS) Action() InstanceAction {
|
||||
return InstanceAction{
|
||||
Action: Action{
|
||||
Name: "install-dompurify-js",
|
||||
Scope: scopes.ScopeUserAdmin,
|
||||
NumParams: 0,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (*InstallDompurifyJS) Act(ctx context.Context, instance *wisski.WissKI, in io.Reader, out io.Writer, params ...string) error {
|
||||
return instance.Barrel().Shell(ctx, stream.NewIOStream(out, out, nil), "/runtime/install_dompurify.sh")
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue