-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(frontend): CherryPick 클라이언트 업데이트 확인
- Loading branch information
Showing
8 changed files
with
61 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
packages/frontend/src/scripts/fetch-cherrypick-releases.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { compareVersions } from 'compare-versions'; | ||
import { version } from '@@/js/config.js'; | ||
import { misskeyApi } from '@/scripts/misskey-api.js'; | ||
|
||
export async function fetchCherrypickReleases(): Promise<boolean> { | ||
try { | ||
const meta = await misskeyApi('admin/meta'); | ||
const response = await fetch('https://api.github.com/repos/kokonect-link/cherrypick/releases'); | ||
const releasesData = await response.json(); | ||
|
||
if (!Array.isArray(releasesData) || releasesData.length === 0) { | ||
console.warn('No CherryPick releases found.'); | ||
return false; | ||
} | ||
|
||
const latestRelease = meta.enableReceivePrerelease | ||
? releasesData[0] | ||
: releasesData.filter((x: any) => !x.prerelease)[0]; | ||
|
||
if (!latestRelease || !latestRelease.tag_name || typeof latestRelease.tag_name !== 'string') { | ||
console.warn('Invalid latest CherryPick release:', latestRelease); | ||
return false; | ||
} | ||
|
||
return ( | ||
compareVersions(version, latestRelease.tag_name) < 0 && | ||
compareVersions(<string>meta.skipCherryPickVersion || version, latestRelease.tag_name) < 0 | ||
); | ||
} catch (error) { | ||
console.error('Failed to fetch CherryPick releases:', error); | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters