mirror of
https://github.com/HeyPuter/puter.git
synced 2026-09-24 06:05:40 +00:00
dev: options to disable undesirable checks in dev
Allows disabling abuse checks undefined origin checks with config parameters to make development more convenient. The approach before this change has been to manually comment out these lines of code.
This commit is contained in:
@@ -19,7 +19,13 @@
|
||||
const APIError = require("../api/APIError");
|
||||
const { Context } = require("../util/context");
|
||||
|
||||
const config = puter.core.config;
|
||||
|
||||
const abuse = options => (req, res, next) => {
|
||||
if ( config.disable_abuse_checks ) {
|
||||
next(); return;
|
||||
}
|
||||
|
||||
const requester = Context.get('requester');
|
||||
|
||||
if ( options.no_bots ) {
|
||||
|
||||
@@ -524,7 +524,7 @@ class WebServerService extends BaseService {
|
||||
}
|
||||
|
||||
// rules that don't apply to notification endpoints
|
||||
const undefined_origin_allowed = this.undefined_origin_allowed.some(rule => {
|
||||
const undefined_origin_allowed = config.undefined_origin_allowed || this.undefined_origin_allowed.some(rule => {
|
||||
if ( typeof rule === 'string' ) return rule === req.path;
|
||||
return rule.test(req.path);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user