Skip to content

Commit

Permalink
Fix authors in addon page
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRolfFR committed Feb 16, 2024
1 parent 8b389d5 commit 19834d9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
PORT=8110
BOT_API_TOKEN=123456789ABCDEFGH
11 changes: 5 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,10 @@ app.get("/addons/:name/?", (req, res, next) => {
.then((res) => res.json())
.then(async (result) => {
addon = result;
const res = await fetch(`https://api.faithfulpack.net/v2/users/raw`);
const users = await res.json();
return Object.values(users).filter((user) => addon.authors.includes(user.id));
const res = await fetch(`https://api.faithfulpack.net/v2/users/${addon.authors.join(',')}`);
const json_response = await res.json();

return Array.isArray(json_response) ? json_response : [json_response];
})
.then(async (result) => {
const authors = result;
Expand All @@ -301,9 +302,7 @@ app.get("/addons/:name/?", (req, res, next) => {
return;
}

const authorArray = addon.authors
.map((author) => authors[author])
.filter((e) => !!e)
const authorArray = authors
.map((user) => user.username)
.filter((e) => !!e);

Expand Down

0 comments on commit 19834d9

Please sign in to comment.