Skip to content

Commit

Permalink
Fix fetching a thumbnail from itch a second time
Browse files Browse the repository at this point in the history
  • Loading branch information
xorblo-doitus committed Apr 4, 2024
1 parent a83cc6d commit 7647dd3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions docs/elements/define-elements.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,15 @@ class ProjectCard extends HTMLElementHelper {

fetchThumbItch(row) {
if (row.get("url").includes("itch.io")) {
this.scrapThumbItch(row.get("url"));
this.setThumbItch(row.get("url"));
return ProjectPage._missingThumbnail + "?INFO_fetching_from_itch";
}
}

async setThumbItch(url) {
this.thumbnail = await this.scrapThumbItch(url);
}

async scrapThumbItch(url) {
const json = await ProjectCard.CORSProxyFetch(url + "/data.json");
if (json === undefined) {
Expand All @@ -152,7 +156,7 @@ class ProjectCard extends HTMLElementHelper {
// const json = await (await fetch(url + "/data.json")).json();
const imageURL = json["cover_image"];
ProjectCard.fetchedImageURLs[this.projectID] = imageURL;
this.thumbnail = ProjectCard.toCORSProxy(imageURL);
return ProjectCard.toCORSProxy(imageURL);
}

fetchThumbRoblox(row) {
Expand Down

0 comments on commit 7647dd3

Please sign in to comment.