mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 14:03:48 +03:00
Renamed redirects
to custom-redirects
We're going to be adding more redirection logic into Ghost and it's going to get confusing if we have names this generic. This makes it clear which feature this service is related to. Ideally in the future we can combine all of these into one redirects service, but for now we will be running a specific service per feature
This commit is contained in:
parent
57f2b64bf2
commit
4726742673
@ -155,7 +155,7 @@ async function initServicesForFrontend({bootLogger}) {
|
||||
debug('End: Routing Settings');
|
||||
|
||||
debug('Begin: Redirects');
|
||||
const customRedirects = require('./server/services/redirects');
|
||||
const customRedirects = require('./server/services/custom-redirects');
|
||||
await customRedirects.init(),
|
||||
debug('End: Redirects');
|
||||
|
||||
|
@ -14,7 +14,7 @@ const themeEngine = require('../services/theme-engine');
|
||||
const themeMiddleware = themeEngine.middleware;
|
||||
const membersService = require('../../server/services/members');
|
||||
const offersService = require('../../server/services/offers');
|
||||
const customRedirects = require('../../server/services/redirects');
|
||||
const customRedirects = require('../../server/services/custom-redirects');
|
||||
const siteRoutes = require('./routes');
|
||||
const shared = require('../../server/web/shared');
|
||||
const errorHandler = require('@tryghost/mw-error-handler');
|
||||
|
@ -1,6 +1,6 @@
|
||||
const path = require('path');
|
||||
|
||||
const redirects = require('../../services/redirects');
|
||||
const customRedirects = require('../../services/custom-redirects');
|
||||
|
||||
module.exports = {
|
||||
docName: 'redirects',
|
||||
@ -10,7 +10,7 @@ module.exports = {
|
||||
disposition: {
|
||||
type: 'file',
|
||||
value() {
|
||||
return redirects.api.getRedirectsFilePath()
|
||||
return customRedirects.api.getRedirectsFilePath()
|
||||
.then((filePath) => {
|
||||
// @deprecated: .json was deprecated in v4.0 but is still the default for backwards compat
|
||||
return filePath === null || path.extname(filePath) === '.json'
|
||||
@ -23,13 +23,13 @@ module.exports = {
|
||||
permissions: true,
|
||||
response: {
|
||||
async format() {
|
||||
const filePath = await redirects.api.getRedirectsFilePath();
|
||||
const filePath = await customRedirects.api.getRedirectsFilePath();
|
||||
|
||||
return filePath === null || path.extname(filePath) === '.json' ? 'json' : 'plain';
|
||||
}
|
||||
},
|
||||
query() {
|
||||
return redirects.api.get();
|
||||
return customRedirects.api.get();
|
||||
}
|
||||
},
|
||||
|
||||
@ -39,7 +39,7 @@ module.exports = {
|
||||
cacheInvalidate: true
|
||||
},
|
||||
query(frame) {
|
||||
return redirects.api.setFromFilePath(frame.file.path, frame.file.ext);
|
||||
return customRedirects.api.setFromFilePath(frame.file.path, frame.file.ext);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -4,7 +4,7 @@ const path = require('path');
|
||||
const fs = require('fs-extra');
|
||||
|
||||
const logging = require('@tryghost/logging');
|
||||
const CustomRedirectsAPI = require('../../../../../core/server/services/redirects/api');
|
||||
const CustomRedirectsAPI = require('../../../../../core/server/services/custom-redirects/api');
|
||||
|
||||
describe('UNIT: redirects CustomRedirectsAPI class', function () {
|
||||
let customRedirectsAPI;
|
@ -1,6 +1,6 @@
|
||||
const should = require('should');
|
||||
|
||||
const {validate} = require('../../../../../core/server/services/redirects/validation');
|
||||
const {validate} = require('../../../../../core/server/services/custom-redirects/validation');
|
||||
|
||||
describe('UNIT: custom redirects validation', function () {
|
||||
it('passes validation for a valid redirects config', function () {
|
@ -19,7 +19,7 @@ const settingsService = require('../../core/server/services/settings/settings-se
|
||||
const routeSettingsService = require('../../core/server/services/route-settings');
|
||||
const themeService = require('../../core/server/services/themes');
|
||||
const limits = require('../../core/server/services/limits');
|
||||
const customRedirectsService = require('../../core/server/services/redirects');
|
||||
const customRedirectsService = require('../../core/server/services/custom-redirects');
|
||||
|
||||
// Other Test Utilities
|
||||
const configUtils = require('./configUtils');
|
||||
|
Loading…
Reference in New Issue
Block a user