dotrino-content 0.3.0 → 0.3.1

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/fetch.js +4 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dotrino-content",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
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/fetch.js CHANGED
@@ -57,7 +57,10 @@ export function startPublicFetch ({ client, node, ratePerMin = 60, quiet = false
57
57
  if (!meta || meta.acl !== 'public' || meta.enc) return fail(from, rid, 'not-found', 'no such public cid')
58
58
  const url = node.publicUrl(p.cid)
59
59
  const out = { type: MSG.FETCH_OK, rid, cid: p.cid, mime: meta.mime, size: meta.size, url }
60
- if (!p.head) {
60
+ // Con atajo, los bytes NO viajan por el proxio salvo que el que pide insista
61
+ // (`full`): cargar por URL es gratis para el node y para la red, y la app ya
62
+ // sabe volver aquí si la URL le falla. Sin atajo, van en el mensaje si caben.
63
+ if (!p.head && (!url || p.full)) {
61
64
  if (meta.size > FETCH_MAX_BYTES) {
62
65
  if (!url) return fail(from, rid, 'too-large', `${meta.size} bytes do not fit in a message and this node has no public bucket`)
63
66
  // Cabe solo por URL: se contesta sin bytes y la app carga por ahí.