mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-24 06:35:49 +03:00
Wired up link-redirects to Ghost services & web server
refs https://github.com/TryGhost/Team/issues/1887
This commit is contained in:
parent
160a0f881e
commit
ae281eb226
@ -156,9 +156,14 @@ async function initServicesForFrontend({bootLogger}) {
|
||||
|
||||
debug('Begin: Redirects');
|
||||
const customRedirects = require('./server/services/custom-redirects');
|
||||
await customRedirects.init(),
|
||||
await customRedirects.init();
|
||||
debug('End: Redirects');
|
||||
|
||||
debug('Begin: Link Redirects');
|
||||
const linkRedirects = require('./server/services/link-redirection');
|
||||
await linkRedirects.init();
|
||||
debug('End: Link Redirects');
|
||||
|
||||
debug('Begin: Themes');
|
||||
// customThemSettingsService.api must be initialized before any theme activation occurs
|
||||
const customThemeSettingsService = require('./server/services/custom-theme-settings');
|
||||
|
@ -15,6 +15,7 @@ const themeMiddleware = themeEngine.middleware;
|
||||
const membersService = require('../../server/services/members');
|
||||
const offersService = require('../../server/services/offers');
|
||||
const customRedirects = require('../../server/services/custom-redirects');
|
||||
const linkRedirects = require('../../server/services/link-redirection');
|
||||
const siteRoutes = require('./routes');
|
||||
const shared = require('../../server/web/shared');
|
||||
const errorHandler = require('@tryghost/mw-error-handler');
|
||||
@ -49,6 +50,8 @@ module.exports = function setupSiteApp(routerConfig) {
|
||||
|
||||
siteApp.use(offersService.middleware);
|
||||
|
||||
siteApp.use(linkRedirects.service.handleRequest);
|
||||
|
||||
// you can extend Ghost with a custom redirects file
|
||||
// see https://github.com/TryGhost/Ghost/issues/7707
|
||||
siteApp.use(customRedirects.middleware);
|
||||
|
16
ghost/core/core/server/services/link-redirection/index.js
Normal file
16
ghost/core/core/server/services/link-redirection/index.js
Normal file
@ -0,0 +1,16 @@
|
||||
class LinkRedirectsServiceWrapper {
|
||||
async init() {
|
||||
if (this.service) {
|
||||
// Already done
|
||||
return;
|
||||
}
|
||||
|
||||
// Wire up all the dependencies
|
||||
const {LinkRedirectsService} = require('@tryghost/link-redirects');
|
||||
|
||||
// Expose the service
|
||||
this.service = new LinkRedirectsService();
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = new LinkRedirectsServiceWrapper();
|
@ -81,6 +81,7 @@
|
||||
"@tryghost/kg-default-cards": "5.18.0",
|
||||
"@tryghost/kg-mobiledoc-html-renderer": "5.3.7",
|
||||
"@tryghost/limit-service": "1.2.3",
|
||||
"@tryghost/link-redirects": "0.0.0",
|
||||
"@tryghost/logging": "2.3.0",
|
||||
"@tryghost/magic-link": "0.0.0",
|
||||
"@tryghost/mailgun-client": "0.0.0",
|
||||
|
Loading…
Reference in New Issue
Block a user