mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 22:43:30 +03:00
6e53527666
refs https://github.com/TryGhost/Ghost/commit/da152a0a1 The cleanup of the Offers labs flag inadvertently removed this logic.
35 lines
1003 B
JavaScript
35 lines
1003 B
JavaScript
const DynamicRedirectManager = require('@tryghost/express-dynamic-redirects');
|
|
const OffersModule = require('@tryghost/members-offers');
|
|
|
|
const stripeService = require('../stripe');
|
|
|
|
const config = require('../../../shared/config');
|
|
const urlUtils = require('../../../shared/url-utils');
|
|
const models = require('../../models');
|
|
|
|
const redirectManager = new DynamicRedirectManager({
|
|
permanentMaxAge: config.get('caching:customRedirects:maxAge'),
|
|
getSubdirectoryURL: (pathname) => {
|
|
return urlUtils.urlJoin(urlUtils.getSubdir(), pathname);
|
|
}
|
|
});
|
|
|
|
module.exports = {
|
|
async init() {
|
|
const offersModule = OffersModule.create({
|
|
OfferModel: models.Offer,
|
|
OfferRedemptionModel: models.OfferRedemption,
|
|
redirectManager: redirectManager,
|
|
stripeAPIService: stripeService.api
|
|
});
|
|
|
|
this.api = offersModule.api;
|
|
|
|
await offersModule.init();
|
|
},
|
|
|
|
api: null,
|
|
|
|
middleware: redirectManager.handleRequest
|
|
};
|