apertodns 1.2.0 → 1.2.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.
Files changed (2) hide show
  1. package/index.js +16 -15
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -397,7 +397,7 @@ const showDomainsList = async () => {
397
397
  });
398
398
 
399
399
  domains.forEach(d => {
400
- const status = d.currentIp ? green('● ONLINE') : red('● OFFLINE');
400
+ const status = d.ip ? green('● ONLINE') : red('● OFFLINE');
401
401
  const lastUpdate = d.lastUpdated
402
402
  ? new Date(d.lastUpdated).toLocaleString("it-IT", { day: '2-digit', month: '2-digit', hour: '2-digit', minute: '2-digit' })
403
403
  : gray('Mai');
@@ -405,7 +405,7 @@ const showDomainsList = async () => {
405
405
  table.push([
406
406
  status,
407
407
  chalk.bold(d.name),
408
- d.currentIp || gray('N/D'),
408
+ d.ip || gray('N/D'),
409
409
  `${d.ttl}s`,
410
410
  lastUpdate
411
411
  ]);
@@ -488,7 +488,7 @@ const deleteDomain = async (name) => {
488
488
  name: "selected",
489
489
  message: "Quale dominio vuoi eliminare?",
490
490
  choices: domains.map(d => ({
491
- name: `${d.currentIp ? green('●') : red('●')} ${d.name}`,
491
+ name: `${d.ip ? green('●') : red('●')} ${d.name}`,
492
492
  value: d.name
493
493
  }))
494
494
  }]);
@@ -1038,7 +1038,7 @@ const showStatsCommand = async () => {
1038
1038
  console.log(JSON.stringify({
1039
1039
  summary: {
1040
1040
  totalDomains: domains.length,
1041
- onlineDomains: domains.filter(d => d.currentIp).length,
1041
+ onlineDomains: domains.filter(d => d.ip).length,
1042
1042
  totalTokens: tokens.length,
1043
1043
  activeTokens: tokens.filter(t => t.active).length
1044
1044
  },
@@ -1060,7 +1060,7 @@ const showStatsCommand = async () => {
1060
1060
  └─────────────────┘`;
1061
1061
 
1062
1062
  const box3 = `┌─────────────────┐
1063
- │ ${cyan.bold(String(domains.filter(d => d.currentIp).length).padStart(2))} Online │
1063
+ │ ${cyan.bold(String(domains.filter(d => d.ip).length).padStart(2))} Online │
1064
1064
  └─────────────────┘`;
1065
1065
 
1066
1066
  console.log(gray(box1.split('\n')[0] + ' ' + box2.split('\n')[0] + ' ' + box3.split('\n')[0]));
@@ -1209,8 +1209,8 @@ const showDashboardCommand = async () => {
1209
1209
  currentIp: ipRes?.trim() || null,
1210
1210
  domains: {
1211
1211
  total: domains.length,
1212
- online: domains.filter(d => d.currentIp).length,
1213
- list: domains.map(d => ({ name: d.name, ip: d.currentIp, lastUpdated: d.lastUpdated }))
1212
+ online: domains.filter(d => d.ip).length,
1213
+ list: domains.map(d => ({ name: d.name, ip: d.ip, lastUpdated: d.lastUpdated }))
1214
1214
  },
1215
1215
  tokens: {
1216
1216
  total: tokens.length,
@@ -1230,7 +1230,7 @@ const showDashboardCommand = async () => {
1230
1230
  console.log();
1231
1231
 
1232
1232
  // Stats row
1233
- const onlineDomains = domains.filter(d => d.currentIp).length;
1233
+ const onlineDomains = domains.filter(d => d.ip).length;
1234
1234
  const activeTokens = tokens.filter(t => t.active).length;
1235
1235
 
1236
1236
  console.log(` ┌──────────────┬──────────────┬──────────────┬──────────────┐`);
@@ -1243,8 +1243,8 @@ const showDashboardCommand = async () => {
1243
1243
  if (domains.length > 0) {
1244
1244
  console.log(` ${gray('Ultimi domini:')}`);
1245
1245
  domains.slice(0, 5).forEach(d => {
1246
- const status = d.currentIp ? green('●') : red('●');
1247
- console.log(` ${status} ${chalk.bold(d.name)} ${gray('→')} ${d.currentIp || gray('N/D')}`);
1246
+ const status = d.ip ? green('●') : red('●');
1247
+ console.log(` ${status} ${chalk.bold(d.name)} ${gray('→')} ${d.ip || gray('N/D')}`);
1248
1248
  });
1249
1249
  if (domains.length > 5) console.log(` ${gray(`... e altri ${domains.length - 5}`)}`);
1250
1250
  }
@@ -1300,18 +1300,19 @@ const setup = async () => {
1300
1300
  ]);
1301
1301
 
1302
1302
  const spin = spinner("Login in corso...").start();
1303
- const res = await fetch(`${API_BASE}/auth/login`, {
1303
+ const res = await fetch(`${API_BASE}/auth/cli-login`, {
1304
1304
  method: "POST",
1305
1305
  headers: { "Content-Type": "application/json" },
1306
1306
  body: JSON.stringify({ email, password })
1307
1307
  });
1308
1308
  const data = await res.json();
1309
1309
 
1310
- if (!res.ok || !data.cliToken) {
1311
- spin.fail("Login fallito: " + (data.message || "Errore"));
1310
+ if (!res.ok || !data.token) {
1311
+ spin.fail("Login fallito: " + (data.error || data.message || "Errore"));
1312
1312
  return;
1313
1313
  }
1314
- apiToken = data.cliToken;
1314
+ apiToken = data.token;
1315
+ config.jwtToken = data.token;
1315
1316
  spin.succeed("Login effettuato!");
1316
1317
  } else {
1317
1318
  // Registrazione solo via web per sicurezza (captcha)
@@ -1321,7 +1322,7 @@ const setup = async () => {
1321
1322
  }
1322
1323
 
1323
1324
  const remoteConfig = await fetchRemoteConfig(apiToken);
1324
- config = remoteConfig ? { ...remoteConfig, apiToken } : { apiToken };
1325
+ config = remoteConfig ? { ...remoteConfig, jwtToken: apiToken } : { jwtToken: apiToken };
1325
1326
 
1326
1327
  const { save } = await inquirer.prompt([{
1327
1328
  type: "confirm",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apertodns",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "ApertoDNS CLI - Dynamic DNS management from your terminal. Manage domains, tokens, API keys and DNS updates with style.",
5
5
  "main": "index.js",
6
6
  "type": "module",