@@ -21,7 +21,7 @@ exports = module.exports = {
|
||||
setMemoryLimit: setMemoryLimit,
|
||||
setAutomaticBackup: setAutomaticBackup,
|
||||
setAutomaticUpdate: setAutomaticUpdate,
|
||||
setRobotsTxt: setRobotsTxt,
|
||||
setReverseProxyConfig: setReverseProxyConfig,
|
||||
setCertificate: setCertificate,
|
||||
setDebugMode: setDebugMode,
|
||||
setEnvironment: setEnvironment,
|
||||
@@ -255,13 +255,19 @@ function setAutomaticUpdate(req, res, next) {
|
||||
});
|
||||
}
|
||||
|
||||
function setRobotsTxt(req, res, next) {
|
||||
function setReverseProxyConfig(req, res, next) {
|
||||
assert.strictEqual(typeof req.body, 'object');
|
||||
assert.strictEqual(typeof req.params.id, 'string');
|
||||
|
||||
if (req.body.robotsTxt !== null && typeof req.body.robotsTxt !== 'string') return next(new HttpError(400, 'robotsTxt is not a string'));
|
||||
|
||||
apps.setRobotsTxt(req.params.id, req.body.robotsTxt, auditSource.fromRequest(req), function (error) {
|
||||
if (!Array.isArray(req.body.frameAncestors)) return next(new HttpError(400, 'frameAncestors must be an array'));
|
||||
if (req.body.frameAncestors.some(fa => typeof fa !== 'string')) return next(new HttpError(400, 'frameAncestors array must contain array of strings'));
|
||||
|
||||
if (!Array.isArray(req.body.hideHeaders)) return next(new HttpError(400, 'hideHeaders must be an array'));
|
||||
if (req.body.hideHeaders.some(h => typeof h !== 'string')) return next(new HttpError(400, 'hideHeaders array must contain array of strings'));
|
||||
|
||||
apps.setReverseProxyConfig(req.params.id, req.body, auditSource.fromRequest(req), function (error) {
|
||||
if (error) return next(toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(200, {}));
|
||||
|
||||
Reference in New Issue
Block a user