Skip to content

Commit

Permalink
Remove request headers
Browse files Browse the repository at this point in the history
  • Loading branch information
Strokkur424 authored Oct 25, 2024
1 parent e9ca484 commit 0fcdff1
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/util/versionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,20 @@ class ExpiringValue<T> {
return this._value;
}
}

const requestHeaders = { "User-Agent": "PaperMC-Docs" };

const createProjectVersionsValue = (
project: string,
ttl: number = 5 * 60 * 1000
): ExpiringValue<string[]> => {
return new ExpiringValue(ttl, async () => {
const result = await fetch(`https://api.papermc.io/v2/projects/${project}`, {
headers: requestHeaders,
}).then((r) => r.json());
const result = await fetch(`https://api.papermc.io/v2/projects/${project}`).then((r) => r.json());

return result.versions;
});
};

const createUserdevVersionsValue = (ttl: number = 5 * 60 * 1000): ExpiringValue<string[]> => {
return new ExpiringValue(ttl, async () => {
const json = await fetch("https://api.github.com/repos/PaperMC/paperweight/tags", {
headers: requestHeaders,
}).then((r) => r.json());
const json = await fetch("https://api.github.com/repos/PaperMC/paperweight/tags").then((r) => r.json());

return json.map((e) => e.name.substring(1)).reverse();
});
Expand Down

0 comments on commit 0fcdff1

Please sign in to comment.