runlocal 0.4.1 → 0.5.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/lib.js +12 -0
- package/package.json +1 -1
package/lib.js
CHANGED
|
@@ -222,6 +222,17 @@ function createConnection(options) {
|
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
if (event === "tunnel_created") {
|
|
225
|
+
const inspectUrl = payload.url.replace(/^https?:\/\/[^/]+/, (origin) => {
|
|
226
|
+
// Convert subdomain URL to main domain /inspect/ URL
|
|
227
|
+
// e.g., https://fuzzy-tiger.runlocal.eu → https://runlocal.eu/inspect/fuzzy-tiger
|
|
228
|
+
const parts = new URL(origin);
|
|
229
|
+
const hostParts = parts.hostname.split(".");
|
|
230
|
+
if (hostParts.length > 2) {
|
|
231
|
+
parts.hostname = hostParts.slice(1).join(".");
|
|
232
|
+
}
|
|
233
|
+
return `${parts.origin}/inspect/${payload.subdomain}`;
|
|
234
|
+
});
|
|
235
|
+
|
|
225
236
|
log("");
|
|
226
237
|
log(` ${GREEN}${BOLD}Tunnel created!${RESET}`);
|
|
227
238
|
log(` ${CYAN}${BOLD}${payload.url}${RESET}`);
|
|
@@ -232,6 +243,7 @@ function createConnection(options) {
|
|
|
232
243
|
|
|
233
244
|
log("");
|
|
234
245
|
log(` ${DIM}Forwarding to localhost:${port}${RESET}`);
|
|
246
|
+
log(` ${DIM}Inspect requests at ${RESET}${CYAN}${inspectUrl}${RESET}`);
|
|
235
247
|
log(` ${DIM}Press Ctrl+C to stop${RESET}`);
|
|
236
248
|
|
|
237
249
|
// Show tip for users without an API key
|