From da78e235dd106568b9bcdad96408023f9d563fc9 Mon Sep 17 00:00:00 2001 From: Naz Date: Fri, 3 Mar 2023 14:10:30 +0800 Subject: [PATCH] Added media inliner service scaffolding refs https://github.com/TryGhost/Toolbox/issues/524 - This is groundwork to build up on when adding media inlining functionality. This service will be used by the API to trigger post's content processing and media inlining. --- ghost/core/core/boot.js | 4 +++- .../server/services/media-inliner/service.js | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 ghost/core/core/server/services/media-inliner/service.js diff --git a/ghost/core/core/boot.js b/ghost/core/core/boot.js index 504eb66f67..258bcfea19 100644 --- a/ghost/core/core/boot.js +++ b/ghost/core/core/boot.js @@ -310,6 +310,7 @@ async function initServices({config}) { const tagsPublic = require('./server/services/tags-public'); const postsPublic = require('./server/services/posts-public'); const slackNotifications = require('./server/services/slack-notifications'); + const mediaInliner = require('./server/services/media-inliner'); const urlUtils = require('./shared/url-utils'); @@ -346,7 +347,8 @@ async function initServices({config}) { comments.init(), linkTracking.init(), emailSuppressionList.init(), - slackNotifications.init() + slackNotifications.init(), + mediaInliner.init() ]); debug('End: Services'); diff --git a/ghost/core/core/server/services/media-inliner/service.js b/ghost/core/core/server/services/media-inliner/service.js new file mode 100644 index 0000000000..e30571cb93 --- /dev/null +++ b/ghost/core/core/server/services/media-inliner/service.js @@ -0,0 +1,16 @@ +module.exports = { + async init() { + const debug = require('@tryghost/debug')('mediaInliner'); + + this.api = { + // @NOTE: the inlining should become an offloaded job + // startMediaInliner: mediaInliner.inlineMedia + startMediaInliner: () => { + debug('[Inliner] Starting media inlining job'); + return { + status: 'success' + }; + } + }; + } +};