mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 13:54:35 +03: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
@ -25,6 +25,7 @@ const labs = require('../../shared/labs');
|
||||
|
||||
const STATIC_IMAGE_URL_PREFIX = `/${urlUtils.STATIC_IMAGE_URL_PREFIX}`;
|
||||
const STATIC_MEDIA_URL_PREFIX = `/${constants.STATIC_MEDIA_URL_PREFIX}`;
|
||||
const STATIC_FILES_URL_PREFIX = `/${constants.STATIC_FILES_URL_PREFIX}`;
|
||||
|
||||
let router;
|
||||
|
||||
@ -117,6 +118,8 @@ module.exports = function setupSiteApp(options = {}) {
|
||||
siteApp.use(STATIC_IMAGE_URL_PREFIX, mw.handleImageSizes, storage.getStorage('images').serve());
|
||||
// Serve blog media using the storage adapter
|
||||
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
|
||||
siteApp.use(membersService.middleware.loadMemberSession);
|
||||
|
Loading…
Reference in New Issue
Block a user