Browse Source

Small Changes

20230320
MengYX 5 years ago
parent
commit
c07d55565d
No known key found for this signature in database GPG Key ID: E63F9C7303E8F604
  1. 2
      package.json
  2. 3
      src/decrypt/ncm.js
  3. 5
      src/decrypt/qmc.js

2
package.json

@ -1,7 +1,7 @@
{ {
"name": "unlock-music", "name": "unlock-music",
"version": "1.4.1", "version": "1.4.1",
"updateInfo": "支持.qmc2;qq音乐显示封面图片;界面优化;修复GBK编码ID3信息", "updateInfo": "支持.kwm",
"license": "MIT", "license": "MIT",
"description": "Unlock encrypted music file in browser.", "description": "Unlock encrypted music file in browser.",
"repository": { "repository": {

3
src/decrypt/ncm.js

@ -19,7 +19,8 @@ export async function Decrypt(file, raw_filename, raw_ext) {
let audioOffset = musicMetaObj.offset + dataView.getUint32(musicMetaObj.offset + 5, true) + 13; let audioOffset = musicMetaObj.offset + dataView.getUint32(musicMetaObj.offset + 5, true) + 13;
let audioData = new Uint8Array(fileBuffer, audioOffset); let audioData = new Uint8Array(fileBuffer, audioOffset);
for (let cur = 0; cur < audioData.length; ++cur) audioData[cur] ^= keyBox[cur & 0xff]; let lenAudioData = audioData.length;
for (let cur = 0; cur < lenAudioData; ++cur) audioData[cur] ^= keyBox[cur & 0xff];
if (musicMeta.album === undefined) musicMeta.album = ""; if (musicMeta.album === undefined) musicMeta.album = "";

5
src/decrypt/qmc.js

@ -50,7 +50,6 @@ export async function Decrypt(file, raw_filename, raw_ext) {
} }
} }
//todo: Use artists list to replace artist
const info = GetFileInfo(musicMeta.common.artist, musicMeta.common.title, raw_filename); const info = GetFileInfo(musicMeta.common.artist, musicMeta.common.title, raw_filename);
if (handler.detect) reportKeyUsage(keyData, seed.Matrix128, if (handler.detect) reportKeyUsage(keyData, seed.Matrix128,
info.artist, info.title, musicMeta.common.album, raw_filename, raw_ext); info.artist, info.title, musicMeta.common.album, raw_filename, raw_ext);
@ -109,7 +108,7 @@ async function queryAlbumCoverImage(artist, title, album) {
} }
console.log(queriedSong); console.log(queriedSong);
let imgUrl = ""; let imgUrl = "";
if (undefined !== queriedSong && undefined !== queriedSong["album"]) { if (!!queriedSong && !!queriedSong["album"]) {
if (queriedSong["album"]["pmid"] !== undefined) { if (queriedSong["album"]["pmid"] !== undefined) {
imgUrl = "https://y.gtimg.cn/music/photo_new/T002M000" + queriedSong["album"]["pmid"] + ".jpg" imgUrl = "https://y.gtimg.cn/music/photo_new/T002M000" + queriedSong["album"]["pmid"] + ".jpg"
} else if (queriedSong["album"]["id"] !== undefined) { } else if (queriedSong["album"]["id"] !== undefined) {
@ -119,4 +118,4 @@ async function queryAlbumCoverImage(artist, title, album) {
} }
} }
return imgUrl; return imgUrl;
} }

Loading…
Cancel
Save