summary refs log tree commit diff
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-01-24 13:28:24 +1100
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-01-24 13:28:24 +1100
commite296598e1ca142fbcaeb11235a31b06baf34be8b (patch)
treea87c1171bd33b2efc0b36515187b794d4f172231
parentUpdate client cacher to allow numbers in extensions ( for woff2 ) (diff)
downloadserver-e296598e1ca142fbcaeb11235a31b06baf34be8b.tar.xz
Don't try to cache files like /assets/;var u,p={26700:0};l.f
-rw-r--r--scripts/client.js13
1 files changed, 9 insertions, 4 deletions
diff --git a/scripts/client.js b/scripts/client.js
index 54a30863..8cbc15b1 100644
--- a/scripts/client.js
+++ b/scripts/client.js
@@ -222,13 +222,18 @@ const processFile = async (asset) => {
 	await fs.writeFile(path.join(CACHE_PATH, asset), text);
 
 	let ret = new Set([
-		...(text.match(/"[A-Fa-f0-9]{20}"/g) ?? []), // These are generally JS assets
+		// These are generally JS assets
+		...(text.match(/"[A-Fa-f0-9]{20}"/g) ?? []),
+
+		// anything that looks like e.exports="filename.ext"
 		...[...text.matchAll(/\.exports=.\..\+"(.*?\..{0,5})"/g)].map(
 			(x) => x[1],
-		), // anything that looks like e.exports="filename.ext"
-		...[...text.matchAll(/\/assets\/(.*?\.[a-z0-9]{0,5})/g)].map(
+		),
+
+		// commonly matches `background: url(/assets/blah.svg)`
+		...[...text.matchAll(/\/assets\/([a-zA-Z0-9]*?\.[a-z0-9]{0,5})/g)].map(
 			(x) => x[1],
-		), // commonly matches `background: url(/assets/blah.svg)`
+		),
 	]);
 
 	return [...ret].map((x) => x.replaceAll('"', ""));