@bsv/overlay-express 2.0.2 โ†’ 2.1.0

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.
Files changed (52) hide show
  1. package/dist/cjs/mod.js +7 -1
  2. package/dist/cjs/mod.js.map +1 -1
  3. package/dist/cjs/package.json +3 -1
  4. package/dist/cjs/src/BanAwareLookupWrapper.js +76 -0
  5. package/dist/cjs/src/BanAwareLookupWrapper.js.map +1 -0
  6. package/dist/cjs/src/BanService.js +118 -0
  7. package/dist/cjs/src/BanService.js.map +1 -0
  8. package/dist/cjs/src/JanitorService.js +206 -93
  9. package/dist/cjs/src/JanitorService.js.map +1 -1
  10. package/dist/cjs/src/OverlayExpress.js +522 -71
  11. package/dist/cjs/src/OverlayExpress.js.map +1 -1
  12. package/dist/cjs/src/makeUserInterface.js +889 -217
  13. package/dist/cjs/src/makeUserInterface.js.map +1 -1
  14. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  15. package/dist/esm/mod.js +4 -1
  16. package/dist/esm/mod.js.map +1 -1
  17. package/dist/esm/src/BanAwareLookupWrapper.js +78 -0
  18. package/dist/esm/src/BanAwareLookupWrapper.js.map +1 -0
  19. package/dist/esm/src/BanService.js +115 -0
  20. package/dist/esm/src/BanService.js.map +1 -0
  21. package/dist/esm/src/JanitorService.js +199 -92
  22. package/dist/esm/src/JanitorService.js.map +1 -1
  23. package/dist/esm/src/OverlayExpress.js +528 -72
  24. package/dist/esm/src/OverlayExpress.js.map +1 -1
  25. package/dist/esm/src/makeUserInterface.js +889 -217
  26. package/dist/esm/src/makeUserInterface.js.map +1 -1
  27. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  28. package/dist/types/mod.d.ts +4 -1
  29. package/dist/types/mod.d.ts.map +1 -1
  30. package/dist/types/src/BanAwareLookupWrapper.d.ts +31 -0
  31. package/dist/types/src/BanAwareLookupWrapper.d.ts.map +1 -0
  32. package/dist/types/src/BanService.d.ts +81 -0
  33. package/dist/types/src/BanService.d.ts.map +1 -0
  34. package/dist/types/src/JanitorService.d.ts +69 -13
  35. package/dist/types/src/JanitorService.d.ts.map +1 -1
  36. package/dist/types/src/OverlayExpress.d.ts +28 -4
  37. package/dist/types/src/OverlayExpress.d.ts.map +1 -1
  38. package/dist/types/src/makeUserInterface.d.ts +2 -0
  39. package/dist/types/src/makeUserInterface.d.ts.map +1 -1
  40. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  41. package/mod.ts +4 -1
  42. package/package.json +3 -1
  43. package/src/BanAwareLookupWrapper.ts +95 -0
  44. package/src/BanService.ts +154 -0
  45. package/src/JanitorService.ts +277 -101
  46. package/src/OverlayExpress.ts +575 -76
  47. package/src/__tests__/BanAwareLookupWrapper.test.ts +255 -0
  48. package/src/__tests__/BanService.test.ts +310 -0
  49. package/src/__tests__/JanitorService.test.ts +342 -5
  50. package/src/__tests__/OverlayExpress.test.ts +19 -6
  51. package/src/__tests__/makeUserInterface.test.ts +4 -3
  52. package/src/makeUserInterface.ts +892 -217
@@ -48,6 +48,10 @@ const chalk_1 = __importDefault(require("chalk"));
48
48
  const util_1 = __importDefault(require("util"));
49
49
  const uuid_1 = require("uuid");
50
50
  const JanitorService_js_1 = require("./JanitorService.js");
51
+ const BanService_js_1 = require("./BanService.js");
52
+ const BanAwareLookupWrapper_js_1 = require("./BanAwareLookupWrapper.js");
53
+ const wallet_toolbox_client_1 = require("@bsv/wallet-toolbox-client");
54
+ const auth_express_middleware_1 = require("@bsv/auth-express-middleware");
51
55
  /**
52
56
  * In-memory migration source for Knex migrations.
53
57
  * Allows running migrations defined in code rather than files.
@@ -129,10 +133,11 @@ class OverlayExpress {
129
133
  // Configuration for the janitor service
130
134
  this.janitorConfig = {
131
135
  requestTimeoutMs: 10000, // 10 seconds
132
- hostDownRevokeScore: 3
136
+ hostDownRevokeScore: 3,
137
+ autoBanOnRemoval: true
133
138
  };
134
139
  this.app = (0, express_1.default)();
135
- this.logger.log(chalk_1.default.green.bold(`${name} constructed ๐ŸŽ‰`));
140
+ this.logger.log(chalk_1.default.green.bold(`${name} constructed`));
136
141
  this.adminToken = adminToken !== null && adminToken !== void 0 ? adminToken : (0, uuid_1.v4)(); // generate random if not provided
137
142
  }
138
143
  /**
@@ -147,7 +152,7 @@ class OverlayExpress {
147
152
  */
148
153
  configurePort(port) {
149
154
  this.port = port;
150
- this.logger.log(chalk_1.default.blue(`๐ŸŒ Server port set to ${port}`));
155
+ this.logger.log(chalk_1.default.blue(`Server port set to ${port}`));
151
156
  }
152
157
  /**
153
158
  * Configures the web user interface
@@ -155,20 +160,32 @@ class OverlayExpress {
155
160
  */
156
161
  configureWebUI(config) {
157
162
  this.webUIConfig = config;
158
- this.logger.log(chalk_1.default.blue('๐Ÿ–ฅ๏ธ Web UI has been configured.'));
163
+ this.logger.log(chalk_1.default.blue('Web UI has been configured.'));
159
164
  }
160
165
  /**
161
166
  * Configures the janitor service parameters
162
167
  * @param config - Janitor configuration options
163
168
  * - requestTimeoutMs: Timeout for health check requests (default: 10000ms)
164
169
  * - hostDownRevokeScore: Number of consecutive failures before deleting output (default: 3)
170
+ * - autoBanOnRemoval: Whether to auto-ban domains when removed by janitor (default: true)
165
171
  */
166
172
  configureJanitor(config) {
167
173
  this.janitorConfig = {
168
174
  ...this.janitorConfig,
169
175
  ...config
170
176
  };
171
- this.logger.log(chalk_1.default.blue('๐Ÿงน Janitor service has been configured.'));
177
+ this.logger.log(chalk_1.default.blue('Janitor service has been configured.'));
178
+ }
179
+ /**
180
+ * Configures the admin identity key for wallet-based admin detection.
181
+ * When set, the frontend can compare the user's wallet identity key against this
182
+ * to determine whether to show the admin dashboard.
183
+ *
184
+ * @param identityKey - The hex-encoded public key of the admin
185
+ */
186
+ configureAdminIdentityKey(identityKey) {
187
+ this.adminIdentityKey = identityKey;
188
+ this.logger.log(chalk_1.default.blue('Admin identity key has been configured.'));
172
189
  }
173
190
  /**
174
191
  * Configures the logger to be used by the server.
@@ -176,7 +193,7 @@ class OverlayExpress {
176
193
  */
177
194
  configureLogger(logger) {
178
195
  this.logger = logger;
179
- this.logger.log(chalk_1.default.blue('๐Ÿ” Logger has been configured.'));
196
+ this.logger.log(chalk_1.default.blue('Logger has been configured.'));
180
197
  }
181
198
  /**
182
199
  * Configures the BSV Blockchain network to be used ('main' or 'test').
@@ -186,7 +203,7 @@ class OverlayExpress {
186
203
  configureNetwork(network) {
187
204
  this.network = network;
188
205
  this.chainTracker = new sdk_1.WhatsOnChain(this.network);
189
- this.logger.log(chalk_1.default.blue(`๐Ÿ”— Network set to ${network}`));
206
+ this.logger.log(chalk_1.default.blue(`Network set to ${network}`));
190
207
  }
191
208
  /**
192
209
  * Configures the ChainTracker to be used.
@@ -195,7 +212,7 @@ class OverlayExpress {
195
212
  */
196
213
  configureChainTracker(chainTracker = new sdk_1.WhatsOnChain(this.network)) {
197
214
  this.chainTracker = chainTracker;
198
- this.logger.log(chalk_1.default.blue('๐Ÿ”— ChainTracker has been configured.'));
215
+ this.logger.log(chalk_1.default.blue('ChainTracker has been configured.'));
199
216
  }
200
217
  /**
201
218
  * Configures the ARC API key.
@@ -203,7 +220,7 @@ class OverlayExpress {
203
220
  */
204
221
  configureArcApiKey(apiKey) {
205
222
  this.arcApiKey = apiKey;
206
- this.logger.log(chalk_1.default.blue('๐Ÿ”‘ ARC API key has been configured.'));
223
+ this.logger.log(chalk_1.default.blue('ARC API key has been configured.'));
207
224
  }
208
225
  /**
209
226
  * Enables or disables GASP synchronization (high-level setting).
@@ -212,7 +229,7 @@ class OverlayExpress {
212
229
  */
213
230
  configureEnableGASPSync(enable) {
214
231
  this.enableGASPSync = enable;
215
- this.logger.log(chalk_1.default.blue(`๐Ÿ”„ GASP synchronization ${enable ? 'enabled' : 'disabled'}.`));
232
+ this.logger.log(chalk_1.default.blue(`GASP synchronization ${enable ? 'enabled' : 'disabled'}.`));
216
233
  }
217
234
  /**
218
235
  * Enables or disables verbose request logging.
@@ -220,7 +237,7 @@ class OverlayExpress {
220
237
  */
221
238
  configureVerboseRequestLogging(enable) {
222
239
  this.verboseRequestLogging = enable;
223
- this.logger.log(chalk_1.default.blue(`๐Ÿ“ Verbose request logging ${enable ? 'enabled' : 'disabled'}.`));
240
+ this.logger.log(chalk_1.default.blue(`Verbose request logging ${enable ? 'enabled' : 'disabled'}.`));
224
241
  }
225
242
  /**
226
243
  * Configure Knex (SQL) database connection.
@@ -234,10 +251,11 @@ class OverlayExpress {
234
251
  };
235
252
  }
236
253
  this.knex = (0, knex_1.default)(config);
237
- this.logger.log(chalk_1.default.blue('๐Ÿ“ฆ Knex successfully configured.'));
254
+ this.logger.log(chalk_1.default.blue('Knex successfully configured.'));
238
255
  }
239
256
  /**
240
257
  * Configures the MongoDB database connection.
258
+ * Also initializes the BanService for persistent ban tracking.
241
259
  * @param connectionString - MongoDB connection string
242
260
  */
243
261
  async configureMongo(connectionString) {
@@ -245,7 +263,10 @@ class OverlayExpress {
245
263
  await mongoClient.connect();
246
264
  const db = mongoClient.db(`${this.name}_lookup_services`);
247
265
  this.mongoDb = db;
248
- this.logger.log(chalk_1.default.blue('๐Ÿƒ MongoDB successfully configured and connected.'));
266
+ // Initialize the BanService
267
+ this.banService = new BanService_js_1.BanService(db);
268
+ await this.banService.ensureIndexes();
269
+ this.logger.log(chalk_1.default.blue('MongoDB successfully configured and connected.'));
249
270
  }
250
271
  /**
251
272
  * Configures a Topic Manager.
@@ -254,7 +275,7 @@ class OverlayExpress {
254
275
  */
255
276
  configureTopicManager(name, manager) {
256
277
  this.managers[name] = manager;
257
- this.logger.log(chalk_1.default.blue(`๐Ÿ—‚๏ธ Configured topic manager ${name}`));
278
+ this.logger.log(chalk_1.default.blue(`Configured topic manager ${name}`));
258
279
  }
259
280
  /**
260
281
  * Configures a Lookup Service.
@@ -263,7 +284,7 @@ class OverlayExpress {
263
284
  */
264
285
  configureLookupService(name, service) {
265
286
  this.services[name] = service;
266
- this.logger.log(chalk_1.default.blue(`๐Ÿ” Configured lookup service ${name}`));
287
+ this.logger.log(chalk_1.default.blue(`Configured lookup service ${name}`));
267
288
  }
268
289
  /**
269
290
  * Configures a Lookup Service using Knex (SQL) database.
@@ -271,11 +292,11 @@ class OverlayExpress {
271
292
  * @param serviceFactory - A factory function that creates a LookupService instance using Knex
272
293
  */
273
294
  configureLookupServiceWithKnex(name, serviceFactory) {
274
- this.ensureKnex();
275
- const factoryResult = serviceFactory(this.knex);
295
+ const knex = this.ensureKnex();
296
+ const factoryResult = serviceFactory(knex);
276
297
  this.services[name] = factoryResult.service;
277
298
  this.migrationsToRun.push(...factoryResult.migrations);
278
- this.logger.log(chalk_1.default.blue(`๐Ÿ” Configured lookup service ${name} with Knex`));
299
+ this.logger.log(chalk_1.default.blue(`Configured lookup service ${name} with Knex`));
279
300
  }
280
301
  /**
281
302
  * Configures a Lookup Service using MongoDB.
@@ -283,9 +304,9 @@ class OverlayExpress {
283
304
  * @param serviceFactory - A factory function that creates a LookupService instance using MongoDB
284
305
  */
285
306
  configureLookupServiceWithMongo(name, serviceFactory) {
286
- this.ensureMongo();
287
- this.services[name] = serviceFactory(this.mongoDb);
288
- this.logger.log(chalk_1.default.blue(`๐Ÿ” Configured lookup service ${name} with MongoDB`));
307
+ const mongoDb = this.ensureMongo();
308
+ this.services[name] = serviceFactory(mongoDb);
309
+ this.logger.log(chalk_1.default.blue(`Configured lookup service ${name} with MongoDB`));
289
310
  }
290
311
  /**
291
312
  * Advanced configuration method for setting or overriding any
@@ -306,18 +327,22 @@ class OverlayExpress {
306
327
  ...this.engineConfig,
307
328
  ...params
308
329
  };
309
- this.logger.log(chalk_1.default.blue('โš™๏ธ Advanced Engine configuration params have been updated.'));
330
+ this.logger.log(chalk_1.default.blue('Advanced Engine configuration params have been updated.'));
310
331
  }
311
332
  /**
312
333
  * Configures the Overlay Engine itself.
313
334
  * By default, auto-configures SHIP and SLAP unless autoConfigureShipSlap = false
314
335
  * Then it merges in any advanced engine config from `this.engineConfig`.
315
336
  *
337
+ * When a BanService is available (from configureMongo), SHIP and SLAP lookup
338
+ * services are automatically wrapped with BanAwareLookupWrapper to prevent
339
+ * GASP from re-syncing banned tokens.
340
+ *
316
341
  * @param autoConfigureShipSlap - Whether to auto-configure SHIP and SLAP services (default: true)
317
342
  */
318
343
  async configureEngine(autoConfigureShipSlap = true) {
319
344
  var _a, _b, _c, _d, _e, _f, _g;
320
- this.ensureKnex();
345
+ const knex = this.ensureKnex();
321
346
  if (autoConfigureShipSlap) {
322
347
  // Auto-configure SHIP and SLAP services
323
348
  this.configureTopicManager('tm_ship', new DiscoveryServices.SHIPTopicManager());
@@ -325,6 +350,18 @@ class OverlayExpress {
325
350
  this.configureLookupServiceWithMongo('ls_ship', (db) => new DiscoveryServices.SHIPLookupService(new DiscoveryServices.SHIPStorage(db)));
326
351
  this.configureLookupServiceWithMongo('ls_slap', (db) => new DiscoveryServices.SLAPLookupService(new DiscoveryServices.SLAPStorage(db)));
327
352
  }
353
+ // Wrap SHIP/SLAP lookup services with ban-aware wrappers if BanService is available.
354
+ // This prevents GASP from re-syncing tokens whose domains or outpoints have been banned.
355
+ if (this.banService !== undefined) {
356
+ if (this.services.ls_ship !== undefined) {
357
+ this.services.ls_ship = new BanAwareLookupWrapper_js_1.BanAwareLookupWrapper(this.services.ls_ship, this.banService, 'SHIP', this.logger);
358
+ this.logger.log(chalk_1.default.blue('SHIP lookup service wrapped with ban-aware filter.'));
359
+ }
360
+ if (this.services.ls_slap !== undefined) {
361
+ this.services.ls_slap = new BanAwareLookupWrapper_js_1.BanAwareLookupWrapper(this.services.ls_slap, this.banService, 'SLAP', this.logger);
362
+ this.logger.log(chalk_1.default.blue('SLAP lookup service wrapped with ban-aware filter.'));
363
+ }
364
+ }
328
365
  // Construct a default sync configuration, in case the user doesn't want GASP at all:
329
366
  let syncConfig = {};
330
367
  if (!this.enableGASPSync) {
@@ -338,7 +375,7 @@ class OverlayExpress {
338
375
  syncConfig = (_a = this.engineConfig.syncConfiguration) !== null && _a !== void 0 ? _a : {};
339
376
  }
340
377
  // Build the actual Storage
341
- const storage = new overlay_1.KnexStorage(this.knex);
378
+ const storage = new overlay_1.KnexStorage(knex);
342
379
  // Include the KnexStorage migrations
343
380
  this.migrationsToRun = [...overlay_1.KnexStorageMigrations.default, ...this.migrationsToRun];
344
381
  // Prepare broadcaster if arcApiKey is set
@@ -400,34 +437,69 @@ class OverlayExpress {
400
437
  this.logger,
401
438
  // suppressDefaultSyncAdvertisements
402
439
  (_g = this.engineConfig.suppressDefaultSyncAdvertisements) !== null && _g !== void 0 ? _g : true);
403
- this.logger.log(chalk_1.default.green('๐Ÿš€ Engine has been configured.'));
440
+ // Create the server wallet for BSV mutual authentication.
441
+ // This uses the same private key as the WalletAdvertiser.
442
+ try {
443
+ const keyDeriver = new sdk_1.KeyDeriver(new sdk_1.PrivateKey(this.privateKey, 'hex'));
444
+ const storageManager = new wallet_toolbox_client_1.WalletStorageManager(keyDeriver.identityKey);
445
+ const signer = new wallet_toolbox_client_1.WalletSigner(this.network, keyDeriver, storageManager);
446
+ const services = new wallet_toolbox_client_1.Services(this.network);
447
+ const wallet = new wallet_toolbox_client_1.Wallet(signer, services);
448
+ this.serverWallet = wallet;
449
+ // Auto-set the admin identity key from the server's own key if not configured
450
+ if (typeof this.adminIdentityKey === 'undefined') {
451
+ this.adminIdentityKey = keyDeriver.identityKey;
452
+ }
453
+ this.logger.log(chalk_1.default.blue('Server wallet initialized for BSV mutual authentication.'));
454
+ }
455
+ catch (e) {
456
+ this.logger.log(chalk_1.default.yellow('Server wallet could not be initialized. BSV auth will not be available.'));
457
+ }
458
+ this.logger.log(chalk_1.default.green('Engine has been configured.'));
404
459
  }
405
460
  /**
406
- * Ensures that Knex is configured.
461
+ * Ensures that Knex is configured and returns it.
407
462
  * @throws Error if Knex is not configured
408
463
  */
409
464
  ensureKnex() {
410
465
  if (typeof this.knex === 'undefined') {
411
466
  throw new Error('You must configure your SQL database with the .configureKnex() method first!');
412
467
  }
468
+ return this.knex;
413
469
  }
414
470
  /**
415
- * Ensures that MongoDB is configured.
471
+ * Ensures that MongoDB is configured and returns it.
416
472
  * @throws Error if MongoDB is not configured
417
473
  */
418
474
  ensureMongo() {
419
475
  if (typeof this.mongoDb === 'undefined') {
420
476
  throw new Error('You must configure your MongoDB connection with the .configureMongo() method first!');
421
477
  }
478
+ return this.mongoDb;
422
479
  }
423
480
  /**
424
- * Ensures that the Overlay Engine is configured.
481
+ * Ensures that the Overlay Engine is configured and returns it.
425
482
  * @throws Error if the Engine is not configured
426
483
  */
427
484
  ensureEngine() {
428
485
  if (typeof this.engine === 'undefined') {
429
486
  throw new Error('You must configure your Overlay Services engine with the .configureEngine() method first!');
430
487
  }
488
+ return this.engine;
489
+ }
490
+ /**
491
+ * Creates a JanitorService instance with current configuration.
492
+ */
493
+ createJanitor() {
494
+ const mongoDb = this.ensureMongo();
495
+ return new JanitorService_js_1.JanitorService({
496
+ mongoDb,
497
+ logger: this.logger,
498
+ requestTimeoutMs: this.janitorConfig.requestTimeoutMs,
499
+ hostDownRevokeScore: this.janitorConfig.hostDownRevokeScore,
500
+ banService: this.banService,
501
+ autoBanOnRemoval: this.janitorConfig.autoBanOnRemoval
502
+ });
431
503
  }
432
504
  /**
433
505
  * Starts the Express server.
@@ -435,17 +507,16 @@ class OverlayExpress {
435
507
  */
436
508
  async start() {
437
509
  var _a, _b, _c;
438
- this.ensureEngine();
439
- this.ensureKnex();
440
- const engine = this.engine;
441
- const knex = this.knex;
510
+ const engine = this.ensureEngine();
511
+ const knex = this.ensureKnex();
512
+ this.startTime = new Date();
442
513
  this.app.use(body_parser_1.default.json({ limit: '1gb', type: 'application/json' }));
443
514
  this.app.use(body_parser_1.default.raw({ limit: '1gb', type: 'application/octet-stream' }));
444
515
  if (this.verboseRequestLogging) {
445
516
  this.app.use((req, res, next) => {
446
517
  const startTime = Date.now();
447
518
  // Log incoming request details
448
- this.logger.log(chalk_1.default.magenta.bold(`๐Ÿ“ฅ Incoming Request: ${String(req.method)} ${String(req.originalUrl)}`));
519
+ this.logger.log(chalk_1.default.magenta.bold(`Incoming Request: ${String(req.method)} ${String(req.originalUrl)}`));
449
520
  // Pretty-print headers
450
521
  this.logger.log(chalk_1.default.cyan('Headers:'));
451
522
  this.logger.log(util_1.default.inspect(req.headers, { colors: true, depth: null }));
@@ -480,7 +551,7 @@ class OverlayExpress {
480
551
  // Log outgoing response details after the response is finished
481
552
  res.on('finish', () => {
482
553
  const duration = Date.now() - startTime;
483
- this.logger.log(chalk_1.default.magenta.bold(`๐Ÿ“ค Outgoing Response: ${String(req.method)} ${String(req.originalUrl)} - Status: ${String(res.statusCode)} - Duration: ${String(duration)}ms`));
554
+ this.logger.log(chalk_1.default.magenta.bold(`Outgoing Response: ${String(req.method)} ${String(req.originalUrl)} - Status: ${String(res.statusCode)} - Duration: ${String(duration)}ms`));
484
555
  this.logger.log(chalk_1.default.cyan('Response Headers:'));
485
556
  this.logger.log(util_1.default.inspect(res.getHeaders(), { colors: true, depth: null }));
486
557
  // Handle response body
@@ -528,7 +599,10 @@ class OverlayExpress {
528
599
  // Serve a static documentation site or user interface
529
600
  this.app.get('/', (req, res) => {
530
601
  res.set('content-type', 'text/html');
531
- res.send((0, makeUserInterface_js_1.default)(this.webUIConfig));
602
+ res.send((0, makeUserInterface_js_1.default)({
603
+ ...this.webUIConfig,
604
+ adminIdentityKey: this.adminIdentityKey
605
+ }));
532
606
  });
533
607
  // Serve a health check endpoint
534
608
  this.app.get('/health', (_, res) => {
@@ -549,7 +623,6 @@ class OverlayExpress {
549
623
  });
550
624
  }
551
625
  })().catch(() => {
552
- // This catch is for any unforeseen errors in the async IIFE itself
553
626
  res.status(500).json({
554
627
  status: 'error',
555
628
  message: 'Unexpected error'
@@ -657,7 +730,7 @@ class OverlayExpress {
657
730
  }
658
731
  }
659
732
  catch (error) {
660
- console.error(chalk_1.default.red('โŒ Error in /submit:'), error);
733
+ console.error(chalk_1.default.red('Error in /submit:'), error);
661
734
  return res.status(400).json({
662
735
  status: 'error',
663
736
  message: error instanceof Error ? error.message : 'An unknown error occurred'
@@ -744,7 +817,7 @@ class OverlayExpress {
744
817
  return res.status(200).json({ status: 'success', message: 'Transaction status updated' });
745
818
  }
746
819
  catch (error) {
747
- console.error(chalk_1.default.red('โŒ Error in /arc-ingest:'), error);
820
+ console.error(chalk_1.default.red('Error in /arc-ingest:'), error);
748
821
  return res.status(400).json({
749
822
  status: 'error',
750
823
  message: error instanceof Error ? error.message : 'An unknown error occurred'
@@ -759,7 +832,7 @@ class OverlayExpress {
759
832
  });
760
833
  }
761
834
  else {
762
- this.logger.warn(chalk_1.default.yellow('โš ๏ธ Disabling ARC because no ARC API key was provided.'));
835
+ this.logger.warn(chalk_1.default.yellow('Disabling ARC because no ARC API key was provided.'));
763
836
  }
764
837
  // GASP sync routes if enabled
765
838
  if (this.enableGASPSync) {
@@ -772,7 +845,7 @@ class OverlayExpress {
772
845
  return res.status(200).json(response);
773
846
  }
774
847
  catch (error) {
775
- console.error(chalk_1.default.red('โŒ Error in /requestSyncResponse:'), error);
848
+ console.error(chalk_1.default.red('Error in /requestSyncResponse:'), error);
776
849
  return res.status(400).json({
777
850
  status: 'error',
778
851
  message: error instanceof Error ? error.message : 'An unknown error occurred'
@@ -794,7 +867,7 @@ class OverlayExpress {
794
867
  return res.status(200).json(response);
795
868
  }
796
869
  catch (error) {
797
- console.error(chalk_1.default.red('โŒ Error in /requestForeignGASPNode:'), error);
870
+ console.error(chalk_1.default.red('Error in /requestForeignGASPNode:'), error);
798
871
  return res.status(400).json({
799
872
  status: 'error',
800
873
  message: error instanceof Error ? error.message : 'An unknown error occurred'
@@ -809,29 +882,413 @@ class OverlayExpress {
809
882
  });
810
883
  }
811
884
  else {
812
- this.logger.warn(chalk_1.default.yellow('โš ๏ธ GASP sync is disabled.'));
885
+ this.logger.warn(chalk_1.default.yellow('GASP sync is disabled.'));
813
886
  }
814
887
  /**
815
888
  * ============== ADMIN ROUTES ==============
816
- * These routes expose advanced engine operations
817
- * and require a valid Bearer token for access.
889
+ * These routes expose advanced engine operations.
890
+ * Authentication: Bearer token OR BSV mutual auth (identity key match).
891
+ */
892
+ /**
893
+ * Set up BSV mutual authentication middleware if a server wallet is available.
894
+ * This handles the /.well-known/auth handshake automatically.
895
+ * With allowUnauthenticated: true, it passes through when no BSV auth headers
896
+ * are present, allowing Bearer token fallback.
818
897
  */
898
+ if (this.serverWallet !== undefined) {
899
+ const bsvAuth = (0, auth_express_middleware_1.createAuthMiddleware)({
900
+ wallet: this.serverWallet,
901
+ allowUnauthenticated: true
902
+ });
903
+ this.app.use(bsvAuth);
904
+ this.logger.log(chalk_1.default.blue('BSV mutual authentication middleware enabled.'));
905
+ }
819
906
  /**
820
- * Middleware for checking the admin bearer token.
907
+ * Middleware for checking admin authentication.
908
+ * Supports two authentication methods:
909
+ * 1. Bearer token (Authorization: Bearer <token>) - for cron jobs, scripts, and fallback
910
+ * 2. BSV mutual auth - if req.auth.identityKey matches the admin identity key
821
911
  */
822
912
  const checkAdminAuth = (req, res, next) => {
823
- const authHeader = req.headers.authorization;
824
- if (typeof authHeader !== 'string' || !authHeader.startsWith('Bearer ')) {
825
- res.status(401).json({ status: 'error', message: 'Unauthorized: Missing Bearer token' });
913
+ // Method 1: BSV mutual authentication (identity key match)
914
+ const authReq = req;
915
+ if (typeof this.adminIdentityKey === 'string' &&
916
+ authReq.auth !== undefined &&
917
+ typeof authReq.auth.identityKey === 'string' &&
918
+ authReq.auth.identityKey !== 'unknown' &&
919
+ authReq.auth.identityKey === this.adminIdentityKey) {
920
+ next();
826
921
  return;
827
922
  }
828
- const token = authHeader.substring('Bearer '.length);
829
- if (token !== this.adminToken) {
830
- res.status(403).json({ status: 'error', message: 'Forbidden: Invalid Bearer token' });
923
+ // Method 2: Bearer token authentication
924
+ const authHeader = req.headers.authorization;
925
+ if (typeof authHeader === 'string' && authHeader.startsWith('Bearer ')) {
926
+ const token = authHeader.substring('Bearer '.length);
927
+ if (token === this.adminToken) {
928
+ next();
929
+ return;
930
+ }
931
+ res.status(403).json({ status: 'error', message: 'Forbidden: Invalid credentials' });
831
932
  return;
832
933
  }
833
- next();
934
+ res.status(401).json({ status: 'error', message: 'Unauthorized: Provide a Bearer token or authenticate with your wallet' });
834
935
  };
936
+ /**
937
+ * Public endpoint that returns the admin identity key (if configured).
938
+ * This allows the frontend to detect whether the current wallet user
939
+ * is the admin by comparing their identity key against this value.
940
+ * The identity key is a public key, so exposing it is safe.
941
+ */
942
+ this.app.get('/admin/config', (_, res) => {
943
+ var _a;
944
+ res.status(200).json({
945
+ adminIdentityKey: (_a = this.adminIdentityKey) !== null && _a !== void 0 ? _a : null,
946
+ nodeName: this.name
947
+ });
948
+ });
949
+ /**
950
+ * Admin route: Get server statistics and overview.
951
+ */
952
+ this.app.get('/admin/stats', checkAdminAuth, (req, res) => {
953
+ ;
954
+ (async () => {
955
+ var _a, _b, _c;
956
+ try {
957
+ const db = this.ensureMongo();
958
+ const [shipCount, slapCount, banStats] = await Promise.all([
959
+ db.collection('shipRecords').countDocuments(),
960
+ db.collection('slapRecords').countDocuments(),
961
+ (_b = (_a = this.banService) === null || _a === void 0 ? void 0 : _a.getStats()) !== null && _b !== void 0 ? _b : { domainBans: 0, outpointBans: 0, totalBans: 0 }
962
+ ]);
963
+ return res.status(200).json({
964
+ status: 'success',
965
+ data: {
966
+ nodeName: this.name,
967
+ network: this.network,
968
+ uptime: this.startTime !== undefined ? Date.now() - this.startTime.getTime() : 0,
969
+ startedAt: (_c = this.startTime) === null || _c === void 0 ? void 0 : _c.toISOString(),
970
+ shipRecordCount: shipCount,
971
+ slapRecordCount: slapCount,
972
+ bannedDomains: banStats.domainBans,
973
+ bannedOutpoints: banStats.outpointBans,
974
+ totalBans: banStats.totalBans,
975
+ topicManagers: Object.keys(this.managers),
976
+ lookupServices: Object.keys(this.services),
977
+ gaspSyncEnabled: this.enableGASPSync
978
+ }
979
+ });
980
+ }
981
+ catch (error) {
982
+ return res.status(400).json({
983
+ status: 'error',
984
+ message: error instanceof Error ? error.message : 'An unknown error occurred'
985
+ });
986
+ }
987
+ })().catch(() => {
988
+ res.status(500).json({ status: 'error', message: 'Unexpected error' });
989
+ });
990
+ });
991
+ /**
992
+ * Admin route: List all SHIP records with full details.
993
+ */
994
+ this.app.get('/admin/ship-records', checkAdminAuth, (req, res) => {
995
+ ;
996
+ (async () => {
997
+ try {
998
+ const db = this.ensureMongo();
999
+ const collection = db.collection('shipRecords');
1000
+ const search = typeof req.query.search === 'string' ? req.query.search : undefined;
1001
+ const rawPage = parseInt(req.query.page, 10);
1002
+ const page = Math.max(1, Number.isNaN(rawPage) ? 1 : rawPage);
1003
+ const rawLimit = parseInt(req.query.limit, 10);
1004
+ const limit = Math.min(200, Math.max(1, Number.isNaN(rawLimit) ? 50 : rawLimit));
1005
+ const skip = (page - 1) * limit;
1006
+ const query = {};
1007
+ if (typeof search === 'string' && search.length > 0) {
1008
+ query.$or = [
1009
+ { domain: { $regex: search, $options: 'i' } },
1010
+ { topic: { $regex: search, $options: 'i' } },
1011
+ { identityKey: { $regex: search, $options: 'i' } },
1012
+ { txid: { $regex: search, $options: 'i' } }
1013
+ ];
1014
+ }
1015
+ const [records, total] = await Promise.all([
1016
+ collection.find(query).sort({ createdAt: -1 }).skip(skip).limit(limit).toArray(),
1017
+ collection.countDocuments(query)
1018
+ ]);
1019
+ return res.status(200).json({
1020
+ status: 'success',
1021
+ data: { records, total, page, limit, pages: Math.ceil(total / limit) }
1022
+ });
1023
+ }
1024
+ catch (error) {
1025
+ return res.status(400).json({
1026
+ status: 'error',
1027
+ message: error instanceof Error ? error.message : 'An unknown error occurred'
1028
+ });
1029
+ }
1030
+ })().catch(() => {
1031
+ res.status(500).json({ status: 'error', message: 'Unexpected error' });
1032
+ });
1033
+ });
1034
+ /**
1035
+ * Admin route: List all SLAP records with full details.
1036
+ */
1037
+ this.app.get('/admin/slap-records', checkAdminAuth, (req, res) => {
1038
+ ;
1039
+ (async () => {
1040
+ try {
1041
+ const db = this.ensureMongo();
1042
+ const collection = db.collection('slapRecords');
1043
+ const search = typeof req.query.search === 'string' ? req.query.search : undefined;
1044
+ const rawPage = parseInt(req.query.page, 10);
1045
+ const page = Math.max(1, Number.isNaN(rawPage) ? 1 : rawPage);
1046
+ const rawLimit = parseInt(req.query.limit, 10);
1047
+ const limit = Math.min(200, Math.max(1, Number.isNaN(rawLimit) ? 50 : rawLimit));
1048
+ const skip = (page - 1) * limit;
1049
+ const query = {};
1050
+ if (typeof search === 'string' && search.length > 0) {
1051
+ query.$or = [
1052
+ { domain: { $regex: search, $options: 'i' } },
1053
+ { service: { $regex: search, $options: 'i' } },
1054
+ { identityKey: { $regex: search, $options: 'i' } },
1055
+ { txid: { $regex: search, $options: 'i' } }
1056
+ ];
1057
+ }
1058
+ const [records, total] = await Promise.all([
1059
+ collection.find(query).sort({ createdAt: -1 }).skip(skip).limit(limit).toArray(),
1060
+ collection.countDocuments(query)
1061
+ ]);
1062
+ return res.status(200).json({
1063
+ status: 'success',
1064
+ data: { records, total, page, limit, pages: Math.ceil(total / limit) }
1065
+ });
1066
+ }
1067
+ catch (error) {
1068
+ return res.status(400).json({
1069
+ status: 'error',
1070
+ message: error instanceof Error ? error.message : 'An unknown error occurred'
1071
+ });
1072
+ }
1073
+ })().catch(() => {
1074
+ res.status(500).json({ status: 'error', message: 'Unexpected error' });
1075
+ });
1076
+ });
1077
+ /**
1078
+ * Admin route: Check health of a specific URL.
1079
+ */
1080
+ this.app.post('/admin/health-check', checkAdminAuth, (req, res) => {
1081
+ ;
1082
+ (async () => {
1083
+ try {
1084
+ const { url } = req.body;
1085
+ if (typeof url !== 'string' || url.length === 0) {
1086
+ return res.status(400).json({ status: 'error', message: 'url is required' });
1087
+ }
1088
+ const janitor = this.createJanitor();
1089
+ const result = await janitor.checkHost(url);
1090
+ return res.status(200).json({ status: 'success', data: { url, ...result } });
1091
+ }
1092
+ catch (error) {
1093
+ return res.status(400).json({
1094
+ status: 'error',
1095
+ message: error instanceof Error ? error.message : 'An unknown error occurred'
1096
+ });
1097
+ }
1098
+ })().catch(() => {
1099
+ res.status(500).json({ status: 'error', message: 'Unexpected error' });
1100
+ });
1101
+ });
1102
+ /**
1103
+ * Admin route: Ban a domain or outpoint.
1104
+ */
1105
+ this.app.post('/admin/ban', checkAdminAuth, (req, res) => {
1106
+ ;
1107
+ (async () => {
1108
+ try {
1109
+ if (this.banService === undefined) {
1110
+ return res.status(400).json({ status: 'error', message: 'Ban service not available (MongoDB not configured)' });
1111
+ }
1112
+ const { type, value, reason } = req.body;
1113
+ if (type !== 'domain' && type !== 'outpoint') {
1114
+ return res.status(400).json({ status: 'error', message: 'type must be "domain" or "outpoint"' });
1115
+ }
1116
+ if (typeof value !== 'string' || value.length === 0) {
1117
+ return res.status(400).json({ status: 'error', message: 'value is required' });
1118
+ }
1119
+ if (type === 'domain') {
1120
+ await this.banService.banDomain(value, reason);
1121
+ // Also remove any existing records for this domain from SHIP and SLAP
1122
+ const db = this.ensureMongo();
1123
+ const [shipDeleted, slapDeleted] = await Promise.all([
1124
+ db.collection('shipRecords').deleteMany({ domain: value }),
1125
+ db.collection('slapRecords').deleteMany({ domain: value })
1126
+ ]);
1127
+ return res.status(200).json({
1128
+ status: 'success',
1129
+ message: `Domain "${value}" banned. Removed ${shipDeleted.deletedCount} SHIP and ${slapDeleted.deletedCount} SLAP records.`
1130
+ });
1131
+ }
1132
+ else {
1133
+ // Parse outpoint: "txid.outputIndex"
1134
+ const dotIndex = value.lastIndexOf('.');
1135
+ if (dotIndex === -1) {
1136
+ return res.status(400).json({ status: 'error', message: 'Outpoint format must be "txid.outputIndex"' });
1137
+ }
1138
+ const txid = value.substring(0, dotIndex);
1139
+ const outputIndex = parseInt(value.substring(dotIndex + 1));
1140
+ if (isNaN(outputIndex)) {
1141
+ return res.status(400).json({ status: 'error', message: 'Invalid outputIndex in outpoint' });
1142
+ }
1143
+ await this.banService.banOutpoint(txid, outputIndex, reason);
1144
+ // Also evict from lookup services
1145
+ const services = Object.values(engine.lookupServices);
1146
+ for (const service of services) {
1147
+ try {
1148
+ await service.outputEvicted(txid, outputIndex);
1149
+ }
1150
+ catch {
1151
+ continue;
1152
+ }
1153
+ }
1154
+ return res.status(200).json({
1155
+ status: 'success',
1156
+ message: `Outpoint "${value}" banned and evicted from lookup services.`
1157
+ });
1158
+ }
1159
+ }
1160
+ catch (error) {
1161
+ return res.status(400).json({
1162
+ status: 'error',
1163
+ message: error instanceof Error ? error.message : 'An unknown error occurred'
1164
+ });
1165
+ }
1166
+ })().catch(() => {
1167
+ res.status(500).json({ status: 'error', message: 'Unexpected error' });
1168
+ });
1169
+ });
1170
+ /**
1171
+ * Admin route: Remove a ban.
1172
+ */
1173
+ this.app.post('/admin/unban', checkAdminAuth, (req, res) => {
1174
+ ;
1175
+ (async () => {
1176
+ try {
1177
+ if (this.banService === undefined) {
1178
+ return res.status(400).json({ status: 'error', message: 'Ban service not available' });
1179
+ }
1180
+ const { type, value } = req.body;
1181
+ if (type !== 'domain' && type !== 'outpoint') {
1182
+ return res.status(400).json({ status: 'error', message: 'type must be "domain" or "outpoint"' });
1183
+ }
1184
+ if (typeof value !== 'string' || value.length === 0) {
1185
+ return res.status(400).json({ status: 'error', message: 'value is required' });
1186
+ }
1187
+ await this.banService.removeBan(type, value);
1188
+ return res.status(200).json({ status: 'success', message: `${type} "${String(value)}" unbanned.` });
1189
+ }
1190
+ catch (error) {
1191
+ return res.status(400).json({
1192
+ status: 'error',
1193
+ message: error instanceof Error ? error.message : 'An unknown error occurred'
1194
+ });
1195
+ }
1196
+ })().catch(() => {
1197
+ res.status(500).json({ status: 'error', message: 'Unexpected error' });
1198
+ });
1199
+ });
1200
+ /**
1201
+ * Admin route: List all bans.
1202
+ */
1203
+ this.app.get('/admin/bans', checkAdminAuth, (req, res) => {
1204
+ ;
1205
+ (async () => {
1206
+ try {
1207
+ if (this.banService === undefined) {
1208
+ return res.status(200).json({ status: 'success', data: { bans: [] } });
1209
+ }
1210
+ const type = req.query.type;
1211
+ const validType = type === 'domain' || type === 'outpoint' ? type : undefined;
1212
+ const bans = await this.banService.listBans(validType);
1213
+ return res.status(200).json({ status: 'success', data: { bans } });
1214
+ }
1215
+ catch (error) {
1216
+ return res.status(400).json({
1217
+ status: 'error',
1218
+ message: error instanceof Error ? error.message : 'An unknown error occurred'
1219
+ });
1220
+ }
1221
+ })().catch(() => {
1222
+ res.status(500).json({ status: 'error', message: 'Unexpected error' });
1223
+ });
1224
+ });
1225
+ /**
1226
+ * Admin route: Remove a token by outpoint, optionally banning the domain.
1227
+ */
1228
+ this.app.post('/admin/remove-token', checkAdminAuth, (req, res) => {
1229
+ ;
1230
+ (async () => {
1231
+ var _a;
1232
+ try {
1233
+ const { txid, outputIndex, service, ban, banDomain: shouldBanDomain } = req.body;
1234
+ if (typeof txid !== 'string' || typeof outputIndex !== 'number') {
1235
+ return res.status(400).json({ status: 'error', message: 'txid (string) and outputIndex (number) are required' });
1236
+ }
1237
+ // Get the domain before removing (for ban option)
1238
+ let removedDomain;
1239
+ if (shouldBanDomain === true || ban === true) {
1240
+ const db = this.ensureMongo();
1241
+ const shipRecord = await db.collection('shipRecords').findOne({ txid, outputIndex });
1242
+ const slapRecord = await db.collection('slapRecords').findOne({ txid, outputIndex });
1243
+ removedDomain = ((_a = shipRecord === null || shipRecord === void 0 ? void 0 : shipRecord.domain) !== null && _a !== void 0 ? _a : slapRecord === null || slapRecord === void 0 ? void 0 : slapRecord.domain);
1244
+ }
1245
+ // Evict from specified service or all services
1246
+ if (typeof service === 'string') {
1247
+ const svc = engine.lookupServices[service];
1248
+ if (svc !== undefined) {
1249
+ await svc.outputEvicted(txid, outputIndex);
1250
+ }
1251
+ }
1252
+ else {
1253
+ const services = Object.values(engine.lookupServices);
1254
+ for (const svc of services) {
1255
+ try {
1256
+ await svc.outputEvicted(txid, outputIndex);
1257
+ }
1258
+ catch {
1259
+ continue;
1260
+ }
1261
+ }
1262
+ }
1263
+ // Ban the outpoint if requested
1264
+ if (ban === true && this.banService !== undefined) {
1265
+ await this.banService.banOutpoint(txid, outputIndex, 'Manually removed by admin', removedDomain);
1266
+ }
1267
+ // Ban the domain if requested
1268
+ if (shouldBanDomain === true && typeof removedDomain === 'string' && this.banService !== undefined) {
1269
+ await this.banService.banDomain(removedDomain, 'Domain banned by admin via token removal');
1270
+ // Remove all records for this domain
1271
+ const banDb = this.ensureMongo();
1272
+ await Promise.all([
1273
+ banDb.collection('shipRecords').deleteMany({ domain: removedDomain }),
1274
+ banDb.collection('slapRecords').deleteMany({ domain: removedDomain })
1275
+ ]);
1276
+ }
1277
+ return res.status(200).json({
1278
+ status: 'success',
1279
+ message: `Token ${txid}.${outputIndex} removed.${ban === true ? ' Outpoint banned.' : ''}${shouldBanDomain === true && typeof removedDomain === 'string' ? ` Domain "${removedDomain}" banned.` : ''}`
1280
+ });
1281
+ }
1282
+ catch (error) {
1283
+ return res.status(400).json({
1284
+ status: 'error',
1285
+ message: error instanceof Error ? error.message : 'An unknown error occurred'
1286
+ });
1287
+ }
1288
+ })().catch(() => {
1289
+ res.status(500).json({ status: 'error', message: 'Unexpected error' });
1290
+ });
1291
+ });
835
1292
  /**
836
1293
  * Admin route to manually sync advertisements, calling `engine.syncAdvertisements()`.
837
1294
  */
@@ -843,7 +1300,7 @@ class OverlayExpress {
843
1300
  return res.status(200).json({ status: 'success', message: 'Advertisements synced successfully' });
844
1301
  }
845
1302
  catch (error) {
846
- console.error(chalk_1.default.red('โŒ Error in /admin/syncAdvertisements:'), error);
1303
+ console.error(chalk_1.default.red('Error in /admin/syncAdvertisements:'), error);
847
1304
  return res.status(400).json({
848
1305
  status: 'error',
849
1306
  message: error instanceof Error ? error.message : 'An unknown error occurred'
@@ -867,7 +1324,7 @@ class OverlayExpress {
867
1324
  return res.status(200).json({ status: 'success', message: 'GASP sync started and completed' });
868
1325
  }
869
1326
  catch (error) {
870
- console.error(chalk_1.default.red('โŒ Error in /admin/startGASPSync:'), error);
1327
+ console.error(chalk_1.default.red('Error in /admin/startGASPSync:'), error);
871
1328
  return res.status(400).json({
872
1329
  status: 'error',
873
1330
  message: error instanceof Error ? error.message : 'An unknown error occurred'
@@ -905,7 +1362,7 @@ class OverlayExpress {
905
1362
  return res.status(200).json({ status: 'success', message: 'Outpoint evicted' });
906
1363
  }
907
1364
  catch (error) {
908
- console.error(chalk_1.default.red('โŒ Error in /admin/evictOutpoint:'), error);
1365
+ console.error(chalk_1.default.red('Error in /admin/evictOutpoint:'), error);
909
1366
  return res.status(400).json({
910
1367
  status: 'error',
911
1368
  message: error instanceof Error ? error.message : 'An unknown error occurred'
@@ -919,24 +1376,18 @@ class OverlayExpress {
919
1376
  });
920
1377
  });
921
1378
  /**
922
- * Admin route to run the janitor service.
1379
+ * Admin route to run the janitor service with enhanced reporting.
923
1380
  */
924
1381
  this.app.post('/admin/janitor', checkAdminAuth, (req, res) => {
925
1382
  ;
926
1383
  (async () => {
927
1384
  try {
928
- this.ensureMongo();
929
- const janitor = new JanitorService_js_1.JanitorService({
930
- mongoDb: this.mongoDb,
931
- logger: this.logger,
932
- requestTimeoutMs: this.janitorConfig.requestTimeoutMs,
933
- hostDownRevokeScore: this.janitorConfig.hostDownRevokeScore
934
- });
935
- await janitor.run();
936
- return res.status(200).json({ status: 'success', message: 'Janitor run completed' });
1385
+ const janitor = this.createJanitor();
1386
+ const report = await janitor.run();
1387
+ return res.status(200).json({ status: 'success', message: 'Janitor run completed', data: report });
937
1388
  }
938
1389
  catch (error) {
939
- console.error(chalk_1.default.red('โŒ Error in /admin/janitor:'), error);
1390
+ console.error(chalk_1.default.red('Error in /admin/janitor:'), error);
940
1391
  return res.status(400).json({
941
1392
  status: 'error',
942
1393
  message: error instanceof Error ? error.message : 'An unknown error occurred'
@@ -954,10 +1405,10 @@ class OverlayExpress {
954
1405
  const result = await knex.migrate.latest({
955
1406
  migrationSource
956
1407
  });
957
- this.logger.log(chalk_1.default.green('๐Ÿ”„ Knex migrations run'), result);
1408
+ this.logger.log(chalk_1.default.green('Knex migrations run'), result);
958
1409
  // 404 handler for all other routes
959
1410
  this.app.use((req, res) => {
960
- this.logger.log(chalk_1.default.red('โŒ 404 Not Found:'), req.url);
1411
+ this.logger.log(chalk_1.default.red('404 Not Found:'), req.url);
961
1412
  res.status(404).json({
962
1413
  status: 'error',
963
1414
  code: 'ERR_ROUTE_NOT_FOUND',
@@ -979,7 +1430,7 @@ class OverlayExpress {
979
1430
  await ((_b = this.engine) === null || _b === void 0 ? void 0 : _b.syncAdvertisements());
980
1431
  }
981
1432
  catch (e) {
982
- this.logger.log(chalk_1.default.red('โŒ Error syncing advertisements:'), e);
1433
+ this.logger.log(chalk_1.default.red('Error syncing advertisements:'), e);
983
1434
  }
984
1435
  // Attempt to do GASP sync if enabled
985
1436
  if (this.enableGASPSync) {
@@ -989,7 +1440,7 @@ class OverlayExpress {
989
1440
  this.logger.log(chalk_1.default.green('GASP sync complete!'));
990
1441
  }
991
1442
  catch (e) {
992
- console.error(chalk_1.default.red('โŒ Failed to GASP sync'), e);
1443
+ console.error(chalk_1.default.red('Failed to GASP sync'), e);
993
1444
  }
994
1445
  }
995
1446
  else {
@@ -997,7 +1448,7 @@ class OverlayExpress {
997
1448
  }
998
1449
  // Start listening on the configured port
999
1450
  this.app.listen(this.port, () => {
1000
- this.logger.log(chalk_1.default.green.bold(`๐ŸŽง ${this.name} is ready and listening on local port ${this.port}`));
1451
+ this.logger.log(chalk_1.default.green.bold(`${this.name} is ready and listening on local port ${this.port}`));
1001
1452
  });
1002
1453
  }
1003
1454
  }