mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 05:37:34 +03:00
Moved normalize image mw into api app
- Moved normalize image mw from shared to api as it is not shared (except within the API) - This file is only used in one part of the app, 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
d0a16112f5
commit
f4f61b8a3a
@ -196,7 +196,7 @@ module.exports = function apiRoutes() {
|
||||
mw.authAdminApi,
|
||||
apiMw.upload.single('file'),
|
||||
apiMw.upload.validation({type: 'images'}),
|
||||
shared.middlewares.image.normalize,
|
||||
apiMw.normalizeImage,
|
||||
http(apiCanary.images.upload)
|
||||
);
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
module.exports = {
|
||||
cors: require('./cors'),
|
||||
normalizeImage: require('./normalize-image'),
|
||||
updateUserLastSeen: require('./update-user-last-seen'),
|
||||
upload: require('./upload'),
|
||||
versionMatch: require('./version-match')
|
||||
|
@ -1,6 +1,6 @@
|
||||
const cloneDeep = require('lodash/cloneDeep');
|
||||
const config = require('../../../../config');
|
||||
const {logging} = require('../../../../lib/common');
|
||||
const config = require('../../../config');
|
||||
const {logging} = require('../../../lib/common');
|
||||
const imageTransform = require('@tryghost/image-transform');
|
||||
|
||||
module.exports = function normalize(req, res, next) {
|
@ -166,7 +166,7 @@ module.exports = function apiRoutes() {
|
||||
mw.authAdminApi,
|
||||
apiMw.upload.single('file'),
|
||||
apiMw.upload.validation({type: 'images'}),
|
||||
shared.middlewares.image.normalize,
|
||||
apiMw.normalizeImage,
|
||||
http(apiv2.images.upload)
|
||||
);
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
module.exports = {
|
||||
get normalize() {
|
||||
return require('./normalize');
|
||||
}
|
||||
};
|
@ -3,10 +3,6 @@ module.exports = {
|
||||
return require('./api');
|
||||
},
|
||||
|
||||
get image() {
|
||||
return require('./image');
|
||||
},
|
||||
|
||||
get brute() {
|
||||
return require('./brute');
|
||||
},
|
||||
|
@ -3,7 +3,7 @@ const sinon = require('sinon');
|
||||
const configUtils = require('../../../../utils/configUtils');
|
||||
const imageTransform = require('@tryghost/image-transform');
|
||||
const {logging} = require('../../../../../core/server/lib/common');
|
||||
const normalize = require('../../../../../core/server/web/shared/middlewares/image/normalize');
|
||||
const normalize = require('../../../../../core/server/web/api/middleware/normalize-image');
|
||||
|
||||
describe('normalize', function () {
|
||||
let res, req;
|
Loading…
Reference in New Issue
Block a user