@threadbase-sh/streamer 1.18.6 → 1.19.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.
package/dist/index.d.cts CHANGED
@@ -281,6 +281,7 @@ interface ServerConfig {
281
281
  apiKey?: string;
282
282
  localNoAuth?: boolean;
283
283
  verbose?: boolean;
284
+ logMenubarRequests?: boolean;
284
285
  browseRoot?: string;
285
286
  publicUrl?: string;
286
287
  disableDb?: boolean;
@@ -629,6 +630,7 @@ declare class WSHub {
629
630
  type ApiDeps = {
630
631
  apiKey: string;
631
632
  localNoAuth: boolean;
633
+ logMenubarRequests: boolean;
632
634
  publicUrl: string | null;
633
635
  browseRoot: string | null;
634
636
  ptyManager: PTYManager;
@@ -753,6 +755,7 @@ declare class StreamerServer {
753
755
  private cacheReady;
754
756
  private apiKey;
755
757
  private localNoAuth;
758
+ private logMenubarRequests;
756
759
  private verbose;
757
760
  private scanProfiles;
758
761
  private dbPool;
package/dist/index.d.ts CHANGED
@@ -281,6 +281,7 @@ interface ServerConfig {
281
281
  apiKey?: string;
282
282
  localNoAuth?: boolean;
283
283
  verbose?: boolean;
284
+ logMenubarRequests?: boolean;
284
285
  browseRoot?: string;
285
286
  publicUrl?: string;
286
287
  disableDb?: boolean;
@@ -629,6 +630,7 @@ declare class WSHub {
629
630
  type ApiDeps = {
630
631
  apiKey: string;
631
632
  localNoAuth: boolean;
633
+ logMenubarRequests: boolean;
632
634
  publicUrl: string | null;
633
635
  browseRoot: string | null;
634
636
  ptyManager: PTYManager;
@@ -753,6 +755,7 @@ declare class StreamerServer {
753
755
  private cacheReady;
754
756
  private apiKey;
755
757
  private localNoAuth;
758
+ private logMenubarRequests;
756
759
  private verbose;
757
760
  private scanProfiles;
758
761
  private dbPool;
package/dist/index.js CHANGED
@@ -1479,14 +1479,19 @@ var POOL_SIZE_MULTIPLIER = 128;
1479
1479
  var pool;
1480
1480
  var poolOffset;
1481
1481
  var fillPool = (bytes) => {
1482
- if (bytes < 0 || bytes > 1024) throw new RangeError("Wrong ID size");
1483
- if (!pool || pool.length < bytes) {
1484
- pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER);
1485
- crypto2.randomFillSync(pool);
1486
- poolOffset = 0;
1487
- } else if (poolOffset + bytes > pool.length) {
1488
- crypto2.randomFillSync(pool);
1489
- poolOffset = 0;
1482
+ if (bytes < 0) throw new RangeError("Wrong ID size");
1483
+ try {
1484
+ if (!pool || pool.length < bytes) {
1485
+ pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER);
1486
+ crypto2.randomFillSync(pool);
1487
+ poolOffset = 0;
1488
+ } else if (poolOffset + bytes > pool.length) {
1489
+ crypto2.randomFillSync(pool);
1490
+ poolOffset = 0;
1491
+ }
1492
+ } catch (e) {
1493
+ pool = void 0;
1494
+ throw e;
1490
1495
  }
1491
1496
  poolOffset += bytes;
1492
1497
  };
@@ -2160,6 +2165,7 @@ var createHonoApp = (deps, upgradeWebSocket) => {
2160
2165
  const start = Date.now();
2161
2166
  const ua = c.req.header("user-agent") ?? "";
2162
2167
  await next();
2168
+ if (!deps.logMenubarRequests && c.req.header("x-client") === "menubar") return;
2163
2169
  const ms = Date.now() - start;
2164
2170
  httpLog.info(`[req] ${c.req.method} ${c.req.path} \u2192 ${c.res.status} ${ms}ms`, {
2165
2171
  method: c.req.method,
@@ -4318,6 +4324,7 @@ var StreamerServer = class {
4318
4324
  cacheReady = false;
4319
4325
  apiKey;
4320
4326
  localNoAuth;
4327
+ logMenubarRequests;
4321
4328
  verbose;
4322
4329
  scanProfiles;
4323
4330
  dbPool = null;
@@ -4362,6 +4369,7 @@ var StreamerServer = class {
4362
4369
  this.sessionStatusBus.setMaxListeners(0);
4363
4370
  this.apiKey = config.apiKey;
4364
4371
  this.localNoAuth = config.localNoAuth ?? false;
4372
+ this.logMenubarRequests = config.logMenubarRequests ?? false;
4365
4373
  this.verbose = config.verbose ?? false;
4366
4374
  this.disableDb = config.disableDb ?? false;
4367
4375
  this.scanProfiles = config.scanProfiles;
@@ -4541,6 +4549,7 @@ var StreamerServer = class {
4541
4549
  const apiDeps = {
4542
4550
  apiKey: this.apiKey,
4543
4551
  localNoAuth: this.localNoAuth,
4552
+ logMenubarRequests: this.logMenubarRequests,
4544
4553
  publicUrl: this.publicUrl,
4545
4554
  browseRoot: this.browseRoot,
4546
4555
  ptyManager: this.ptyManager,