0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-08 02:52:39 -05:00

Added media inlining button in settings>labs

refs https://github.com/TryGhost/Toolbox/issues/524

- Having a button in Admin UI allows to manually trigger media inlining job once import has been processed.
- Added a "start" button hidden behind labs calling Admin API endpoint that starts external media inlining job.
This commit is contained in:
Naz 2023-03-03 14:41:24 +08:00
parent de87479fb9
commit 901485c47b
No known key found for this signature in database
2 changed files with 30 additions and 0 deletions

View file

@ -150,6 +150,11 @@ export default class LabsController extends Controller {
this.utils.downloadFile(this.ghostPaths.url.api(endpoint));
}
@action
startMediaInlinerAction() {
return this.startMediaInliner.perform();
}
@action
confirmDeleteAll() {
return this.modals.open(DeleteAllModal);
@ -213,6 +218,19 @@ export default class LabsController extends Controller {
return RSVP.resolve();
}
@(task(function*() {
const inlineURL = this.ghostPaths.url.api('db/media/inline');
yield this.ajax.post(inlineURL, {
dataType: 'json',
// @NOTE: the domains list will become input based
data: {
domains: []
}
});
// TODO: notify user the inliner has started
}).drop())
startMediaInliner;
@(task(function* (success) {
this.set('redirectSuccess', success);
this.set('redirectFailure', !success);

View file

@ -31,6 +31,18 @@
</div>
</div>
{{#if this.feature.mediaInliner}}
<div class="gh-expandable-block">
<div class="gh-expandable-header">
<div>
<h4 class="gh-expandable-title">Inline external media</h4>
<p class="gh-expandable-description">Download and inline external media files used in posts.</p>
</div>
<button type="button" class="gh-btn" {{on "click" this.startMediaInlinerAction}}><span>Start</span></button>
</div>
</div>
{{/if}}
<div class="gh-expandable-block">
<div class="gh-expandable-header">
<div>