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!
This commit is contained in:
Emi Matchu 2022-08-03 14:36:07 -07:00
parent 6df1f49208
commit bd9017796e
3 changed files with 7 additions and 7 deletions

View file

@ -37,7 +37,7 @@ async function loadAssetManifest(swfUrl) {
const SWF_URL_PATTERN = /^https?:\/\/images\.neopets\.com\/cp\/(bio|items)\/swf\/(.+?)_([a-z0-9]+)\.swf$/; const SWF_URL_PATTERN = /^https?:\/\/images\.neopets\.com\/cp\/(bio|items)\/swf\/(.+?)_([a-z0-9]+)\.swf$/;
function convertSwfUrlToPossibleManifestUrls(swfUrl) { function convertSwfUrlToPossibleManifestUrls(swfUrl) {
const match = new URL(swfUrl, "http://images.neopets.com") const match = new URL(swfUrl, "https://images.neopets.com")
.toString() .toString()
.match(SWF_URL_PATTERN); .match(SWF_URL_PATTERN);
if (!match) { if (!match) {
@ -51,8 +51,8 @@ function convertSwfUrlToPossibleManifestUrls(swfUrl) {
// TODO: There are a few potential manifest URLs in play! Long-term, we // 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! // should get this from modeling data. But these are some good guesses!
return [ return [
`http://images.neopets.com/cp/${type}/data/${folders}/manifest.json`, `https://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}_${hash}/manifest.json`,
]; ];
} }

View file

@ -423,7 +423,7 @@ async function loadAndCacheAssetDataFromManifest(db, layer) {
const format = asset.format; const format = asset.format;
const assetUrls = asset.assetData.map( 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 // In the case of JS assets, we want the *last* one in the list, because

View file

@ -518,7 +518,7 @@ const resolvers = {
{ {
title: `🛠 ${colorName} ${speciesName}`, title: `🛠 ${colorName} ${speciesName}`,
thumbnail: { thumbnail: {
url: `http://pets.neopets.com/cp/${ url: `https://pets.neopets.com/cp/${
petType.basicImageHash || petType.imageHash petType.basicImageHash || petType.imageHash
}/1/6.png`, }/1/6.png`,
height: 150, height: 150,
@ -754,7 +754,7 @@ const resolvers = {
{ {
title: `🛠 ${colorName} ${speciesName}`, title: `🛠 ${colorName} ${speciesName}`,
thumbnail: { thumbnail: {
url: `http://pets.neopets.com/cp/${ url: `https://pets.neopets.com/cp/${
petType.basicImageHash || petType.imageHash petType.basicImageHash || petType.imageHash
}/1/6.png`, }/1/6.png`,
height: 150, height: 150,
@ -833,7 +833,7 @@ const resolvers = {
{ {
title: `🛠 ${colorName} ${speciesName}`, title: `🛠 ${colorName} ${speciesName}`,
thumbnail: { thumbnail: {
url: `http://pets.neopets.com/cp/${ url: `https://pets.neopets.com/cp/${
petType.basicImageHash || petType.imageHash petType.basicImageHash || petType.imageHash
}/1/6.png`, }/1/6.png`,
height: 150, height: 150,