pinggy 0.4.6 → 0.4.8

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.
@@ -1449,11 +1449,23 @@ async function startFileServer(dirPath, port = 8080) {
1449
1449
  // src/workers/file_serve_worker.ts
1450
1450
  (async () => {
1451
1451
  try {
1452
- const { dir, port } = import_worker_threads.workerData;
1453
- const portNum = parseInt(port.split(":")[1]);
1452
+ const { dir, forwarding } = import_worker_threads.workerData;
1453
+ logger.debug("file_serve_worker received workerData", { dir, forwarding: JSON.stringify(forwarding) });
1454
+ let address;
1455
+ if (typeof forwarding === "string") {
1456
+ address = forwarding;
1457
+ } else if (Array.isArray(forwarding) && forwarding.length > 0) {
1458
+ address = forwarding[0]?.address;
1459
+ }
1460
+ logger.debug("file_serve_worker resolved address", { address });
1461
+ const match = typeof address === "string" ? address.match(/:(\d+)\/?$/) : null;
1462
+ const portNum = match ? parseInt(match[1], 10) : void 0;
1463
+ logger.debug("file_serve_worker resolved port", { portNum, defaultPort: portNum ?? 8080 });
1454
1464
  const result = await startFileServer(dir, portNum);
1465
+ logger.info("file_serve_worker static file server started", { dir, port: portNum ?? 8080 });
1455
1466
  import_worker_threads.parentPort?.postMessage({ type: "started", portNum });
1456
1467
  if (result.hasInvalidPath && result.error) {
1468
+ logger.warn("file_serve_worker invalid path warning", { message: result.error.message, code: result.error.code });
1457
1469
  import_worker_threads.parentPort?.postMessage({
1458
1470
  type: "warning",
1459
1471
  message: result.error.message,
@@ -1415,11 +1415,23 @@ async function startFileServer(dirPath, port = 8080) {
1415
1415
  // src/workers/file_serve_worker.ts
1416
1416
  (async () => {
1417
1417
  try {
1418
- const { dir, port } = workerData;
1419
- const portNum = parseInt(port.split(":")[1]);
1418
+ const { dir, forwarding } = workerData;
1419
+ logger.debug("file_serve_worker received workerData", { dir, forwarding: JSON.stringify(forwarding) });
1420
+ let address;
1421
+ if (typeof forwarding === "string") {
1422
+ address = forwarding;
1423
+ } else if (Array.isArray(forwarding) && forwarding.length > 0) {
1424
+ address = forwarding[0]?.address;
1425
+ }
1426
+ logger.debug("file_serve_worker resolved address", { address });
1427
+ const match = typeof address === "string" ? address.match(/:(\d+)\/?$/) : null;
1428
+ const portNum = match ? parseInt(match[1], 10) : void 0;
1429
+ logger.debug("file_serve_worker resolved port", { portNum, defaultPort: portNum ?? 8080 });
1420
1430
  const result = await startFileServer(dir, portNum);
1431
+ logger.info("file_serve_worker static file server started", { dir, port: portNum ?? 8080 });
1421
1432
  parentPort?.postMessage({ type: "started", portNum });
1422
1433
  if (result.hasInvalidPath && result.error) {
1434
+ logger.warn("file_serve_worker invalid path warning", { message: result.error.message, code: result.error.code });
1423
1435
  parentPort?.postMessage({
1424
1436
  type: "warning",
1425
1437
  message: result.error.message,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinggy",
3
- "version": "0.4.6",
3
+ "version": "0.4.8",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "description": "Create secure, shareable tunnels to your localhost and manage them from the command line. ",
@@ -51,7 +51,7 @@
51
51
  ]
52
52
  },
53
53
  "dependencies": {
54
- "@pinggy/pinggy": "^0.4.3",
54
+ "@pinggy/pinggy": "^0.4.4",
55
55
  "blessed": "^0.1.81",
56
56
  "clipboardy": "^5.0.0",
57
57
  "mime": "^4.1.0",