@jebcode-dev/jebcode-tunnel 1.0.5 → 1.0.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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/index.js +17 -10
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -68,4 +68,4 @@ npm link
68
68
 
69
69
  ---
70
70
  © 2026 JEBCODE SOFTWARE E TECNOLOGIA LTDA.
71
- **JebCode Infrastructure v1.0.4**
71
+ **JebCode Infrastructure v1.0.8**
package/index.js CHANGED
@@ -131,34 +131,41 @@ function startTunnel(port, options = {}) {
131
131
  process.exit(1);
132
132
  }
133
133
 
134
- const subdomain = options.subdomain || "dev";
134
+ const subdomain = options.subdomain || null; // Se for null, o servidor gera um automático
135
135
  const insecure = options.insecure || false;
136
136
 
137
137
  process.stdout.write(chalk.blue(" ☁ Conectando à infraestrutura JebCode... "));
138
138
 
139
139
  const socket = io(SERVER_URL, {
140
- transports: ["websocket", "polling"],
141
- reconnectionAttempts: 10,
142
- timeout: 15000,
143
- rejectUnauthorized: !insecure,
144
- pingInterval: 10000,
145
- pingTimeout: 5000
140
+ transports: ["websocket"], // FORÇA WEBSOCKET (Mais estável que polling)
141
+ reconnection: true,
142
+ reconnectionAttempts: Infinity,
143
+ reconnectionDelay: 1000,
144
+ reconnectionDelayMax: 5000,
145
+ timeout: 20000, // Mais tempo para o handshake
146
+ rejectUnauthorized: !insecure
146
147
  });
147
148
 
148
149
  socket.on("connect", () => {
149
150
  process.stdout.write(chalk.green("OK\n"));
150
- socket.emit("authenticate", { token: config.token, subdomain });
151
+ socket.emit("authenticate", { token: config.token, subdomain, port });
151
152
  });
152
153
 
153
154
  let hasShownHeader = false;
154
155
  socket.on("auth_result", (result) => {
155
156
  if (result.success) {
157
+ const finalSubdomain = result.subdomain || subdomain;
156
158
  if (!hasShownHeader) {
157
159
  console.clear();
158
160
  console.log(getHeader());
161
+ const displayDomain = SERVER_URL.includes("localhost") ? "localhost:3000" : "jebcodetunnel.com";
162
+ const publicUrl = SERVER_URL.includes("localhost")
163
+ ? `http://${finalSubdomain}.localhost:3000`
164
+ : `https://${finalSubdomain}.jebcodetunnel.com`;
165
+
159
166
  console.log(chalk.white(" STATUS DO TÚNEL ATIVO"));
160
- console.log(chalk.blue(" ▪"), chalk.bold("URL Pública: "), chalk.yellow(`https://${subdomain}.jebcodetunnel.com`));
161
- console.log(chalk.blue(" ▪"), chalk.bold("Encaminhando:"), chalk.white(`http://localhost:${port}`), chalk.gray("➔"), chalk.cyan("jeb-gateway"));
167
+ console.log(chalk.blue(" ▪"), chalk.bold("URL Pública: "), chalk.yellow(publicUrl));
168
+ console.log(chalk.blue(" ▪"), chalk.bold("Encaminhando:"), chalk.white(`http://localhost:${port}`), chalk.gray("➔"), chalk.cyan(displayDomain));
162
169
  console.log(chalk.blue(" ▪"), chalk.bold("Dashboard: "), chalk.gray(`${SERVER_URL}/dashboard`));
163
170
 
164
171
  console.log(chalk.gray("\n Pressione CTRL+C para encerrar o túnel"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jebcode-dev/jebcode-tunnel",
3
- "version": "1.0.5",
3
+ "version": "1.0.8",
4
4
  "description": "CLI do JebCode Tunnel",
5
5
  "license": "MIT",
6
6
  "publishConfig": {