improve version check

pull/342/head
vapao 2021-06-19 00:22:57 +08:00
parent ffe94a3fee
commit 3a069e5524
1 changed files with 4 additions and 5 deletions

View File

@ -25,18 +25,17 @@ class About extends React.Component {
http.get('/api/setting/about/')
.then(res => this.setState({info: res}))
.finally(() => this.setState({fetching: false}))
http.get('https://gitee.com/api/v5/repos/openspug/spug/releases/latest')
http.get(`https://api.spug.cc/apis/release/latest/?version=${VERSION}`)
.then(res => {
if (res.tag_name && res.tag_name !== VERSION) {
const logs = res.body.replace(/- */g, '');
if (res.has_new) {
notification.open({
key: 'new_version',
duration: 0,
top: 88,
message: `发现新版本 ${res.tag_name}`,
message: `发现新版本 ${res.version}`,
icon: <SmileTwoTone />,
btn: <a target="_blank" rel="noopener noreferrer" href="https://spug.dev/docs/update-version/">如何升级</a>,
description: <pre style={{lineHeight: '30px'}}>{logs}</pre>
description: <pre style={{lineHeight: '30px'}}>{res.content}</pre>
})
}
})