@jebcode-dev/jebcode-tunnel 1.0.4 → 1.0.5

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 -29
  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.3**
71
+ **JebCode Infrastructure v1.0.4**
package/index.js CHANGED
@@ -150,18 +150,24 @@ function startTunnel(port, options = {}) {
150
150
  socket.emit("authenticate", { token: config.token, subdomain });
151
151
  });
152
152
 
153
+ let hasShownHeader = false;
153
154
  socket.on("auth_result", (result) => {
154
155
  if (result.success) {
155
- console.clear();
156
- console.log(getHeader());
157
- console.log(chalk.white(" STATUS DO TÚNEL ATIVO"));
158
- console.log(chalk.blue(" ▪"), chalk.bold("URL Pública: "), chalk.yellow(`https://${subdomain}.jebcodetunnel.com`));
159
- console.log(chalk.blue(" ▪"), chalk.bold("Encaminhando:"), chalk.white(`http://localhost:${port}`), chalk.gray("➔"), chalk.cyan("jeb-gateway"));
160
- console.log(chalk.blue(" ▪"), chalk.bold("Dashboard: "), chalk.gray(`${SERVER_URL}/dashboard`));
161
-
162
- console.log(chalk.gray("\n Pressione CTRL+C para encerrar o túnel"));
163
- console.log(chalk.white("\n LOGS DE TRÁFEGO EM TEMPO REAL:"));
164
- console.log(chalk.gray(" " + "─".repeat(60)));
156
+ if (!hasShownHeader) {
157
+ console.clear();
158
+ console.log(getHeader());
159
+ 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"));
162
+ console.log(chalk.blue(" ▪"), chalk.bold("Dashboard: "), chalk.gray(`${SERVER_URL}/dashboard`));
163
+
164
+ console.log(chalk.gray("\n Pressione CTRL+C para encerrar o túnel"));
165
+ console.log(chalk.white("\n LOGS DE TRÁFEGO EM TEMPO REAL:"));
166
+ console.log(chalk.gray(" " + "─".repeat(60)));
167
+ hasShownHeader = true;
168
+ } else {
169
+ console.log(chalk.green("\n ✔ Conexão Restabelecida!"));
170
+ }
165
171
  } else {
166
172
  console.log(chalk.red("\n ✖ Falha na Autenticação:"), chalk.bold(result.message));
167
173
  console.log(chalk.gray(" Verifique seu token e se o subdomínio foi criado no dashboard.\n"));
@@ -176,12 +182,8 @@ function startTunnel(port, options = {}) {
176
182
  socket.on("incoming_request", async (reqData) => {
177
183
  const timestamp = new Date().toLocaleTimeString();
178
184
  const methodColor = reqData.method === "GET" ? chalk.green : reqData.method === "POST" ? chalk.blue : chalk.yellow;
179
-
180
- // Log imediato para feedback instantâneo no terminal
181
- const startLog = `${chalk.gray(` [${timestamp}]`)} ${methodColor(reqData.method.padEnd(7))} ${chalk.white(reqData.path.substring(0, 30).padEnd(30))} ${chalk.yellow("PROCESSANDO...")}`;
182
- process.stdout.write(startLog);
183
-
184
185
  const startTime = Date.now();
186
+
185
187
  try {
186
188
  const response = await axios({
187
189
  method: reqData.method,
@@ -196,14 +198,6 @@ function startTunnel(port, options = {}) {
196
198
  const duration = Date.now() - startTime;
197
199
  const statusColor = response.status < 300 ? chalk.green : response.status < 400 ? chalk.cyan : chalk.red;
198
200
 
199
- // Limpa a linha atual e sobrescreve com o log final
200
- if (process.stdout.isTTY) {
201
- process.stdout.clearLine(0);
202
- process.stdout.cursorTo(0);
203
- } else {
204
- process.stdout.write("\n");
205
- }
206
-
207
201
  const logLine = [
208
202
  chalk.gray(` [${timestamp}]`),
209
203
  methodColor(reqData.method.padEnd(7)),
@@ -221,12 +215,6 @@ function startTunnel(port, options = {}) {
221
215
  });
222
216
  } catch (err) {
223
217
  const duration = Date.now() - startTime;
224
- if (process.stdout.isTTY) {
225
- process.stdout.clearLine(0);
226
- process.stdout.cursorTo(0);
227
- } else {
228
- process.stdout.write("\n");
229
- }
230
218
  console.log(`${chalk.gray(` [${timestamp}]`)} ${methodColor(reqData.method.padEnd(7))} ${chalk.white(reqData.path.substring(0, 30).padEnd(30))} ${chalk.red("FALHOU")} ${chalk.gray(`${duration}ms`)}`);
231
219
 
232
220
  socket.emit(`response_${reqData.id}`, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jebcode-dev/jebcode-tunnel",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "CLI do JebCode Tunnel",
5
5
  "license": "MIT",
6
6
  "publishConfig": {