nebula-notebook 0.2.29 → 0.2.31

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.
@@ -180,7 +180,8 @@ class AuthService {
180
180
  return;
181
181
  }
182
182
  const issuer = 'NebulaNotebook';
183
- const accountName = 'local';
183
+ // host:port so several Nebula installs are distinguishable in the app.
184
+ const accountName = (0, setup_qr_1.accountLabel)(os.hostname(), process.env.PORT || process.env.NODE_SERVER_PORT || 3000);
184
185
  const otpAuthUrl = otplib_1.authenticator.keyuri(accountName, issuer, this.config.totpSecret);
185
186
  console.log((0, setup_qr_1.buildSetupInstructions)(this.config.totpSecret, otpAuthUrl, (0, setup_qr_1.renderQr)(otpAuthUrl, 'small')));
186
187
  }
@@ -8,5 +8,13 @@
8
8
  * scan depends on any glyph, only on color support.
9
9
  */
10
10
  export type QrMode = 'small' | 'big';
11
+ /**
12
+ * The otpauth account label. Every install used to render the same
13
+ * "NebulaNotebook: local" entry, so a user running Nebula in two places got
14
+ * two indistinguishable authenticator entries — and no way to tell which
15
+ * 6-digit code belongs to which server. Host:port makes them self-labeling.
16
+ * Colons are separators in the otpauth label grammar, so they are replaced.
17
+ */
18
+ export declare function accountLabel(host: string, port: number | string): string;
11
19
  export declare function renderQr(otpAuthUrl: string, mode: QrMode): string;
12
20
  export declare function buildSetupInstructions(secret: string, otpAuthUrl: string, qrString: string): string;
@@ -42,9 +42,21 @@ var __importStar = (this && this.__importStar) || (function () {
42
42
  };
43
43
  })();
44
44
  Object.defineProperty(exports, "__esModule", { value: true });
45
+ exports.accountLabel = accountLabel;
45
46
  exports.renderQr = renderQr;
46
47
  exports.buildSetupInstructions = buildSetupInstructions;
47
48
  const qrcode = __importStar(require("qrcode-terminal"));
49
+ /**
50
+ * The otpauth account label. Every install used to render the same
51
+ * "NebulaNotebook: local" entry, so a user running Nebula in two places got
52
+ * two indistinguishable authenticator entries — and no way to tell which
53
+ * 6-digit code belongs to which server. Host:port makes them self-labeling.
54
+ * Colons are separators in the otpauth label grammar, so they are replaced.
55
+ */
56
+ function accountLabel(host, port) {
57
+ const clean = (host || '').trim().replace(/:/g, '-') || 'local';
58
+ return `${clean}:${port}`;
59
+ }
48
60
  function renderQr(otpAuthUrl, mode) {
49
61
  let out = '';
50
62
  // qrcode-terminal invokes the callback synchronously.
@@ -10,7 +10,6 @@ const otplib_1 = require("otplib");
10
10
  const setup_qr_1 = require("../auth/setup-qr");
11
11
  const AUTH_CONFIG_FILE = path_1.default.join(os_1.default.homedir(), '.nebula', 'auth.json');
12
12
  const ISSUER = 'NebulaNotebook';
13
- const ACCOUNT_NAME = 'local';
14
13
  function fail(message) {
15
14
  console.error(message);
16
15
  process.exit(1);
@@ -44,7 +43,7 @@ function main() {
44
43
  if (!secret) {
45
44
  fail(`[Auth] Missing "totpSecret" in ${AUTH_CONFIG_FILE}`);
46
45
  }
47
- const otpAuthUrl = otplib_1.authenticator.keyuri(ACCOUNT_NAME, ISSUER, secret);
46
+ const otpAuthUrl = otplib_1.authenticator.keyuri((0, setup_qr_1.accountLabel)(os_1.default.hostname(), process.env.PORT || 3000), ISSUER, secret);
48
47
  if (args.includes('--url')) {
49
48
  console.log(otpAuthUrl);
50
49
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nebula-notebook",
3
- "version": "0.2.29",
3
+ "version": "0.2.31",
4
4
  "description": "AI-native notebook computing environment — real Jupyter kernels, real filesystem, built to be driven by agents (Claude Code / Codex) via MCP",
5
5
  "type": "module",
6
6
  "license": "MIT",