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:
KernelDeimos
2025-09-09 19:01:27 -04:00
parent a4d1855b70
commit 8e6fba9e66
2 changed files with 7 additions and 1 deletions
+6
View File
@@ -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);
});