@dotrino/terminal-agent 0.41.1 → 0.41.3

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/bin/terminal.js CHANGED
@@ -530,6 +530,7 @@ async function farRequest (conn, msg, type) {
530
530
  }
531
531
  const farMessage = (r) => ({
532
532
  'not-linked': t('esta máquina no está enlazada con tu bóveda, así que no ve tus otras máquinas. Enlázala con: dotrino-terminal link', 'this machine is not linked to your vault, so it cannot see your other machines. Link it with: dotrino-terminal link'),
533
+ 'no-acta': t('no se pudo preguntar a tu bóveda qué máquinas tienes. Comprueba que esté encendida y que esta máquina tenga conexión.', 'could not ask your vault which machines you have. Check that it is on and that this machine is online.'),
533
534
  'no-machine': t('no hay ninguna máquina encendida con ese id o nombre (mira «dotrino-terminal machines»).', 'no machine with that id or name is on (see "dotrino-terminal machines").'),
534
535
  'ambiguous-machine': t('hay más de una máquina con ese nombre: usa su id (mira «dotrino-terminal machines»).', 'more than one machine has that name: use its id (see "dotrino-terminal machines").')
535
536
  }[r.code] || `${r.message} (${r.code})`)
package/desktop.js CHANGED
@@ -79,7 +79,23 @@ export const assetFor = (assets, kind) => pickAsset(assets, [MATCH[kind]])
79
79
  function asRoot (cmd, args, { run, uid }) {
80
80
  const [c, a] = uid === 0 ? [cmd, args] : ['sudo', [cmd, ...args]]
81
81
  run(c, a, { stdio: 'inherit' })
82
- return [c, ...a].join(' ')
82
+ }
83
+
84
+ const has = (cmd, run) => { try { run('sh', ['-c', `command -v ${cmd}`], { stdio: 'ignore' }); return true } catch (_) { return false } }
85
+
86
+ /**
87
+ * Con qué se instala el paquete ya bajado. Se prefiere el gestor que RESUELVE dependencias
88
+ * (`apt-get`, `dnf`, `zypper`) al que solo desempaqueta (`dpkg`, `rpm`): una versión nueva
89
+ * puede pedir una librería que la anterior no pedía, y `rpm -U` se para ahí sin traerla.
90
+ *
91
+ * @returns {[string, string[]]}
92
+ */
93
+ export function packageCommand (kind, file, { run = execFileSync } = {}) {
94
+ if (kind === 'deb') return has('apt-get', run) ? ['apt-get', ['install', '-y', file]] : ['dpkg', ['-i', file]]
95
+ if (has('dnf', run)) return ['dnf', ['install', '-y', file]]
96
+ // El paquete no va firmado con una llave de rpm: lo que se comprobó es su atestación.
97
+ if (has('zypper', run)) return ['zypper', ['--non-interactive', 'install', '--allow-unsigned-rpm', file]]
98
+ return ['rpm', ['-U', file]]
83
99
  }
84
100
 
85
101
  /**
@@ -92,11 +108,10 @@ function asRoot (cmd, args, { run, uid }) {
92
108
  * @returns {any}
93
109
  */
94
110
  export function install (file, how, { exe, run = execFileSync, uid = process.getuid?.() } = {}) {
95
- try {
96
- if (how.kind === 'deb') { asRoot('dpkg', ['-i', file], { run, uid }); return { ok: true } }
97
- if (how.kind === 'rpm') { asRoot('rpm', ['-U', file], { run, uid }); return { ok: true } }
98
- } catch (e) {
99
- return fail('install-failed', `the package manager did not install it: ${e.message}`, { file })
111
+ if (how.kind === 'deb' || how.kind === 'rpm') {
112
+ try { asRoot(...packageCommand(how.kind, file, { run }), { run, uid }); return { ok: true } } catch (e) {
113
+ return fail('install-failed', `the package manager did not install it: ${e.message}`, { file })
114
+ }
100
115
  }
101
116
  if (how.kind === 'tar') {
102
117
  const work = path.dirname(file)
@@ -171,4 +186,4 @@ export async function updateDesktop ({ exe, current, check = false, say = () =>
171
186
  }
172
187
  }
173
188
 
174
- export default { updateDesktop, latestDesktop, installKind, assetFor, install, DESKTOP_TAG, BINARY }
189
+ export default { packageCommand, updateDesktop, latestDesktop, installKind, assetFor, install, DESKTOP_TAG, BINARY }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotrino/terminal-agent",
3
- "version": "0.41.1",
3
+ "version": "0.41.3",
4
4
  "description": "Dotrino Terminal: las ventanas de esta máquina (dotrino-terminal) y su agente, que deja abrir esas mismas consolas desde los otros aparatos de tu cuenta, cifrado punto a punto.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -33,7 +33,7 @@
33
33
  "dependencies": {
34
34
  "@dotrino/identity": "0.107.2",
35
35
  "@dotrino/proxy-client": "0.30.3",
36
- "@dotrino/remote-agent": "0.18.1",
36
+ "@dotrino/remote-agent": "0.18.2",
37
37
  "@dotrino/update": "0.8.0",
38
38
  "@dotrino/vault": "0.82.1",
39
39
  "@xterm/addon-serialize": "0.13.0",