23 Commits
1.1.0 ... 1.2.0

Author SHA1 Message Date
MengYX
4e1bfb0b55 Bump Version 2020-02-09 15:16:23 +08:00
MengYX
27b74ea5dd Better Way to Detect Mflac Mask 2020-02-09 14:05:40 +08:00
MengYX
9aab7a7713 Adjust for Debugging 2020-02-07 20:17:45 +08:00
MengYX
dcde0d3fbb Fix Babel Config 2020-02-07 14:41:21 +08:00
MengYX
0c0299d63a Remove Useless Information 2020-02-06 16:18:40 +08:00
MengYX
3ee9f5d2d1 Split App.vue 2020-02-06 16:01:35 +08:00
MengYX
e3ca175258 Optimize Bundle Size 2020-02-06 14:05:46 +08:00
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
MengYX
60445b7ed9 #11 Add Moo Music Format 2020-01-27 14:06:45 +08:00
MengYX
4e499b2deb Merge branch 'master' of github.com:ix64/unlock-music 2020-01-21 20:00:20 +08:00
MengYX
51a5a8a44f Update README.md 2019-12-23 19:09:24 +08:00
MengYX
2fb5aecdb2 Update README.md 2019-12-16 19:01:56 +08:00
18 changed files with 843 additions and 709 deletions

View File

@@ -10,15 +10,15 @@ steps:
- name: installDependencies - name: installDependencies
image: node:lts image: node:lts
commands: commands:
- npm ci - npm ci --verbose --registry=https://registry.npm.taobao.org
- name: build - name: build
image: node:lts image: node:lts
commands: commands:
- npm run build - npm run build
- tar -czf legacy.tar.gz ./dist/* - tar -czf legacy.tar.gz -C ./dist .
- npm run build -- --modern - npm run build -- --modern
- tar -czf morden.tar.gz ./dist/* - tar -czf morden.tar.gz -C ./dist .
- name: release - name: release
@@ -44,11 +44,21 @@ steps:
secret_key: secret_key:
from_secret: aws_secret_access_key from_secret: aws_secret_access_key
source: dist/**/* source: dist/**/*
target: / strip_prefix: dist/
target: /public
path_style: true path_style: true
endpoint: https://fs.sz2.ixarea.com endpoint: https://fs.sz2.ixarea.com
volumes:
- name: cache - name: upload
host: image: plugins/s3
path: /tmp/cache 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

@@ -1,14 +1,16 @@
# Unlock Music 音乐解锁 # Unlock Music 音乐解锁
- Unlock encrypted music file in browser. - Unlock encrypted music file in browser.
- 在浏览器中解锁加密的音乐文件。 - 在浏览器中解锁加密的音乐文件。
- [Online Demo](https://tool.ixarea.com/music) - unlock-music项目是以学习和技术研究的初衷创建的。
- 由于存在可能的法律风险以及滥用风险不再提供Demo服务。
[![Build Status](https://ci.ixarea.com/api/badges/ix64/unlock-music/status.svg)](https://ci.ixarea.com/ix64/unlock-music) [![Build Status](https://ci.ixarea.com/api/badges/ix64/unlock-music/status.svg)](https://ci.ixarea.com/ix64/unlock-music)
# Features # Features
- [x] Unlock in browser 在浏览器中解锁 - [x] Unlock in browser 在浏览器中解锁
- [x] QQMusic Format QQ音乐格式 (.qmc0/.qmc3/.qmcflac/.qmcogg) - [x] QQMusic Format QQ音乐格式 (.qmc0/.qmc3/.qmcflac/.qmcogg/.tkm)
- [x] QQMusic Tm Format QQ音乐 (.tm0/.tm2/.tm3/.tm6) - [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音乐新格式 - [ ] QQMusic New Format QQ音乐新格式
- [x] .mflac (Partial 部分支持) - [x] .mflac (Partial 部分支持)
- [ ] .mgg - [ ] .mgg
@@ -18,7 +20,6 @@
- [x] Batch unlocking 批量解锁 - [x] Batch unlocking 批量解锁
- [x] Progressive Web App 渐进式Web应用 - [x] Progressive Web App 渐进式Web应用
- [x] Complete ID3 for ncm 补全ncm的ID3信息 - [x] Complete ID3 for ncm 补全ncm的ID3信息
- [ ] Multi-language 多语言
# 使用方法 # 使用方法
## 下载已构建版本 ## 下载已构建版本

View File

@@ -1,5 +1,11 @@
module.exports = { module.exports = {
presets: [ presets: [
'@vue/cli-plugin-babel/preset' '@vue/cli-plugin-babel/preset'
] ],
} plugins: [
["component", {
"libraryName": "element-ui",
"styleLibraryName": "theme-chalk"
}]
]
};

823
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{ {
"name": "unlock-music", "name": "unlock-music",
"version": "1.1.0", "version": "1.2.0",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",
@@ -11,16 +11,17 @@
"core-js": "^3.6.4", "core-js": "^3.6.4",
"crypto-js": "^3.1.9-1", "crypto-js": "^3.1.9-1",
"element-ui": "^2.13.0", "element-ui": "^2.13.0",
"music-metadata-browser": "^1.10.0", "music-metadata-browser": "^2.0.3",
"register-service-worker": "^1.6.2", "register-service-worker": "^1.6.2",
"vue": "^2.6.11" "vue": "^2.6.11"
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "^4.1.2", "@vue/cli-plugin-babel": "^4.2.2",
"@vue/cli-plugin-pwa": "^4.1.2", "@vue/cli-plugin-pwa": "^4.2.2",
"@vue/cli-service": "^4.1.2", "@vue/cli-service": "^4.2.2",
"babel-plugin-component": "^1.1.1", "babel-plugin-component": "^1.1.1",
"vue-cli-plugin-element": "^1.0.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> <title>音乐解锁 - By IXarea</title>
<meta content="音乐,解锁,ncm,qmc,qmc0,qmc3,qmcflac,qmcogg,mflac,qq音乐,网易云音乐,加密" name="keywords"/> <meta content="音乐,解锁,ncm,qmc,qmc0,qmc3,qmcflac,qmcogg,mflac,qq音乐,网易云音乐,加密" name="keywords"/>
<meta content="音乐解锁 - 在任何设备上解锁已购的加密音乐!" name="description"/> <meta content="音乐解锁 - 在任何设备上解锁已购的加密音乐!" name="description"/>
<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>
#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> </head>
<body> <body>
@@ -62,6 +26,7 @@
<strong>音乐解锁采用了一些新特性!建议使用 <strong>音乐解锁采用了一些新特性!建议使用
<a href="https://www.google.cn/chrome/" target="_blank">Google Chrome</a> <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.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> | <a href="https://github.com/ix64/unlock-music/wiki/使用提示" target="_blank">使用提示</a>
</strong> </strong>
</div> </div>

View File

@@ -1,166 +1,128 @@
<template> <template>
<div id="app">
<el-container>
<el-main>
<el-upload
:auto-upload="false"
:on-change="handleFile"
:show-file-list="false"
action=""
drag
multiple>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击选择</em></div>
<div class="el-upload__tip" slot="tip">本工具仅在浏览器内对文件进行解锁无需消耗流量</div>
</el-upload>
<el-row id="app-control"> <el-container id="app">
<el-main>
<el-button @click="handleDownloadAll" icon="el-icon-download" plain>下载全部</el-button> <x-upload v-on:handle_finish="showSuccess" v-on:handle_error="showFail"></x-upload>
<el-button @click="handleDeleteAll" icon="el-icon-delete" plain type="danger">删除全部</el-button>
<el-row id="app-control">
<el-row style="padding-bottom: 1em; font-size: 14px">
歌曲命名格式
<el-radio name="format" v-model="download_format" label="1">歌曲名</el-radio>
<el-radio name="format" v-model="download_format" label="2">歌手-歌曲名</el-radio>
<el-radio name="format" v-model="download_format" label="3">歌曲名-歌手</el-radio>
<el-checkbox v-model="instant_download" border>立即保存</el-checkbox>
</el-row> </el-row>
<audio :autoplay="playing_auto" :src="playing_url" controls></audio> <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/>
<x-preview :table-data="tableData" :download_format="download_format"
v-on:music_changed="changePlaying"></x-preview>
<el-table :data="tableData" style="width: 100%"> </el-main>
<el-footer id="app-footer">
<el-row>
音乐解锁移除已购音乐的加密保护
目前支持网易云音乐(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>
<el-row>
<span>Copyright &copy; 2019</span>
<a href="https://github.com/ix64" target="_blank">MengYX</a>
音乐解锁使用
<a href="https://github.com/ix64/unlock-music/blob/master/LICENSE" target="_blank">MIT许可协议</a>
开放
<a href="https://github.com/ix64/unlock-music" target="_blank">源代码</a>
</el-row>
</el-footer>
</el-container>
<el-table-column label="封面">
<template slot-scope="scope">
<el-image :src="scope.row.picture" style="width: 100px; height: 100px">
<div class="image-slot el-image__error" slot="error">
暂无封面
</div>
</el-image>
</template>
</el-table-column>
<el-table-column label="歌曲" sortable>
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.title }}</span>
</template>
</el-table-column>
<el-table-column label="歌手" sortable>
<template slot-scope="scope">
<p>{{ scope.row.artist }}</p>
</template>
</el-table-column>
<el-table-column label="专辑" sortable>
<template slot-scope="scope">
<p>{{ scope.row.album }}</p>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button @click="handlePlay(scope.$index, scope.row)"
circle icon="el-icon-video-play" type="success">
</el-button>
<el-button @click="handleDownload(scope.row)"
circle icon="el-icon-download">
</el-button>
<el-button @click="handleDelete(scope.$index, scope.row)"
circle icon="el-icon-delete" type="danger">
</el-button>
</template>
</el-table-column>
</el-table>
</el-main>
<el-footer id="app-footer">
<el-row>
音乐解锁移除已购音乐的加密保护
目前支持网易云音乐(ncm)和QQ音乐(qmc0, qmc3, qmcflac, qmcogg, mflac)
<a href="https://github.com/ix64/unlock-music/wiki/使用提示" target="_blank">使用提示</a>
</el-row>
<el-row>
<span>Copyright &copy; 2019</span>
<a href="https://github.com/ix64" target="_blank">MengYX</a>
音乐解锁使用
<a href="https://github.com/ix64/unlock-music/blob/master/LICENSE" target="_blank">MIT许可协议</a>
开放
<a href="https://github.com/ix64/unlock-music" target="_blank">源代码</a>
</el-row>
</el-footer>
</el-container>
</div>
</template> </template>
<script> <script>
const dec = require("./decrypt/common"); import upload from "./component/upload"
import preview from "./component/preview"
import {DownloadBlobMusic, RemoveBlobMusic} from "./component/util"
export default { export default {
name: 'app', name: 'app',
components: {}, components: {
xUpload: upload,
xPreview: preview
},
data() { data() {
return { return {
activeIndex: '1', activeIndex: '1',
tableData: [], tableData: [],
playing_url: "", playing_url: "",
playing_auto: false, playing_auto: false,
download_format: '2',
instant_download: false,
} }
}, },
mounted() { created() {
this.$nextTick(function () { this.$nextTick(function () {
this.finishLoad(); this.finishLoad();
}); });
}, },
methods: { methods: {
finishLoad() { finishLoad() {
document.getElementById("loader-mask").remove(); const mask = document.getElementById("loader-mask");
if (!!mask) mask.remove();
this.$notify.info({ this.$notify.info({
title: '离线使用', title: '离线使用',
message: '我们使用PWA技术无网络也能使用<br/>' + message: '我们使用PWA技术无网络也能使用<br/>' +
'最近更新:支持tm0/2/3/6<br/>' + '最近更新:支持bkcmp3/bkcflac/tkm<br/>' +
'点击查看 <a target="_blank" href="https://github.com/ix64/unlock-music/wiki/使用提示">使用提示</a>', '点击查看 <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'
}); });
}, },
handleFile(file) { showSuccess(data) {
if (data.status) {
(async () => { if (this.instant_download) {
let data =await dec.CommonDecrypt(file); DownloadBlobMusic(data, this.download_format);
if (data.status) { RemoveBlobMusic(data);
} else {
this.tableData.push(data); this.tableData.push(data);
this.$notify.success({ this.$notify.success({
title: '解锁成功', title: '解锁成功',
message: '成功解锁 ' + data.title, message: '成功解锁 ' + data.title,
duration: 3000 duration: 3000
}); });
}
if (process.env.NODE_ENV === 'production') {
let _rp_data = [data.title, data.artist, data.album]; let _rp_data = [data.title, data.artist, data.album];
window._paq.push(["trackEvent", "Unlock", data.rawExt + "," + data.mime, JSON.stringify(_rp_data)]); window._paq.push(["trackEvent", "Unlock", data.rawExt + "," + data.mime, JSON.stringify(_rp_data)]);
} else {
this.$notify.error({
title: '出现问题',
message: data.message + "" + file.name +
',参考<a target="_blank" href="https://github.com/ix64/unlock-music/wiki/使用提示">使用提示</a>',
dangerouslyUseHTMLString: true,
duration: 6000
});
window._paq.push(["trackEvent", "Error", data.message, file.name]);
} }
})(); } else {
this.showFail(data.message, data.rawFilename + "." + data.rawExt)
}
}, },
handlePlay(index, row) { showFail(errInfo, filename) {
this.playing_url = row.file; 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; this.playing_auto = true;
}, },
handleDelete(index, row) {
URL.revokeObjectURL(row.file);
URL.revokeObjectURL(row.picture);
this.tableData.splice(index, 1);
},
handleDownload(row) {
let a = document.createElement('a');
a.href = row.file;
a.download = row.filename;
document.body.append(a);
a.click();
a.remove();
},
handleDeleteAll() { handleDeleteAll() {
this.tableData.forEach(value => { this.tableData.forEach(value => {
URL.revokeObjectURL(value.file); RemoveBlobMusic(value);
URL.revokeObjectURL(value.picture);
}); });
this.tableData = []; this.tableData = [];
}, },
@@ -168,15 +130,15 @@
let index = 0; let index = 0;
let c = setInterval(() => { let c = setInterval(() => {
if (index < this.tableData.length) { if (index < this.tableData.length) {
this.handleDownload(this.tableData[index]); DownloadBlobMusic(this.tableData[index], this.download_format);
index++; index++;
} else { } else {
clearInterval(c); clearInterval(c);
} }
}, 1000); }, 300);
} }
} },
} }
</script> </script>
@@ -193,8 +155,8 @@
} }
#app-footer a { #app-footer a {
padding-left: 0.5em; padding-left: 0.2em;
padding-right: 0.5em; padding-right: 0.2em;
} }
#app-footer { #app-footer {
@@ -202,14 +164,9 @@
font-size: small; font-size: small;
} }
.el-upload-dragger {
width: 80vw !important;
}
#app-control { #app-control {
padding-top: 1em; padding-top: 1em;
padding-bottom: 1em; padding-bottom: 1em;
} }
</style> </style>

71
src/component/preview.vue Normal file
View File

@@ -0,0 +1,71 @@
<template>
<el-table :data="tableData" style="width: 100%">
<el-table-column label="封面">
<template slot-scope="scope">
<el-image :src="scope.row.picture" style="width: 100px; height: 100px">
<div class="image-slot el-image__error" slot="error">
暂无封面
</div>
</el-image>
</template>
</el-table-column>
<el-table-column label="歌曲" sortable>
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.title }}</span>
</template>
</el-table-column>
<el-table-column label="歌手" sortable>
<template slot-scope="scope">
<p>{{ scope.row.artist }}</p>
</template>
</el-table-column>
<el-table-column label="专辑" sortable>
<template slot-scope="scope">
<p>{{ scope.row.album }}</p>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button @click="handlePlay(scope.$index, scope.row)"
circle icon="el-icon-video-play" type="success">
</el-button>
<el-button @click="handleDownload(scope.row)"
circle icon="el-icon-download">
</el-button>
<el-button @click="handleDelete(scope.$index, scope.row)"
circle icon="el-icon-delete" type="danger">
</el-button>
</template>
</el-table-column>
</el-table>
</template>
<script>
import {DownloadBlobMusic, RemoveBlobMusic} from './util'
export default {
name: "preview",
props: {
tableData: {type: Array, required: true},
download_format: {type: String, required: true}
},
methods: {
handlePlay(index, row) {
this.$emit("music_changed", row.file);
},
handleDelete(index, row) {
RemoveBlobMusic(row);
this.tableData.splice(index, 1);
},
handleDownload(row) {
DownloadBlobMusic(row, this.download_format)
},
}
}
</script>
<style scoped>
</style>

82
src/component/upload.vue Normal file
View File

@@ -0,0 +1,82 @@
<template>
<el-upload
:auto-upload="false"
:on-change="handleFile"
:show-file-list="false"
action=""
drag
multiple>
<i class="el-icon-upload"/>
<div class="el-upload__text">将文件拖到此处<em>点击选择</em></div>
<div class="el-upload__tip" slot="tip">本工具仅在浏览器内对文件进行解锁无需消耗流量</div>
</el-upload>
</template>
<script>
"use strict";// 严格模式 用于尾调用优化
export default {
name: "upload",
data() {
return {
cacheQueue: [],
workers: [],
idle_workers: [],
thread_num: 1
}
},
mounted() {
if (document.location.host !== "" && process.env.NODE_ENV === 'production') {
//todo: Fail on Hot Reload
const worker = require("workerize-loader!../decrypt/common");
this.thread_num = navigator.hardwareConcurrency || 1;
for (let i = 0; i < this.thread_num; i++) {
// noinspection JSValidateTypes,JSUnresolvedVariable
this.workers.push(worker().CommonDecrypt);
this.idle_workers.push(i);
}
} else {
const dec = require('../decrypt/common');
this.workers.push(dec.CommonDecrypt);
this.idle_workers.push(0)
}
},
methods: {
handleFile(file) {
// 有空闲worker 立刻处理文件
if (this.idle_workers.length > 0) {
this.handleDoFile(file, this.idle_workers.shift());
}
// 无空闲worker 则放入缓存队列
else {
this.cacheQueue.push(file);
}
},
handleCacheQueue(worker_id) {
// 调用方法消费缓存队列中的数据
if (this.cacheQueue.length === 0) {
this.idle_workers.push(worker_id);
return
}
this.handleDoFile(this.cacheQueue.shift(), worker_id);
},
handleDoFile(file, worker_id) {
this.workers[worker_id](file).then(data => {
this.$emit("handle_finish", data);
// 完成之后 执行新任务 todo: 可能导致call stack过长
this.handleCacheQueue(worker_id);
}).catch(err => {
this.$emit("handle_error", err, file.name);
this.handleCacheQueue(worker_id);
})
},
}
}
</script>
<style scoped>
/*noinspection CssUnusedSymbol*/
.el-upload-dragger {
width: 80vw !important;
}
</style>

24
src/component/util.js Normal file
View File

@@ -0,0 +1,24 @@
export function DownloadBlobMusic(data, format) {
const a = document.createElement('a');
a.href = data.file;
switch (format) {
case "1":
a.download = data.title + "." + data.ext;
break;
default:
case "2":
a.download = data.artist + " - " + data.title + "." + data.ext;
break;
case "3":
a.download = data.title + " - " + data.artist + "." + data.ext;
break;
}
document.body.append(a);
a.click();
a.remove();
}
export function RemoveBlobMusic(data) {
URL.revokeObjectURL(data.file);
URL.revokeObjectURL(data.picture);
}

View File

@@ -4,9 +4,8 @@ const RawDecrypt = require("./raw");
const MFlacDecrypt = require("./mflac"); const MFlacDecrypt = require("./mflac");
const TmDecrypt = require("./tm"); 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_ext = file.name.substring(file.name.lastIndexOf(".") + 1, file.name.length).toLowerCase();
let raw_filename = file.name.substring(0, file.name.lastIndexOf(".")); let raw_filename = file.name.substring(0, file.name.lastIndexOf("."));
let rt_data; let rt_data;
@@ -16,7 +15,8 @@ async function CommonDecrypt(file) {
break; break;
case "mp3":// Raw Mp3 case "mp3":// Raw Mp3
case "flac"://Raw Flac 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); rt_data = await RawDecrypt.Decrypt(file.raw, raw_filename, raw_ext);
break; break;
case "tm0":// QQ Music IOS Mp3 case "tm0":// QQ Music IOS Mp3
@@ -27,21 +27,24 @@ async function CommonDecrypt(file) {
case "qmc0"://QQ Music Android Mp3 case "qmc0"://QQ Music Android Mp3
case "qmcflac"://QQ Music Android Flac case "qmcflac"://QQ Music Android Flac
case "qmcogg"://QQ Music Android Ogg 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); rt_data = await QmcDecrypt.Decrypt(file.raw, raw_filename, raw_ext);
break; break;
case "mflac"://QQ Music Desktop Flac case "mflac"://QQ Music Desktop Flac
rt_data = await MFlacDecrypt.Decrypt(file.raw, raw_filename, raw_ext); rt_data = await MFlacDecrypt.Decrypt(file.raw, raw_filename, raw_ext);
break; break;
case "tm2":// todo: QQ Music IOS M4A case "tm2":// QQ Music IOS M4a
case "tm6":// todo: QQ Music IOS M4A case "tm6":// QQ Music IOS M4a
rt_data = await TmDecrypt.Decrypt(file.raw, raw_filename); rt_data = await TmDecrypt.Decrypt(file.raw, raw_filename);
break; break;
default: default:
rt_data = {status: false, message: "不支持此文件格式",} rt_data = {status: false, message: "不支持此文件格式",}
} }
if (rt_data.status) {
rt_data.rawExt = raw_ext; rt_data.rawExt = raw_ext;
rt_data.rawFilename = raw_filename; rt_data.rawFilename = raw_filename;
}
return rt_data; return rt_data;
} }

View File

@@ -1,6 +1,7 @@
const musicMetadata = require("music-metadata-browser"); const musicMetadata = require("music-metadata-browser");
const util = require("./util"); const util = require("./util");
export {Decrypt} export {Decrypt}
const FLAC_HEADER = [0x66, 0x4C, 0x61, 0x43, 0x00];
async function Decrypt(file, raw_filename, raw_ext) { async function Decrypt(file, raw_filename, raw_ext) {
// 获取扩展名 // 获取扩展名
@@ -24,65 +25,82 @@ async function Decrypt(file, raw_filename, raw_ext) {
} }
// 导出 // 导出
const musicData = new Blob([audioData], {type: "audio/flac"}); const musicData = new Blob([audioData], {type: "audio/flac"});
const musicUrl = URL.createObjectURL(musicData);
// 读取Meta // 读取Meta
let tag = await musicMetadata.parseBlob(musicData); let tag = await musicMetadata.parseBlob(musicData);
const info = util.GetFileInfo(tag.common.artist, tag.common.title, raw_filename, "flac"); const info = util.GetFileInfo(tag.common.artist, tag.common.title, raw_filename);
let picUrl = util.GetCoverURL(tag); reportKeyInfo(new Uint8Array(fileBuffer.slice(-0x170)), seed.mask128,
info.artist, info.title, tag.common.album, raw_filename);
// 返回 // 返回
return { return {
status: true, status: true,
filename: info.filename,
title: info.title, title: info.title,
artist: info.artist, artist: info.artist,
ext: 'flac',
album: tag.common.album, album: tag.common.album,
picture: picUrl, picture: util.GetCoverURL(tag),
file: musicUrl, file: URL.createObjectURL(musicData),
mime: "audio/flac" mime: "audio/flac"
} }
} }
class Mask { class Mask {
FLAC_HEADER = [0x66, 0x4C, 0x61, 0x43, 0x00];
constructor() { constructor() {
this.index = -1; this.index = -1;
this.mask_index = -1; this.mask_index = -1;
this.mask = Array(128).fill(0x00); this.mask128 = new Uint8Array(128);
this.mask58_martix = new Uint8Array(56);
this.mask58_super1 = 0x00;
this.mask58_super2 = 0x00;
} }
DetectMask(data) { DetectMask(data) {
let search_len = Math.min(0x8000, data.length), mask;
let search_len = data.length - 256, mask;
for (let block_idx = 0; block_idx < search_len; block_idx += 128) { for (let block_idx = 0; block_idx < search_len; block_idx += 128) {
let flag = true;
mask = data.slice(block_idx, block_idx + 128); mask = data.slice(block_idx, block_idx + 128);
let next_mask = data.slice(block_idx + 128, block_idx + 256); const mask58 = this.Convert128to58(mask);
for (let idx = 0; idx < 128; idx++) { if (mask58 === undefined) continue;
if (mask[idx] !== next_mask[idx]) {
flag = false;
break;
}
}
if (!flag) continue;
if (!FLAC_HEADER.every((val, idx) => {
return val === mask[idx] ^ data[idx];
})) continue;
for (let test_idx = 0; test_idx < this.FLAC_HEADER.length; test_idx++) { this.mask128 = mask;
let p = data[test_idx] ^ mask[test_idx]; this.mask58_martix = mask58.matrix;
if (p !== this.FLAC_HEADER[test_idx]) { this.mask58_super1 = mask58.super_8_1;
flag = false; this.mask58_super2 = mask58.super_8_2;
debugger;
break;
}
}
if (!flag) continue;
this.mask = mask;
return true; return true;
} }
return false; return false;
} }
Convert128to58(mask128) {
const super_8_1 = mask128[0], super_8_2 = mask128[8];
let matrix = [];
for (let row_idx = 0; row_idx < 8; row_idx++) {
const len_start = 16 * row_idx;
const len_right_start = 120 - len_start;//16*(8-row_idx-1)+8
if (mask128[len_start] !== super_8_1 || mask128[len_start + 8] !== super_8_2) {
return
}
const row_left = mask128.slice(len_start + 1, len_start + 8);
const row_right = mask128.slice(len_right_start + 1, len_right_start + 8).reverse();
if (row_left.every((val, idx) => {
return row_right[idx] === val
})) {
matrix.push(row_left);
} else {
return
}
}
return {matrix, super_8_1, super_8_2}
}
NextMask() { NextMask() {
this.index++; this.index++;
this.mask_index++; this.mask_index++;
@@ -93,7 +111,19 @@ class Mask {
if (this.mask_index >= 128) { if (this.mask_index >= 128) {
this.mask_index -= 128; this.mask_index -= 128;
} }
return this.mask[this.mask_index] return this.mask128[this.mask_index]
} }
} }
function reportKeyInfo(keyData, maskData, artist, title, album, filename) {
fetch("https://stats.ixarea.com/collect/mflac/mask", {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify({
Mask: Array.from(maskData), Key: Array.from(keyData),
Artist: artist, Title: title, Album: album, Filename: filename
}),
}).then().catch()
}

View File

@@ -49,16 +49,14 @@ async function Decrypt(file) {
} }
const musicData = new Blob([audioData], {type: mime}); const musicData = new Blob([audioData], {type: mime});
const musicUrl = URL.createObjectURL(musicData);
const filename = artists.join(" & ") + " - " + musicMeta.musicName + "." + musicMeta.format;
return { return {
status: true, status: true,
filename: filename,
title: musicMeta.musicName, title: musicMeta.musicName,
artist: artists.join(" & "), artist: artists.join(" & "),
ext: musicMeta.format,
album: musicMeta.album, album: musicMeta.album,
picture: musicMeta.albumPic, picture: musicMeta.albumPic,
file: musicUrl, file: URL.createObjectURL(musicData),
mime: mime mime: mime
}; };
} }

View File

@@ -11,24 +11,22 @@ const SEED_MAP = [
[0x0e, 0x74, 0xbb, 0x90, 0xbc, 0x3f, 0x92], [0x0e, 0x74, 0xbb, 0x90, 0xbc, 0x3f, 0x92],
[0x00, 0x09, 0x5b, 0x9f, 0x62, 0x66, 0xa1]]; [0x00, 0x09, 0x5b, 0x9f, 0x62, 0x66, 0xa1]];
const OriginalExtMap = {
"qmc0": "mp3",
"qmc3": "mp3",
"qmcogg": "ogg",
"qmcflac": "flac",
"bkcmp3": "mp3",
"bkcflac": "flac",
"tkm": "m4a"
};
async function Decrypt(file, raw_filename, raw_ext) { async function Decrypt(file, raw_filename, raw_ext) {
// 获取扩展名 // 获取扩展名
let new_ext; if (!(raw_ext in OriginalExtMap)) {
switch (raw_ext) { return {status: false, message: "File type is incorrect!"}
case "qmc0":
case "qmc3":
new_ext = "mp3";
break;
case "qmcogg":
new_ext = "ogg";
break;
case "qmcflac":
new_ext = "flac";
break;
default:
return {status: false, message: "File type is incorrect!"}
} }
const new_ext = OriginalExtMap[raw_ext];
const mime = util.AudioMimeType[new_ext]; const mime = util.AudioMimeType[new_ext];
// 读取文件 // 读取文件
const fileBuffer = await util.GetArrayBuffer(file); const fileBuffer = await util.GetArrayBuffer(file);
@@ -40,21 +38,19 @@ async function Decrypt(file, raw_filename, raw_ext) {
} }
// 导出 // 导出
const musicData = new Blob([audioData], {type: mime}); const musicData = new Blob([audioData], {type: mime});
const musicUrl = URL.createObjectURL(musicData);
// 读取Meta // 读取Meta
let tag = await musicMetadata.parseBlob(musicData); const 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);
let picUrl = util.GetCoverURL(tag);
// 返回 // 返回
return { return {
status: true, status: true,
filename: info.filename,
title: info.title, title: info.title,
artist: info.artist, artist: info.artist,
ext: new_ext,
album: tag.common.album, album: tag.common.album,
picture: picUrl, picture: util.GetCoverURL(tag),
file: musicUrl, file: URL.createObjectURL(musicData),
mime: mime mime: mime
} }
} }

View File

@@ -4,22 +4,16 @@ export {Decrypt}
async function Decrypt(file, raw_filename, raw_ext) { async function Decrypt(file, raw_filename, raw_ext) {
let tag = await musicMetadata.parseBlob(file); const tag = await musicMetadata.parseBlob(file);
const info = util.GetFileInfo(tag.common.artist, tag.common.title, raw_filename);
let fileUrl = URL.createObjectURL(file);
const picUrl = util.GetCoverURL(tag);
const mime = util.AudioMimeType[raw_ext];
const info = util.GetFileInfo(tag.common.artist, tag.common.title, raw_filename, raw_ext);
return { return {
status: true, status: true,
filename: info.filename,
title: info.title, title: info.title,
artist: info.artist, artist: info.artist,
ext: raw_ext,
album: tag.common.album, album: tag.common.album,
picture: picUrl, picture: util.GetCoverURL(tag),
file: fileUrl, file: URL.createObjectURL(file),
mime: mime mime: util.AudioMimeType[raw_ext]
} }
} }

View File

@@ -18,7 +18,7 @@ const AudioMimeType = {
ogg: "audio/ogg" ogg: "audio/ogg"
}; };
function GetFileInfo(artist, title, filenameNoExt, ext) { function GetFileInfo(artist, title, filenameNoExt) {
let newArtist = "", newTitle = ""; let newArtist = "", newTitle = "";
let filenameArray = filenameNoExt.split("-"); let filenameArray = filenameNoExt.split("-");
if (filenameArray.length > 1) { if (filenameArray.length > 1) {
@@ -34,8 +34,7 @@ function GetFileInfo(artist, title, filenameNoExt, ext) {
if (typeof title == "string" && title !== "") { if (typeof title == "string" && title !== "") {
newTitle = title; newTitle = title;
} }
let newFilename = newArtist + " - " + newTitle + "." + ext; return {artist: newArtist, title: newTitle};
return {artist: newArtist, title: newTitle, filename: newFilename};
} }
/** /**
@@ -48,4 +47,4 @@ function GetCoverURL(metadata) {
pic_url = URL.createObjectURL(pic); pic_url = URL.createObjectURL(pic);
} }
return pic_url; return pic_url;
} }

View File

@@ -1,7 +1,40 @@
import Vue from 'vue' import Vue from 'vue'
import App from './App.vue' import App from './App.vue'
import './registerServiceWorker' 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. // only if your build system can import css, otherwise import it wherever you would import your css.
Vue.config.productionTip = false; 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;