Skip to content

Commit

Permalink
improve version comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
josStorer committed Dec 13, 2024
1 parent c22e4c5 commit 068a70b
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 2 deletions.
6 changes: 6 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"abcjs": "^6.2.3",
"chart.js": "^4.3.0",
"classnames": "^2.3.2",
"compare-versions": "^6.1.1",
"file-saver": "^2.0.5",
"html-midi-player": "^1.5.0",
"i18next": "^22.4.15",
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/startup.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { compare } from 'compare-versions'
import { t } from 'i18next'
import { throttle } from 'lodash-es'
import { toast } from 'react-toastify'
Expand Down Expand Up @@ -72,7 +73,7 @@ async function initRemoteText() {
)
.then((r) => r.json())
.then((data) => {
if (data.version >= manifest.version) {
if (compare(data.version, manifest.version, '>=')) {
if (data.introduction) commonStore.setIntroduction(data.introduction)
if (data.about) commonStore.setAbout(data.about)
}
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/utils/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Button } from '@fluentui/react-components'
import { compare } from 'compare-versions'
import { t } from 'i18next'
import { findLastIndex, throttle } from 'lodash-es'
import { NavigateFunction } from 'react-router'
Expand Down Expand Up @@ -468,7 +469,7 @@ export async function checkUpdate(notifyEvenLatest: boolean = false) {
r.json().then((data) => {
if (data.tag_name) {
const versionTag = data.tag_name
if (versionTag.replace('v', '') > manifest.version) {
if (compare(versionTag.replace('v', ''), manifest.version, '>')) {
const verifyUrl = !commonStore.settings.giteeUpdatesSource
? `https://api.github.com/repos/josstorer/RWKV-Runner/releases/tags/${versionTag}`
: `https://gitee.com/api/v5/repos/josc146/RWKV-Runner/releases/tags/${versionTag}`
Expand Down
14 changes: 14 additions & 0 deletions frontend/wailsjs/runtime/runtime.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions frontend/wailsjs/runtime/runtime.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 068a70b

Please sign in to comment.