mirror of
https://github.com/Yonle/bostr.git
synced 2025-03-17 13:22:49 +01:00
add a way to set user agent
Signed-off-by: Yonle <yonle@lecturify.net>
This commit is contained in:
parent
d3c73eb05a
commit
499e765a28
2
http.js
2
http.js
@ -33,7 +33,7 @@ if (!config.relays?.length) (async () => {
|
||||
console.log("Load balancer mode. Fetching relays list from", config.loadbalancer[0].replace(/^ws/, "http"));
|
||||
const request = await undici.request(config.loadbalancer[0].replace(/^ws/, "http"), {
|
||||
headers: {
|
||||
"User-Agent": `Bostr ${version}; The nostr relay bouncer; https://codeberg.org/Yonle/bostr; ${config.server_meta.canonical_url || "No canonical bouncer URL specified"}; Contact: ${config.server_meta.contact}`
|
||||
"User-Agent": config.user_agent
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "bostr",
|
||||
"version": "3.0.10",
|
||||
"version": "3.1.0",
|
||||
"description": "Nostr relay bouncer",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
@ -7,7 +7,7 @@ const WebSocket = require("ws");
|
||||
const { validateEvent, nip19, matchFilters, mergeFilters, getFilterLimit } = require("nostr-tools");
|
||||
const nip42 = require("./nip42.js");
|
||||
|
||||
let { relays, log_about_relays, server_meta, private_keys, reconnect_time, wait_eose, pause_on_limit, max_eose_score, upstream_ratelimit_expiration, max_client_subs, idle_sessions, cache_relays, loadbalancer, max_known_events } = require(process.env.BOSTR_CONFIG_PATH || "./config");
|
||||
let { relays, log_about_relays, server_meta, private_keys, reconnect_time, wait_eose, pause_on_limit, max_eose_score, upstream_ratelimit_expiration, max_client_subs, idle_sessions, cache_relays, loadbalancer, max_known_events, user_agent } = require(process.env.BOSTR_CONFIG_PATH || "./config");
|
||||
|
||||
log_about_relays = process.env.LOG_ABOUT_RELAYS || log_about_relays;
|
||||
loadbalancer = loadbalancer || [];
|
||||
@ -292,7 +292,7 @@ class Session extends WebSocket {
|
||||
if (!stats[addr]) stats[addr] = { raw_rx: 0, rx: 0, tx: 0, f: 0 };
|
||||
super(addr, {
|
||||
headers: {
|
||||
"User-Agent": `Bostr ${version}; The nostr relay bouncer; https://codeberg.org/Yonle/bostr; ConnID: ${id}; ${server_meta.canonical_url || "No canonical bouncer URL specified"}; Contact: ${server_meta.contact}`,
|
||||
"User-Agent": user_agent,
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user