|
|
|
@ -2,7 +2,7 @@
|
|
|
|
|
|
|
|
|
|
<el-container id="app">
|
|
|
|
|
<el-main>
|
|
|
|
|
<x-upload v-on:handle_error="showFail" v-on:handle_finish="showSuccess"></x-upload>
|
|
|
|
|
<file-selector @error="showFail" @success="showSuccess"/>
|
|
|
|
|
|
|
|
|
|
<div id="app-control">
|
|
|
|
|
<el-row class="mb-3">
|
|
|
|
@ -28,14 +28,14 @@
|
|
|
|
|
|
|
|
|
|
<audio :autoplay="playing_auto" :src="playing_url" controls/>
|
|
|
|
|
|
|
|
|
|
<x-preview :download_format="download_format" :table-data="tableData"
|
|
|
|
|
v-on:music_changed="changePlaying"></x-preview>
|
|
|
|
|
<PreviewTable :filename_format="download_format" :table-data="tableData"
|
|
|
|
|
@music_changed="changePlaying"></PreviewTable>
|
|
|
|
|
|
|
|
|
|
</el-main>
|
|
|
|
|
<el-footer id="app-footer">
|
|
|
|
|
<el-row>
|
|
|
|
|
<a href="https://github.com/ix64/unlock-music" target="_blank">音乐解锁</a>(v<span
|
|
|
|
|
v-text="version"></span>):移除已购音乐的加密保护。
|
|
|
|
|
<a href="https://github.com/ix64/unlock-music" target="_blank">音乐解锁</a>
|
|
|
|
|
(v{{ version }}):移除已购音乐的加密保护。
|
|
|
|
|
<a href="https://github.com/ix64/unlock-music/wiki/使用提示" target="_blank">使用提示</a>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row>
|
|
|
|
@ -44,7 +44,7 @@
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row>
|
|
|
|
|
<!--如果进行二次开发,此行版权信息不得移除且应明显地标注于页面上-->
|
|
|
|
|
<span>Copyright © 2019-</span><span v-text="(new Date()).getFullYear()"></span> MengYX
|
|
|
|
|
<span>Copyright © 2019 - {{ (new Date()).getFullYear() }} MengYX</span>
|
|
|
|
|
音乐解锁使用
|
|
|
|
|
<a href="https://github.com/ix64/unlock-music/blob/master/LICENSE" target="_blank">MIT许可协议</a>
|
|
|
|
|
开放源代码
|
|
|
|
@ -56,50 +56,50 @@
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
|
|
import upload from "./component/upload"
|
|
|
|
|
import preview from "./component/preview"
|
|
|
|
|
import {DownloadBlobMusic, RemoveBlobMusic} from "./component/util"
|
|
|
|
|
import config from "../package"
|
|
|
|
|
import {IXAREA_API_ENDPOINT} from "@/decrypt/utils";
|
|
|
|
|
import FileSelector from "./component/FileSelector"
|
|
|
|
|
import PreviewTable from "./component/PreviewTable"
|
|
|
|
|
import {DownloadBlobMusic, RemoveBlobMusic} from "./component/utils"
|
|
|
|
|
import config from "../package"
|
|
|
|
|
import {IXAREA_API_ENDPOINT} from "@/decrypt/utils";
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: 'app',
|
|
|
|
|
components: {
|
|
|
|
|
xUpload: upload,
|
|
|
|
|
xPreview: preview
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
version: config.version,
|
|
|
|
|
activeIndex: '1',
|
|
|
|
|
tableData: [],
|
|
|
|
|
playing_url: "",
|
|
|
|
|
playing_auto: false,
|
|
|
|
|
download_format: '1',
|
|
|
|
|
instant_download: false,
|
|
|
|
|
export default {
|
|
|
|
|
name: 'app',
|
|
|
|
|
components: {
|
|
|
|
|
FileSelector,
|
|
|
|
|
PreviewTable
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
version: config.version,
|
|
|
|
|
activeIndex: '1',
|
|
|
|
|
tableData: [],
|
|
|
|
|
playing_url: "",
|
|
|
|
|
playing_auto: false,
|
|
|
|
|
download_format: '1',
|
|
|
|
|
instant_download: false,
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.$nextTick(function () {
|
|
|
|
|
this.finishLoad();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
async finishLoad() {
|
|
|
|
|
const mask = document.getElementById("loader-mask");
|
|
|
|
|
if (!!mask) mask.remove();
|
|
|
|
|
let updateInfo;
|
|
|
|
|
try {
|
|
|
|
|
const resp = await fetch(IXAREA_API_ENDPOINT + "/music/app-version", {
|
|
|
|
|
method: "POST", headers: {"Content-Type": "application/json"},
|
|
|
|
|
body: JSON.stringify({"Version": this.version})
|
|
|
|
|
});
|
|
|
|
|
updateInfo = await resp.json();
|
|
|
|
|
} catch (e) {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.$nextTick(function () {
|
|
|
|
|
this.finishLoad();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
async finishLoad() {
|
|
|
|
|
const mask = document.getElementById("loader-mask");
|
|
|
|
|
if (!!mask) mask.remove();
|
|
|
|
|
let updateInfo;
|
|
|
|
|
try {
|
|
|
|
|
const resp = await fetch(IXAREA_API_ENDPOINT + "/music/app-version", {
|
|
|
|
|
method: "POST", headers: {"Content-Type": "application/json"},
|
|
|
|
|
body: JSON.stringify({"Version": this.version})
|
|
|
|
|
});
|
|
|
|
|
updateInfo = await resp.json();
|
|
|
|
|
} catch (e) {
|
|
|
|
|
}
|
|
|
|
|
if ((!!updateInfo && process.env.NODE_ENV === 'production') && (!!updateInfo.HttpsFound ||
|
|
|
|
|
(!!updateInfo.Found && window.location.protocol !== "https:"))) {
|
|
|
|
|
this.$notify.warning({
|
|
|
|
|
if ((!!updateInfo && process.env.NODE_ENV === 'production') && (!!updateInfo.HttpsFound ||
|
|
|
|
|
(!!updateInfo.Found && window.location.protocol !== "https:"))) {
|
|
|
|
|
this.$notify.warning({
|
|
|
|
|
title: '发现更新',
|
|
|
|
|
message: '发现新版本 v' + updateInfo.Version +
|
|
|
|
|
'<br/>更新详情:' + updateInfo.Detail +
|
|
|
|
@ -107,78 +107,74 @@
|
|
|
|
|
dangerouslyUseHTMLString: true,
|
|
|
|
|
duration: 15000,
|
|
|
|
|
position: 'top-left'
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.$notify.info({
|
|
|
|
|
title: '离线使用',
|
|
|
|
|
message: '我们使用PWA技术,无网络也能使用' +
|
|
|
|
|
'<br/>最近更新:' + config.updateInfo +
|
|
|
|
|
'<br/><a target="_blank" href="https://github.com/ix64/unlock-music/wiki/使用提示">使用提示</a>',
|
|
|
|
|
dangerouslyUseHTMLString: true,
|
|
|
|
|
duration: 10000,
|
|
|
|
|
position: 'top-left'
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
showSuccess(data) {
|
|
|
|
|
if (data.status) {
|
|
|
|
|
if (this.instant_download) {
|
|
|
|
|
DownloadBlobMusic(data, this.download_format);
|
|
|
|
|
RemoveBlobMusic(data);
|
|
|
|
|
} else {
|
|
|
|
|
this.tableData.push(data);
|
|
|
|
|
this.$notify.success({
|
|
|
|
|
title: '解锁成功',
|
|
|
|
|
message: '成功解锁 ' + data.title,
|
|
|
|
|
duration: 3000
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (process.env.NODE_ENV === 'production') {
|
|
|
|
|
let _rp_data = [data.title, data.artist, data.album];
|
|
|
|
|
window._paq.push(["trackEvent", "Unlock", data.rawExt + "," + data.mime, JSON.stringify(_rp_data)]);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
this.showFail(data.message, data.rawFilename + "." + data.rawExt)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
showFail(errInfo, filename) {
|
|
|
|
|
this.$notify.error({
|
|
|
|
|
title: '出现问题',
|
|
|
|
|
message: errInfo + "," + filename +
|
|
|
|
|
',参考<a target="_blank" href="https://github.com/ix64/unlock-music/wiki/使用提示">使用提示</a>',
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.$notify.info({
|
|
|
|
|
title: '离线使用',
|
|
|
|
|
message: '我们使用PWA技术,无网络也能使用' +
|
|
|
|
|
'<br/>最近更新:' + config.updateInfo +
|
|
|
|
|
'<br/><a target="_blank" href="https://github.com/ix64/unlock-music/wiki/使用提示">使用提示</a>',
|
|
|
|
|
dangerouslyUseHTMLString: true,
|
|
|
|
|
duration: 6000
|
|
|
|
|
duration: 10000,
|
|
|
|
|
position: 'top-left'
|
|
|
|
|
});
|
|
|
|
|
if (process.env.NODE_ENV === 'production') {
|
|
|
|
|
window._paq.push(["trackEvent", "Error", errInfo, filename]);
|
|
|
|
|
}
|
|
|
|
|
console.error(errInfo, filename);
|
|
|
|
|
},
|
|
|
|
|
changePlaying(url) {
|
|
|
|
|
this.playing_url = url;
|
|
|
|
|
this.playing_auto = true;
|
|
|
|
|
},
|
|
|
|
|
handleDeleteAll() {
|
|
|
|
|
this.tableData.forEach(value => {
|
|
|
|
|
RemoveBlobMusic(value);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
showSuccess(data) {
|
|
|
|
|
if (this.instant_download) {
|
|
|
|
|
DownloadBlobMusic(data, this.download_format);
|
|
|
|
|
RemoveBlobMusic(data);
|
|
|
|
|
} else {
|
|
|
|
|
this.tableData.push(data);
|
|
|
|
|
this.$notify.success({
|
|
|
|
|
title: '解锁成功',
|
|
|
|
|
message: '成功解锁 ' + data.title,
|
|
|
|
|
duration: 3000
|
|
|
|
|
});
|
|
|
|
|
this.tableData = [];
|
|
|
|
|
},
|
|
|
|
|
handleDownloadAll() {
|
|
|
|
|
let index = 0;
|
|
|
|
|
let c = setInterval(() => {
|
|
|
|
|
if (index < this.tableData.length) {
|
|
|
|
|
DownloadBlobMusic(this.tableData[index], this.download_format);
|
|
|
|
|
index++;
|
|
|
|
|
} else {
|
|
|
|
|
clearInterval(c);
|
|
|
|
|
}
|
|
|
|
|
}, 300);
|
|
|
|
|
}
|
|
|
|
|
if (process.env.NODE_ENV === 'production') {
|
|
|
|
|
let _rp_data = [data.title, data.artist, data.album];
|
|
|
|
|
window._paq.push(["trackEvent", "Unlock", data.rawExt + "," + data.mime, JSON.stringify(_rp_data)]);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
showFail(errInfo, filename) {
|
|
|
|
|
this.$notify.error({
|
|
|
|
|
title: '出现问题',
|
|
|
|
|
message: errInfo + "," + filename +
|
|
|
|
|
',参考<a target="_blank" href="https://github.com/ix64/unlock-music/wiki/使用提示">使用提示</a>',
|
|
|
|
|
dangerouslyUseHTMLString: true,
|
|
|
|
|
duration: 6000
|
|
|
|
|
});
|
|
|
|
|
if (process.env.NODE_ENV === 'production') {
|
|
|
|
|
window._paq.push(["trackEvent", "Error", errInfo, filename]);
|
|
|
|
|
}
|
|
|
|
|
console.error(errInfo, filename);
|
|
|
|
|
},
|
|
|
|
|
changePlaying(url) {
|
|
|
|
|
this.playing_url = url;
|
|
|
|
|
this.playing_auto = true;
|
|
|
|
|
},
|
|
|
|
|
handleDeleteAll() {
|
|
|
|
|
this.tableData.forEach(value => {
|
|
|
|
|
RemoveBlobMusic(value);
|
|
|
|
|
});
|
|
|
|
|
this.tableData = [];
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
handleDownloadAll() {
|
|
|
|
|
let index = 0;
|
|
|
|
|
let c = setInterval(() => {
|
|
|
|
|
if (index < this.tableData.length) {
|
|
|
|
|
DownloadBlobMusic(this.tableData[index], this.download_format);
|
|
|
|
|
index++;
|
|
|
|
|
} else {
|
|
|
|
|
clearInterval(c);
|
|
|
|
|
}
|
|
|
|
|
}, 300);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
|
@import "scss/unlock-music";
|
|
|
|
|
@import "scss/unlock-music";
|
|
|
|
|
</style>
|
|
|
|
|