dotrino-content 0.3.3 → 0.3.5

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 +4 -4
  2. package/src/public.js +6 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dotrino-content",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
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,9 @@
23
23
  "typescript": "5.9.3"
24
24
  },
25
25
  "dependencies": {
26
- "@dotrino/identity": "0.56.0",
27
- "@dotrino/remote-agent": "0.4.1",
28
- "@dotrino/vault": "0.28.0"
26
+ "@dotrino/identity": "0.57.0",
27
+ "@dotrino/remote-agent": "0.5.1",
28
+ "@dotrino/vault": "0.30.0"
29
29
  },
30
30
  "keywords": [
31
31
  "dotrino",
package/src/public.js CHANGED
@@ -158,12 +158,14 @@ const parseMeta = (row) => {
158
158
  * pretende ser un visor. Lleva la imagen solo si el propio blob es una imagen o
159
159
  * si tiene una miniatura pública enlazada (`thumbnailCid`).
160
160
  */
161
- export function previewHtml ({ cid, row, base, appUrl, owner, index, imageCid = null }) {
161
+ export function previewHtml ({ cid, row, base, appUrl, owner, index, imageCid = null, imageFallback = null }) {
162
162
  const m = parseMeta(row)
163
163
  const title = m.title || m.name || 'Contenido compartido'
164
164
  // La imagen de la tarjeta la decide la ruta, que es quien pudo COMPROBAR que
165
165
  // ese cid es una imagen de verdad y que sale por el puerto. Aquí solo se pinta.
166
- const image = imageCid ? `${base}/c/${imageCid}` : null
166
+ // Sin imagen propia, la tarjeta de la app (`og.jpg`): una tarjeta sin imagen casi no
167
+ // se ve en X/LinkedIn, y la app es de quien es el contenido.
168
+ const image = imageCid ? `${base}/c/${imageCid}` : (imageFallback || null)
167
169
  const kb = Math.max(1, Math.round(row.size / 1024))
168
170
  const desc = m.description || `${row.mime} · ${kb} KB`
169
171
  // El enlace de "abrir" lleva la referencia en el #fragment: el servidor de la
@@ -270,7 +272,8 @@ export function createPublicServer (node, opts = {}) {
270
272
  if (top === 'p') {
271
273
  const body = previewHtml({
272
274
  cid, row, imageCid: await pickImage(cid, row),
273
- base: baseUrl(req, opts.publicUrl), appUrl, owner: opts.owner ?? node.owner, index: !!opts.index
275
+ base: baseUrl(req, opts.publicUrl), appUrl, owner: opts.owner ?? node.owner, index: !!opts.index,
276
+ imageFallback: opts.imageFallback ?? `${appUrl.replace(/\/+$/, '')}/og.jpg`
274
277
  })
275
278
  res.writeHead(200, {
276
279
  'content-type': 'text/html; charset=utf-8',