1
0
Fork 0
mirror of https://git.sr.ht/~ashkeel/strimertul synced 2024-10-04 02:50:33 +00:00

Compare commits

...

2 commits

Author SHA1 Message Date
Ash Keel
afc931c6b8
docs: update changelog
All checks were successful
continuous-integration/drone/tag Build is passing
2023-11-12 02:33:18 +01:00
Ash Keel
3094fee5be
feat: use new update check 2023-11-12 02:31:45 +01:00
2 changed files with 15 additions and 30 deletions

View file

@ -7,9 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## current ## current
## 3.3.1 - 2023-11-12
### Changed ### Changed
- Updated Kilovolt with a new websocket library - Updated Kilovolt with a new websocket library
- Releases have been moved so the update checker now uses a new endpoint
### Fixed ### Fixed

View file

@ -201,6 +201,15 @@ function hasLatestOrBeta(current: string, latest: string): boolean {
return parsedCurrent.prerelease > parsedLatest.prerelease; return parsedCurrent.prerelease > parsedLatest.prerelease;
} }
interface VersionInfo {
name: string;
url: string;
}
interface UpdateInfo {
stable: VersionInfo;
latest: VersionInfo;
}
export default function Sidebar({ export default function Sidebar({
sections, sections,
}: SidebarProps): React.ReactElement { }: SidebarProps): React.ReactElement {
@ -216,36 +225,9 @@ export default function Sidebar({
async function fetchLastVersion() { async function fetchLastVersion() {
try { try {
// For prerelease builds, use the list endpoint to get the latest prerelease const req = await fetch('https://strimertul.stream/update.json');
if (prerelease) { const data = (await req.json()) as UpdateInfo;
const req = await fetch( setLastVersion(prerelease ? data.latest : data.stable);
`https://api.github.com/repos/${APPREPO}/releases`,
{
headers: {
Accept: 'application/vnd.github.v3+json',
},
},
);
const data = (await req.json()) as { html_url: string; name: string }[];
setLastVersion({
url: data[0].html_url,
name: data[0].name,
});
} else {
const req = await fetch(
`https://api.github.com/repos/${APPREPO}/releases/latest`,
{
headers: {
Accept: 'application/vnd.github.v3+json',
},
},
);
const data = (await req.json()) as { html_url: string; name: string };
setLastVersion({
url: data.html_url,
name: data.name,
});
}
} catch (e) { } catch (e) {
// TODO Report error nicely // TODO Report error nicely
console.warn('Failed checking upstream for latest version', e); console.warn('Failed checking upstream for latest version', e);