From bd9017796e131668180d29ff6cee6f1dd316aace Mon Sep 17 00:00:00 2001 From: Matchu Date: Wed, 3 Aug 2022 14:36:07 -0700 Subject: [PATCH] Use HTTPS for images.neopets.com and pets.neopets.com Tbh I didn't even really validate these changes, or that the codepaths right now aren't working, they just seem like clear drop-in upgrades now that HTTPS works and HTTP requests are redirected. Simplify! --- src/server/neopets-assets.js | 6 +++--- src/server/types/AppearanceLayer.js | 2 +- src/server/types/MutationsForSupport.js | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/server/neopets-assets.js b/src/server/neopets-assets.js index 179e40d..dfe0464 100644 --- a/src/server/neopets-assets.js +++ b/src/server/neopets-assets.js @@ -37,7 +37,7 @@ async function loadAssetManifest(swfUrl) { const SWF_URL_PATTERN = /^https?:\/\/images\.neopets\.com\/cp\/(bio|items)\/swf\/(.+?)_([a-z0-9]+)\.swf$/; function convertSwfUrlToPossibleManifestUrls(swfUrl) { - const match = new URL(swfUrl, "http://images.neopets.com") + const match = new URL(swfUrl, "https://images.neopets.com") .toString() .match(SWF_URL_PATTERN); if (!match) { @@ -51,8 +51,8 @@ function convertSwfUrlToPossibleManifestUrls(swfUrl) { // TODO: There are a few potential manifest URLs in play! Long-term, we // should get this from modeling data. But these are some good guesses! return [ - `http://images.neopets.com/cp/${type}/data/${folders}/manifest.json`, - `http://images.neopets.com/cp/${type}/data/${folders}_${hash}/manifest.json`, + `https://images.neopets.com/cp/${type}/data/${folders}/manifest.json`, + `https://images.neopets.com/cp/${type}/data/${folders}_${hash}/manifest.json`, ]; } diff --git a/src/server/types/AppearanceLayer.js b/src/server/types/AppearanceLayer.js index 69aab86..9f041b6 100644 --- a/src/server/types/AppearanceLayer.js +++ b/src/server/types/AppearanceLayer.js @@ -423,7 +423,7 @@ async function loadAndCacheAssetDataFromManifest(db, layer) { const format = asset.format; const assetUrls = asset.assetData.map( - (ad) => new URL(ad.path, "http://images.neopets.com") + (ad) => new URL(ad.path, "https://images.neopets.com") ); // In the case of JS assets, we want the *last* one in the list, because diff --git a/src/server/types/MutationsForSupport.js b/src/server/types/MutationsForSupport.js index 02f8e4f..b0a123d 100644 --- a/src/server/types/MutationsForSupport.js +++ b/src/server/types/MutationsForSupport.js @@ -518,7 +518,7 @@ const resolvers = { { title: `🛠 ${colorName} ${speciesName}`, thumbnail: { - url: `http://pets.neopets.com/cp/${ + url: `https://pets.neopets.com/cp/${ petType.basicImageHash || petType.imageHash }/1/6.png`, height: 150, @@ -754,7 +754,7 @@ const resolvers = { { title: `🛠 ${colorName} ${speciesName}`, thumbnail: { - url: `http://pets.neopets.com/cp/${ + url: `https://pets.neopets.com/cp/${ petType.basicImageHash || petType.imageHash }/1/6.png`, height: 150, @@ -833,7 +833,7 @@ const resolvers = { { title: `🛠 ${colorName} ${speciesName}`, thumbnail: { - url: `http://pets.neopets.com/cp/${ + url: `https://pets.neopets.com/cp/${ petType.basicImageHash || petType.imageHash }/1/6.png`, height: 150,