From 08da5be83b7fe7f67ce861fa311ce9b32bb22f55 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sun, 29 Oct 2023 15:28:20 -0300 Subject: urls, write: integrate separate media cache --- src/write/build-modes/live-dev-server.js | 5 ++++- src/write/build-modes/static-build.js | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src/write') diff --git a/src/write/build-modes/live-dev-server.js b/src/write/build-modes/live-dev-server.js index 1339c322..47d59f95 100644 --- a/src/write/build-modes/live-dev-server.js +++ b/src/write/build-modes/live-dev-server.js @@ -51,6 +51,7 @@ export async function go({ cliOptions, _dataPath, mediaPath, + mediaCachePath, defaultLanguage, languages, @@ -171,7 +172,7 @@ export async function go({ const { area: localFileArea, path: localFilePath - } = pathname.match(/^\/(?static|util|media)\/(?.*)/)?.groups ?? {}; + } = pathname.match(/^\/(?static|util|media|thumb)\/(?.*)/)?.groups ?? {}; if (localFileArea) { // Not security tested, man, this is a dev server!! @@ -182,6 +183,8 @@ export async function go({ localDirectory = path.join(srcRootPath, localFileArea); } else if (localFileArea === 'media') { localDirectory = mediaPath; + } else if (localFileArea === 'thumb') { + localDirectory = mediaCachePath; } let filePath; diff --git a/src/write/build-modes/static-build.js b/src/write/build-modes/static-build.js index 09316999..96f2a0ed 100644 --- a/src/write/build-modes/static-build.js +++ b/src/write/build-modes/static-build.js @@ -84,6 +84,7 @@ export async function go({ cliOptions, _dataPath, mediaPath, + mediaCachePath, queueSize, defaultLanguage, @@ -133,6 +134,7 @@ export async function go({ await writeSymlinks({ srcRootPath, mediaPath, + mediaCachePath, outputPath, urls, }); @@ -414,6 +416,7 @@ async function writePage({ function writeSymlinks({ srcRootPath, mediaPath, + mediaCachePath, outputPath, urls, }) { @@ -421,6 +424,7 @@ function writeSymlinks({ link(path.join(srcRootPath, 'util'), 'shared.utilityRoot'), link(path.join(srcRootPath, 'static'), 'shared.staticRoot'), link(mediaPath, 'media.root'), + link(mediaCachePath, 'thumb.root'), ]); async function link(directory, urlKey) { -- cgit 1.3.0-6-gf8a5