mirror of https://github.com/wg-easy/wg-easy
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
529 B
20 lines
529 B
type GithubRelease = {
|
|
tag_name: string;
|
|
};
|
|
|
|
export async function fetchLatestRelease() {
|
|
try {
|
|
const response = await $fetch<GithubRelease>(
|
|
'https://api.github.com/repos/wg-easy/wg-easy/releases/latest',
|
|
{ method: 'get' }
|
|
);
|
|
if (!response) {
|
|
throw new Error('Empty Response');
|
|
}
|
|
// TODO: changelog
|
|
return { version: response.tag_name, changelog: '' };
|
|
} catch (e) {
|
|
SERVER_DEBUG('Failed to fetch latest releases: ', e);
|
|
return { version: 'v0.0.0', changelog: '' };
|
|
}
|
|
}
|
|
|