mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-07 03:22:21 +03:00
Moved admin-redirects mw into site app
- Moved admin-redirects from shared to site as it is not shared - This file is only used in one place, this updates the code structure to reflect this - This is one of many similar changes needed to make it easier to refactor to the existing setup
This commit is contained in:
parent
6fd4c65421
commit
c3f4b7a57c
@ -11,10 +11,6 @@ module.exports = {
|
|||||||
return require('./validation');
|
return require('./validation');
|
||||||
},
|
},
|
||||||
|
|
||||||
get adminRedirects() {
|
|
||||||
return require('./admin-redirects');
|
|
||||||
},
|
|
||||||
|
|
||||||
get brute() {
|
get brute() {
|
||||||
return require('./brute');
|
return require('./brute');
|
||||||
},
|
},
|
||||||
|
@ -19,6 +19,7 @@ const membersService = require('../../services/members');
|
|||||||
const membersMiddleware = membersService.middleware;
|
const membersMiddleware = membersService.middleware;
|
||||||
const siteRoutes = require('./routes');
|
const siteRoutes = require('./routes');
|
||||||
const shared = require('../shared');
|
const shared = require('../shared');
|
||||||
|
const mw = require('./middleware');
|
||||||
const sentry = require('../../sentry');
|
const sentry = require('../../sentry');
|
||||||
|
|
||||||
const STATIC_IMAGE_URL_PREFIX = `/${urlUtils.STATIC_IMAGE_URL_PREFIX}`;
|
const STATIC_IMAGE_URL_PREFIX = `/${urlUtils.STATIC_IMAGE_URL_PREFIX}`;
|
||||||
@ -96,7 +97,7 @@ module.exports = function setupSiteApp(options = {}) {
|
|||||||
shared.middlewares.customRedirects.use(siteApp);
|
shared.middlewares.customRedirects.use(siteApp);
|
||||||
|
|
||||||
// More redirects
|
// More redirects
|
||||||
siteApp.use(shared.middlewares.adminRedirects());
|
siteApp.use(mw.adminRedirects());
|
||||||
|
|
||||||
// force SSL if blog url is set to https. The redirects handling must happen before asset and page routing,
|
// force SSL if blog url is set to https. The redirects handling must happen before asset and page routing,
|
||||||
// otherwise we serve assets/pages with http. This can cause mixed content warnings in the admin client.
|
// otherwise we serve assets/pages with http. This can cause mixed content warnings in the admin client.
|
||||||
|
@ -12,6 +12,8 @@ const adminRedirect = (path) => {
|
|||||||
module.exports = function adminRedirects() {
|
module.exports = function adminRedirects() {
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
|
|
||||||
|
console.log('loading admin redirects');
|
||||||
|
|
||||||
if (config.get('admin:redirects')) {
|
if (config.get('admin:redirects')) {
|
||||||
router.get(/^\/ghost\/?$/, adminRedirect('/'));
|
router.get(/^\/ghost\/?$/, adminRedirect('/'));
|
||||||
}
|
}
|
3
core/server/web/site/middleware/index.js
Normal file
3
core/server/web/site/middleware/index.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module.exports = {
|
||||||
|
adminRedirects: require('./admin-redirects')
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user