diff --git a/app.vue b/app.vue index 26449e3..f9f2a06 100644 --- a/app.vue +++ b/app.vue @@ -125,6 +125,8 @@ const appConfig = useAppConfig(); import { createDbWorker } from "sql.js-httpvfs"; import { useLocalStorage } from "@vueuse/core"; import { getFile, saveFile } from "./indexdb"; +import { Liquid } from "liquidjs"; +const liquid = new Liquid(); useHead({ title: appConfig.title, @@ -184,12 +186,7 @@ const setResults = (books) => { b[key] = b[columns[key]]; delete b[columns[key]]; } - b.image_url = images - .replaceAll("${id}", b.id) - .replaceAll("${md5}", b.md5) - .replaceAll("${md5_lowercse}", b.md5?.toLowerCase()) - .replaceAll("${ipfs_cid}", b.ipfs_cid) - .replaceAll("${id_group}", Math.floor(b.id / 1000) * 1000); + b.image_url = liquid.parseAndRenderSync(images, b); return b; }); }; diff --git a/package-lock.json b/package-lock.json index d34f722..195f764 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,7 @@ "hasInstallScript": true, "dependencies": { "@vueuse/core": "^11.1.0", + "liquidjs": "^10.19.0", "lucide-vue-next": "^0.439.0", "nuxt": "^3.13.0", "nuxt-lucide-icons": "^1.0.5", @@ -4051,6 +4052,35 @@ "url": "https://github.com/sponsors/antonk52" } }, + "node_modules/liquidjs": { + "version": "10.19.0", + "resolved": "https://registry.npmjs.org/liquidjs/-/liquidjs-10.19.0.tgz", + "integrity": "sha512-dNINmbNJ/bp3B8n25BtZQV/GbrmFf0o2InGdMdfQXa+LxfzTFXOkUnBsOLZUb82sLzxaiWv5Jc381Kn4zHjTsQ==", + "license": "MIT", + "dependencies": { + "commander": "^10.0.0" + }, + "bin": { + "liquid": "bin/liquid.js", + "liquidjs": "bin/liquid.js" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/liquidjs" + } + }, + "node_modules/liquidjs/node_modules/commander": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", + "license": "MIT", + "engines": { + "node": ">=14" + } + }, "node_modules/listhen": { "version": "1.7.2", "license": "MIT", diff --git a/package.json b/package.json index 96a4ea1..eceb407 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ }, "dependencies": { "@vueuse/core": "^11.1.0", + "liquidjs": "^10.19.0", "lucide-vue-next": "^0.439.0", "nuxt": "^3.13.0", "nuxt-lucide-icons": "^1.0.5",