12 Commits
1.1.1 ... 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
MengYX
211b4e0206 #9 Add QQ Music tkm Format 2020-01-27 18:02:39 +08:00
MengYX
4cd5b45986 Fix QMC filename error 2020-01-27 16:43:40 +08:00
13 changed files with 478 additions and 379 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

View File

@@ -8,7 +8,7 @@
# Features
- [x] Unlock in browser 在浏览器中解锁
- [x] QQMusic Format QQ音乐格式 (.qmc0/.qmc3/.qmcflac/.qmcogg)
- [x] QQMusic Format QQ音乐格式 (.qmc0/.qmc3/.qmcflac/.qmcogg/.tkm)
- [x] MooMusic Format Moo音乐格式 ([.bkcmp3/.bkcflac](https://github.com/ix64/unlock-music/issues/11))
- [x] QQMusic Tm Format QQ音乐Tm格式 (.tm0/.tm2/.tm3/.tm6)
- [ ] QQMusic New Format QQ音乐新格式

581
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "unlock-music",
"version": "1.1.1",
"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%">
@@ -67,7 +75,7 @@
<el-footer id="app-footer">
<el-row>
音乐解锁移除已购音乐的加密保护
目前支持网易云音乐(ncm)QQ音乐(qmc0, qmc3, qmcflac, qmcogg, mflac)以及
目前支持网易云音乐(ncm)QQ音乐(qmc, mflac, tkm)以及
<a href="https://github.com/ix64/unlock-music/blob/master/README.md" target="_blank">其他格式</a>
<a href="https://github.com/ix64/unlock-music/wiki/使用提示" target="_blank">使用提示</a>
</el-row>
@@ -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() {
@@ -109,7 +148,7 @@
this.$notify.info({
title: '离线使用',
message: '我们使用PWA技术无网络也能使用<br/>' +
'最近更新支持bkcmp3/bkcflac<br/>' +
'最近更新支持bkcmp3/bkcflac/tkm<br/>' +
'点击查看 <a target="_blank" href="https://github.com/ix64/unlock-music/wiki/使用提示">使用提示</a>',
dangerouslyUseHTMLString: true,
duration: 10000,
@@ -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;
@@ -16,7 +15,8 @@ async function CommonDecrypt(file) {
break;
case "mp3":// Raw Mp3
case "flac"://Raw Flac
case "m4a":// todo: Raw M4A
case "m4a":// Raw M4a
case "ogg":// Raw Ogg
rt_data = await RawDecrypt.Decrypt(file.raw, raw_filename, raw_ext);
break;
case "tm0":// QQ Music IOS Mp3
@@ -27,6 +27,7 @@ async function CommonDecrypt(file) {
case "qmc0"://QQ Music Android Mp3
case "qmcflac"://QQ Music Android Flac
case "qmcogg"://QQ Music Android Ogg
case "tkm"://QQ Music Accompaniment M4a
case "bkcmp3"://Moo Music Mp3
case "bkcflac"://Moo Music Flac
rt_data = await QmcDecrypt.Decrypt(file.raw, raw_filename, raw_ext);
@@ -34,8 +35,8 @@ async function CommonDecrypt(file) {
case "mflac"://QQ Music Desktop Flac
rt_data = await MFlacDecrypt.Decrypt(file.raw, raw_filename, raw_ext);
break;
case "tm2":// todo: QQ Music IOS M4A
case "tm6":// todo: QQ Music IOS M4A
case "tm2":// QQ Music IOS M4a
case "tm6":// QQ Music IOS M4a
rt_data = await TmDecrypt.Decrypt(file.raw, raw_filename);
break;
default:

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

@@ -17,7 +17,8 @@ const OriginalExtMap = {
"qmcogg": "ogg",
"qmcflac": "flac",
"bkcmp3": "mp3",
"bkcflac": "flac"
"bkcflac": "flac",
"tkm": "m4a"
};
async function Decrypt(file, raw_filename, raw_ext) {
@@ -25,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);
@@ -40,7 +41,7 @@ async function Decrypt(file, raw_filename, raw_ext) {
const musicUrl = URL.createObjectURL(musicData);
// 读取Meta
let tag = await musicMetadata.parseBlob(musicData);
const info = util.GetFileInfo(tag.common.artist, tag.common.title, raw_filename, raw_ext);
const info = util.GetFileInfo(tag.common.artist, tag.common.title, raw_filename, new_ext);
let picUrl = util.GetCoverURL(tag);
// 返回
@@ -49,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;