-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add download link to outdated message
- Loading branch information
1 parent
777be8e
commit 36fdf55
Showing
4 changed files
with
57 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
let metadata: { name?: string } = {} | ||
|
||
const fetchData = async (): Promise<void> => { | ||
try { | ||
metadata = { ...await (await fetch('https://api.spiget.org/v2/resources/2124/versions/latest')).json() } | ||
} catch (e) { | ||
console.error(e) | ||
} | ||
type Metadata = { | ||
tag_name: string | ||
assets: { | ||
name: string | ||
browser_download_url: string | ||
}[] | ||
} | ||
|
||
await fetchData() | ||
setInterval(fetchData, 1_000 * 60) // 60 requests per hour | ||
const fetchData = async (): Promise<Metadata> => { | ||
return await (await fetch('https://api.github.com/repos/SkinsRestorer/SkinsRestorer/releases/latest')).json() | ||
} | ||
let metadata = await fetchData() | ||
setInterval(() => { | ||
void fetchData().catch(console.error) | ||
}, 1_000 * 60) // 60 requests per hour | ||
|
||
export function getMetadata () { | ||
export function getMetadata() { | ||
return metadata | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.