mindwire 0.1.40 → 0.1.41

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.
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { enableAddressDiscovery, disableAddressDiscovery, discoveryDescription, connectionAddress, saveDiscoveryPreference, discoveryPreference, reconcileAddressDiscovery, connectionInfo, connectionDescription, updateComputer, updateProgress, activeUpdate } from './chunk-ZP7F7LP7.js';
3
- import { SDK_VERSION, defaultStateDirectory, computerClient, superviseComputer, ensureComputer, readJSON, defaultComputerConfig, computerPairingURI, stopComputer, processStateAlive, providerFailure, acquireProcessLock, writeJSON, currentProcessIdentity, CONTROLLER_PROTOCOL, versionAtLeast, websocketURL, providerNeedsAction, cloudflareCommand, computerPairingQRData, ProviderConnectionError } from './chunk-BJL5K6M7.js';
4
- import './chunk-PFYKJ6LX.js';
2
+ import { enableAddressDiscovery, disableAddressDiscovery, discoveryDescription, connectionAddress, saveDiscoveryPreference, discoveryPreference, reconcileAddressDiscovery, connectionInfo, connectionDescription, updateComputer, updateProgress, activeUpdate } from './chunk-4XNTGVCI.js';
3
+ import { SDK_VERSION, defaultStateDirectory, computerClient, superviseComputer, ensureComputer, readJSON, defaultComputerConfig, computerPairingURI, stopComputer, processStateAlive, providerFailure, acquireProcessLock, writeJSON, currentProcessIdentity, CONTROLLER_PROTOCOL, versionAtLeast, websocketURL, providerNeedsAction, cloudflareCommand, computerPairingQRData, ProviderConnectionError } from './chunk-T2ZIA4TK.js';
4
+ import { ApiError } from './chunk-PFYKJ6LX.js';
5
5
  import { promisify, parseArgs } from 'util';
6
6
  import { fileURLToPath, pathToFileURL } from 'url';
7
7
  import { realpathSync, mkdtempSync, chmodSync, writeFileSync, rmSync } from 'fs';
@@ -1384,9 +1384,34 @@ Allow only ${terminalText(info.username)}. Leave password-only VNC access off.`)
1384
1384
  }
1385
1385
  info = await client.surfaces.localStatus();
1386
1386
  }
1387
- const password = await prompt.secret(`Mac password for ${terminalText(info.username)} (hidden): `);
1388
- if (!password || Buffer.byteLength(password) > 63 || password.includes("\0")) throw new Error("Enter your Mac password (up to 63 UTF-8 bytes). Desktop settings were not changed.");
1389
- await client.surfaces.configureLocal({ enabled: true, username: info.username, password }, localToken);
1387
+ while (true) {
1388
+ const password = await prompt.secret(`Mac password for ${terminalText(info.username)} (hidden): `);
1389
+ let retryMessage;
1390
+ if (!password || Buffer.byteLength(password) > 63 || password.includes("\0")) {
1391
+ retryMessage = "Enter your Mac login password (up to 63 UTF-8 bytes).";
1392
+ } else {
1393
+ try {
1394
+ await client.surfaces.configureLocal({ enabled: true, username: info.username, password }, localToken);
1395
+ break;
1396
+ } catch (error) {
1397
+ if (!(error instanceof ApiError) || !error.body || typeof error.body !== "object" || !("code" in error.body) || error.body.code !== "desktop_authentication") throw error;
1398
+ retryMessage = `The Mac didn\u2019t accept that login. Check the password for ${terminalText(info.username)} and try again.
1399
+ Use your Mac login password, not your Apple Account password. If it\u2019s correct, check that Screen Sharing allows this account.`;
1400
+ }
1401
+ }
1402
+ prompt.print(`${retryMessage}
1403
+ Desktop settings were not changed.`);
1404
+ const retry = prompt.select ? await prompt.select("Mac login", [
1405
+ { value: "retry", label: "Try password again" },
1406
+ { value: "settings", label: "Open Screen Sharing settings" },
1407
+ { value: "cancel", label: "Cancel setup" }
1408
+ ]) : (await prompt.question("Try password again? [y/N]: ")).toLowerCase() === "y" ? "retry" : "cancel";
1409
+ if (retry !== "retry" && retry !== "settings") return info;
1410
+ if (retry === "settings") {
1411
+ (options.openSettings ?? openScreenSharingSettings)();
1412
+ await prompt.question("Check that your Mac account is allowed, then press Return to retry: ");
1413
+ }
1414
+ }
1390
1415
  prompt.print("Desktop access is on. Open Desktop in Mindwire on your phone.\nTurn it off anytime with mindwire desktop disable.");
1391
1416
  return client.surfaces.localStatus();
1392
1417
  }