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
|
## 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
|
||||||
|
|
||||||
|
|
|
@ -201,15 +201,6 @@ 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 {
|
||||||
|
@ -225,9 +216,36 @@ export default function Sidebar({
|
||||||
|
|
||||||
async function fetchLastVersion() {
|
async function fetchLastVersion() {
|
||||||
try {
|
try {
|
||||||
const req = await fetch('https://strimertul.stream/update.json');
|
// For prerelease builds, use the list endpoint to get the latest prerelease
|
||||||
const data = (await req.json()) as UpdateInfo;
|
if (prerelease) {
|
||||||
setLastVersion(prerelease ? data.latest : data.stable);
|
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) {
|
} 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);
|
||||||
|
|
Loading…
Reference in a new issue