10 Commits
1.1.2 ... 1.1.3

Author SHA1 Message Date
MengYX
05cdd7b896 Merge branch 'ix-master' 2020-02-05 02:08:08 +08:00
MengYX
91ba19d878 Bump Version 2020-02-05 01:58:53 +08:00
MengYX
a7c7b6cbfa Add instant download to avoid memory occupation 2020-02-05 01:53:58 +08:00
MengYX
50fbb69394 Merge branch 'pull/17'
# Conflicts:
#	src/App.vue
2020-02-05 01:38:34 +08:00
MengYX
402fb184f7 Add Web Worker 2020-02-05 00:30:44 +08:00
MengYX
0766e2fcb0 Merge pull request #16 from smtop/dev
增加歌曲命名格式选项
2020-02-04 19:41:01 +08:00
1519715742@qq.com
92bd0f6be3 Performance improvement in multiple files 2020-02-04 19:12:44 +08:00
smdev
9c6af8ff9c 增加歌曲命名格式选项 2020-02-04 18:24:53 +08:00
MengYX
8094f3ad58 Update CI 2020-02-01 12:05:00 +08:00
MengYX
e6a81f8546 Edit index.html Upgrade Dependencies 2020-01-31 11:47:16 +08:00
12 changed files with 217 additions and 121 deletions

View File

@@ -16,9 +16,9 @@ steps:
image: node:lts
commands:
- npm run build
- tar -czf legacy.tar.gz ./dist/*
- tar -czf legacy.tar.gz -C ./dist .
- npm run build -- --modern
- tar -czf morden.tar.gz ./dist/*
- tar -czf morden.tar.gz -C ./dist .
- name: release
@@ -44,11 +44,21 @@ steps:
secret_key:
from_secret: aws_secret_access_key
source: dist/**/*
target: /
strip_prefix: dist/
target: /public
path_style: true
endpoint: https://fs.sz2.ixarea.com
volumes:
- name: cache
host:
path: /tmp/cache
- name: upload
image: plugins/s3
settings:
bucket: unlock-music
access_key:
from_secret: aws_access_key_id
secret_key:
from_secret: aws_secret_access_key
source: ./*.tar.gz
target: /build/${DRONE_BUILD_NUMBER}
path_style: true
endpoint: https://fs.sz2.ixarea.com

81
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "unlock-music",
"version": "1.1.2",
"version": "1.1.3",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -1070,6 +1070,11 @@
"integrity": "sha1-HBJhu+qhCoBVu8XYq4S3sq/IRqA=",
"dev": true
},
"@types/debug": {
"version": "4.1.5",
"resolved": "https://registry.npm.taobao.org/@types/debug/download/@types/debug-4.1.5.tgz",
"integrity": "sha1-sU76iFK3do2JiQZhPCP2iHE+As0="
},
"@types/events": {
"version": "3.0.0",
"resolved": "https://registry.npm.taobao.org/@types/events/download/@types/events-3.0.0.tgz",
@@ -4619,9 +4624,27 @@
}
},
"file-type": {
"version": "12.4.2",
"resolved": "https://registry.npm.taobao.org/file-type/download/file-type-12.4.2.tgz?cache=0&sync_timestamp=1579456502251&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ffile-type%2Fdownload%2Ffile-type-12.4.2.tgz",
"integrity": "sha1-o0TqVmSh0BRH7n+xtjX3L+thadk="
"version": "13.1.2",
"resolved": "https://registry.npm.taobao.org/file-type/download/file-type-13.1.2.tgz",
"integrity": "sha1-DltyvKdWnBUuLVqE7OB+lPd/gz8=",
"requires": {
"readable-web-to-node-stream": "^2.0.0",
"strtok3": "^5.0.2",
"token-types": "^2.0.0",
"typedarray-to-buffer": "^3.1.5"
},
"dependencies": {
"strtok3": {
"version": "5.0.2",
"resolved": "https://registry.npm.taobao.org/strtok3/download/strtok3-5.0.2.tgz",
"integrity": "sha1-u4Hx9WdC4W8aMMzOXcPZSYqlR1o=",
"requires": {
"@tokenizer/token": "^0.1.1",
"debug": "^4.1.1",
"peek-readable": "^3.1.0"
}
}
}
},
"file-uri-to-path": {
"version": "1.0.0",
@@ -7189,15 +7212,15 @@
"dev": true
},
"music-metadata": {
"version": "5.4.3",
"resolved": "https://registry.npm.taobao.org/music-metadata/download/music-metadata-5.4.3.tgz",
"integrity": "sha1-sTwi5ZMSeIkisGVuRaGBB1FIz2s=",
"version": "6.3.1",
"resolved": "https://registry.npm.taobao.org/music-metadata/download/music-metadata-6.3.1.tgz",
"integrity": "sha1-uoSReMdBryECX2XCRmCt9uk7uCo=",
"requires": {
"content-type": "^1.0.4",
"debug": "^4.1.0",
"file-type": "^12.4.2",
"file-type": "^13.1.2",
"media-typer": "^1.1.0",
"strtok3": "^4.1.1",
"strtok3": "^6.0.0",
"token-types": "^2.0.0"
},
"dependencies": {
@@ -7209,15 +7232,15 @@
}
},
"music-metadata-browser": {
"version": "1.10.0",
"resolved": "https://registry.npm.taobao.org/music-metadata-browser/download/music-metadata-browser-1.10.0.tgz",
"integrity": "sha1-GpwLKqFseELW2y6+WGFxoeRCZEQ=",
"version": "2.0.3",
"resolved": "https://registry.npm.taobao.org/music-metadata-browser/download/music-metadata-browser-2.0.3.tgz",
"integrity": "sha1-CHD1ZbbqemrJ8kAqft5QbrPZCZ8=",
"requires": {
"assert": "^2.0.0",
"buffer": "^5.2.1",
"debug": "^4.0.1",
"music-metadata": "^5.3.1",
"readable-stream": "^3.3.0",
"music-metadata": "^6.3.1",
"readable-stream": "^3.5.0",
"readable-web-to-node-stream": "^2.0.0",
"remove": "^0.1.5",
"typedarray-to-buffer": "^3.1.5"
@@ -7936,6 +7959,11 @@
"sha.js": "^2.4.8"
}
},
"peek-readable": {
"version": "3.1.0",
"resolved": "https://registry.npm.taobao.org/peek-readable/download/peek-readable-3.1.0.tgz",
"integrity": "sha1-JQsIt94J24Vz1/2OpHUhW7/xQ0g="
},
"performance-now": {
"version": "2.1.0",
"resolved": "http://registry.npm.taobao.org/performance-now/download/performance-now-2.1.0.tgz",
@@ -9929,13 +9957,14 @@
"dev": true
},
"strtok3": {
"version": "4.1.1",
"resolved": "https://registry.npm.taobao.org/strtok3/download/strtok3-4.1.1.tgz",
"integrity": "sha1-dQQ7thdeuyLxDUjf6bBlYDRdxkc=",
"version": "6.0.0",
"resolved": "https://registry.npm.taobao.org/strtok3/download/strtok3-6.0.0.tgz",
"integrity": "sha1-1rkAhj2urP5sFyTG57s216WOg8g=",
"requires": {
"@tokenizer/token": "^0.1.0",
"@tokenizer/token": "^0.1.1",
"@types/debug": "^4.1.5",
"debug": "^4.1.1",
"then-read-stream": "^3.0.0"
"peek-readable": "^3.1.0"
}
},
"stylehacks": {
@@ -10059,11 +10088,6 @@
}
}
},
"then-read-stream": {
"version": "3.0.0",
"resolved": "https://registry.npm.taobao.org/then-read-stream/download/then-read-stream-3.0.0.tgz",
"integrity": "sha1-Sk7DfiPxgTW1b7xhZwtugZXlRbI="
},
"thenify": {
"version": "3.3.0",
"resolved": "https://registry.npm.taobao.org/thenify/download/thenify-3.3.0.tgz",
@@ -11215,6 +11239,15 @@
"errno": "~0.1.7"
}
},
"workerize-loader": {
"version": "1.1.0",
"resolved": "https://registry.npm.taobao.org/workerize-loader/download/workerize-loader-1.1.0.tgz",
"integrity": "sha1-06Y0OQ3LaFzB7iks0f/+7wpkYEQ=",
"dev": true,
"requires": {
"loader-utils": "^1.2.3"
}
},
"wrap-ansi": {
"version": "6.2.0",
"resolved": "https://registry.npm.taobao.org/wrap-ansi/download/wrap-ansi-6.2.0.tgz",

View File

@@ -1,6 +1,6 @@
{
"name": "unlock-music",
"version": "1.1.2",
"version": "1.1.3",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
@@ -11,7 +11,7 @@
"core-js": "^3.6.4",
"crypto-js": "^3.1.9-1",
"element-ui": "^2.13.0",
"music-metadata-browser": "^1.10.0",
"music-metadata-browser": "^2.0.3",
"register-service-worker": "^1.6.2",
"vue": "^2.6.11"
},
@@ -21,6 +21,7 @@
"@vue/cli-service": "^4.1.2",
"babel-plugin-component": "^1.1.1",
"vue-cli-plugin-element": "^1.0.1",
"vue-template-compiler": "^2.6.11"
"vue-template-compiler": "^2.6.11",
"workerize-loader": "^1.1.0"
}
}

View File

@@ -12,43 +12,7 @@
<title>音乐解锁 - By IXarea</title>
<meta content="音乐,解锁,ncm,qmc,qmc0,qmc3,qmcflac,qmcogg,mflac,qq音乐,网易云音乐,加密" name="keywords"/>
<meta content="音乐解锁 - 在任何设备上解锁已购的加密音乐!" name="description"/>
<style>
#loader {
position: absolute;
left: 50%;
top: 50%;
z-index: 1010;
margin: -75px 0 0 -75px;
border: 16px solid #f3f3f3;
border-radius: 50%;
border-top: 16px solid #3498db;
width: 120px;
height: 120px;
animation: spin 2s linear infinite;
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
#loader-mask {
position: absolute;
width: 100%;
height: 100%;
bottom: 0;
left: 0;
right: 0;
top: 0;
z-index: 1009;
background-color: rgba(242, 246, 252, 0.88);
}
</style>
<style>#loader{position:absolute;left:50%;top:50%;z-index:1010;margin:-75px 0 0 -75px;border:16px solid #f3f3f3;border-radius:50%;border-top:16px solid #3498db;width:120px;height:120px;animation:spin 2s linear infinite}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}#loader-mask{position:absolute;width:100%;height:100%;bottom:0;left:0;right:0;top:0;z-index:1009;background-color:rgba(242,246,252,0.88)}</style>
</head>
<body>
@@ -62,6 +26,7 @@
<strong>音乐解锁采用了一些新特性!建议使用
<a href="https://www.google.cn/chrome/" target="_blank">Google Chrome</a>
<a href="https://www.firefox.com.cn/" target="_blank">Mozilla Firefox</a>
<a href="https://www.microsoftedgeinsider.com/zh-cn/download" target="_blank">Mozilla Firefox</a>
| <a href="https://github.com/ix64/unlock-music/wiki/使用提示" target="_blank">使用提示</a>
</strong>
</div>

View File

@@ -9,18 +9,26 @@
action=""
drag
multiple>
<i class="el-icon-upload"></i>
<i class="el-icon-upload"/>
<div class="el-upload__text">将文件拖到此处<em>点击选择</em></div>
<div class="el-upload__tip" slot="tip">本工具仅在浏览器内对文件进行解锁无需消耗流量</div>
</el-upload>
<el-row id="app-control">
<el-row style="padding-bottom: 1em; font-size: 14px">
歌曲命名格式
<el-radio name="format" v-model="format" label="1">歌曲名</el-radio>
<el-radio name="format" v-model="format" label="2">歌手-歌曲名</el-radio>
<el-radio name="format" v-model="format" label="3">歌曲名-歌手</el-radio>
<el-checkbox v-model="instantDownload" border>立即保存</el-checkbox>
</el-row>
<el-button @click="handleDownloadAll" icon="el-icon-download" plain>下载全部</el-button>
<el-button @click="handleDeleteAll" icon="el-icon-delete" plain type="danger">删除全部</el-button>
</el-row>
<audio :autoplay="playing_auto" :src="playing_url" controls></audio>
<audio :autoplay="playing_auto" :src="playing_url" controls/>
<el-table :data="tableData" style="width: 100%">
@@ -85,8 +93,11 @@
</template>
<script>
// 严格模式 用于尾调用优化
"use strict";
const dec = require("./decrypt/common");
const worker = require("workerize-loader!./decrypt/common");
const dec = require('./decrypt/common');
export default {
name: 'app',
components: {},
@@ -96,12 +107,40 @@
tableData: [],
playing_url: "",
playing_auto: false,
format: '2',
instantDownload: false,
workCount: 0,
cacheQueue: [],
cacheQueueOption: {
push: (element) => {
this.cacheQueue.push(element);
},
pop: () => {
return this.cacheQueue.shift();
},
size: () => {
return this.cacheQueue.length;
}
},
workers: [],
idle_workers: [],
thread_num: 1
}
},
mounted() {
this.$nextTick(function () {
this.finishLoad();
});
if (document.location.host !== "") {
this.thread_num = Math.max(navigator.hardwareConcurrency, 1);
for (let i = 0; i < this.thread_num; i++) {
this.workers.push(worker().CommonDecrypt);
this.idle_workers.push(i);
}
} else {
this.workers.push(dec.CommonDecrypt);
this.idle_workers.push(0)
}
},
methods: {
finishLoad() {
@@ -117,16 +156,37 @@
});
},
handleFile(file) {
(async () => {
let data = await dec.CommonDecrypt(file);
// 有空闲worker 立刻处理文件
if (this.idle_workers.length > 0) {
this.handleDoFile(file, this.idle_workers.shift());
}
// 无空闲worker 则放入缓存队列
else {
this.cacheQueueOption.push(file);
}
},
handleCacheQueue(worker_id) {
// 调用方法消费缓存队列中的数据
if (this.cacheQueue.length === 0) {
this.idle_workers.push(worker_id);
return
}
this.handleDoFile(this.cacheQueueOption.pop(), worker_id);
},
handleDoFile(file, worker_id) {
this.workers[worker_id](file).then(data => {
if (data.status) {
this.tableData.push(data);
this.$notify.success({
title: '解锁成功',
message: '成功解锁 ' + data.title,
duration: 3000
});
if (this.instantDownload) {
this.handleDownload(data);
this.handleDelete(null, data);
} else {
this.tableData.push(data);
this.$notify.success({
title: '解锁成功',
message: '成功解锁 ' + data.title,
duration: 3000
});
}
let _rp_data = [data.title, data.artist, data.album];
window._paq.push(["trackEvent", "Unlock", data.rawExt + "," + data.mime, JSON.stringify(_rp_data)]);
} else {
@@ -139,7 +199,13 @@
});
window._paq.push(["trackEvent", "Error", data.message, file.name]);
}
})();
// 完成之后 执行新任务 todo: 可能导致call stack过长
this.handleCacheQueue(worker_id);
}).catch(err => {
console.error(err, file);
window._paq.push(["trackEvent", "Error", err, file.name]);
this.handleCacheQueue(worker_id);
})
},
handlePlay(index, row) {
this.playing_url = row.file;
@@ -148,12 +214,27 @@
handleDelete(index, row) {
URL.revokeObjectURL(row.file);
URL.revokeObjectURL(row.picture);
this.tableData.splice(index, 1);
if (index != null) {
this.tableData.splice(index, 1);
}
},
handleDownload(row) {
let a = document.createElement('a');
a.href = row.file;
a.download = row.filename;
switch (this.format) {
case "1":
a.download = row.title + "." + row.ext;
break;
case "2":
a.download = row.artist + " - " + row.title + "." + row.ext;
break;
case "3":
a.download = row.title + " - " + row.artist + "." + row.ext;
break;
default:
a.download = row.filename;
break;
}
document.body.append(a);
a.click();
a.remove();
@@ -203,6 +284,7 @@
font-size: small;
}
/*noinspection CssUnusedSymbol*/
.el-upload-dragger {
width: 80vw !important;
}

View File

@@ -4,9 +4,8 @@ const RawDecrypt = require("./raw");
const MFlacDecrypt = require("./mflac");
const TmDecrypt = require("./tm");
export {CommonDecrypt}
async function CommonDecrypt(file) {
export async function CommonDecrypt(file) {
let raw_ext = file.name.substring(file.name.lastIndexOf(".") + 1, file.name.length).toLowerCase();
let raw_filename = file.name.substring(0, file.name.lastIndexOf("."));
let rt_data;

View File

@@ -36,6 +36,7 @@ async function Decrypt(file, raw_filename, raw_ext) {
filename: info.filename,
title: info.title,
artist: info.artist,
ext: 'flac',
album: tag.common.album,
picture: picUrl,
file: musicUrl,

View File

@@ -56,6 +56,7 @@ async function Decrypt(file) {
filename: filename,
title: musicMeta.musicName,
artist: artists.join(" & "),
ext: musicMeta.format,
album: musicMeta.album,
picture: musicMeta.albumPic,
file: musicUrl,

View File

@@ -26,7 +26,7 @@ async function Decrypt(file, raw_filename, raw_ext) {
if (!(raw_ext in OriginalExtMap)) {
return {status: false, message: "File type is incorrect!"}
}
let new_ext = OriginalExtMap[raw_ext]
let new_ext = OriginalExtMap[raw_ext];
const mime = util.AudioMimeType[new_ext];
// 读取文件
const fileBuffer = await util.GetArrayBuffer(file);
@@ -50,6 +50,7 @@ async function Decrypt(file, raw_filename, raw_ext) {
filename: info.filename,
title: info.title,
artist: info.artist,
ext: new_ext,
album: tag.common.album,
picture: picUrl,
file: musicUrl,

View File

@@ -17,6 +17,7 @@ async function Decrypt(file, raw_filename, raw_ext) {
filename: info.filename,
title: info.title,
artist: info.artist,
ext: raw_ext,
album: tag.common.album,
picture: picUrl,
file: fileUrl,

View File

@@ -1,7 +1,40 @@
import Vue from 'vue'
import App from './App.vue'
import './registerServiceWorker'
import './plugins/element.js'
import {
Button,
Col,
Container,
Footer,
Icon,
Image,
Link,
Main,
Notification,
Row,
Table,
TableColumn,
Upload,
Radio,
Checkbox
} from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(Link);
Vue.use(Image);
Vue.use(Button);
Vue.use(Table);
Vue.use(TableColumn);
Vue.use(Main);
Vue.use(Footer);
Vue.use(Container);
Vue.use(Icon);
Vue.use(Row);
Vue.use(Col);
Vue.use(Upload);
Vue.use(Checkbox);
Vue.use(Radio);
Vue.prototype.$notify = Notification;
// only if your build system can import css, otherwise import it wherever you would import your css.
Vue.config.productionTip = false;

View File

@@ -1,31 +0,0 @@
import Vue from 'vue'
import {
Button,
Col,
Container,
Footer,
Icon,
Image,
Link,
Main,
Notification,
Row,
Table,
TableColumn,
Upload
} from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(Link);
Vue.use(Image);
Vue.use(Button);
Vue.use(Table);
Vue.use(TableColumn);
Vue.use(Main);
Vue.use(Footer);
Vue.use(Container);
Vue.use(Icon);
Vue.use(Row);
Vue.use(Col);
Vue.use(Upload);
Vue.prototype.$notify = Notification;