mirror of
https://git.sr.ht/~ashkeel/strimertul
synced 2024-10-04 02:50:33 +00:00
Compare commits
No commits in common. "afc931c6b81f2393d8301ed8d984b114ed2e0891" and "5d4894d5f48a5c6fe415f9b80a139ad8c28406f2" have entirely different histories.
afc931c6b8
...
5d4894d5f4
2 changed files with 30 additions and 15 deletions
|
@ -7,12 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## current
|
||||
|
||||
## 3.3.1 - 2023-11-12
|
||||
|
||||
### Changed
|
||||
|
||||
- Updated Kilovolt with a new websocket library
|
||||
- Releases have been moved so the update checker now uses a new endpoint
|
||||
|
||||
### Fixed
|
||||
|
||||
|
|
|
@ -201,15 +201,6 @@ function hasLatestOrBeta(current: string, latest: string): boolean {
|
|||
return parsedCurrent.prerelease > parsedLatest.prerelease;
|
||||
}
|
||||
|
||||
interface VersionInfo {
|
||||
name: string;
|
||||
url: string;
|
||||
}
|
||||
interface UpdateInfo {
|
||||
stable: VersionInfo;
|
||||
latest: VersionInfo;
|
||||
}
|
||||
|
||||
export default function Sidebar({
|
||||
sections,
|
||||
}: SidebarProps): React.ReactElement {
|
||||
|
@ -225,9 +216,36 @@ export default function Sidebar({
|
|||
|
||||
async function fetchLastVersion() {
|
||||
try {
|
||||
const req = await fetch('https://strimertul.stream/update.json');
|
||||
const data = (await req.json()) as UpdateInfo;
|
||||
setLastVersion(prerelease ? data.latest : data.stable);
|
||||
// For prerelease builds, use the list endpoint to get the latest prerelease
|
||||
if (prerelease) {
|
||||
const req = await fetch(
|
||||
`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) {
|
||||
// TODO Report error nicely
|
||||
console.warn('Failed checking upstream for latest version', e);
|
||||
|
|
Loading…
Reference in a new issue