nport 2.0.3 → 2.0.4

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 (2) hide show
  1. package/index.js +20 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -302,7 +302,26 @@ class APIClient {
302
302
  if (error.response?.data?.error) {
303
303
  const errorMsg = error.response.data.error;
304
304
 
305
- // Check for duplicate tunnel error
305
+ // Check for subdomain in use (active tunnel)
306
+ if (
307
+ errorMsg.includes("SUBDOMAIN_IN_USE:") ||
308
+ errorMsg.includes("currently in use") ||
309
+ errorMsg.includes("already exists and is currently active")
310
+ ) {
311
+ return new Error(
312
+ chalk.red(`✗ Subdomain "${subdomain}" is already in use!\n\n`) +
313
+ chalk.yellow(`💡 This subdomain is currently being used by another active tunnel.\n\n`) +
314
+ chalk.white(`Choose a different subdomain:\n`) +
315
+ chalk.gray(` 1. Add a suffix: `) +
316
+ chalk.cyan(`nport ${state.port || CONFIG.DEFAULT_PORT} -s ${subdomain}-2\n`) +
317
+ chalk.gray(` 2. Try a variation: `) +
318
+ chalk.cyan(`nport ${state.port || CONFIG.DEFAULT_PORT} -s my-${subdomain}\n`) +
319
+ chalk.gray(` 3. Use random name: `) +
320
+ chalk.cyan(`nport ${state.port || CONFIG.DEFAULT_PORT}\n`)
321
+ );
322
+ }
323
+
324
+ // Check for duplicate tunnel error (other Cloudflare errors)
306
325
  if (
307
326
  errorMsg.includes("already have a tunnel") ||
308
327
  errorMsg.includes("[1013]")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nport",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "Free & open source ngrok alternative - Tunnel HTTP/HTTPS connections via Cloudflare Edge with custom subdomains",
5
5
  "type": "module",
6
6
  "main": "index.js",