From 2164f0602131c5768960ae310d15a3bc04fc8117 Mon Sep 17 00:00:00 2001 From: Matchu Date: Thu, 21 Jan 2021 15:14:23 -0800 Subject: [PATCH] Add --resync-existing to cache-asset-manifests Wowie, looks like all the SVG asset manifests changed format lol! Running this now to update them all. There's a lot of them! --- scripts/cache-asset-manifests.js | 9 ++++++++- src/server/types/AppearanceLayer.js | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/cache-asset-manifests.js b/scripts/cache-asset-manifests.js index 185e7c1..cfdb4c8 100644 --- a/scripts/cache-asset-manifests.js +++ b/scripts/cache-asset-manifests.js @@ -16,9 +16,16 @@ const connectToDb = require("../src/server/db"); const neopetsAssets = require("../src/server/neopets-assets"); async function cacheAssetManifests(db) { + // Normally, we skip manifests that we already have. But you can run with + // --resync-existing to check old manifests for changes! (This might take, + // like, multiple minutes to even run this first query!) + const condition = argv.resyncExisting + ? `1` + : `manifest IS NULL OR manifest = ""`; + const [rows] = await db.execute( `SELECT id, url, manifest FROM swf_assets ` + - `WHERE manifest IS NULL OR manifest = "" AND id >= ? ` + + `WHERE ${condition} AND id >= ? ` + `ORDER BY id`, [argv.start || 0] ); diff --git a/src/server/types/AppearanceLayer.js b/src/server/types/AppearanceLayer.js index c82ff29..2045e71 100644 --- a/src/server/types/AppearanceLayer.js +++ b/src/server/types/AppearanceLayer.js @@ -160,6 +160,9 @@ const resolvers = { // In the `lod` case, if there's a JS asset, then don't treat this as an // SVG asset at all. (There might be an SVG in the asset list anyway // sometimes I think, for the animation, but ignore it if so!) + // + // NOTE: I thiiink the `vector` case is deprecated? I haven't verified + // whether it's gone from our database yet, though. const jsAssetDatum = asset.assetData.find((ad) => ad.path.endsWith(".js") );