Fix bug where we weren't recognizing new SVGs

So, we've been behind the latest conversion data for a while anyway, because I don't run the sync very often. But I ran the sync today and noticed that the newly converted SVGs weren't showing up in DTI!

This is because TNT changed the asset manifest structure they use for SVG-only assets. Now, we support both!

To test, I checked the Blue Acara (old-style SVG manifest), the Blue Chia (new-style SVG manifest), and the Floating Negg Faerie Doll (animated clip).
This commit is contained in:
Emi Matchu 2021-01-20 10:43:41 -08:00
parent 275d1d62ab
commit f40ccf0b21

View file

@ -153,16 +153,28 @@ const resolvers = {
}
const asset = manifest.assets[0];
if (asset.format !== "vector") {
if (asset.format !== "vector" && asset.format !== "lod") {
return null;
}
if (asset.assetData.length !== 1) {
// 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!)
const jsAssetDatum = asset.assetData.find((ad) =>
ad.path.endsWith(".js")
);
if (jsAssetDatum) {
return null;
}
const assetDatum = asset.assetData[0];
const url = new URL(assetDatum.path, "http://images.neopets.com");
const svgAssetDatum = asset.assetData.find((ad) =>
ad.path.endsWith(".svg")
);
if (!svgAssetDatum) {
return null;
}
const url = new URL(svgAssetDatum.path, "http://images.neopets.com");
return url.toString();
},
canvasMovieLibraryUrl: async ({ id }, _, { db, swfAssetLoader }) => {