From 4fb0d84f5b598f63cbb8215c6e534356f470e8bb Mon Sep 17 00:00:00 2001 From: tree Date: Thu, 7 Mar 2024 18:00:53 +0100 Subject: [PATCH] fix thumbs --- utils/engine.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/utils/engine.js b/utils/engine.js index ee3a881..a6b5f0d 100644 --- a/utils/engine.js +++ b/utils/engine.js @@ -63,14 +63,16 @@ export class Engine { // scan for thumbnails for await (const ti of Deno.readDir(join(yearDir, "thumbs"))) { const [name, ext] = ti.name.split('.') - const split = name.split('-') - const thumbKey = split[split.length-1] - const imageKey = split[split.length-2] - const sid = split.slice(0, split.length-2).join('-') - - if (ev.id === sid) { - ev.thumbs[[ imageKey, thumbKey.replace('px', '')].join(':')] = `https://data.web3privacy.info/img/events/${year}/thumbs/${ev.id}-${imageKey}-${thumbKey}.${ext}` + + //console.log(name, `^${ev.id}-(.+)-(\\d+)px$`) + const match = name.match(new RegExp(`^${ev.id}-([\\w\\d-]+)-(\\d+)px`)); + if (!match) { + continue } + const thumbKey = match[1] + const imageKey = match[2] + + ev.thumbs[[ imageKey, thumbKey.replace('px', '')].join(':')] = `https://data.web3privacy.info/img/events/${year}/thumbs/${ev.id}-${imageKey}-${thumbKey}.${ext}` } } }