@dotrino/content 0.3.13 → 0.4.0

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/README.md CHANGED
File without changes
package/bin/cli.js CHANGED
@@ -26,9 +26,14 @@ import { ContentNode } from '../src/node.js'
26
26
  import { createServer } from '../src/server.js'
27
27
  import { createPublicServer, DEFAULT_PUBLIC_PORT, DEFAULT_MAX_BYTES, DEFAULT_RATE_PER_MIN } from '../src/public.js'
28
28
  import { isLinked, linkDir, startContentAgent } from '../src/agent.js'
29
+ import { createRequire } from 'node:module'
30
+
31
+ const { version: VERSION } = createRequire(import.meta.url)('../package.json')
29
32
 
30
33
  const USAGE = `uso:
31
34
  dotrino-content enroll <código>
35
+ dotrino-content info [--json] qué aparato es este node: su ID (el de «dotrino-vault members»),
36
+ su bóveda y sus permisos. Sin red.
32
37
  dotrino-content start [--port 3777] [--dir <ruta>] [--max-gb <n>] [--max-blob-mb <n>] [--gc-min <min>] [--no-agent]
33
38
  [--public] [--public-port 3778] [--public-host 0.0.0.0] [--public-max-kb 512]
34
39
  [--public-rate 60] [--public-egress-gb <n>] [--public-url https://…] [--app-url https://…]
@@ -53,6 +58,7 @@ const { values, positionals } = parseArgs({
53
58
  'public-url': { type: 'string' },
54
59
  'app-url': { type: 'string' },
55
60
  'public-index': { type: 'boolean' },
61
+ json: { type: 'boolean' },
56
62
  help: { type: 'boolean', short: 'h' }
57
63
  }
58
64
  })
@@ -63,11 +69,24 @@ if (values.help) {
63
69
  }
64
70
 
65
71
  const cmd = positionals[0] || 'start'
66
- if (cmd !== 'start' && cmd !== 'enroll') {
72
+ if (cmd !== 'start' && cmd !== 'enroll' && cmd !== 'info') {
67
73
  console.error(`comando desconocido: ${cmd}\n${USAGE}`)
68
74
  process.exit(1)
69
75
  }
70
76
 
77
+ // `info`: la pieza común de todos los comandos (CONVENCIONES §15.1). Lo que se viene a
78
+ // mirar es el ID, para buscarlo en el acta.
79
+ if (cmd === 'info') {
80
+ const { loadLink } = await import('@dotrino/remote-agent/link')
81
+ const { deviceInfo, formatDeviceInfo } = await import('@dotrino/vault/device-info')
82
+ const dir = linkDir()
83
+ const link = loadLink(dir)
84
+ if (!link) { console.error(`este node no está enlazado (${dir}): dotrino-content enroll <código>`); process.exit(1) }
85
+ const info = await deviceInfo(link, { kind: 'content', ns: 'content', version: VERSION, dir })
86
+ console.log(values.json ? JSON.stringify(info, null, 2) : formatDeviceInfo(info))
87
+ process.exit(0)
88
+ }
89
+
71
90
  /**
72
91
  * Enrolamiento: el flujo endurecido del ecosistema, tal cual lo hace la terminal.
73
92
  * Este node genera su llave, MUESTRA un código y espera a que lo apruebes tipeando
@@ -149,10 +168,17 @@ node.gc()
149
168
  // propia ACL, su límite por IP y su techo de salida: no se activa por descuido.
150
169
  server.listen(port, '127.0.0.1', () => {
151
170
  const s = node.stats()
152
- console.log(`dotrino-content en http://127.0.0.1:${port} · datos: ${dir}`)
171
+ console.log(`dotrino-content ${VERSION} en http://127.0.0.1:${port} · datos: ${dir}`)
153
172
  console.log(`blobs: ${s.blobs} · bytes: ${s.bytes}${maxBytes ? ` / ${maxBytes}` : ''}`)
154
173
  })
155
174
 
175
+ // §15: una vez al día mira si hay versión nueva y lo dice en el log. Solo avisa.
176
+ const { watchForUpdate } = await import('@dotrino/update')
177
+ watchForUpdate({
178
+ current: VERSION, source: 'npm', pkg: '@dotrino/content',
179
+ onNewer: (r) => console.log(`[content] version ${r.version} is available (running ${r.current}): npm i -g @dotrino/content@${r.version}`)
180
+ })
181
+
156
182
  // Plano de control: solo si este node ya está enlazado a un vault. Sin enlace sigue
157
183
  // siendo lo de antes (un node local), y se dice en voz alta para que nadie crea que
158
184
  // tiene administración remota cuando no la tiene.
@@ -161,7 +187,7 @@ if (values['no-agent']) {
161
187
  console.log('plano de control: apagado (--no-agent)')
162
188
  } else if (isLinked()) {
163
189
  try {
164
- agent = await startContentAgent({ node })
190
+ agent = await startContentAgent({ node, version: VERSION })
165
191
  } catch (e) {
166
192
  console.error(`plano de control: no arrancó (${e.message})`)
167
193
  }
package/lib/public.js CHANGED
File without changes
package/lib/ref.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotrino/content",
3
- "version": "0.3.13",
3
+ "version": "0.4.0",
4
4
  "description": "Nodo de contenido del ecosistema Dotrino: guarda los bytes del usuario direccionados por su hash (cid), en su propia maquina y, si el dueno quiere, respaldados en su propio bucket (R2, Backblaze, Hetzner, Storj o S3). Lo publico sale por URL directa; lo privado, cifrado y solo por la red Dotrino.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -23,9 +23,11 @@
23
23
  "typescript": "5.9.3"
24
24
  },
25
25
  "dependencies": {
26
- "@dotrino/identity": "0.78.0",
27
- "@dotrino/remote-agent": "0.9.2",
28
- "@dotrino/vault": "0.52.0"
26
+ "@dotrino/identity": "0.105.0",
27
+ "@dotrino/proxy-client": "0.25.0",
28
+ "@dotrino/remote-agent": "0.12.0",
29
+ "@dotrino/update": "0.2.2",
30
+ "@dotrino/vault": "0.75.0"
29
31
  },
30
32
  "keywords": [
31
33
  "dotrino",
package/src/agent.js CHANGED
File without changes
package/src/announce.js CHANGED
File without changes
File without changes
package/src/blobstore.js CHANGED
File without changes
package/src/db.js CHANGED
File without changes
package/src/fetch.js CHANGED
File without changes
package/src/index.js CHANGED
File without changes
package/src/node.js CHANGED
File without changes
package/src/ops.js CHANGED
File without changes
package/src/public.js CHANGED
File without changes
package/src/s3.js CHANGED
File without changes
package/src/server.js CHANGED
File without changes
package/src/storage.js CHANGED
File without changes
package/src/vaultEnv.js CHANGED
File without changes