routstrd 0.2.21 → 0.2.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dockerignore +12 -0
- package/Dockerfile +3 -0
- package/bun.lock +9 -8
- package/dist/daemon/index.js +4125 -927
- package/dist/index.js +79 -59
- package/docker-compose.yml +14 -0
- package/package.json +3 -3
- package/src/start-daemon.ts +5 -5
- package/src/utils/logger.ts +3 -3
- package/.claude/settings.local.json +0 -10
package/dist/index.js
CHANGED
|
@@ -27,7 +27,6 @@ var __export = (target, all) => {
|
|
|
27
27
|
});
|
|
28
28
|
};
|
|
29
29
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
30
|
-
var __require = import.meta.require;
|
|
31
30
|
|
|
32
31
|
// node_modules/commander/lib/error.js
|
|
33
32
|
var require_error = __commonJS((exports) => {
|
|
@@ -749,11 +748,11 @@ var require_suggestSimilar = __commonJS((exports) => {
|
|
|
749
748
|
|
|
750
749
|
// node_modules/commander/lib/command.js
|
|
751
750
|
var require_command = __commonJS((exports) => {
|
|
752
|
-
var EventEmitter =
|
|
753
|
-
var childProcess =
|
|
754
|
-
var path =
|
|
755
|
-
var fs =
|
|
756
|
-
var process2 =
|
|
751
|
+
var EventEmitter = import.meta.require("events").EventEmitter;
|
|
752
|
+
var childProcess = import.meta.require("child_process");
|
|
753
|
+
var path = import.meta.require("path");
|
|
754
|
+
var fs = import.meta.require("fs");
|
|
755
|
+
var process2 = import.meta.require("process");
|
|
757
756
|
var { Argument, humanReadableArgName } = require_argument();
|
|
758
757
|
var { CommanderError } = require_error();
|
|
759
758
|
var { Help, stripColor } = require_help();
|
|
@@ -1001,7 +1000,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1001
1000
|
this._exitCallback = (err) => {
|
|
1002
1001
|
if (err.code !== "commander.executeSubCommandAsync") {
|
|
1003
1002
|
throw err;
|
|
1004
|
-
} else {
|
|
1003
|
+
} else {
|
|
1004
|
+
}
|
|
1005
1005
|
};
|
|
1006
1006
|
}
|
|
1007
1007
|
return this;
|
|
@@ -2170,18 +2170,18 @@ var init_logger = __esm(() => {
|
|
|
2170
2170
|
LOGS_DIR = join(LOG_DIR, "logs");
|
|
2171
2171
|
logger = {
|
|
2172
2172
|
log: (...args) => {
|
|
2173
|
-
console.log(...args);
|
|
2174
2173
|
writeLog("INFO", ...args);
|
|
2175
2174
|
},
|
|
2176
2175
|
debug: (...args) => {
|
|
2177
2176
|
writeLog("DEBUG", ...args);
|
|
2178
2177
|
},
|
|
2178
|
+
warn: (...args) => {
|
|
2179
|
+
writeLog("WARN", ...args);
|
|
2180
|
+
},
|
|
2179
2181
|
error: (...args) => {
|
|
2180
|
-
console.error(...args);
|
|
2181
2182
|
writeLog("ERROR", ...args);
|
|
2182
2183
|
},
|
|
2183
2184
|
info: (...args) => {
|
|
2184
|
-
console.log(...args);
|
|
2185
2185
|
writeLog("INFO", ...args);
|
|
2186
2186
|
}
|
|
2187
2187
|
};
|
|
@@ -2235,7 +2235,8 @@ async function readLockOwner(lockDir) {
|
|
|
2235
2235
|
token: typeof parsed.token === "string" ? parsed.token : undefined
|
|
2236
2236
|
};
|
|
2237
2237
|
}
|
|
2238
|
-
} catch {
|
|
2238
|
+
} catch {
|
|
2239
|
+
}
|
|
2239
2240
|
return null;
|
|
2240
2241
|
}
|
|
2241
2242
|
async function isLockStale(lockDir, staleAfterMs) {
|
|
@@ -2297,7 +2298,8 @@ async function withCrossProcessLock(lockDir, fn, options = {}) {
|
|
|
2297
2298
|
await release();
|
|
2298
2299
|
}
|
|
2299
2300
|
}
|
|
2300
|
-
var init_process_lock = () => {
|
|
2301
|
+
var init_process_lock = () => {
|
|
2302
|
+
};
|
|
2301
2303
|
|
|
2302
2304
|
// src/start-daemon.ts
|
|
2303
2305
|
async function isDaemonHealthy(port) {
|
|
@@ -2320,7 +2322,7 @@ async function startDaemonUnlocked(options) {
|
|
|
2320
2322
|
const pollIntervalMs = 250;
|
|
2321
2323
|
const startupTimeoutMs = 10 * 60 * 1000;
|
|
2322
2324
|
if (await isDaemonHealthy(port)) {
|
|
2323
|
-
|
|
2325
|
+
console.log(`Routstr daemon already running on http://localhost:${port}/v1`);
|
|
2324
2326
|
return;
|
|
2325
2327
|
}
|
|
2326
2328
|
if (options.port) {
|
|
@@ -2332,8 +2334,8 @@ async function startDaemonUnlocked(options) {
|
|
|
2332
2334
|
const daemonScript = new URL("./daemon/index.js", import.meta.url).pathname;
|
|
2333
2335
|
const shellCmd = `bun run "${daemonScript}" ${args.map((a) => `'${a}'`).join(" ")}`;
|
|
2334
2336
|
const proc = Bun.spawn(["sh", "-c", shellCmd], {
|
|
2335
|
-
stdout: "
|
|
2336
|
-
stderr: "
|
|
2337
|
+
stdout: "ignore",
|
|
2338
|
+
stderr: "ignore",
|
|
2337
2339
|
stdin: "ignore",
|
|
2338
2340
|
detached: true
|
|
2339
2341
|
});
|
|
@@ -2349,7 +2351,7 @@ async function startDaemonUnlocked(options) {
|
|
|
2349
2351
|
throw new Error(`Daemon process exited early with code ${exitCode}. Check logs in ${LOGS_DIR2}`);
|
|
2350
2352
|
}
|
|
2351
2353
|
if (await isDaemonHealthy(port)) {
|
|
2352
|
-
|
|
2354
|
+
console.log(`Routstr daemon started (PID: ${proc.pid}).`);
|
|
2353
2355
|
return;
|
|
2354
2356
|
}
|
|
2355
2357
|
}
|
|
@@ -2359,7 +2361,7 @@ async function startDaemon(options = {}) {
|
|
|
2359
2361
|
const port = options.port || "8008";
|
|
2360
2362
|
const startupTimeoutMs = 10 * 60 * 1000;
|
|
2361
2363
|
if (await isDaemonHealthy(port)) {
|
|
2362
|
-
|
|
2364
|
+
console.log(`Routstr daemon already running on http://localhost:${port}/v1`);
|
|
2363
2365
|
return;
|
|
2364
2366
|
}
|
|
2365
2367
|
await withCrossProcessLock(DAEMON_STARTUP_LOCK_PATH, async () => {
|
|
@@ -5218,7 +5220,8 @@ function unsafeWrapper(fn) {
|
|
|
5218
5220
|
return function(...args) {
|
|
5219
5221
|
try {
|
|
5220
5222
|
return fn.apply(null, args);
|
|
5221
|
-
} catch (e) {
|
|
5223
|
+
} catch (e) {
|
|
5224
|
+
}
|
|
5222
5225
|
};
|
|
5223
5226
|
}
|
|
5224
5227
|
function bech32Polymod(pre) {
|
|
@@ -7588,7 +7591,8 @@ function* matchAll(content) {
|
|
|
7588
7591
|
start: match.index,
|
|
7589
7592
|
end: match.index + shortcode.length
|
|
7590
7593
|
};
|
|
7591
|
-
} catch (_e) {
|
|
7594
|
+
} catch (_e) {
|
|
7595
|
+
}
|
|
7592
7596
|
}
|
|
7593
7597
|
}
|
|
7594
7598
|
function replaceAll(content, replacer) {
|
|
@@ -7668,7 +7672,8 @@ async function getZapEndpoint(metadata) {
|
|
|
7668
7672
|
if (body.allowsNostr && body.nostrPubkey) {
|
|
7669
7673
|
return body.callback;
|
|
7670
7674
|
}
|
|
7671
|
-
} catch (err) {
|
|
7675
|
+
} catch (err) {
|
|
7676
|
+
}
|
|
7672
7677
|
return null;
|
|
7673
7678
|
}
|
|
7674
7679
|
function makeZapRequest(params) {
|
|
@@ -8029,7 +8034,8 @@ var __defProp2, __export2 = (target, all) => {
|
|
|
8029
8034
|
this.reconnectTimeoutHandle = setTimeout(async () => {
|
|
8030
8035
|
try {
|
|
8031
8036
|
await this.connect();
|
|
8032
|
-
} catch (err) {
|
|
8037
|
+
} catch (err) {
|
|
8038
|
+
}
|
|
8033
8039
|
}, backoff);
|
|
8034
8040
|
}
|
|
8035
8041
|
handleHardClose(reason) {
|
|
@@ -8401,7 +8407,8 @@ var __defProp2, __export2 = (target, all) => {
|
|
|
8401
8407
|
try {
|
|
8402
8408
|
this.relay.send('["CLOSE",' + JSON.stringify(this.id) + "]");
|
|
8403
8409
|
} catch (err) {
|
|
8404
|
-
if (err instanceof SendingOnClosedConnection) {
|
|
8410
|
+
if (err instanceof SendingOnClosedConnection) {
|
|
8411
|
+
} else {
|
|
8405
8412
|
throw err;
|
|
8406
8413
|
}
|
|
8407
8414
|
}
|
|
@@ -9080,10 +9087,12 @@ var init_esm = __esm(() => {
|
|
|
9080
9087
|
};
|
|
9081
9088
|
try {
|
|
9082
9089
|
_WebSocket = WebSocket;
|
|
9083
|
-
} catch {
|
|
9090
|
+
} catch {
|
|
9091
|
+
}
|
|
9084
9092
|
try {
|
|
9085
9093
|
_WebSocket2 = WebSocket;
|
|
9086
|
-
} catch {
|
|
9094
|
+
} catch {
|
|
9095
|
+
}
|
|
9087
9096
|
nip19_exports = {};
|
|
9088
9097
|
__export2(nip19_exports, {
|
|
9089
9098
|
BECH32_REGEX: () => BECH32_REGEX,
|
|
@@ -9126,7 +9135,8 @@ var init_esm = __esm(() => {
|
|
|
9126
9135
|
NIP05_REGEX = /^(?:([\w.+-]+)@)?([\w_-]+(\.[\w_-]+)+)$/;
|
|
9127
9136
|
try {
|
|
9128
9137
|
_fetch = fetch;
|
|
9129
|
-
} catch (_) {
|
|
9138
|
+
} catch (_) {
|
|
9139
|
+
}
|
|
9130
9140
|
nip10_exports = {};
|
|
9131
9141
|
__export2(nip10_exports, {
|
|
9132
9142
|
parse: () => parse
|
|
@@ -9138,7 +9148,8 @@ var init_esm = __esm(() => {
|
|
|
9138
9148
|
});
|
|
9139
9149
|
try {
|
|
9140
9150
|
_fetch2 = fetch;
|
|
9141
|
-
} catch {
|
|
9151
|
+
} catch {
|
|
9152
|
+
}
|
|
9142
9153
|
nip13_exports = {};
|
|
9143
9154
|
__export2(nip13_exports, {
|
|
9144
9155
|
getPow: () => getPow,
|
|
@@ -9226,7 +9237,8 @@ var init_esm = __esm(() => {
|
|
|
9226
9237
|
});
|
|
9227
9238
|
try {
|
|
9228
9239
|
_fetch3 = fetch;
|
|
9229
|
-
} catch {
|
|
9240
|
+
} catch {
|
|
9241
|
+
}
|
|
9230
9242
|
nip47_exports = {};
|
|
9231
9243
|
__export2(nip47_exports, {
|
|
9232
9244
|
makeNwcRequestEvent: () => makeNwcRequestEvent,
|
|
@@ -9247,7 +9259,8 @@ var init_esm = __esm(() => {
|
|
|
9247
9259
|
});
|
|
9248
9260
|
try {
|
|
9249
9261
|
_fetch4 = fetch;
|
|
9250
|
-
} catch {
|
|
9262
|
+
} catch {
|
|
9263
|
+
}
|
|
9251
9264
|
nip77_exports = {};
|
|
9252
9265
|
__export2(nip77_exports, {
|
|
9253
9266
|
Negentropy: () => Negentropy,
|
|
@@ -11256,8 +11269,8 @@ var require_qrcode = __commonJS((exports) => {
|
|
|
11256
11269
|
|
|
11257
11270
|
// node_modules/pngjs/lib/chunkstream.js
|
|
11258
11271
|
var require_chunkstream = __commonJS((exports, module) => {
|
|
11259
|
-
var util =
|
|
11260
|
-
var Stream =
|
|
11272
|
+
var util = import.meta.require("util");
|
|
11273
|
+
var Stream = import.meta.require("stream");
|
|
11261
11274
|
var ChunkStream = module.exports = function() {
|
|
11262
11275
|
Stream.call(this);
|
|
11263
11276
|
this._buffers = [];
|
|
@@ -11613,7 +11626,7 @@ var require_filter_parse = __commonJS((exports, module) => {
|
|
|
11613
11626
|
|
|
11614
11627
|
// node_modules/pngjs/lib/filter-parse-async.js
|
|
11615
11628
|
var require_filter_parse_async = __commonJS((exports, module) => {
|
|
11616
|
-
var util =
|
|
11629
|
+
var util = import.meta.require("util");
|
|
11617
11630
|
var ChunkStream = require_chunkstream();
|
|
11618
11631
|
var Filter = require_filter_parse();
|
|
11619
11632
|
var FilterAsync = module.exports = function(bitmapInfo) {
|
|
@@ -11727,7 +11740,8 @@ var require_parser = __commonJS((exports, module) => {
|
|
|
11727
11740
|
this.inflateData = dependencies.inflateData;
|
|
11728
11741
|
this.finished = dependencies.finished;
|
|
11729
11742
|
this.simpleTransparency = dependencies.simpleTransparency;
|
|
11730
|
-
this.headersFinished = dependencies.headersFinished || function() {
|
|
11743
|
+
this.headersFinished = dependencies.headersFinished || function() {
|
|
11744
|
+
};
|
|
11731
11745
|
};
|
|
11732
11746
|
Parser.prototype.start = function() {
|
|
11733
11747
|
this.read(constants.PNG_SIGNATURE.length, this._parseSignature.bind(this));
|
|
@@ -11919,7 +11933,8 @@ var require_parser = __commonJS((exports, module) => {
|
|
|
11919
11933
|
var require_bitmapper = __commonJS((exports) => {
|
|
11920
11934
|
var interlaceUtils = require_interlace();
|
|
11921
11935
|
var pixelBppMapper = [
|
|
11922
|
-
function() {
|
|
11936
|
+
function() {
|
|
11937
|
+
},
|
|
11923
11938
|
function(pxData, data, pxPos, rawPos) {
|
|
11924
11939
|
if (rawPos === data.length) {
|
|
11925
11940
|
throw new Error("Ran out of data");
|
|
@@ -11960,7 +11975,8 @@ var require_bitmapper = __commonJS((exports) => {
|
|
|
11960
11975
|
}
|
|
11961
11976
|
];
|
|
11962
11977
|
var pixelBppCustomMapper = [
|
|
11963
|
-
function() {
|
|
11978
|
+
function() {
|
|
11979
|
+
},
|
|
11964
11980
|
function(pxData, pixelData, pxPos, maxBit) {
|
|
11965
11981
|
let pixel = pixelData[0];
|
|
11966
11982
|
pxData[pxPos] = pixel;
|
|
@@ -12204,8 +12220,8 @@ var require_format_normaliser = __commonJS((exports, module) => {
|
|
|
12204
12220
|
|
|
12205
12221
|
// node_modules/pngjs/lib/parser-async.js
|
|
12206
12222
|
var require_parser_async = __commonJS((exports, module) => {
|
|
12207
|
-
var util =
|
|
12208
|
-
var zlib =
|
|
12223
|
+
var util = import.meta.require("util");
|
|
12224
|
+
var zlib = import.meta.require("zlib");
|
|
12209
12225
|
var ChunkStream = require_chunkstream();
|
|
12210
12226
|
var FilterAsync = require_filter_parse_async();
|
|
12211
12227
|
var Parser = require_parser();
|
|
@@ -12239,7 +12255,8 @@ var require_parser_async = __commonJS((exports, module) => {
|
|
|
12239
12255
|
}
|
|
12240
12256
|
if (this._filter) {
|
|
12241
12257
|
this._filter.destroy();
|
|
12242
|
-
this._filter.on("error", function() {
|
|
12258
|
+
this._filter.on("error", function() {
|
|
12259
|
+
});
|
|
12243
12260
|
}
|
|
12244
12261
|
this.errord = true;
|
|
12245
12262
|
};
|
|
@@ -12598,7 +12615,7 @@ var require_packer = __commonJS((exports, module) => {
|
|
|
12598
12615
|
var CrcStream = require_crc();
|
|
12599
12616
|
var bitPacker = require_bitpacker();
|
|
12600
12617
|
var filter = require_filter_pack();
|
|
12601
|
-
var zlib =
|
|
12618
|
+
var zlib = import.meta.require("zlib");
|
|
12602
12619
|
var Packer = module.exports = function(options) {
|
|
12603
12620
|
this._options = options;
|
|
12604
12621
|
options.deflateChunkSize = options.deflateChunkSize || 32 * 1024;
|
|
@@ -12682,8 +12699,8 @@ var require_packer = __commonJS((exports, module) => {
|
|
|
12682
12699
|
|
|
12683
12700
|
// node_modules/pngjs/lib/packer-async.js
|
|
12684
12701
|
var require_packer_async = __commonJS((exports, module) => {
|
|
12685
|
-
var util =
|
|
12686
|
-
var Stream =
|
|
12702
|
+
var util = import.meta.require("util");
|
|
12703
|
+
var Stream = import.meta.require("stream");
|
|
12687
12704
|
var constants = require_constants();
|
|
12688
12705
|
var Packer = require_packer();
|
|
12689
12706
|
var PackerAsync = module.exports = function(opt) {
|
|
@@ -12715,10 +12732,10 @@ var require_packer_async = __commonJS((exports, module) => {
|
|
|
12715
12732
|
|
|
12716
12733
|
// node_modules/pngjs/lib/sync-inflate.js
|
|
12717
12734
|
var require_sync_inflate = __commonJS((exports, module) => {
|
|
12718
|
-
var assert =
|
|
12719
|
-
var zlib =
|
|
12720
|
-
var util =
|
|
12721
|
-
var kMaxLength =
|
|
12735
|
+
var assert = import.meta.require("assert").ok;
|
|
12736
|
+
var zlib = import.meta.require("zlib");
|
|
12737
|
+
var util = import.meta.require("util");
|
|
12738
|
+
var kMaxLength = import.meta.require("buffer").kMaxLength;
|
|
12722
12739
|
function Inflate(opts) {
|
|
12723
12740
|
if (!(this instanceof Inflate)) {
|
|
12724
12741
|
return new Inflate(opts);
|
|
@@ -12878,7 +12895,8 @@ var require_filter_parse_sync = __commonJS((exports) => {
|
|
|
12878
12895
|
write: function(bufferPart) {
|
|
12879
12896
|
outBuffers.push(bufferPart);
|
|
12880
12897
|
},
|
|
12881
|
-
complete: function() {
|
|
12898
|
+
complete: function() {
|
|
12899
|
+
}
|
|
12882
12900
|
});
|
|
12883
12901
|
filter.start();
|
|
12884
12902
|
reader.process();
|
|
@@ -12889,7 +12907,7 @@ var require_filter_parse_sync = __commonJS((exports) => {
|
|
|
12889
12907
|
// node_modules/pngjs/lib/parser-sync.js
|
|
12890
12908
|
var require_parser_sync = __commonJS((exports, module) => {
|
|
12891
12909
|
var hasSyncZlib = true;
|
|
12892
|
-
var zlib =
|
|
12910
|
+
var zlib = import.meta.require("zlib");
|
|
12893
12911
|
var inflateSync = require_sync_inflate();
|
|
12894
12912
|
if (!zlib.deflateSync) {
|
|
12895
12913
|
hasSyncZlib = false;
|
|
@@ -12975,7 +12993,7 @@ var require_parser_sync = __commonJS((exports, module) => {
|
|
|
12975
12993
|
// node_modules/pngjs/lib/packer-sync.js
|
|
12976
12994
|
var require_packer_sync = __commonJS((exports, module) => {
|
|
12977
12995
|
var hasSyncZlib = true;
|
|
12978
|
-
var zlib =
|
|
12996
|
+
var zlib = import.meta.require("zlib");
|
|
12979
12997
|
if (!zlib.deflateSync) {
|
|
12980
12998
|
hasSyncZlib = false;
|
|
12981
12999
|
}
|
|
@@ -13019,8 +13037,8 @@ var require_png_sync = __commonJS((exports) => {
|
|
|
13019
13037
|
|
|
13020
13038
|
// node_modules/pngjs/lib/png.js
|
|
13021
13039
|
var require_png = __commonJS((exports) => {
|
|
13022
|
-
var util =
|
|
13023
|
-
var Stream =
|
|
13040
|
+
var util = import.meta.require("util");
|
|
13041
|
+
var Stream = import.meta.require("stream");
|
|
13024
13042
|
var Parser = require_parser_async();
|
|
13025
13043
|
var Packer = require_packer_async();
|
|
13026
13044
|
var PNGSync = require_png_sync();
|
|
@@ -13224,7 +13242,7 @@ var require_utils2 = __commonJS((exports) => {
|
|
|
13224
13242
|
|
|
13225
13243
|
// node_modules/qrcode/lib/renderer/png.js
|
|
13226
13244
|
var require_png2 = __commonJS((exports) => {
|
|
13227
|
-
var fs =
|
|
13245
|
+
var fs = import.meta.require("fs");
|
|
13228
13246
|
var PNG = require_png().PNG;
|
|
13229
13247
|
var Utils = require_utils2();
|
|
13230
13248
|
exports.render = function render(qrData, options) {
|
|
@@ -13348,7 +13366,7 @@ var require_utf8 = __commonJS((exports) => {
|
|
|
13348
13366
|
cb = options;
|
|
13349
13367
|
options = undefined;
|
|
13350
13368
|
}
|
|
13351
|
-
const fs =
|
|
13369
|
+
const fs = import.meta.require("fs");
|
|
13352
13370
|
const utf8 = exports.render(qrData, options);
|
|
13353
13371
|
fs.writeFile(path, utf8, cb);
|
|
13354
13372
|
};
|
|
@@ -13522,7 +13540,7 @@ var require_svg = __commonJS((exports) => {
|
|
|
13522
13540
|
cb = options;
|
|
13523
13541
|
options = undefined;
|
|
13524
13542
|
}
|
|
13525
|
-
const fs =
|
|
13543
|
+
const fs = import.meta.require("fs");
|
|
13526
13544
|
const svgTag = exports.render(qrData, options);
|
|
13527
13545
|
const xmlStr = '<?xml version="1.0" encoding="utf-8"?>' + '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">' + svgTag;
|
|
13528
13546
|
fs.writeFile(path, xmlStr, cb);
|
|
@@ -14139,7 +14157,8 @@ function renderBox(lines, width, title) {
|
|
|
14139
14157
|
function startBarSection(sectionKey, maxLabelLen) {
|
|
14140
14158
|
_sectionMaxLabelLen.set(sectionKey, maxLabelLen);
|
|
14141
14159
|
}
|
|
14142
|
-
function endBarSection(_sectionKey) {
|
|
14160
|
+
function endBarSection(_sectionKey) {
|
|
14161
|
+
}
|
|
14143
14162
|
function renderBarChart(label, value, maxValue, width, color, percentageValue, sectionKey) {
|
|
14144
14163
|
const safeMaxValue = Math.max(maxValue, 1);
|
|
14145
14164
|
const pct = percentageValue !== undefined ? percentageValue.toFixed(1) : (value / safeMaxValue * 100).toFixed(1);
|
|
@@ -15610,7 +15629,7 @@ async function isCocodInstalled(cocodPath) {
|
|
|
15610
15629
|
// package.json
|
|
15611
15630
|
var package_default = {
|
|
15612
15631
|
name: "routstrd",
|
|
15613
|
-
version: "0.2.
|
|
15632
|
+
version: "0.2.22",
|
|
15614
15633
|
module: "src/index.ts",
|
|
15615
15634
|
type: "module",
|
|
15616
15635
|
private: false,
|
|
@@ -15633,8 +15652,8 @@ var package_default = {
|
|
|
15633
15652
|
typescript: "^5"
|
|
15634
15653
|
},
|
|
15635
15654
|
dependencies: {
|
|
15636
|
-
"@cashu/cashu-ts": "^3.
|
|
15637
|
-
"@routstr/sdk": "^0.3.
|
|
15655
|
+
"@cashu/cashu-ts": "^4.3.0",
|
|
15656
|
+
"@routstr/sdk": "^0.3.8",
|
|
15638
15657
|
"applesauce-core": "^5.1.0",
|
|
15639
15658
|
"applesauce-relay": "^5.1.0",
|
|
15640
15659
|
commander: "^14.0.2",
|
|
@@ -16409,7 +16428,7 @@ serviceCmd.command("install").description("Install and start routstrd using PM2
|
|
|
16409
16428
|
try {
|
|
16410
16429
|
daemonPath = Bun.resolveSync("./daemon/index.js", import.meta.url);
|
|
16411
16430
|
} catch (e) {
|
|
16412
|
-
const path =
|
|
16431
|
+
const path = import.meta.require("path");
|
|
16413
16432
|
daemonPath = path.join(path.dirname(import.meta.url).replace("file://", ""), "daemon", "index.js");
|
|
16414
16433
|
}
|
|
16415
16434
|
if (!existsSync9(daemonPath)) {
|
|
@@ -16446,7 +16465,8 @@ serviceCmd.command("uninstall").description("Stop and remove routstrd from PM2")
|
|
|
16446
16465
|
serviceCmd.command("logs").description("View PM2 logs for routstrd").action(() => {
|
|
16447
16466
|
try {
|
|
16448
16467
|
execSync("pm2 logs routstrd", { stdio: "inherit" });
|
|
16449
|
-
} catch (e) {
|
|
16468
|
+
} catch (e) {
|
|
16469
|
+
}
|
|
16450
16470
|
});
|
|
16451
16471
|
program.command("restart").description("Restart the background daemon").option("--port <port>", "Port to listen on").option("-p, --provider <provider>", "Default provider to use").action(async (options) => {
|
|
16452
16472
|
await requireLocalDaemon();
|
|
@@ -16487,7 +16507,7 @@ program.command("mode").description("Set the client mode (lazyrefund/apikeys or
|
|
|
16487
16507
|
Current mode: ${currentMode}`);
|
|
16488
16508
|
const modes = ["apikeys", "xcashu"];
|
|
16489
16509
|
const selectedIndex = await new Promise((resolve) => {
|
|
16490
|
-
const rl =
|
|
16510
|
+
const rl = import.meta.require("readline").createInterface({
|
|
16491
16511
|
input: process.stdin,
|
|
16492
16512
|
output: process.stdout
|
|
16493
16513
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "routstrd",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.22",
|
|
4
4
|
"module": "src/index.ts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"typescript": "^5"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@cashu/cashu-ts": "^3.
|
|
27
|
-
"@routstr/sdk": "^0.3.
|
|
26
|
+
"@cashu/cashu-ts": "^4.3.0",
|
|
27
|
+
"@routstr/sdk": "^0.3.8",
|
|
28
28
|
"applesauce-core": "^5.1.0",
|
|
29
29
|
"applesauce-relay": "^5.1.0",
|
|
30
30
|
"commander": "^14.0.2",
|
package/src/start-daemon.ts
CHANGED
|
@@ -28,7 +28,7 @@ async function startDaemonUnlocked(
|
|
|
28
28
|
const startupTimeoutMs = 10 * 60 * 1000;
|
|
29
29
|
|
|
30
30
|
if (await isDaemonHealthy(port)) {
|
|
31
|
-
|
|
31
|
+
console.log(`Routstr daemon already running on http://localhost:${port}/v1`);
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -43,8 +43,8 @@ async function startDaemonUnlocked(
|
|
|
43
43
|
const shellCmd = `bun run "${daemonScript}" ${args.map((a) => `'${a}'`).join(" ")}`;
|
|
44
44
|
|
|
45
45
|
const proc = Bun.spawn(["sh", "-c", shellCmd], {
|
|
46
|
-
stdout: "
|
|
47
|
-
stderr: "
|
|
46
|
+
stdout: "ignore",
|
|
47
|
+
stderr: "ignore",
|
|
48
48
|
stdin: "ignore",
|
|
49
49
|
detached: true,
|
|
50
50
|
});
|
|
@@ -67,7 +67,7 @@ async function startDaemonUnlocked(
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
if (await isDaemonHealthy(port)) {
|
|
70
|
-
|
|
70
|
+
console.log(`Routstr daemon started (PID: ${proc.pid}).`);
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
@@ -84,7 +84,7 @@ export async function startDaemon(
|
|
|
84
84
|
const startupTimeoutMs = 10 * 60 * 1000;
|
|
85
85
|
|
|
86
86
|
if (await isDaemonHealthy(port)) {
|
|
87
|
-
|
|
87
|
+
console.log(`Routstr daemon already running on http://localhost:${port}/v1`);
|
|
88
88
|
return;
|
|
89
89
|
}
|
|
90
90
|
|
package/src/utils/logger.ts
CHANGED
|
@@ -48,18 +48,18 @@ async function writeLog(level: string, ...args: unknown[]) {
|
|
|
48
48
|
|
|
49
49
|
export const logger = {
|
|
50
50
|
log: (...args: unknown[]) => {
|
|
51
|
-
console.log(...args);
|
|
52
51
|
writeLog("INFO", ...args);
|
|
53
52
|
},
|
|
54
53
|
debug: (...args: unknown[]) => {
|
|
55
54
|
writeLog("DEBUG", ...args);
|
|
56
55
|
},
|
|
56
|
+
warn: (...args: unknown[]) => {
|
|
57
|
+
writeLog("WARN", ...args);
|
|
58
|
+
},
|
|
57
59
|
error: (...args: unknown[]) => {
|
|
58
|
-
console.error(...args);
|
|
59
60
|
writeLog("ERROR", ...args);
|
|
60
61
|
},
|
|
61
62
|
info: (...args: unknown[]) => {
|
|
62
|
-
console.log(...args);
|
|
63
63
|
writeLog("INFO", ...args);
|
|
64
64
|
},
|
|
65
65
|
};
|