pinokiod 8.2.11 → 8.2.13

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.
@@ -59,12 +59,14 @@ class TailscaleCLI {
59
59
  }
60
60
  }
61
61
  setPrefs(hostname) {
62
- return this.run(['set', '--hostname=' + hostname, '--accept-dns=false', '--accept-routes=false', '--exit-node='])
62
+ return this.run(['set', '--hostname=' + hostname, '--accept-dns=false', '--accept-routes=false', '--exit-node=',
63
+ ...(process.platform === 'win32' ? ['--unattended=true'] : [])])
63
64
  }
64
65
  up(onUpdate, force = false, hostname = 'pinokio') {
65
66
  let emitted = 0
66
67
  return this.run(['up', '--json', '--timeout=5m', '--hostname=' + hostname,
67
- '--accept-dns=false', '--accept-routes=false', '--exit-node=', ...(force ? ['--force-reauth'] : [])], {
68
+ '--accept-dns=false', '--accept-routes=false', '--exit-node=',
69
+ ...(process.platform === 'win32' ? ['--unattended=true'] : []), ...(force ? ['--force-reauth'] : [])], {
68
70
  timeout: 305000,
69
71
  onOutput(output) {
70
72
  // The pinned CLI emits pretty-printed top-level JSON objects.
@@ -686,7 +686,7 @@ class Anywhere {
686
686
  if (!enabled) {
687
687
  return Object.assign(base, { phase: 'off', running: false })
688
688
  }
689
- if (this.starting) {
689
+ if (this.starting || !this.api) {
690
690
  return Object.assign(base, { phase: 'starting', running: false })
691
691
  }
692
692
  const owned = await this.assertOwnership()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "8.2.11",
3
+ "version": "8.2.13",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -577,6 +577,18 @@ test('unverified daemons cannot receive logout, login, approval or Serve changes
577
577
  }
578
578
  })
579
579
 
580
+ test('status reports starting before autostart begins', async () => {
581
+ const anywhere = new Anywhere(fakeKernel(os.tmpdir()))
582
+ anywhere.config = { enabled: true }
583
+ anywhere.readPid = () => assert.fail('ownership must wait for autostart')
584
+ assert.equal(anywhere.starting, null)
585
+ const snapshot = await anywhere.snapshot()
586
+ assert.equal(snapshot.phase, 'starting')
587
+ assert.equal(snapshot.running, false)
588
+ assert.equal(snapshot.error, null)
589
+ assert.equal(anywhere.api, null, 'polling must not create a client before autostart')
590
+ })
591
+
580
592
  test('status cannot control an unowned daemon while autostart is checking installation', async t => {
581
593
  const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'pk-autostart-owner-'))
582
594
  t.after(() => fs.rmSync(tmp, { recursive: true, force: true }))
@@ -10,6 +10,28 @@ const TailscaleCLI = require('../kernel/anywhere/cli')
10
10
  const Anywhere = require('../kernel/anywhere')
11
11
  const Tailscaled = require('../kernel/bin/tailscaled')
12
12
 
13
+ test('Windows startup and login retain the profile after the CLI exits', async () => {
14
+ const source = fs.readFileSync(require.resolve('../kernel/anywhere/cli'), 'utf8')
15
+ const cliRequire = require('node:module').createRequire(require.resolve('../kernel/anywhere/cli'))
16
+ for (const platform of ['win32', 'darwin', 'linux']) {
17
+ const module = { exports: {} }
18
+ vm.runInNewContext(source, { module, require: cliRequire, process: { platform } })
19
+ const cli = new module.exports({ binPath: 'fixture', socketPath: 'fixture' })
20
+ const calls = []
21
+ cli.run = async args => { calls.push(args); return '' }
22
+ await cli.setPrefs('pinokio')
23
+ await cli.up(() => {})
24
+ await cli.up(() => {}, true)
25
+ for (const args of calls) {
26
+ assert.equal(args.includes('--unattended=true'), platform === 'win32', `${platform} ${args[0]}`)
27
+ assert.ok(args.includes('--accept-dns=false'))
28
+ assert.ok(args.includes('--accept-routes=false'))
29
+ assert.ok(args.includes('--exit-node='))
30
+ }
31
+ assert.ok(calls[2].includes('--force-reauth'))
32
+ }
33
+ })
34
+
13
35
  test('CLI login delivers each streamed update once and rejects output-handler failures', async () => {
14
36
  const source = fs.readFileSync(require.resolve('../kernel/anywhere/cli'), 'utf8')
15
37
  const cliRequire = require('node:module').createRequire(require.resolve('../kernel/anywhere/cli'))
@@ -17,7 +39,7 @@ test('CLI login delivers each streamed update once and rejects output-handler fa
17
39
  let finish, killed = false
18
40
  const child = { stdout: new EventEmitter(), kill() { killed = true } }
19
41
  const module = { exports: {} }
20
- vm.runInNewContext(source, { module, require(name) {
42
+ vm.runInNewContext(source, { module, process, require(name) {
21
43
  if (name !== 'child_process') return cliRequire(name)
22
44
  return { execFile(file, args, options, callback) { finish = callback; return child } }
23
45
  } })