5 Commits
1.3.3 ... 1.3.4

Author SHA1 Message Date
MengYX
0c23249d76 Bump Version 2020-03-12 18:56:21 +08:00
MengYX
6502d2d067 Merge CI Settings 2020-03-10 12:22:46 +08:00
MengYX
24e1d33642 Fix errors when parsing ncm files without metadata 2020-03-10 09:31:48 +08:00
MengYX
a72804544f Remove Source Map in production 2020-03-04 10:00:18 +08:00
MengYX
2aeb60d0a9 Update CI 2020-03-04 09:38:30 +08:00
6 changed files with 26 additions and 27 deletions

12
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "unlock-music",
"version": "1.3.3",
"version": "1.3.4",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -1074,7 +1074,7 @@
},
"@types/debug": {
"version": "4.1.5",
"resolved": "https://registry.npm.taobao.org/@types/debug/download/@types/debug-4.1.5.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fdebug%2Fdownload%2F%40types%2Fdebug-4.1.5.tgz",
"resolved": "https://registry.npm.taobao.org/@types/debug/download/@types/debug-4.1.5.tgz",
"integrity": "sha1-sU76iFK3do2JiQZhPCP2iHE+As0="
},
"@types/events": {
@@ -8929,9 +8929,9 @@
}
},
"register-service-worker": {
"version": "1.6.2",
"resolved": "https://registry.npm.taobao.org/register-service-worker/download/register-service-worker-1.6.2.tgz",
"integrity": "sha1-kpflTCBcNxxuSb+oj2mX6N0xX0w="
"version": "1.7.0",
"resolved": "https://registry.npm.taobao.org/register-service-worker/download/register-service-worker-1.7.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fregister-service-worker%2Fdownload%2Fregister-service-worker-1.7.0.tgz",
"integrity": "sha1-tLYNh6HRF/EZv9JOzgc9zbhdrmQ="
},
"regjsgen": {
"version": "0.5.1",
@@ -10392,7 +10392,7 @@
},
"typedarray-to-buffer": {
"version": "3.1.5",
"resolved": "https://registry.npm.taobao.org/typedarray-to-buffer/download/typedarray-to-buffer-3.1.5.tgz",
"resolved": "https://registry.npm.taobao.org/typedarray-to-buffer/download/typedarray-to-buffer-3.1.5.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftypedarray-to-buffer%2Fdownload%2Ftypedarray-to-buffer-3.1.5.tgz",
"integrity": "sha1-qX7nqf9CaRufeD/xvFES/j/KkIA=",
"requires": {
"is-typedarray": "^1.0.0"

View File

@@ -1,7 +1,7 @@
{
"name": "unlock-music",
"version": "1.3.3",
"updateInfo": "支持网易云音乐DJ类型ncm优化旧浏览器的支持",
"version": "1.3.4",
"updateInfo": "修复解锁无元数据的ncm文件时会产生的错误",
"license": "MIT",
"description": "Unlock encrypted music file in browser.",
"repository": {
@@ -20,7 +20,7 @@
"crypto-js": "^4.0.0",
"element-ui": "^2.13.0",
"music-metadata-browser": "^2.0.4",
"register-service-worker": "^1.6.2",
"register-service-worker": "^1.7.0",
"vue": "^2.6.11"
},
"devDependencies": {

View File

@@ -140,8 +140,8 @@
});
if (process.env.NODE_ENV === 'production') {
window._paq.push(["trackEvent", "Error", errInfo, filename]);
console.error(errInfo, filename);
}
console.error(errInfo, filename);
},
changePlaying(url) {
this.playing_url = url;

View File

@@ -9,7 +9,7 @@ export async function CommonDecrypt(file) {
let rt_data;
switch (raw_ext) {
case "ncm":// Netease Mp3/Flac
rt_data = await NcmDecrypt.Decrypt(file.raw);
rt_data = await NcmDecrypt.Decrypt(file.raw, raw_filename, raw_ext);
break;
case "mp3":// Raw Mp3
case "flac"://Raw Flac

View File

@@ -2,10 +2,9 @@ const CryptoJS = require("crypto-js");
const ID3Writer = require("browser-id3-writer");
const CORE_KEY = CryptoJS.enc.Hex.parse("687a4852416d736f356b496e62617857");
const META_KEY = CryptoJS.enc.Hex.parse("2331346C6A6B5F215C5D2630553C2728");
import {AudioMimeType, DetectAudioExt, GetArrayBuffer} from "./util"
export async function Decrypt(file) {
import {AudioMimeType, DetectAudioExt, GetArrayBuffer, GetFileInfo} from "./util"
export async function Decrypt(file, raw_filename, raw_ext) {
const fileBuffer = await GetArrayBuffer(file);
const dataView = new DataView(fileBuffer);
@@ -13,32 +12,34 @@ export async function Decrypt(file) {
dataView.getUint32(4, true) !== 0x4d414446)
return {status: false, message: "此ncm文件已损坏"};
const keyDataObj = getKeyData(dataView, fileBuffer, 10);
const keyBox = getKeyBox(keyDataObj.data);
const musicMetaObj = getMetaData(dataView, fileBuffer, keyDataObj.offset);
const musicMeta = musicMetaObj.data;
let audioOffset = musicMetaObj.offset + dataView.getUint32(musicMetaObj.offset + 5, true) + 13;
let audioData = new Uint8Array(fileBuffer, audioOffset);
for (let cur = 0; cur < audioData.length; ++cur) audioData[cur] ^= keyBox[cur & 0xff];
if (musicMeta.format === undefined) musicMeta.format = DetectAudioExt(audioData, "mp3");
const mime = AudioMimeType[musicMeta.format];
if (musicMeta.album === undefined) musicMeta.album = "";
const artists = [];
musicMeta.artist.forEach(arr => artists.push(arr[0]));
if (musicMeta.format === "mp3")
audioData = await writeID3(audioData, artists, musicMeta.musicName, musicMeta.album, musicMeta.albumPic);
if (!!musicMeta.artist) musicMeta.artist.forEach(arr => artists.push(arr[0]));
const info = GetFileInfo(artists.join(" & "), musicMeta.musicName, raw_filename);
if (artists.length === 0) artists.push(info.artist);
if (musicMeta.format === undefined) musicMeta.format = DetectAudioExt(audioData, "mp3");
if (musicMeta.format === "mp3")
audioData = await writeID3(audioData, artists, info.title, musicMeta.album, musicMeta.albumPic);
const mime = AudioMimeType[musicMeta.format];
const musicData = new Blob([audioData], {type: mime});
return {
status: true,
title: musicMeta.musicName,
artist: artists.join(" & "),
title: info.title,
artist: info.artist,
ext: musicMeta.format,
album: musicMeta.album,
picture: musicMeta.albumPic,
@@ -129,9 +130,7 @@ function getKeyBox(keyData) {
function getMetaData(dataView, fileBuffer, offset) {
const metaDataLen = dataView.getUint32(offset, true);
offset += 4;
if (metaDataLen === 0) {
return {};
}
if (metaDataLen === 0) return {data: {}, offset: offset};
const cipherText = new Uint8Array(fileBuffer, offset, metaDataLen).map(
data => data ^ 0x63

View File

@@ -1,6 +1,6 @@
module.exports = {
publicPath: '',
productionSourceMap: true,
productionSourceMap: false,
pwa: {
workboxOptions: {
skipWaiting: true