bouncer: a feature to override client limit

Signed-off-by: Yonle <yonle@lecturify.net>
This commit is contained in:
Yonle
2024-02-23 13:11:00 +07:00
parent d589c034e2
commit aa2084d6b9
3 changed files with 14 additions and 6 deletions

View File

@@ -36,6 +36,7 @@ module.exports = (ws, req, onClose) => {
ws.pubkey = null;
ws.rejectKinds = query.reject?.split(",").map(_ => parseInt(_));
ws.acceptKinds = query.accept?.split(",").map(_ => parseInt(_));
ws.forcedLimit = parseInt(query.limit);
if (authorized_keys?.length) {
authKey = Date.now() + Math.random().toString(36);
@@ -113,6 +114,9 @@ module.exports = (ws, req, onClose) => {
return true;
});
}
if (filters[fn].limit > ws.forcedLimit)
filters[fn].limit = ws.forcedLimit;
}
if (!ws.relays.size && !sessStarted) {