pinggy 0.1.1 → 0.1.2

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.
@@ -15,11 +15,15 @@ import { withFullScreen } from "fullscreen-ink";
15
15
  import path from "node:path";
16
16
  import { Worker } from "node:worker_threads";
17
17
  import { getFreePort } from "../utils/getFreePort.js";
18
+ import { fileURLToPath } from "url";
18
19
  const TunnelData = {
19
20
  urls: null,
20
21
  greet: null,
21
22
  usage: null,
22
23
  };
24
+ const __filename = fileURLToPath(import.meta.url);
25
+ const __dirname = path.dirname(__filename);
26
+ let inkInstance = null;
23
27
  export function startCli(finalConfig, manager) {
24
28
  return __awaiter(this, void 0, void 0, function* () {
25
29
  if (!finalConfig.NoTUI && finalConfig.webDebugger === "") {
@@ -27,7 +31,7 @@ export function startCli(finalConfig, manager) {
27
31
  const freePort = yield getFreePort(finalConfig.webDebugger || "");
28
32
  finalConfig.webDebugger = `localhost:${freePort}`;
29
33
  }
30
- const workerPath = path.resolve("./dist/cli/worker.js");
34
+ const workerPath = path.resolve(__dirname, "worker.js");
31
35
  try {
32
36
  const worker = new Worker(workerPath, {
33
37
  workerData: { finalConfig },
package/dist/tui/index.js CHANGED
@@ -95,6 +95,6 @@ const TunnelTui = ({ urls, greet, tunnelConfig }) => {
95
95
  return (_jsxs(_Fragment, { children: [_jsx(Container, { children: _jsx(Borders, { children: _jsxs(Box, { flexDirection: "column", height: "100%", justifyContent: "space-between", children: [_jsxs(Box, { flexDirection: "column", children: [greet && (_jsx(Box, { justifyContent: "center", width: "94%", marginBottom: 1, children: _jsx(Text, { color: "cyanBright", bold: true, children: greet }) })), _jsxs(Box, { flexDirection: "row", justifyContent: "space-evenly", width: "100%", paddingY: 1, children: [_jsx(URLsSection, { urls: urls, currentQrIndex: currentQrIndex }), _jsx(StatsSection, { stats: stats })] }), _jsxs(Box, { flexDirection: "row", justifyContent: "space-evenly", width: "100%", paddingY: 1, children: [_jsxs(Box, { flexDirection: "column", marginBottom: 1, width: isQrCodeRequested ? "60%" : "80%", children: [_jsx(Text, { color: "yellowBright", children: "HTTP Requests:" }), visiblePairs.map((pair, i) => {
96
96
  var _a, _b, _c, _d;
97
97
  return (_jsx(Text, { children: _jsxs(Text, { color: selectedIndex === startIndex + i ? "cyanBright" : getStatusColor(((_a = pair.response) === null || _a === void 0 ? void 0 : _a.status) || ""), children: [selectedIndex === startIndex + i ? "> " : " ", ((_b = pair.request) === null || _b === void 0 ? void 0 : _b.method) || "", pair.response ? (_jsxs(Text, { color: selectedIndex === startIndex + i ? "cyanBright" : getStatusColor(((_c = pair.response) === null || _c === void 0 ? void 0 : _c.status) || ""), children: [" ", " ", pair.response.status] })) : (_jsx(Text, { dimColor: true, children: "..." })), " ", ((_d = pair.request) === null || _d === void 0 ? void 0 : _d.uri) || ""] }) }, i));
98
- })] }), isQrCodeRequested && (_jsx(QrCodeSection, { qrCodes: qrCodes, urls: urls, currentQrIndex: currentQrIndex }))] })] }), _jsx(Box, { justifyContent: "center", marginTop: 1, children: _jsx(Text, { dimColor: true, children: "Press Ctrl+C to stop the tunnel." }) })] }) }) }), inDetailView && (_jsx(DebuggerDetailModal, { requestText: headers === null || headers === void 0 ? void 0 : headers.req, responseText: headers === null || headers === void 0 ? void 0 : headers.res, onClose: () => setInDetailView(false) })), keyBindingView && _jsx(KeyBindings, {})] }));
98
+ })] }), isQrCodeRequested && (_jsx(QrCodeSection, { qrCodes: qrCodes, urls: urls, currentQrIndex: currentQrIndex }))] })] }), _jsx(Box, { justifyContent: "center", marginTop: 1, children: _jsx(Text, { dimColor: true, children: "Press Ctrl+C to stop the tunnel Or press h for key bindings" }) })] }) }) }), inDetailView && (_jsx(DebuggerDetailModal, { requestText: headers === null || headers === void 0 ? void 0 : headers.req, responseText: headers === null || headers === void 0 ? void 0 : headers.res, onClose: () => setInDetailView(false) })), keyBindingView && _jsx(KeyBindings, {})] }));
99
99
  };
100
100
  export default TunnelTui;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinggy",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
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. ",
@@ -46,4 +46,4 @@
46
46
  "type": "git",
47
47
  "url": "git+https://github.com/Pinggy-io/cli-js.git"
48
48
  }
49
- }
49
+ }
@@ -7,12 +7,16 @@ import { withFullScreen } from "fullscreen-ink";
7
7
  import path from "node:path";
8
8
  import { Worker } from "node:worker_threads";
9
9
  import { getFreePort } from "../utils/getFreePort.js";
10
+ import { fileURLToPath } from "url";
11
+ import { Instance, render } from "ink";
10
12
 
11
- const TunnelData: {
13
+ interface TunnelData {
12
14
  urls: string[] | null;
13
15
  greet: string | null;
14
16
  usage: any;
15
- } = {
17
+ }
18
+
19
+ const TunnelData: TunnelData = {
16
20
  urls: null,
17
21
  greet: null,
18
22
  usage: null,
@@ -22,13 +26,18 @@ declare global {
22
26
  var __PINGGY_TUNNEL_STATS__: ((stats: any) => void) | undefined;
23
27
  }
24
28
 
29
+ const __filename = fileURLToPath(import.meta.url);
30
+ const __dirname = path.dirname(__filename);
31
+
32
+ let inkInstance: Instance | null = null;
33
+
25
34
  export async function startCli(finalConfig: FinalConfig, manager: TunnelManager) {
26
35
  if (!finalConfig.NoTUI && finalConfig.webDebugger === "") {
27
36
  // Need a webdebugger port
28
37
  const freePort = await getFreePort(finalConfig.webDebugger || "");
29
38
  finalConfig.webDebugger = `localhost:${freePort}`;
30
39
  }
31
- const workerPath = path.resolve("./dist/cli/worker.js");
40
+ const workerPath = path.resolve(__dirname, "worker.js");
32
41
  try {
33
42
  const worker = new Worker(workerPath, {
34
43
  workerData: { finalConfig },
package/src/tui/index.tsx CHANGED
@@ -199,7 +199,7 @@ const TunnelTui = ({ urls, greet, tunnelConfig }: TunnelAppProps) => {
199
199
 
200
200
  {/* ===== Bottom sticky message ===== */}
201
201
  <Box justifyContent="center" marginTop={1}>
202
- <Text dimColor>Press Ctrl+C to stop the tunnel.</Text>
202
+ <Text dimColor>Press Ctrl+C to stop the tunnel Or press h for key bindings</Text>
203
203
  </Box>
204
204
  </Box>
205
205
  </Borders>