forked from um/web
Add Update Check
This commit is contained in:
parent
f7d19e62fd
commit
9fd7177ebb
31
src/App.vue
31
src/App.vue
@ -50,6 +50,7 @@
|
|||||||
import upload from "./component/upload"
|
import upload from "./component/upload"
|
||||||
import preview from "./component/preview"
|
import preview from "./component/preview"
|
||||||
import {DownloadBlobMusic, RemoveBlobMusic} from "./component/util"
|
import {DownloadBlobMusic, RemoveBlobMusic} from "./component/util"
|
||||||
|
import config from "../package"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'app',
|
name: 'app',
|
||||||
@ -59,6 +60,7 @@
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
version: config.version,
|
||||||
activeIndex: '1',
|
activeIndex: '1',
|
||||||
tableData: [],
|
tableData: [],
|
||||||
playing_url: "",
|
playing_url: "",
|
||||||
@ -73,18 +75,39 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
finishLoad() {
|
async finishLoad() {
|
||||||
const mask = document.getElementById("loader-mask");
|
const mask = document.getElementById("loader-mask");
|
||||||
if (!!mask) mask.remove();
|
if (!!mask) mask.remove();
|
||||||
|
let updateInfo;
|
||||||
|
try {
|
||||||
|
const resp = await fetch("https://stats.ixarea.com/collect/music/app-version", {
|
||||||
|
method: "POST", headers: {"Content-Type": "application/json"},
|
||||||
|
body: JSON.stringify({Version: this.version})
|
||||||
|
});
|
||||||
|
updateInfo = await resp.json();
|
||||||
|
} catch (e) {
|
||||||
|
}
|
||||||
|
if (!!updateInfo.Found) {
|
||||||
|
this.$notify.warning({
|
||||||
|
title: '发现更新',
|
||||||
|
message: '发现新版本 v' + updateInfo.Version +
|
||||||
|
'<br/>更新详情:' + updateInfo.Detail +
|
||||||
|
'<br/><a target="_blank" href="' + updateInfo.URL + '">获取更新</a>',
|
||||||
|
dangerouslyUseHTMLString: true,
|
||||||
|
duration: 15000,
|
||||||
|
position: 'top-left'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
this.$notify.info({
|
this.$notify.info({
|
||||||
title: '离线使用',
|
title: '离线使用',
|
||||||
message: '我们使用PWA技术,无网络也能使用<br/>' +
|
message: '我们使用PWA技术,无网络也能使用' +
|
||||||
'最近更新:提供实验性mgg支持<br/>' +
|
'<br/>最近更新:提供实验性mgg支持' +
|
||||||
'点击查看 <a target="_blank" href="https://github.com/ix64/unlock-music/wiki/使用提示">使用提示</a>',
|
'<br/><a target="_blank" href="https://github.com/ix64/unlock-music/wiki/使用提示">使用提示</a>',
|
||||||
dangerouslyUseHTMLString: true,
|
dangerouslyUseHTMLString: true,
|
||||||
duration: 10000,
|
duration: 10000,
|
||||||
position: 'top-left'
|
position: 'top-left'
|
||||||
});
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
showSuccess(data) {
|
showSuccess(data) {
|
||||||
if (data.status) {
|
if (data.status) {
|
||||||
|
Loading…
Reference in New Issue
Block a user