mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05: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
10 changed files with 10 additions and 10 deletions
|
@ -155,7 +155,7 @@ async function initServicesForFrontend({bootLogger}) {
|
||||||
debug('End: Routing Settings');
|
debug('End: Routing Settings');
|
||||||
|
|
||||||
debug('Begin: Redirects');
|
debug('Begin: Redirects');
|
||||||
const customRedirects = require('./server/services/redirects');
|
const customRedirects = require('./server/services/custom-redirects');
|
||||||
await customRedirects.init(),
|
await customRedirects.init(),
|
||||||
debug('End: Redirects');
|
debug('End: Redirects');
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ const themeEngine = require('../services/theme-engine');
|
||||||
const themeMiddleware = themeEngine.middleware;
|
const themeMiddleware = themeEngine.middleware;
|
||||||
const membersService = require('../../server/services/members');
|
const membersService = require('../../server/services/members');
|
||||||
const offersService = require('../../server/services/offers');
|
const offersService = require('../../server/services/offers');
|
||||||
const customRedirects = require('../../server/services/redirects');
|
const customRedirects = require('../../server/services/custom-redirects');
|
||||||
const siteRoutes = require('./routes');
|
const siteRoutes = require('./routes');
|
||||||
const shared = require('../../server/web/shared');
|
const shared = require('../../server/web/shared');
|
||||||
const errorHandler = require('@tryghost/mw-error-handler');
|
const errorHandler = require('@tryghost/mw-error-handler');
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
const redirects = require('../../services/redirects');
|
const customRedirects = require('../../services/custom-redirects');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
docName: 'redirects',
|
docName: 'redirects',
|
||||||
|
@ -10,7 +10,7 @@ module.exports = {
|
||||||
disposition: {
|
disposition: {
|
||||||
type: 'file',
|
type: 'file',
|
||||||
value() {
|
value() {
|
||||||
return redirects.api.getRedirectsFilePath()
|
return customRedirects.api.getRedirectsFilePath()
|
||||||
.then((filePath) => {
|
.then((filePath) => {
|
||||||
// @deprecated: .json was deprecated in v4.0 but is still the default for backwards compat
|
// @deprecated: .json was deprecated in v4.0 but is still the default for backwards compat
|
||||||
return filePath === null || path.extname(filePath) === '.json'
|
return filePath === null || path.extname(filePath) === '.json'
|
||||||
|
@ -23,13 +23,13 @@ module.exports = {
|
||||||
permissions: true,
|
permissions: true,
|
||||||
response: {
|
response: {
|
||||||
async format() {
|
async format() {
|
||||||
const filePath = await redirects.api.getRedirectsFilePath();
|
const filePath = await customRedirects.api.getRedirectsFilePath();
|
||||||
|
|
||||||
return filePath === null || path.extname(filePath) === '.json' ? 'json' : 'plain';
|
return filePath === null || path.extname(filePath) === '.json' ? 'json' : 'plain';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
query() {
|
query() {
|
||||||
return redirects.api.get();
|
return customRedirects.api.get();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ module.exports = {
|
||||||
cacheInvalidate: true
|
cacheInvalidate: true
|
||||||
},
|
},
|
||||||
query(frame) {
|
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 fs = require('fs-extra');
|
||||||
|
|
||||||
const logging = require('@tryghost/logging');
|
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 () {
|
describe('UNIT: redirects CustomRedirectsAPI class', function () {
|
||||||
let customRedirectsAPI;
|
let customRedirectsAPI;
|
|
@ -1,6 +1,6 @@
|
||||||
const should = require('should');
|
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 () {
|
describe('UNIT: custom redirects validation', function () {
|
||||||
it('passes validation for a valid redirects config', 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 routeSettingsService = require('../../core/server/services/route-settings');
|
||||||
const themeService = require('../../core/server/services/themes');
|
const themeService = require('../../core/server/services/themes');
|
||||||
const limits = require('../../core/server/services/limits');
|
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
|
// Other Test Utilities
|
||||||
const configUtils = require('./configUtils');
|
const configUtils = require('./configUtils');
|
||||||
|
|
Loading…
Add table
Reference in a new issue