mirror of
https://github.com/Yonle/bostr.git
synced 2025-03-18 05:42:03 +01:00
http&bouncer: connection configured save mode
Signed-off-by: Yonle <yonle@lecturify.net>
This commit is contained in:
parent
7293893ab4
commit
84b0421f4c
@ -38,6 +38,7 @@ module.exports = (ws, req, onClose) => {
|
||||
ws.acceptKinds = query.accept?.split(",").map(_ => parseInt(_));
|
||||
ws.forcedLimit = parseInt(query.limit);
|
||||
ws.accurateMode = parseInt(query.accurate);
|
||||
ws.saveMode = parseInt(query.save);
|
||||
|
||||
if (authorized_keys?.length) {
|
||||
authKey = Date.now() + Math.random().toString(36);
|
||||
@ -268,7 +269,7 @@ function newConn(addr, client, reconn_t = 0) {
|
||||
if (client.events.get(data[1]).size >= limit) {
|
||||
// Once reached to <filter.limit>, send EOSE to client.
|
||||
client.send(JSON.stringify(["EOSE", data[1]]));
|
||||
if (!client.accurateMode && pause_on_limit) {
|
||||
if (!client.accurateMode && (client.saveMode || pause_on_limit)) {
|
||||
client.pause_subs.add(data[1]);
|
||||
} else {
|
||||
client.pendingEOSE.delete(data[1]);
|
||||
|
@ -49,7 +49,7 @@ module.exports = {
|
||||
// Could save client's bandwidth. Disable this if you need to get more events.
|
||||
//
|
||||
// You may also need to adjust <max_eose_score>.
|
||||
pause_on_limit: false,
|
||||
pause_on_limit: true,
|
||||
|
||||
// Maximum of received EOSE from relays to send EOSE to client.
|
||||
// Normally, waiting EOSE from 3 relays should be enough. Leaving it with 0 equals wait for every established relays.
|
||||
|
5
http.js
5
http.js
@ -79,9 +79,12 @@ server.on('request', (req, res) => {
|
||||
res.write(`\n\n- To make connection that override client's REQ limit, Connect:`);
|
||||
res.write(`\n ${serverAddr}?limit=50 or ${serverAddr}?accurate=1&limit=50`);
|
||||
res.write(`\n (Will override REQ limit from client to 50 if exceeds)`);
|
||||
res.write(`\n\n- To connect with accurate bouncing mode, Connect:`);
|
||||
res.write(`\n\n- To connect with accurate bouncing mode${config.pause_on_limit ? "" : " (Default)"}, Connect:`);
|
||||
res.write(`\n ${serverAddr}?accurate=1`);
|
||||
res.write(`\n (Will consume lot of bandwidths)`);
|
||||
res.write(`\n\n- To connect with save mode${config.pause_on_limit ? " (Default)" : ""}, Connect:`);
|
||||
res.write(`\n ${serverAddr}?save=1`);
|
||||
res.write(`\n (Saves bandwidth usage)`);
|
||||
res.end(`\n\n---\nPowered by Bostr (${version}) - Open source Nostr bouncer\nhttps://github.com/Yonle/bostr`);
|
||||
} else if (req.url.includes("favicon") && favicon) {
|
||||
res.writeHead(200, { "Content-Type": "image/" + config.favicon?.split(".").pop() });
|
||||
|
Loading…
x
Reference in New Issue
Block a user