fix thumbs

This commit is contained in:
tree🌴 2024-03-07 18:00:53 +01:00
parent 0e44e4a586
commit 4fb0d84f5b

View file

@ -63,14 +63,16 @@ export class Engine {
// scan for thumbnails // scan for thumbnails
for await (const ti of Deno.readDir(join(yearDir, "thumbs"))) { for await (const ti of Deno.readDir(join(yearDir, "thumbs"))) {
const [name, ext] = ti.name.split('.') const [name, ext] = ti.name.split('.')
const split = name.split('-')
const thumbKey = split[split.length-1] //console.log(name, `^${ev.id}-(.+)-(\\d+)px$`)
const imageKey = split[split.length-2] const match = name.match(new RegExp(`^${ev.id}-([\\w\\d-]+)-(\\d+)px`));
const sid = split.slice(0, split.length-2).join('-') if (!match) {
continue
if (ev.id === sid) {
ev.thumbs[[ imageKey, thumbKey.replace('px', '')].join(':')] = `https://data.web3privacy.info/img/events/${year}/thumbs/${ev.id}-${imageKey}-${thumbKey}.${ext}`
} }
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}`
} }
} }
} }