fix (api): fetch latest version from new repository
This commit is contained in:
parent
ba1e2898de
commit
dc66474eef
4 changed files with 10 additions and 6 deletions
|
@ -2,6 +2,10 @@
|
|||
|
||||
Breaking changes are indicated by the :warning: icon.
|
||||
|
||||
## Unreleased
|
||||
|
||||
- :warning: The field name of the response of `latest-version` has been changed from `tag_name` to `latest_version`.
|
||||
|
||||
## v1.0.5-rc
|
||||
|
||||
- `admin/update-meta` can now take `moreUrls` parameter, and response of `admin/meta` now includes `moreUrls`
|
||||
|
|
|
@ -14,14 +14,14 @@ export const paramDef = {
|
|||
} as const;
|
||||
|
||||
export default define(meta, paramDef, async () => {
|
||||
let tag_name;
|
||||
await fetch("https://git.joinfirefish.org/api/v4/projects/7/releases")
|
||||
let latest_version;
|
||||
await fetch("https://firefish.dev/firefish/firefish/-/raw/main/package.json")
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
tag_name = data[0].tag_name;
|
||||
latest_version = data.version;
|
||||
});
|
||||
|
||||
return {
|
||||
tag_name,
|
||||
latest_version,
|
||||
};
|
||||
});
|
||||
|
|
|
@ -122,7 +122,7 @@ os.api("admin/abuse-user-reports", {
|
|||
|
||||
if (defaultStore.state.showAdminUpdates) {
|
||||
os.api("latest-version").then((res) => {
|
||||
const cleanRes = parseInt(res?.tag_name.replace(/[^0-9]/g, ""));
|
||||
const cleanRes = parseInt(res?.latest_version.replace(/[^0-9]/g, ""));
|
||||
const cleanVersion = parseInt(version.replace(/[^0-9]/g, ""));
|
||||
if (cleanRes > cleanVersion) {
|
||||
updateAvailable.value = true;
|
||||
|
|
|
@ -206,7 +206,7 @@ if (isAdmin) {
|
|||
|
||||
if (defaultStore.state.showAdminUpdates) {
|
||||
os.api("latest-version").then((res) => {
|
||||
const cleanRes = parseInt(res?.tag_name.replace(/[^0-9]/g, ""));
|
||||
const cleanRes = parseInt(res?.latest_version.replace(/[^0-9]/g, ""));
|
||||
const cleanVersion = parseInt(version.replace(/[^0-9]/g, ""));
|
||||
if (cleanRes > cleanVersion) {
|
||||
updateAvailable.value = true;
|
||||
|
|
Loading…
Reference in a new issue