mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Added static file handling to the frontend
refs https://github.com/TryGhost/Toolbox/issues/114 - Static files uploaded through the Admin Files API should be accessible throught the world under `/content/files/` - Note the feature is behind an alpha "filesAPI" flag, which has to be enabled in the labs first
This commit is contained in:
parent
b7d8d70ccf
commit
be748f2f6d
1 changed files with 3 additions and 0 deletions
|
@ -25,6 +25,7 @@ const labs = require('../../shared/labs');
|
||||||
|
|
||||||
const STATIC_IMAGE_URL_PREFIX = `/${urlUtils.STATIC_IMAGE_URL_PREFIX}`;
|
const STATIC_IMAGE_URL_PREFIX = `/${urlUtils.STATIC_IMAGE_URL_PREFIX}`;
|
||||||
const STATIC_MEDIA_URL_PREFIX = `/${constants.STATIC_MEDIA_URL_PREFIX}`;
|
const STATIC_MEDIA_URL_PREFIX = `/${constants.STATIC_MEDIA_URL_PREFIX}`;
|
||||||
|
const STATIC_FILES_URL_PREFIX = `/${constants.STATIC_FILES_URL_PREFIX}`;
|
||||||
|
|
||||||
let router;
|
let router;
|
||||||
|
|
||||||
|
@ -117,6 +118,8 @@ module.exports = function setupSiteApp(options = {}) {
|
||||||
siteApp.use(STATIC_IMAGE_URL_PREFIX, mw.handleImageSizes, storage.getStorage('images').serve());
|
siteApp.use(STATIC_IMAGE_URL_PREFIX, mw.handleImageSizes, storage.getStorage('images').serve());
|
||||||
// Serve blog media using the storage adapter
|
// Serve blog media using the storage adapter
|
||||||
siteApp.use(STATIC_MEDIA_URL_PREFIX, labs.enabledMiddleware('mediaAPI'), storage.getStorage('media').serve());
|
siteApp.use(STATIC_MEDIA_URL_PREFIX, labs.enabledMiddleware('mediaAPI'), storage.getStorage('media').serve());
|
||||||
|
// Serve blog files using the storage adapter
|
||||||
|
siteApp.use(STATIC_FILES_URL_PREFIX, labs.enabledMiddleware('filesAPI'), storage.getStorage('files').serve());
|
||||||
|
|
||||||
// Global handling for member session, ensures a member is logged in to the frontend
|
// Global handling for member session, ensures a member is logged in to the frontend
|
||||||
siteApp.use(membersService.middleware.loadMemberSession);
|
siteApp.use(membersService.middleware.loadMemberSession);
|
||||||
|
|
Loading…
Reference in a new issue