mirror of
https://github.com/Yonle/bostr.git
synced 2025-10-06 14:11:03 +02:00
@@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
const { version } = require("./package.json");
|
const { version } = require("./package.json");
|
||||||
|
const { nip19 } = require("nostr-tools")
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const cluster = require("cluster");
|
const cluster = require("cluster");
|
||||||
const argv = process.argv.slice(2);
|
const argv = process.argv.slice(2);
|
||||||
@@ -13,6 +14,7 @@ function showHelp() {
|
|||||||
" makeconf [conffile] - Make config file\n" +
|
" makeconf [conffile] - Make config file\n" +
|
||||||
" start [conffile] - Run bostr with specified config\n" +
|
" start [conffile] - Run bostr with specified config\n" +
|
||||||
" check [conffile] - Check config file\n" +
|
" check [conffile] - Check config file\n" +
|
||||||
|
" hexconverter [nip19] - Convert NIP-19 string to hex\n" +
|
||||||
" help - Show this help text\n\n" +
|
" help - Show this help text\n\n" +
|
||||||
"Software is licensed under BSD-3-Clause\n" +
|
"Software is licensed under BSD-3-Clause\n" +
|
||||||
"https://github.com/Yonle/bostr"
|
"https://github.com/Yonle/bostr"
|
||||||
@@ -68,6 +70,12 @@ switch (argv[0]) {
|
|||||||
process.env.BOSTR_CONFIG_PATH = readPath(argv[1]);
|
process.env.BOSTR_CONFIG_PATH = readPath(argv[1]);
|
||||||
require("./index.js");
|
require("./index.js");
|
||||||
break;
|
break;
|
||||||
|
case "hexconverter":
|
||||||
|
if (!argv[1]) return console.log("Usage: bostr hexconverter [npub|nsec|....] ....");
|
||||||
|
for (const i of argv.slice(1)) {
|
||||||
|
console.log(nip19.decode(i).data);
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if (argv[0] && (argv[0] !== "help")) {
|
if (argv[0] && (argv[0] !== "help")) {
|
||||||
console.error("Unrecognized command:", argv[0]);
|
console.error("Unrecognized command:", argv[0]);
|
||||||
|
@@ -204,7 +204,7 @@ function newConn(addr, client, reconn_t = 0) {
|
|||||||
if (client.readyState !== 1) return;
|
if (client.readyState !== 1) return;
|
||||||
const relay = new WebSocket(addr, {
|
const relay = new WebSocket(addr, {
|
||||||
headers: {
|
headers: {
|
||||||
"User-Agent": `Bostr (v${version}); The nostr relay bouncer; https://github.com/Yonle/bostr`
|
"User-Agent": `Bostr ${version}; The nostr relay bouncer; https://github.com/Yonle/bostr`
|
||||||
},
|
},
|
||||||
noDelay: true,
|
noDelay: true,
|
||||||
allowSynchronousEvents: true
|
allowSynchronousEvents: true
|
||||||
|
@@ -102,13 +102,16 @@ module.exports = {
|
|||||||
//
|
//
|
||||||
// NOTE: - Require NIP-42 compatible nostr client
|
// NOTE: - Require NIP-42 compatible nostr client
|
||||||
private_keys: {
|
private_keys: {
|
||||||
// "pubkey-in-hex": "privatekey",
|
// "pubkey-in-hex": "privatekey-in-hex",
|
||||||
// "pubkey-in-hex": "nsec ...."
|
// "pubkey-in-hex": "nsec ...."
|
||||||
},
|
},
|
||||||
// Tip: If you want to convert your pubkey/privatekey to hex,
|
// Tip: If you want to convert your pubkey/privatekey to hex,
|
||||||
// You could run the following command:
|
// You could run the following command:
|
||||||
// $ node hexconverter.js npub....
|
// $ node hexconverter.js npub....
|
||||||
// $ node hexconverter.js nsec....
|
// $ node hexconverter.js nsec....
|
||||||
|
// or
|
||||||
|
// $ bostr hexconverter npub....
|
||||||
|
// $ bostr hexconverter nsec....
|
||||||
|
|
||||||
// Server information.
|
// Server information.
|
||||||
// Only for when nostr client requesting server information.
|
// Only for when nostr client requesting server information.
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "bostr",
|
"name": "bostr",
|
||||||
"version": "2.0.5",
|
"version": "2.0.6",
|
||||||
"description": "Nostr relay bouncer",
|
"description": "Nostr relay bouncer",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
Reference in New Issue
Block a user