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.
|
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
|
## v1.0.5-rc
|
||||||
|
|
||||||
- `admin/update-meta` can now take `moreUrls` parameter, and response of `admin/meta` now includes `moreUrls`
|
- `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;
|
} as const;
|
||||||
|
|
||||||
export default define(meta, paramDef, async () => {
|
export default define(meta, paramDef, async () => {
|
||||||
let tag_name;
|
let latest_version;
|
||||||
await fetch("https://git.joinfirefish.org/api/v4/projects/7/releases")
|
await fetch("https://firefish.dev/firefish/firefish/-/raw/main/package.json")
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
tag_name = data[0].tag_name;
|
latest_version = data.version;
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
tag_name,
|
latest_version,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
@ -122,7 +122,7 @@ os.api("admin/abuse-user-reports", {
|
||||||
|
|
||||||
if (defaultStore.state.showAdminUpdates) {
|
if (defaultStore.state.showAdminUpdates) {
|
||||||
os.api("latest-version").then((res) => {
|
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, ""));
|
const cleanVersion = parseInt(version.replace(/[^0-9]/g, ""));
|
||||||
if (cleanRes > cleanVersion) {
|
if (cleanRes > cleanVersion) {
|
||||||
updateAvailable.value = true;
|
updateAvailable.value = true;
|
||||||
|
|
|
@ -206,7 +206,7 @@ if (isAdmin) {
|
||||||
|
|
||||||
if (defaultStore.state.showAdminUpdates) {
|
if (defaultStore.state.showAdminUpdates) {
|
||||||
os.api("latest-version").then((res) => {
|
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, ""));
|
const cleanVersion = parseInt(version.replace(/[^0-9]/g, ""));
|
||||||
if (cleanRes > cleanVersion) {
|
if (cleanRes > cleanVersion) {
|
||||||
updateAvailable.value = true;
|
updateAvailable.value = true;
|
||||||
|
|
Loading…
Reference in a new issue