mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-29 13:52:10 +03:00
Moved route settings to new server service
- The main goal here is getting this settings related code out of the routing service as it really doesn't belong there - This settings file is used purely by the API to get and set files - its not really anything to do with actual routing - This file calls out to the bridge to do a reload, which helps decouple slightly - More refactoring is needed to get rid of the urlService dependency - Note this file is really similar to the redirects one, it would be good to merge them
This commit is contained in:
parent
32a09dc9c6
commit
8612f3aaeb
@ -7,10 +7,6 @@ module.exports = {
|
||||
return require('./registry');
|
||||
},
|
||||
|
||||
get settings() {
|
||||
return require('./settings');
|
||||
},
|
||||
|
||||
get helpers() {
|
||||
return require('./helpers');
|
||||
},
|
||||
|
@ -2,7 +2,7 @@ const Promise = require('bluebird');
|
||||
const _ = require('lodash');
|
||||
const validator = require('@tryghost/validator');
|
||||
const models = require('../../models');
|
||||
const frontendRouting = require('../../../frontend/services/routing');
|
||||
const routeSettings = require('../../services/route-settings');
|
||||
const frontendSettings = require('../../../frontend/services/settings');
|
||||
const i18n = require('../../../shared/i18n');
|
||||
const {BadRequestError, NoPermissionError, NotFoundError} = require('@tryghost/errors');
|
||||
@ -328,7 +328,7 @@ module.exports = {
|
||||
method: 'edit'
|
||||
},
|
||||
async query(frame) {
|
||||
await frontendRouting.settings.setFromFilePath(frame.file.path);
|
||||
await routeSettings.setFromFilePath(frame.file.path);
|
||||
const getRoutesHash = () => frontendSettings.getCurrentHash('routes');
|
||||
await settingsService.syncRoutesHash(getRoutesHash);
|
||||
}
|
||||
@ -348,7 +348,7 @@ module.exports = {
|
||||
method: 'browse'
|
||||
},
|
||||
query() {
|
||||
return frontendRouting.settings.get();
|
||||
return routeSettings.get();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
const Promise = require('bluebird');
|
||||
const _ = require('lodash');
|
||||
const models = require('../../models');
|
||||
const frontendRouting = require('../../../frontend/services/routing');
|
||||
const routeSettings = require('../../services/route-settings');
|
||||
const frontendSettings = require('../../../frontend/services/settings');
|
||||
const i18n = require('../../../shared/i18n');
|
||||
const {NoPermissionError, NotFoundError} = require('@tryghost/errors');
|
||||
@ -168,7 +168,7 @@ module.exports = {
|
||||
method: 'edit'
|
||||
},
|
||||
async query(frame) {
|
||||
await frontendRouting.settings.setFromFilePath(frame.file.path);
|
||||
await routeSettings.setFromFilePath(frame.file.path);
|
||||
const getRoutesHash = () => frontendSettings.getCurrentHash('routes');
|
||||
await settingsService.syncRoutesHash(getRoutesHash);
|
||||
}
|
||||
@ -188,7 +188,7 @@ module.exports = {
|
||||
method: 'browse'
|
||||
},
|
||||
query() {
|
||||
return frontendRouting.settings.get();
|
||||
return routeSettings.get();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -2,7 +2,7 @@ const Promise = require('bluebird');
|
||||
const _ = require('lodash');
|
||||
const validator = require('@tryghost/validator');
|
||||
const models = require('../../models');
|
||||
const frontendRouting = require('../../../frontend/services/routing');
|
||||
const routeSettings = require('../../services/route-settings');
|
||||
const frontendSettings = require('../../../frontend/services/settings');
|
||||
const i18n = require('../../../shared/i18n');
|
||||
const {BadRequestError, NoPermissionError, NotFoundError} = require('@tryghost/errors');
|
||||
@ -313,7 +313,7 @@ module.exports = {
|
||||
method: 'edit'
|
||||
},
|
||||
async query(frame) {
|
||||
await frontendRouting.settings.setFromFilePath(frame.file.path);
|
||||
await routeSettings.settings.setFromFilePath(frame.file.path);
|
||||
const getRoutesHash = () => frontendSettings.getCurrentHash('routes');
|
||||
await settingsService.syncRoutesHash(getRoutesHash);
|
||||
}
|
||||
@ -333,7 +333,7 @@ module.exports = {
|
||||
method: 'browse'
|
||||
},
|
||||
query() {
|
||||
return frontendRouting.settings.get();
|
||||
return routeSettings.settings.get();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
1
core/server/services/route-settings/index.js
Normal file
1
core/server/services/route-settings/index.js
Normal file
@ -0,0 +1 @@
|
||||
module.exports = require('./route-settings');
|
@ -2,9 +2,9 @@ const Promise = require('bluebird');
|
||||
const moment = require('moment-timezone');
|
||||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
const urlService = require('../url');
|
||||
const urlService = require('../../../frontend/services/url');
|
||||
|
||||
const debug = require('@tryghost/debug')('services:frontend:routing:settings');
|
||||
const debug = require('@tryghost/debug')('services:route-settings');
|
||||
const errors = require('@tryghost/errors');
|
||||
const tpl = require('@tryghost/tpl');
|
||||
const config = require('../../../shared/config');
|
Loading…
Reference in New Issue
Block a user