diff --git a/docs/api-change.md b/docs/api-change.md index dfd873b873..ff382fc6c9 100644 --- a/docs/api-change.md +++ b/docs/api-change.md @@ -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` diff --git a/packages/backend/src/server/api/endpoints/latest-version.ts b/packages/backend/src/server/api/endpoints/latest-version.ts index a5c00e7a4c..2ca29429b6 100644 --- a/packages/backend/src/server/api/endpoints/latest-version.ts +++ b/packages/backend/src/server/api/endpoints/latest-version.ts @@ -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, }; }); diff --git a/packages/client/src/pages/admin/index.vue b/packages/client/src/pages/admin/index.vue index 009a6ba6e2..82cf2e3c0c 100644 --- a/packages/client/src/pages/admin/index.vue +++ b/packages/client/src/pages/admin/index.vue @@ -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; diff --git a/packages/client/src/ui/_common_/navbar.vue b/packages/client/src/ui/_common_/navbar.vue index 875060576f..9c2dc5d8d7 100644 --- a/packages/client/src/ui/_common_/navbar.vue +++ b/packages/client/src/ui/_common_/navbar.vue @@ -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;