mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Moved serve-public-file mw into site app
- Moved serve-public-file 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
be71dfebe5
commit
61633d48ee
5 changed files with 10 additions and 13 deletions
|
@ -55,10 +55,6 @@ module.exports = {
|
|||
return require('./request-id');
|
||||
},
|
||||
|
||||
get servePublicFile() {
|
||||
return require('./serve-public-file');
|
||||
},
|
||||
|
||||
get uncapitalise() {
|
||||
return require('./uncapitalise');
|
||||
},
|
||||
|
|
|
@ -110,22 +110,22 @@ module.exports = function setupSiteApp(options = {}) {
|
|||
|
||||
// /public/members.js
|
||||
siteApp.get('/public/members.js', shared.middlewares.labs.members,
|
||||
shared.middlewares.servePublicFile('public/members.js', 'application/javascript', constants.ONE_YEAR_S));
|
||||
mw.servePublicFile('public/members.js', 'application/javascript', constants.ONE_YEAR_S));
|
||||
|
||||
// /public/members.min.js
|
||||
siteApp.get('/public/members.min.js', shared.middlewares.labs.members,
|
||||
shared.middlewares.servePublicFile('public/members.min.js', 'application/javascript', constants.ONE_YEAR_S));
|
||||
mw.servePublicFile('public/members.min.js', 'application/javascript', constants.ONE_YEAR_S));
|
||||
|
||||
// Serve sitemap.xsl file
|
||||
siteApp.use(shared.middlewares.servePublicFile('sitemap.xsl', 'text/xsl', constants.ONE_DAY_S));
|
||||
siteApp.use(mw.servePublicFile('sitemap.xsl', 'text/xsl', constants.ONE_DAY_S));
|
||||
|
||||
// Serve stylesheets for default templates
|
||||
siteApp.use(shared.middlewares.servePublicFile('public/ghost.css', 'text/css', constants.ONE_HOUR_S));
|
||||
siteApp.use(shared.middlewares.servePublicFile('public/ghost.min.css', 'text/css', constants.ONE_YEAR_S));
|
||||
siteApp.use(mw.servePublicFile('public/ghost.css', 'text/css', constants.ONE_HOUR_S));
|
||||
siteApp.use(mw.servePublicFile('public/ghost.min.css', 'text/css', constants.ONE_YEAR_S));
|
||||
|
||||
// Serve images for default templates
|
||||
siteApp.use(shared.middlewares.servePublicFile('public/404-ghost@2x.png', 'image/png', constants.ONE_HOUR_S));
|
||||
siteApp.use(shared.middlewares.servePublicFile('public/404-ghost.png', 'image/png', constants.ONE_HOUR_S));
|
||||
siteApp.use(mw.servePublicFile('public/404-ghost@2x.png', 'image/png', constants.ONE_HOUR_S));
|
||||
siteApp.use(mw.servePublicFile('public/404-ghost.png', 'image/png', constants.ONE_HOUR_S));
|
||||
|
||||
// Serve blog images using the storage adapter
|
||||
siteApp.use(STATIC_IMAGE_URL_PREFIX, mw.handleImageSizes, storage.getStorage().serve());
|
||||
|
@ -158,7 +158,7 @@ module.exports = function setupSiteApp(options = {}) {
|
|||
debug('Static content done');
|
||||
|
||||
// Serve robots.txt if not found in theme
|
||||
siteApp.use(shared.middlewares.servePublicFile('robots.txt', 'text/plain', constants.ONE_HOUR_S));
|
||||
siteApp.use(mw.servePublicFile('robots.txt', 'text/plain', constants.ONE_HOUR_S));
|
||||
|
||||
// setup middleware for internal apps
|
||||
// @TODO: refactor this to be a proper app middleware hook for internal apps
|
||||
|
|
|
@ -2,5 +2,6 @@ module.exports = {
|
|||
adminRedirects: require('./admin-redirects'),
|
||||
handleImageSizes: require('./handle-image-sizes'),
|
||||
serveFavicon: require('./serve-favicon'),
|
||||
servePublicFile: require('./serve-public-file'),
|
||||
staticTheme: require('./static-theme')
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
var should = require('should'),
|
||||
sinon = require('sinon'),
|
||||
fs = require('fs-extra'),
|
||||
servePublicFile = require('../../../../core/server/web/shared/middlewares/serve-public-file');
|
||||
servePublicFile = require('../../../../../core/server/web/site/middleware/serve-public-file');
|
||||
|
||||
describe('servePublicFile', function () {
|
||||
var res, req, next;
|
Loading…
Add table
Reference in a new issue