diff --git a/bostr_cli.js b/bostr_cli.js index f0c16b1..5e6c1d8 100755 --- a/bostr_cli.js +++ b/bostr_cli.js @@ -1,5 +1,6 @@ #!/usr/bin/env node const { version } = require("./package.json"); +const { nip19 } = require("nostr-tools") const fs = require("fs"); const cluster = require("cluster"); const argv = process.argv.slice(2); @@ -10,10 +11,11 @@ function showHelp() { console.log( "Usage: bostr [command] (argv)\n" + "Available command:\n" + - " makeconf [conffile] - Make config file\n" + - " start [conffile] - Run bostr with specified config\n" + - " check [conffile] - Check config file\n" + - " help - Show this help text\n\n" + + " makeconf [conffile] - Make config file\n" + + " start [conffile] - Run bostr with specified config\n" + + " check [conffile] - Check config file\n" + + " hexconverter [nip19] - Convert NIP-19 string to hex\n" + + " help - Show this help text\n\n" + "Software is licensed under BSD-3-Clause\n" + "https://github.com/Yonle/bostr" ); @@ -68,6 +70,12 @@ switch (argv[0]) { process.env.BOSTR_CONFIG_PATH = readPath(argv[1]); require("./index.js"); 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: if (argv[0] && (argv[0] !== "help")) { console.error("Unrecognized command:", argv[0]); diff --git a/bouncer.js b/bouncer.js index 15f4bd3..5c5e935 100644 --- a/bouncer.js +++ b/bouncer.js @@ -204,7 +204,7 @@ function newConn(addr, client, reconn_t = 0) { if (client.readyState !== 1) return; const relay = new WebSocket(addr, { 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, allowSynchronousEvents: true diff --git a/config.js.example b/config.js.example index cb0d128..55fc7ea 100644 --- a/config.js.example +++ b/config.js.example @@ -102,13 +102,16 @@ module.exports = { // // NOTE: - Require NIP-42 compatible nostr client private_keys: { - // "pubkey-in-hex": "privatekey", + // "pubkey-in-hex": "privatekey-in-hex", // "pubkey-in-hex": "nsec ...." }, // Tip: If you want to convert your pubkey/privatekey to hex, // You could run the following command: // $ node hexconverter.js npub.... // $ node hexconverter.js nsec.... + // or + // $ bostr hexconverter npub.... + // $ bostr hexconverter nsec.... // Server information. // Only for when nostr client requesting server information. diff --git a/package.json b/package.json index 3b7f1a9..cbfe7e5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bostr", - "version": "2.0.5", + "version": "2.0.6", "description": "Nostr relay bouncer", "main": "index.js", "scripts": {