@dotrino/content 0.6.3 → 0.6.4
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/cli.js +13 -13
- package/package.json +1 -1
- package/src/storage.js +3 -3
package/bin/cli.js
CHANGED
|
@@ -105,8 +105,8 @@ if (cmd === 'info') {
|
|
|
105
105
|
// aquí: es donde se mira qué es este aparato. Fuera del JSON, que lo lee una máquina.
|
|
106
106
|
if (!values.json) {
|
|
107
107
|
const { updateStatusText } = await import('@dotrino/update/npm')
|
|
108
|
-
const
|
|
109
|
-
if (
|
|
108
|
+
const status = updateStatusText({ dir, current: VERSION, lang: 'es' })
|
|
109
|
+
if (status) console.log('\n' + status)
|
|
110
110
|
}
|
|
111
111
|
process.exit(0)
|
|
112
112
|
}
|
|
@@ -169,7 +169,7 @@ const gcMin = Number(values['gc-min'] || 60)
|
|
|
169
169
|
const { startVaultConfig, isEnrolled } = await import('../src/vaultEnv.js')
|
|
170
170
|
const log = (m) => console.log(m)
|
|
171
171
|
const vaultConfig = startVaultConfig({ log })
|
|
172
|
-
if (!isEnrolled()) console.log('
|
|
172
|
+
if (!isEnrolled()) console.log('no vault: local config (enroll with: dotrino-content enroll <code>)')
|
|
173
173
|
// Se ESPERA a la configuración antes de montar el almacén, porque de ella sale cuál es
|
|
174
174
|
// (§15.14). Con plazo: si la bóveda no contesta, se arranca con el disco y ya se
|
|
175
175
|
// reiniciará cuando llegue — un node no puede quedarse sin servir por eso.
|
|
@@ -180,7 +180,7 @@ const { store, cfg } = await openStore({ dir, log })
|
|
|
180
180
|
|
|
181
181
|
const node = await new ContentNode({ dir, maxBytes, maxBlobBytes, store, log, publicBase: cfg?.pub ? cfg.baseUrl : null }).init()
|
|
182
182
|
// Lo que quedó sin subir en un arranque anterior. Se lanza y no se espera.
|
|
183
|
-
node.backupPending().then(({ pending }) => { if (pending) log(`[
|
|
183
|
+
node.backupPending().then(({ pending }) => { if (pending) log(`[store] ${pending} pending upload(s) to the bucket`) })
|
|
184
184
|
const server = createServer(node)
|
|
185
185
|
|
|
186
186
|
// GC periódico de vencidos (ttl); el GC por cuota corre inline en cada put.
|
|
@@ -192,7 +192,7 @@ node.gc()
|
|
|
192
192
|
// propia ACL, su límite por IP y su techo de salida: no se activa por descuido.
|
|
193
193
|
server.listen(port, '127.0.0.1', () => {
|
|
194
194
|
const s = node.stats()
|
|
195
|
-
console.log(`dotrino-content ${VERSION}
|
|
195
|
+
console.log(`dotrino-content ${VERSION} on http://127.0.0.1:${port} · data: ${dir}`)
|
|
196
196
|
console.log(`blobs: ${s.blobs} · bytes: ${s.bytes}${maxBytes ? ` / ${maxBytes}` : ''}`)
|
|
197
197
|
})
|
|
198
198
|
|
|
@@ -201,15 +201,15 @@ server.listen(port, '127.0.0.1', () => {
|
|
|
201
201
|
// tiene administración remota cuando no la tiene.
|
|
202
202
|
let agent = null
|
|
203
203
|
if (values['no-agent']) {
|
|
204
|
-
console.log('
|
|
204
|
+
console.log('control plane: off (--no-agent)')
|
|
205
205
|
} else if (isLinked()) {
|
|
206
206
|
try {
|
|
207
207
|
agent = await startContentAgent({ node, version: VERSION })
|
|
208
208
|
} catch (e) {
|
|
209
|
-
console.error(`
|
|
209
|
+
console.error(`control plane: did not start (${e.message})`)
|
|
210
210
|
}
|
|
211
211
|
} else {
|
|
212
|
-
console.log('
|
|
212
|
+
console.log('control plane: not linked (run `dotrino-content enroll <code>` to manage it from your apps)')
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
// Modo público (§7.2). Va DESPUÉS del agente a propósito: el `owner` del node lo
|
|
@@ -231,14 +231,14 @@ if (values.public) {
|
|
|
231
231
|
owner: node.owner
|
|
232
232
|
})
|
|
233
233
|
publicServer.listen(publicPort, publicHost, () => {
|
|
234
|
-
console.log(`
|
|
235
|
-
`${maxKb ? `
|
|
236
|
-
`${egressGb ? ` ·
|
|
234
|
+
console.log(`public previews on http://${publicHost}:${publicPort} · images only` +
|
|
235
|
+
`${maxKb ? ` up to ${maxKb} KB` : ' (NO size cap)'}` +
|
|
236
|
+
`${egressGb ? ` · egress cap ${egressGb} GB/day` : ''}`)
|
|
237
237
|
if (!node.owner) {
|
|
238
|
-
console.log('
|
|
238
|
+
console.log(' note: this node is not linked to a vault, so the cards come out without an "Open" link')
|
|
239
239
|
}
|
|
240
240
|
if (!maxKb) {
|
|
241
|
-
console.log('
|
|
241
|
+
console.log(' note: with no size cap this serves originals, not previews — and you pay for the bandwidth')
|
|
242
242
|
}
|
|
243
243
|
})
|
|
244
244
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dotrino/content",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
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": {
|
package/src/storage.js
CHANGED
|
@@ -101,7 +101,7 @@ export async function checkBuckets (cfg, { priv, pub }, f = fetch) {
|
|
|
101
101
|
fatal.push(`the private bucket "${cfg.priv}" answers without credentials (HTTP ${r.status}): it is open to the world`)
|
|
102
102
|
}
|
|
103
103
|
} catch (e) {
|
|
104
|
-
warn.push(`
|
|
104
|
+
warn.push(`could not check whether the private bucket is closed: ${e.message}`)
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
// 3. El dominio del público tiene que servir DE VERDAD, y eso no se deduce mirando
|
|
@@ -122,10 +122,10 @@ export async function checkBuckets (cfg, { priv, pub }, f = fetch) {
|
|
|
122
122
|
const r = await f(`${cfg.baseUrl.replace(/\/+$/, '')}/${cid}`, { method: 'GET' })
|
|
123
123
|
const body = r.ok ? (await r.text()).trim() : ''
|
|
124
124
|
if (body !== PROBE) {
|
|
125
|
-
warn.push(`${cfg.baseUrl}
|
|
125
|
+
warn.push(`${cfg.baseUrl} does not serve what is in "${cfg.pub}" (HTTP ${r.status}): check that the domain is connected TO THE BUCKET in the dashboard`)
|
|
126
126
|
}
|
|
127
127
|
} catch (e) {
|
|
128
|
-
warn.push(`
|
|
128
|
+
warn.push(`could not check the public path: ${e.message}`)
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
|