mirror of
https://git.um-react.app/um/um-react.git
synced 2026-11-26 15:16:59 +00:00
refactor: reorganize Kugou and Kuwo imports, add key management features
- Updated import paths for Kugou and Kuwo instructions to reflect new directory structure. - Introduced new key management functionalities for Kugou, including key import and selection logic. - Added comprehensive instructions for both Kugou and Kuwo key handling across various platforms. - Implemented Redux selectors for managing staging and production keys for Kugou and Kuwo. - Enhanced documentation and tests for new features and key management processes.
This commit is contained in:
1 parent
a9a937bc5e
commit
7a11d4f941
58 files changed
+522
-311
No files matched your search
@@ -1,28 +0,0 @@
|
||||
import { HiWord } from '~/components/HelpText/HiWord';
|
||||
|
||||
export function InstructionsIOS() {
|
||||
return (
|
||||
<>
|
||||
<p>你需要越狱来访问 iOS 应用的私有数据。</p>
|
||||
<p>
|
||||
⚠️ 请注意,越狱通常意味着你的设备
|
||||
<span className="text-red-600">将失去保修资格</span>。
|
||||
</p>
|
||||
<ol className="list-decimal pl-6">
|
||||
<li>
|
||||
访问设备的这个目录:
|
||||
<br />
|
||||
<code className="break-words">
|
||||
/var/mobile/Containers/Data/Application/<HiWord className="text-nowrap">{'<酷我数据目录>'}</HiWord>/mmkv
|
||||
</code>
|
||||
</li>
|
||||
<li>
|
||||
提取密钥数据库文件 <code>kw_ekey</code> 至浏览器可访问的目录,如下载目录。
|
||||
</li>
|
||||
<li>
|
||||
提交刚刚提取的 <code>kw_ekey</code> 密钥数据库。
|
||||
</li>
|
||||
</ol>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
export function InstructionsPC() {
|
||||
return <p>使用 Windows 客户端下载的文件不需要导入密钥。</p>;
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
import { AndroidADBPullInstruction } from '~/components/AndroidADBPullInstruction/AndroidADBPullInstruction';
|
||||
import { InstructionsPC } from './InstructionsPC';
|
||||
import { InstructionsIOS } from './InstructionsIOS';
|
||||
import { InstructionsTabs, InstructionTab } from '~/components/InstructionsTabs';
|
||||
|
||||
export function KWMv2AllInstructions() {
|
||||
const ANDROID_DIR = '/data/data/cn.kuwo.player/files/mmkv';
|
||||
const ANDROID_FILE = 'cn.kuwo.player.mmkv.defaultconfig';
|
||||
const tabs: InstructionTab[] = [
|
||||
{ id: 'android', label: '安卓', content: <AndroidADBPullInstruction dir={ANDROID_DIR} file={ANDROID_FILE} /> },
|
||||
{ id: 'ios', label: 'iOS', content: <InstructionsIOS /> },
|
||||
{ id: 'windows', label: 'Windows', content: <InstructionsPC /> },
|
||||
];
|
||||
|
||||
return <InstructionsTabs tabs={tabs} />;
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
import { PiFileAudio, PiHash } from 'react-icons/pi';
|
||||
import { kwm2DeleteKey, kwm2UpdateKey } from '../../settingsSlice';
|
||||
import { useAppDispatch } from '~/hooks';
|
||||
import { memo } from 'react';
|
||||
import { StagingKWMv2Key } from '../../keyFormats';
|
||||
import { KeyInput } from '~/components/KeyInput';
|
||||
|
||||
export const KWMv2EKeyItem = memo(({ id, ekey, quality, rid, i }: StagingKWMv2Key & { i: number }) => {
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
const ekeyLen = ekey.length;
|
||||
const isValidEKey = ekeyLen === 364 || ekeyLen === 704;
|
||||
|
||||
return (
|
||||
<KeyInput
|
||||
name={rid}
|
||||
quality={quality}
|
||||
value={ekey}
|
||||
isValidKey={isValidEKey}
|
||||
onSetName={(value) => dispatch(kwm2UpdateKey({ id, field: 'rid', value }))}
|
||||
onSetQuality={(value) => dispatch(kwm2UpdateKey({ id, field: 'quality', value }))}
|
||||
onSetValue={(value) => dispatch(kwm2UpdateKey({ id, field: 'ekey', value }))}
|
||||
onDelete={() => dispatch(kwm2DeleteKey({ id }))}
|
||||
sequence={i + 1}
|
||||
nameLabel={
|
||||
<>
|
||||
ID
|
||||
<PiHash className="hidden md:inline-block" />
|
||||
</>
|
||||
}
|
||||
qualityLabel={
|
||||
<>
|
||||
质量 <PiFileAudio className="hidden md:inline-block" />
|
||||
</>
|
||||
}
|
||||
namePlaceholder="音频哈希。不建议手动填写。"
|
||||
qualityPlaceholder="比特率 ID"
|
||||
valuePlaceholder="密钥,通常包含 364 或 704 位字符,没有空格。"
|
||||
/>
|
||||
);
|
||||
});
|
||||
@@ -1,39 +0,0 @@
|
||||
import { RiFileCopyLine } from 'react-icons/ri';
|
||||
import { ExtLink } from '~/components/ExtLink';
|
||||
import { FilePathBlock } from '~/components/FilePathBlock.tsx';
|
||||
import { copyToClipboard } from '~/util/clipboard';
|
||||
|
||||
const DB_PATH = '%APPDATA%\\KuGou8\\KGMusicV3.db';
|
||||
export function InstructionsPC() {
|
||||
const copyDbPathToClipboard = () => copyToClipboard(DB_PATH);
|
||||
|
||||
return (
|
||||
<>
|
||||
<p>
|
||||
酷狗的 Windows 客户端使用魔改的
|
||||
<ExtLink className="link-info px-1" href="https://www.zetetic.net/sqlcipher/">
|
||||
SQLCipher
|
||||
</ExtLink>
|
||||
来加密储存密钥。
|
||||
</p>
|
||||
<p>该密钥数据库通常位于下述路径:</p>
|
||||
<FilePathBlock>{DB_PATH}</FilePathBlock>
|
||||
|
||||
<h3 className="font-bold text-xl mt-4">导入密钥</h3>
|
||||
<ol className="list-decimal pl-6">
|
||||
<li>
|
||||
<button className="btn btn-sm btn-outline btn-accent mr-2" onClick={copyDbPathToClipboard}>
|
||||
<RiFileCopyLine className="text-xl" />
|
||||
<span>复制</span>
|
||||
</button>
|
||||
<code>KGMusicV3.db</code> 文件路径
|
||||
</li>
|
||||
<li>点击上方的「文件选择区域」,打开「文件选择框」</li>
|
||||
<li>
|
||||
在「文件名」输入框中粘贴之前复制的 <code>KGMusicV3.db</code> 文件路径
|
||||
</li>
|
||||
<li>按下「回车键」确认。</li>
|
||||
</ol>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
import { AndroidADBPullInstruction } from '~/components/AndroidADBPullInstruction/AndroidADBPullInstruction';
|
||||
import { InstructionsPC } from './InstructionsPC';
|
||||
import { InstructionsTabs, InstructionTab } from '~/components/InstructionsTabs';
|
||||
|
||||
export function KugouAllInstructions() {
|
||||
const ANDROID_DIR = '/data/data/com.kugou.android/files/mmkv';
|
||||
const ANDROID_FILE = 'mggkey_multi_process';
|
||||
const tabs: InstructionTab[] = [
|
||||
{ id: 'android', label: '安卓', content: <AndroidADBPullInstruction dir={ANDROID_DIR} file={ANDROID_FILE} /> },
|
||||
{ id: 'windows', label: 'Windows', content: <InstructionsPC /> },
|
||||
];
|
||||
|
||||
return <InstructionsTabs tabs={tabs} />;
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
import { kugouDeleteKey, kugouUpdateKey } from '../../settingsSlice';
|
||||
import { useAppDispatch } from '~/hooks';
|
||||
import { memo } from 'react';
|
||||
import { StagingKugouKey } from '../../keyFormats';
|
||||
import { KeyInput } from '~/components/KeyInput';
|
||||
|
||||
export const KugouEKeyItem = memo(({ id, ekey, audioHash, i }: StagingKugouKey & { i: number }) => {
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
const ekeyLen = ekey.length;
|
||||
const isValidEKey = ekeyLen === 364 || ekeyLen === 704;
|
||||
|
||||
return (
|
||||
<KeyInput
|
||||
name={audioHash}
|
||||
value={ekey}
|
||||
isValidKey={isValidEKey}
|
||||
onSetName={(value) => dispatch(kugouUpdateKey({ id, field: 'audioHash', value }))}
|
||||
onSetValue={(value) => dispatch(kugouUpdateKey({ id, field: 'ekey', value }))}
|
||||
onDelete={() => dispatch(kugouDeleteKey({ id }))}
|
||||
sequence={i + 1}
|
||||
namePlaceholder="音频哈希。不建议手动填写。"
|
||||
valuePlaceholder="密钥,通常包含 364 或 704 位字符,没有空格。"
|
||||
/>
|
||||
);
|
||||
});
|
||||
@@ -1,72 +0,0 @@
|
||||
import { useRef, useState } from 'react';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
|
||||
import { ImportSecretModal } from '~/components/ImportSecretModal';
|
||||
|
||||
import { kugouAddKey, kugouClearKeys, kugouImportKeys } from '../settingsSlice';
|
||||
import { selectStagingKugouV5Keys } from '../settingsSelector';
|
||||
import type { StagingKugouKey } from '../keyFormats';
|
||||
import { AddKey } from '~/components/AddKey.tsx';
|
||||
import { KugouEKeyItem } from '~/features/settings/panels/Kugou/KugouEKeyItem.tsx';
|
||||
import { KugouAllInstructions } from '~/features/settings/panels/Kugou/KugouAllInstructions.tsx';
|
||||
import { parseAndroidKugouMMKV } from '~/util/mmkv/kugou.ts';
|
||||
import { DatabaseKeyExtractor } from '~/util/DatabaseKeyExtractor.ts';
|
||||
import { KeyListContainer } from '~/components/KeyListContainer';
|
||||
import { toastImportResult } from '~/util/toastImportResult';
|
||||
|
||||
export function PanelKGGKey() {
|
||||
const dispatch = useDispatch();
|
||||
const kugouKeys = useSelector(selectStagingKugouV5Keys);
|
||||
const [showImportModal, setShowImportModal] = useState(false);
|
||||
|
||||
const addKey = () => dispatch(kugouAddKey());
|
||||
const clearAll = () => dispatch(kugouClearKeys());
|
||||
const handleSecretImport = async (file: File) => {
|
||||
let keys: Omit<StagingKugouKey, 'id'>[] | null = null;
|
||||
if (/mggkey_multi_process/i.test(file.name)) {
|
||||
keys = parseAndroidKugouMMKV(new DataView(await file.arrayBuffer()));
|
||||
} else if (/^KGMusicV3\.db$/.test(file.name)) {
|
||||
const extractor = await DatabaseKeyExtractor.getInstance();
|
||||
keys = extractor.extractKugouKeyFromEncryptedDb(await file.arrayBuffer());
|
||||
}
|
||||
|
||||
if (keys && keys.length > 0) {
|
||||
dispatch(kugouImportKeys(keys));
|
||||
setShowImportModal(false);
|
||||
}
|
||||
toastImportResult(file.name, keys);
|
||||
};
|
||||
|
||||
const refKeyContainer = useRef<HTMLDivElement>(null);
|
||||
|
||||
return (
|
||||
<div className="container flex flex-col grow min-h-0 w-full">
|
||||
<h2 className="text-2xl font-bold">酷狗解密密钥 (KGG / KGM v5)</h2>
|
||||
|
||||
<p>酷狗已经升级了加密方式,现在最新版本的客户端使用 KGG / KGM v5 加密。</p>
|
||||
|
||||
<h3 className="mt-2 text-xl font-bold">密钥管理</h3>
|
||||
<AddKey
|
||||
addKey={addKey}
|
||||
refContainer={refKeyContainer}
|
||||
importKeyFromFile={() => setShowImportModal(true)}
|
||||
clearKeys={clearAll}
|
||||
/>
|
||||
|
||||
<KeyListContainer ref={refKeyContainer} keys={kugouKeys}>
|
||||
{kugouKeys.map(({ id, audioHash, ekey }, i) => (
|
||||
<KugouEKeyItem key={id} id={id} ekey={ekey} audioHash={audioHash} i={i} />
|
||||
))}
|
||||
</KeyListContainer>
|
||||
|
||||
<ImportSecretModal
|
||||
clientName="酷狗音乐"
|
||||
show={showImportModal}
|
||||
onClose={() => setShowImportModal(false)}
|
||||
onImport={handleSecretImport}
|
||||
>
|
||||
<KugouAllInstructions />
|
||||
</ImportSecretModal>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
import { useRef, useState } from 'react';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
|
||||
import { ImportSecretModal } from '~/components/ImportSecretModal';
|
||||
import { parseAndroidKuwoEKey, parseIosKuwoEKey } from '~/util/mmkv/kuwo';
|
||||
|
||||
import { kwm2AddKey, kwm2ClearKeys, kwm2ImportKeys } from '../settingsSlice';
|
||||
import { selectStagingKWMv2Keys } from '../settingsSelector';
|
||||
import { KWMv2EKeyItem } from './KWMv2/KWMv2EKeyItem';
|
||||
import type { StagingKWMv2Key } from '../keyFormats';
|
||||
import { KWMv2AllInstructions } from './KWMv2/KWMv2AllInstructions';
|
||||
import { AddKey } from '~/components/AddKey';
|
||||
import { KeyListContainer } from '~/components/KeyListContainer';
|
||||
import { toastImportResult } from '~/util/toastImportResult';
|
||||
|
||||
export function PanelKWMv2Key() {
|
||||
const dispatch = useDispatch();
|
||||
const kwm2Keys = useSelector(selectStagingKWMv2Keys);
|
||||
const [showImportModal, setShowImportModal] = useState(false);
|
||||
|
||||
const addKey = () => dispatch(kwm2AddKey());
|
||||
const clearAll = () => dispatch(kwm2ClearKeys());
|
||||
const handleSecretImport = async (file: File) => {
|
||||
let keys: Omit<StagingKWMv2Key, 'id'>[] | null = null;
|
||||
if (/cn\.kuwo\.player\.mmkv/i.test(file.name)) {
|
||||
keys = parseAndroidKuwoEKey(new DataView(await file.arrayBuffer()));
|
||||
} else if (/kw_ekey/.test(file.name)) {
|
||||
keys = parseIosKuwoEKey(new DataView(await file.arrayBuffer()));
|
||||
}
|
||||
|
||||
if (keys && keys.length > 0) {
|
||||
dispatch(kwm2ImportKeys(keys));
|
||||
setShowImportModal(false);
|
||||
}
|
||||
toastImportResult(file.name, keys);
|
||||
};
|
||||
|
||||
const refKeyContainer = useRef<HTMLDivElement>(null);
|
||||
return (
|
||||
<div className="container flex flex-col grow min-h-0 w-full">
|
||||
<h2 className="text-2xl font-bold">酷我解密密钥(KwmV2)</h2>
|
||||
<p>
|
||||
酷我安卓版本的「臻品音质」已经换用 V2 版,表现为加密文件的后缀名为 <code>mflac</code> 或 <code>mgg</code>。
|
||||
</p>
|
||||
<p>该格式需要提取密钥后才能正常解密。</p>
|
||||
|
||||
<h3 className="mt-2 text-xl font-bold">密钥管理</h3>
|
||||
<AddKey
|
||||
addKey={addKey}
|
||||
refContainer={refKeyContainer}
|
||||
importKeyFromFile={() => setShowImportModal(true)}
|
||||
clearKeys={clearAll}
|
||||
/>
|
||||
|
||||
<KeyListContainer ref={refKeyContainer} keys={kwm2Keys}>
|
||||
{kwm2Keys.map(({ id, ekey, quality, rid }, i) => (
|
||||
<KWMv2EKeyItem key={id} id={id} ekey={ekey} quality={quality} rid={rid} i={i} />
|
||||
))}
|
||||
</KeyListContainer>
|
||||
|
||||
<ImportSecretModal
|
||||
clientName="酷我音乐"
|
||||
show={showImportModal}
|
||||
onClose={() => setShowImportModal(false)}
|
||||
onImport={handleSecretImport}
|
||||
>
|
||||
<KWMv2AllInstructions />
|
||||
</ImportSecretModal>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,134 +0,0 @@
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
import { qmc2AddKey, qmc2AllowFuzzyNameSearch, qmc2ClearKeys, qmc2ImportKeys } from '../settingsSlice';
|
||||
import { selectStagingQMCv2Settings } from '../settingsSelector';
|
||||
import React, { useRef, useState } from 'react';
|
||||
import { QMCv2EKeyItem } from './QMCv2/QMCv2EKeyItem';
|
||||
import { ImportSecretModal } from '~/components/ImportSecretModal';
|
||||
import { StagingQMCv2Key } from '../keyFormats';
|
||||
import { DatabaseKeyExtractor } from '~/util/DatabaseKeyExtractor';
|
||||
import { parseAndroidQmEKey } from '~/util/mmkv/qm';
|
||||
import { getFileName } from '~/util/pathHelper';
|
||||
import { QMCv2QQMusicAllInstructions } from './QMCv2/QMCv2QQMusicAllInstructions';
|
||||
import { QMCv2DoubanAllInstructions } from './QMCv2/QMCv2DoubanAllInstructions';
|
||||
import { AddKey } from '~/components/AddKey';
|
||||
import { InfoModal } from '~/components/InfoModal.tsx';
|
||||
import { Ruby } from '~/components/Ruby.tsx';
|
||||
import { ExtLink } from '~/components/ExtLink.tsx';
|
||||
import { KeyListContainer } from '~/components/KeyListContainer';
|
||||
import { toastImportResult } from '~/util/toastImportResult';
|
||||
|
||||
export function PanelQMCv2Key() {
|
||||
const dispatch = useDispatch();
|
||||
const { keys: qmc2Keys, allowFuzzyNameSearch } = useSelector(selectStagingQMCv2Settings);
|
||||
const [showImportModal, setShowImportModal] = useState(false);
|
||||
const [secretType, setSecretType] = useState<'qm' | 'douban'>('qm');
|
||||
|
||||
const addKey = () => dispatch(qmc2AddKey());
|
||||
const clearAll = () => dispatch(qmc2ClearKeys());
|
||||
|
||||
const handleAllowFuzzyNameSearchCheckbox = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
dispatch(qmc2AllowFuzzyNameSearch({ enable: e.target.checked }));
|
||||
};
|
||||
|
||||
const handleSecretImport = async (file: File) => {
|
||||
try {
|
||||
const fileBuffer = await file.arrayBuffer();
|
||||
|
||||
let keys: null | Omit<StagingQMCv2Key, 'id'>[] = null;
|
||||
|
||||
if (/(player_process[_.]db|music_audio_play)(\.db)?$/i.test(file.name)) {
|
||||
const extractor = await DatabaseKeyExtractor.getInstance();
|
||||
keys = extractor.extractQmcV2KeysFromSqliteDb(fileBuffer);
|
||||
} else if (/MMKVStreamEncryptId|filenameEkeyMap|qmpc-mmkv-v1|(\.mmkv$)/i.test(file.name)) {
|
||||
const fileBuffer = await file.arrayBuffer();
|
||||
const map = parseAndroidQmEKey(new DataView(fileBuffer));
|
||||
keys = Array.from(map.entries(), ([name, ekey]) => ({ name: getFileName(name), ekey }));
|
||||
}
|
||||
|
||||
if (keys && keys.length > 0) {
|
||||
dispatch(qmc2ImportKeys(keys));
|
||||
setShowImportModal(false);
|
||||
}
|
||||
|
||||
toastImportResult(file.name, keys);
|
||||
} catch (e) {
|
||||
console.error('error during import: ', e);
|
||||
alert(`导入数据库时发生错误:${e as Error}`);
|
||||
}
|
||||
};
|
||||
|
||||
const refKeyContainer = useRef<HTMLDivElement>(null);
|
||||
|
||||
return (
|
||||
<>
|
||||
<h2 className="text-2xl font-bold">QMCv2 解密密钥</h2>
|
||||
|
||||
<p>QQ 音乐、豆瓣 FM 目前采用的加密方案(QMCv2)。</p>
|
||||
<p>「QQ 音乐」安卓、Mac 或 iOS 客户端,或「豆瓣 FM」安卓客户端会将密钥存储在外部的数据库文件内。</p>
|
||||
|
||||
<div className="flex flex-row gap-2 items-center my-2">
|
||||
<label className="label">
|
||||
<input
|
||||
className="checkbox"
|
||||
type="checkbox"
|
||||
checked={allowFuzzyNameSearch}
|
||||
onChange={handleAllowFuzzyNameSearchCheckbox}
|
||||
/>
|
||||
允许匹配相似文件名
|
||||
</label>
|
||||
<InfoModal
|
||||
title="莱文斯坦距离"
|
||||
description={
|
||||
<div>
|
||||
<p>若文件名匹配失败,则使用相似文件名的密钥。</p>
|
||||
<p>
|
||||
该匹配使用「
|
||||
<ExtLink href="https://zh.wikipedia.org/zh-cn/%E8%90%8A%E6%96%87%E6%96%AF%E5%9D%A6%E8%B7%9D%E9%9B%A2">
|
||||
<Ruby caption="Levenshtein distance">莱文斯坦距离</Ruby>
|
||||
</ExtLink>
|
||||
」算法来计算文件名的相似程度。
|
||||
</p>
|
||||
<p>若密钥数量过多,匹配时可能会造成浏览器卡顿或无响应一段时间。</p>
|
||||
<p>若不确定,请勾选该项。</p>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
这是什么?
|
||||
</InfoModal>
|
||||
</div>
|
||||
|
||||
<h3 className="mt-2 text-xl font-bold">密钥管理</h3>
|
||||
<AddKey
|
||||
addKey={addKey}
|
||||
refContainer={refKeyContainer}
|
||||
importKeyFromFile={() => setShowImportModal(true)}
|
||||
clearKeys={clearAll}
|
||||
/>
|
||||
|
||||
<KeyListContainer ref={refKeyContainer} keys={qmc2Keys}>
|
||||
{qmc2Keys.map(({ id, ekey, name }, i) => (
|
||||
<QMCv2EKeyItem key={id} id={id} ekey={ekey} name={name} i={i} />
|
||||
))}
|
||||
</KeyListContainer>
|
||||
|
||||
<ImportSecretModal
|
||||
clientName={
|
||||
<select
|
||||
value={secretType}
|
||||
onChange={(e) => setSecretType(e.target.value as 'qm' | 'douban')}
|
||||
className="inline mx-1 px-1 border-b border-accent/50 bg-base-100"
|
||||
>
|
||||
<option value="qm">QQ 音乐</option>
|
||||
<option value="douban">豆瓣 FM</option>
|
||||
</select>
|
||||
}
|
||||
show={showImportModal}
|
||||
onClose={() => setShowImportModal(false)}
|
||||
onImport={handleSecretImport}
|
||||
>
|
||||
{secretType === 'qm' && <QMCv2QQMusicAllInstructions />}
|
||||
{secretType === 'douban' && <QMCv2DoubanAllInstructions />}
|
||||
</ImportSecretModal>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,125 +0,0 @@
|
||||
import { useAppDispatch, useAppSelector } from '~/hooks';
|
||||
import { ExtLink } from '~/components/ExtLink';
|
||||
import { ChangeEvent, ClipboardEvent, useId } from 'react';
|
||||
import { VQuote } from '~/components/HelpText/VQuote';
|
||||
import { selectStagingQtfmAndroidKey } from '../settingsSelector';
|
||||
import { qtfmAndroidUpdateKey } from '../settingsSlice';
|
||||
import { workerClientBus } from '~/decrypt-worker/client.ts';
|
||||
import { GetQingTingFMDeviceKeyPayload } from '~/decrypt-worker/types.ts';
|
||||
import { DECRYPTION_WORKER_ACTION_NAME } from '~/decrypt-worker/constants.ts';
|
||||
import { Ruby } from '~/components/Ruby';
|
||||
import { HiWord } from '~/components/HelpText/HiWord';
|
||||
import { toast } from 'react-toastify';
|
||||
|
||||
const QTFM_DEVICE_ID_URL = 'https://github.com/parakeet-rs/qtfm-device-id/releases/latest';
|
||||
|
||||
export function PanelQingTing() {
|
||||
const dispatch = useAppDispatch();
|
||||
const secretKey = useAppSelector(selectStagingQtfmAndroidKey);
|
||||
const setSecretKey = (secretKey: string) => {
|
||||
dispatch(qtfmAndroidUpdateKey({ deviceKey: secretKey }));
|
||||
};
|
||||
|
||||
const handleDataPaste = (e: ClipboardEvent<HTMLInputElement>) => {
|
||||
const plainText = e.clipboardData.getData('text/plain');
|
||||
const matchDeviceSecret = plainText.match(/^DEVICE_SECRET: ([0-9a-fA-F]+)/m);
|
||||
if (matchDeviceSecret) {
|
||||
e.preventDefault();
|
||||
setSecretKey(matchDeviceSecret[1]);
|
||||
return;
|
||||
}
|
||||
|
||||
const dataMap = Object.create(null) as GetQingTingFMDeviceKeyPayload;
|
||||
for (const [, key, value] of plainText.matchAll(/^(PRODUCT|DEVICE|MANUFACTURER|BRAND|BOARD|MODEL): (.+)/gim)) {
|
||||
dataMap[key.toLowerCase() as keyof GetQingTingFMDeviceKeyPayload] = value;
|
||||
}
|
||||
const { product, device, manufacturer, brand, board, model } = dataMap;
|
||||
|
||||
if (product && device && manufacturer && brand && board && model) {
|
||||
e.preventDefault();
|
||||
workerClientBus
|
||||
.request<
|
||||
string,
|
||||
GetQingTingFMDeviceKeyPayload
|
||||
>(DECRYPTION_WORKER_ACTION_NAME.QINGTING_FM_GET_DEVICE_KEY, dataMap)
|
||||
.then(setSecretKey, (err) => toast.error(`生成设备密钥时发生错误: ${err}`));
|
||||
}
|
||||
};
|
||||
|
||||
const handleDataInput = (e: ChangeEvent<HTMLInputElement>) => {
|
||||
setSecretKey(e.target.value);
|
||||
};
|
||||
|
||||
const idSecretKey = useId();
|
||||
|
||||
return (
|
||||
<div className="min-h-0 flex-col grow px-1">
|
||||
<h2 className="text-2xl font-bold mb-4">蜻蜓 FM</h2>
|
||||
|
||||
<p>
|
||||
<VQuote>蜻蜓 FM</VQuote>的安卓版本需要获取设备密钥,并以此来生成解密密钥。
|
||||
</p>
|
||||
|
||||
<div className="my-4">
|
||||
<fieldset className="fieldset">
|
||||
<legend className="fieldset-legend text-lg">
|
||||
<label htmlFor={idSecretKey}>设备密钥</label>
|
||||
</legend>
|
||||
<input
|
||||
id={idSecretKey}
|
||||
type="text"
|
||||
className="input font-mono"
|
||||
onPaste={handleDataPaste}
|
||||
value={secretKey}
|
||||
onChange={handleDataInput}
|
||||
/>
|
||||
<p className="label flex-wrap">
|
||||
粘贴含有设备密钥的信息的内容时将自动提取密钥(如通过
|
||||
<ExtLink href={QTFM_DEVICE_ID_URL}>
|
||||
<code>qtfm-device-id</code>
|
||||
</ExtLink>
|
||||
获取的设备信息),不需要 root。
|
||||
</p>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<h3 className="text-xl font-bold my-2">注意事项</h3>
|
||||
<ul className="list-disc pl-6">
|
||||
<li>
|
||||
<p>
|
||||
下载的文件位于
|
||||
<VQuote>
|
||||
<code className="break-words">
|
||||
<HiWord>[内部储存]</HiWord>/<wbr />
|
||||
Android/
|
||||
<wbr />
|
||||
data/
|
||||
<wbr />
|
||||
fm.qingting.qtradio/
|
||||
<wbr />
|
||||
files/Music/
|
||||
</code>
|
||||
</VQuote>
|
||||
</p>
|
||||
<ul className="list-disc pl-6">
|
||||
<li>
|
||||
<p>
|
||||
你可能需要使用有
|
||||
<Ruby caption="root">特权</Ruby>
|
||||
的文件浏览器访问。
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>
|
||||
音频文件文件名为「<code>.p~!</code>」前缀。
|
||||
</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>因为解密密钥与文件名相关,因此解密前请不要更改文件名。</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
import { InstructionsIOSCondition } from './InstructionsIOSCondition';
|
||||
import { useId } from 'react';
|
||||
|
||||
export function InstructionsIOS() {
|
||||
const iosInstructionId = useId();
|
||||
|
||||
return (
|
||||
<>
|
||||
<div>
|
||||
<p>iOS 设备获取应用私有文件比较麻烦,你需要越狱或使用一台 PC 或 Mac 来对 iOS 设备进行完整备份。</p>
|
||||
<p>因此,建议换用 PC 或 Mac 重新下载音乐文件然后再尝试解密。</p>
|
||||
</div>
|
||||
|
||||
<div className="join join-vertical bg-base-100 mt-2 max-w-full">
|
||||
<div className="collapse collapse-arrow join-item border-base-300 border">
|
||||
<input type="radio" name={iosInstructionId} />
|
||||
<div className="collapse-title font-semibold">
|
||||
我的 iOS 设备<strong>已经越狱</strong>{' '}
|
||||
</div>
|
||||
<div className="collapse-content text-sm min-w-0">
|
||||
<InstructionsIOSCondition jailbreak={true} />
|
||||
</div>
|
||||
</div>
|
||||
<div className="collapse collapse-arrow join-item border-base-300 border">
|
||||
<input type="radio" name={iosInstructionId} />
|
||||
<div className="collapse-title font-semibold">
|
||||
我的 iOS 设备<strong>没有越狱</strong>
|
||||
</div>
|
||||
<div className="collapse-content text-sm min-w-0">
|
||||
<InstructionsIOSCondition jailbreak={false} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
import iosAllowBackup from './iosAllowBackup.webp';
|
||||
import { FilePathBlock } from '~/components/FilePathBlock';
|
||||
import { HiWord } from '~/components/HelpText/HiWord';
|
||||
|
||||
const EXAMPLE_MEDIA_ID = '0011wjLv1bIkvv';
|
||||
const EXAMPLE_NAME_IOS = '333407709-0011wjLv1bIkvv-1.mgalaxy';
|
||||
const EXAMPLE_NAME_DB = 'Q0M00011wjLv1bIkvv.mflac';
|
||||
|
||||
export function InstructionsIOSCondition({ jailbreak }: { jailbreak: boolean }) {
|
||||
const useJailbreak = jailbreak;
|
||||
const useBackup = !jailbreak;
|
||||
|
||||
const pathPrefix = jailbreak ? (
|
||||
<>
|
||||
/var/mobile/Containers/Data/Application/<HiWord className="text-nowrap">[随机字符]</HiWord>/
|
||||
</>
|
||||
) : (
|
||||
'/AppDomain-'
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<h4 className="text-lg font-semibold">获取密钥数据库文件</h4>
|
||||
<ol className="list-decimal pl-4">
|
||||
{useBackup && (
|
||||
<li>
|
||||
首先需要在 iOS 客户端的设定允许备份:
|
||||
<br />
|
||||
<img src={iosAllowBackup}></img>
|
||||
</li>
|
||||
)}
|
||||
{useBackup && <li>使用你喜欢的备份软件对 iOS 设备进行完整备份</li>}
|
||||
<li>
|
||||
{useBackup && <span>打开备份文件,并导航到下述目录:</span>}
|
||||
{useJailbreak && <span>访问下述目录:</span>}
|
||||
<FilePathBlock>{pathPrefix}com.tencent.QQMusic/Documents/mmkv/</FilePathBlock>
|
||||
</li>
|
||||
<li>
|
||||
提取或导出密钥数据库文件 <code>filenameEkeyMap</code>
|
||||
</li>
|
||||
<li>
|
||||
提交导出的 <code>filenameEkeyMap</code> 文件
|
||||
</li>
|
||||
<li>按下「保存」来应用更改。</li>
|
||||
</ol>
|
||||
|
||||
<h3 className="text-lg font-semibold mt-3">获取离线文件</h3>
|
||||
<section>
|
||||
<p>访问下述目录:</p>
|
||||
<FilePathBlock>
|
||||
{pathPrefix}com.tencent.QQMusic/Library/Application Support/com.tencent.QQMusic/iData/iMusic
|
||||
</FilePathBlock>
|
||||
<p>
|
||||
该目录又存在数个子目录,其子目录下保存的「<code>[字符].m[字符]</code>」文件则是最终的加密文件。
|
||||
</p>
|
||||
<p>
|
||||
格式:<code>[song_id]-[mid]-[随机数字].m[后缀]</code>
|
||||
</p>
|
||||
<p>
|
||||
 例:<code>{EXAMPLE_NAME_IOS}</code>
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<h4 className="text-lg font-semibold mt-3">解密离线文件</h4>
|
||||
<p>勾选设定界面的「使用近似文件名匹配」可跳过该节内容。</p>
|
||||
<p>⚠ 注意:若密钥过多,匹配过程可能会造成浏览器卡顿或无响应。</p>
|
||||
<ol className="list-decimal pl-4 mt-1">
|
||||
<li>
|
||||
提取文件的 <code>[mid]</code> 部分,如 <code>{EXAMPLE_MEDIA_ID}</code>
|
||||
</li>
|
||||
<li>
|
||||
查找密钥表,得到文件名「<code>{EXAMPLE_NAME_DB}</code>」
|
||||
</li>
|
||||
<li>
|
||||
将文件更名为对应的文件名,如
|
||||
<br />
|
||||
<code>{EXAMPLE_NAME_IOS}</code>
|
||||
<br />➔ <code>{EXAMPLE_NAME_DB}</code>
|
||||
</li>
|
||||
<li>
|
||||
回到主界面,提交文件「<code>{EXAMPLE_NAME_DB}</code>」。
|
||||
</li>
|
||||
</ol>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
import { useId } from 'react';
|
||||
import { InstructionsMacV8 } from './InstructionsMacV8';
|
||||
import { InstructionsMacV10 } from './InstructionsMacV10';
|
||||
|
||||
export function InstructionsMac() {
|
||||
const macInstructionId = useId();
|
||||
|
||||
return (
|
||||
<>
|
||||
<p>Mac 客户端使用 mmkv 数据库储存密钥。</p>
|
||||
<p>建议使用 v8.8.0 或 v10.7 版本的客户端,其中 v8.8.0 版本需要屏蔽更新。</p>
|
||||
|
||||
<div className="join join-vertical bg-base-100 mt-2 max-w-full">
|
||||
<div className="collapse collapse-arrow join-item border-base-300 border">
|
||||
<input type="radio" name={macInstructionId} />
|
||||
<div className="collapse-title font-semibold">使用 QQ 音乐 Mac v8.8.0</div>
|
||||
<div className="collapse-content text-sm min-w-0">
|
||||
<InstructionsMacV8 />
|
||||
</div>
|
||||
</div>
|
||||
<div className="collapse collapse-arrow join-item border-base-300 border">
|
||||
<input type="radio" name={macInstructionId} />
|
||||
<div className="collapse-title font-semibold">使用 QQ 音乐 Mac v10.7.1</div>
|
||||
<div className="collapse-content text-sm min-w-0">
|
||||
<InstructionsMacV10 />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
import { ExtLink } from '~/components/ExtLink';
|
||||
|
||||
import {
|
||||
commandName as DUMP_COMMAND_NAME,
|
||||
tarName as DUMP_COMMAND_TARBALL_NAME,
|
||||
tarball as DUMP_COMMAND_BASE64,
|
||||
} from './assets/qqmusic_v10.7_dump.command?&name=QQ 音乐 Mac v10 密钥提取.command&mac-command';
|
||||
import { DownloadBase64 } from '~/components/DownloadBase64';
|
||||
import { VQuote } from '~/components/HelpText/VQuote';
|
||||
import { InSecretImportModalContext } from '~/context/InSecretImportModal';
|
||||
import { useContext } from 'react';
|
||||
|
||||
const MAC_CLIENT_URL =
|
||||
'https://c.y.qq.com/cgi-bin/file_redirect.fcg?bid=dldir&file=ecosfile%2Fmusic_clntupate%2Fmac%2Fother%2FQQMusicMac10.7.1Build00.dmg&sign=1-0cb9ee4c40e7447e2113cfdee2dc11c88487b0e31fe37cfe1c59e12c20956dce-689e9373';
|
||||
const MAC_CLIENT_TG_URL = 'https://t.me/um_lsr_ch/30';
|
||||
|
||||
export function InstructionsMacV10() {
|
||||
const inSecretImportModal = useContext(InSecretImportModalContext);
|
||||
return (
|
||||
<>
|
||||
<p className="mt-4">获取 QQ 音乐 Mac 客户端 10.7.1:</p>
|
||||
<ul className="list-disc pl-6">
|
||||
<li>
|
||||
<ExtLink className="link-info" href={MAC_CLIENT_URL}>
|
||||
通过 QQ 音乐官网下载(高速,但可能失效)
|
||||
</ExtLink>
|
||||
</li>
|
||||
<li>
|
||||
<ExtLink className="link-info" href={MAC_CLIENT_TG_URL}>
|
||||
通过 Telegram 下载(缓存,需要账号)
|
||||
</ExtLink>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4 className="font-bold text-lg mt-4">导入密钥</h4>
|
||||
<ol className="list-decimal pl-6">
|
||||
<li>
|
||||
下载 <DownloadBase64 data={DUMP_COMMAND_BASE64} filename={DUMP_COMMAND_TARBALL_NAME}></DownloadBase64>
|
||||
,打开得到 <code>{DUMP_COMMAND_NAME}</code>。
|
||||
</li>
|
||||
<li>
|
||||
<p>
|
||||
双击 <code>{DUMP_COMMAND_NAME}</code> 执行。
|
||||
</p>
|
||||
<p>
|
||||
※ 若是提示文件来自未知开发者,请右键点击该文件,选择菜单第一项
|
||||
<VQuote>打开</VQuote>,在警告窗口再次选择<VQuote>打开</VQuote>。
|
||||
</p>
|
||||
</li>
|
||||
<li>
|
||||
运行后会在脚本当前目录生成 <code>qqmusic-mac-*.mmkv</code> 文件,其中 <code>*</code> 是一串随机字符。
|
||||
</li>
|
||||
{inSecretImportModal ? (
|
||||
<li>
|
||||
上传刚生成的 <code>qqmusic-mac-*.mmkv</code> 文件到上方的<VQuote>文件选择区域</VQuote>。
|
||||
</li>
|
||||
) : (
|
||||
<li>
|
||||
前往设定页面,提交生成的 <code>qqmusic-mac-*.mmkv</code> 文件。
|
||||
</li>
|
||||
)}
|
||||
</ol>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
import { RiFileCopyLine } from 'react-icons/ri';
|
||||
import { ExtLink } from '~/components/ExtLink';
|
||||
import { FilePathBlock } from '~/components/FilePathBlock';
|
||||
import { VQuote } from '~/components/HelpText/VQuote';
|
||||
import { MacCommandKey } from '~/components/Key/MacCommandKey';
|
||||
import { ShiftKey } from '~/components/Key/ShiftKey';
|
||||
import { copyToClipboard } from '~/util/clipboard';
|
||||
|
||||
import {
|
||||
commandName as BLOCK_UPDATE_COMAND,
|
||||
tarName as BLOCK_UPDATE_TAR_NAME,
|
||||
tarball as BLOCK_UPDATE_BASE64,
|
||||
} from './assets/qqmusic_v8.8.0_patch_update.command?&name=QQ 音乐 Mac v8.8.0 屏蔽更新.command&mac-command';
|
||||
import { DownloadBase64 } from '~/components/DownloadBase64';
|
||||
import { useContext } from 'react';
|
||||
import { InSecretImportModalContext } from '~/context/InSecretImportModal';
|
||||
|
||||
const MAC_CLIENT_URL =
|
||||
'https://web.archive.org/web/20230903/https://dldir1.qq.com/music/clntupate/mac/QQMusicMac_Mgr.dmg';
|
||||
const MAC_CLIENT_TG_URL = 'https://t.me/um_lsr_ch/21';
|
||||
const DB_PATH =
|
||||
'~/Library/Containers/com.tencent.QQMusicMac/Data/Library/Application Support/QQMusicMac/mmkv/MMKVStreamEncryptId';
|
||||
|
||||
export function InstructionsMacV8() {
|
||||
const inSecretImportModal = useContext(InSecretImportModalContext);
|
||||
|
||||
return (
|
||||
<>
|
||||
<p className="mt-4">获取 QQ 音乐 Mac 客户端 8.8.0:</p>
|
||||
<ul className="list-disc pl-6">
|
||||
<li>
|
||||
<ExtLink className="link-info" href={MAC_CLIENT_URL}>
|
||||
通过 <code>Archive.org</code> 缓存下载(慢)
|
||||
</ExtLink>
|
||||
</li>
|
||||
<li>
|
||||
<ExtLink className="link-info" href={MAC_CLIENT_TG_URL}>
|
||||
通过 Telegram 下载(需要账号)
|
||||
</ExtLink>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p className="mt-4">
|
||||
部分用户可能会被强制要求更新。你可以下载
|
||||
<DownloadBase64 filename={BLOCK_UPDATE_TAR_NAME} data={BLOCK_UPDATE_BASE64}></DownloadBase64>
|
||||
并执行 <code>{BLOCK_UPDATE_COMAND}</code>。
|
||||
<span>其原理是修改 QQ 音乐的版本号,让其认为自己是最新版本,从而达到屏蔽更新的效果。</span>
|
||||
</p>
|
||||
<p>
|
||||
※ 若是提示文件来自未知开发者,请右键点击该文件,选择菜单第一项
|
||||
<VQuote>打开</VQuote>,在警告窗口再次选择<VQuote>打开</VQuote>。
|
||||
</p>
|
||||
|
||||
<p className="mt-4">密钥文件通常存储在下述路径:</p>
|
||||
<FilePathBlock>{DB_PATH}</FilePathBlock>
|
||||
|
||||
<h4 className="font-bold text-lg mt-4">导入密钥</h4>
|
||||
<ol className="list-decimal pl-6">
|
||||
<li>
|
||||
<button className="btn btn-sm btn-outline btn-accent mr-2" onClick={() => copyToClipboard(DB_PATH)}>
|
||||
<RiFileCopyLine className="text-xl" />
|
||||
<span>复制</span>
|
||||
</button>
|
||||
<code>MMKVStreamEncryptId</code> 文件路径
|
||||
</li>
|
||||
<li>
|
||||
{inSecretImportModal ? (
|
||||
<p>
|
||||
点击上方的<VQuote>文件选择区域</VQuote>,打开<VQuote>文件选择框</VQuote>
|
||||
</p>
|
||||
) : (
|
||||
<p>前往设定页面,提交该密钥文件。</p>
|
||||
)}
|
||||
<p>
|
||||
※ 你可以在文件选择对话框按下
|
||||
<VQuote>
|
||||
<ShiftKey className="mx-1" />
|
||||
{'+'}
|
||||
<MacCommandKey className="mx-1" />
|
||||
{'+'}
|
||||
<kbd className="kbd mx-1">G</kbd>
|
||||
</VQuote>
|
||||
组合键打开<VQuote>路径输入框</VQuote>,粘贴文件路径并回车提交。
|
||||
</p>
|
||||
</li>
|
||||
</ol>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
import { ExtLink } from '~/components/ExtLink';
|
||||
import { HiWord } from '~/components/HelpText/HiWord';
|
||||
import NoopExecutable from './assets/noop.exe?base64';
|
||||
import NoopExecutableSource from './assets/noop.asm.txt?base64';
|
||||
|
||||
const QMPC_MMKV_RELEASES_URL = 'https://git.um-react.app/um/qmpc-mmkv/releases';
|
||||
const PC_CLIENT_URL = 'https://web.archive.org/web/2023/https://dldir1v6.qq.com/music/clntupate/QQMusic_Setup_1951.exe';
|
||||
const PC_CLIENT_TG_URL = 'https://t.me/um_lsr_ch/24';
|
||||
|
||||
export function InstructionsPC() {
|
||||
return (
|
||||
<>
|
||||
<p className="mt-2">
|
||||
使用 <span className="text-primary">19.57 至 22.76</span>下载的歌曲文件
|
||||
<HiWord>需要导入密钥</HiWord>。
|
||||
</p>
|
||||
|
||||
<p className="mt-4">
|
||||
请从{' '}
|
||||
<ExtLink className="link-info" href={QMPC_MMKV_RELEASES_URL}>
|
||||
qmpc-mmkv-cli
|
||||
</ExtLink>{' '}
|
||||
获取工具,提取密钥文件 <code>qmpc-mmkv-v1.mmkv</code> 后在本页导入。
|
||||
</p>
|
||||
|
||||
<p className="mt-4">
|
||||
使用 <span className="text-base-content/70">19.51 或更低版本</span>下载的歌曲文件
|
||||
<HiWord>无需密钥</HiWord>。
|
||||
</p>
|
||||
|
||||
<p className="mt-4">
|
||||
获取 QQ 音乐 Windows <HiWord>19.51</HiWord> 客户端:
|
||||
</p>
|
||||
<ul className="list-disc pl-6">
|
||||
<li>
|
||||
<ExtLink className="link-info" href={PC_CLIENT_URL}>
|
||||
通过 <code>Archive.org</code> 缓存下载(慢)
|
||||
</ExtLink>
|
||||
</li>
|
||||
<li>
|
||||
<ExtLink className="link-info" href={PC_CLIENT_TG_URL}>
|
||||
通过 Telegram 下载(需要账号)
|
||||
</ExtLink>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p className="mt-4">
|
||||
安装完成后可以覆盖 QQ 音乐安装目录下的
|
||||
<a
|
||||
className="link link-info mx-1"
|
||||
download="QQMusicUp.exe"
|
||||
href={`data:application/vnd.microsoft.portable-executable;base64,${NoopExecutable}`}
|
||||
>
|
||||
<code>QQMusicUp.exe</code>
|
||||
</a>
|
||||
同名文件,屏蔽自动更新(
|
||||
<a
|
||||
className="link"
|
||||
download="QQMusicUp.asm"
|
||||
href={`data:text/x-asm;charset=utf-8;base64,${NoopExecutableSource}`}
|
||||
>
|
||||
源码
|
||||
</a>
|
||||
)。
|
||||
</p>
|
||||
<p className="mt-2">降级后需要删除新版本下载的文件并重新使用旧版本下载。</p>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
import { AndroidADBPullInstruction } from '~/components/AndroidADBPullInstruction/AndroidADBPullInstruction';
|
||||
import { InstructionsTabs, InstructionTab } from '~/components/InstructionsTabs.tsx';
|
||||
|
||||
export function QMCv2DoubanAllInstructions() {
|
||||
const tabs: InstructionTab[] = [
|
||||
{
|
||||
id: 'android',
|
||||
label: '安卓',
|
||||
content: <AndroidADBPullInstruction dir="/data/data/com.douban.radio/databases" file="music_audio_play" />,
|
||||
},
|
||||
];
|
||||
|
||||
return <InstructionsTabs tabs={tabs} />;
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
import { qmc2DeleteKey, qmc2UpdateKey } from '../../settingsSlice';
|
||||
import { useAppDispatch } from '~/hooks';
|
||||
import { memo } from 'react';
|
||||
import { KeyInput } from '~/components/KeyInput.tsx';
|
||||
|
||||
export const QMCv2EKeyItem = memo(({ id, name, ekey, i }: { id: string; name: string; ekey: string; i: number }) => {
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
const ekeyLen = ekey.length;
|
||||
const isValidEKey = ekeyLen === 364 || ekeyLen === 704;
|
||||
|
||||
return (
|
||||
<KeyInput
|
||||
name={name}
|
||||
value={ekey}
|
||||
isValidKey={isValidEKey}
|
||||
onSetName={(value) => dispatch(qmc2UpdateKey({ id, field: 'name', value }))}
|
||||
onSetValue={(value) => dispatch(qmc2UpdateKey({ id, field: 'ekey', value }))}
|
||||
onDelete={() => dispatch(qmc2DeleteKey({ id }))}
|
||||
sequence={i + 1}
|
||||
namePlaceholder="文件名,包括后缀名。如 “AAA - BBB.mflac”"
|
||||
valuePlaceholder="密钥,通常包含 364 或 704 位字符,没有空格。"
|
||||
/>
|
||||
);
|
||||
});
|
||||
@@ -1,20 +0,0 @@
|
||||
import { AndroidADBPullInstruction } from '~/components/AndroidADBPullInstruction/AndroidADBPullInstruction';
|
||||
import { InstructionsIOS } from './InstructionsIOS';
|
||||
import { InstructionsMac } from './InstructionsMac';
|
||||
import { InstructionsPC } from './InstructionsPC';
|
||||
import { InstructionsTabs, InstructionTab } from '~/components/InstructionsTabs.tsx';
|
||||
|
||||
export function QMCv2QQMusicAllInstructions({ limitHeight }: { limitHeight?: boolean }) {
|
||||
const tabs: InstructionTab[] = [
|
||||
{
|
||||
id: 'android',
|
||||
label: '安卓',
|
||||
content: <AndroidADBPullInstruction dir="/data/data/com.tencent.qqmusic/databases" file="player_process_db" />,
|
||||
},
|
||||
{ id: 'ios', label: 'iOS', content: <InstructionsIOS /> },
|
||||
{ id: 'mac', label: 'Mac', content: <InstructionsMac /> },
|
||||
{ id: 'windows', label: 'Windows', content: <InstructionsPC /> },
|
||||
];
|
||||
|
||||
return <InstructionsTabs tabs={tabs} limitHeight={limitHeight} />;
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
com.tencent.QQMusicMac.plist
|
||||
iData/
|
||||
qqmusic-mac-*.mmkv
|
||||
@@ -1,16 +0,0 @@
|
||||
; QQ 音乐更新 - 占位文件
|
||||
; 使用 FASM 编译即可。
|
||||
|
||||
format PE GUI 4.0
|
||||
entry start
|
||||
|
||||
include 'win32a.inc'
|
||||
|
||||
section '.text' code readable executable
|
||||
start:
|
||||
invoke ExitProcess, 0
|
||||
|
||||
section '.idata' import data readable writeable
|
||||
library kernel,'KERNEL32.DLL'
|
||||
import kernel,\
|
||||
ExitProcess,'ExitProcess'
|
||||
Binary file not shown.
@@ -1,213 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# QQMusic Mac MMKV Decryptor by LSR@Unlock Music
|
||||
|
||||
import hashlib
|
||||
import re
|
||||
import sys
|
||||
from argparse import ArgumentParser
|
||||
from dataclasses import dataclass
|
||||
from os import PathLike
|
||||
from os.path import dirname
|
||||
from pathlib import Path
|
||||
from struct import pack, unpack
|
||||
|
||||
|
||||
@dataclass
|
||||
class MMKVDecryptionData:
|
||||
udid: str
|
||||
mmkv_path: Path
|
||||
mmkv_key: str
|
||||
data: bytes
|
||||
|
||||
@property
|
||||
def mmkv_name(self) -> str:
|
||||
return self.mmkv_path.name
|
||||
|
||||
|
||||
def _aes_128_cfb_decrypt(key: bytes, iv: bytes, ciphertext: bytes) -> bytes:
|
||||
"""Decrypt using `Crypto.Cipher.AES` _or_ fallback to `OpenSSL` otherwise"""
|
||||
try:
|
||||
from Crypto.Cipher import AES # pyright: ignore[reportMissingImports]
|
||||
|
||||
aes = AES.new(key[:16], AES.MODE_CFB, iv=iv, segment_size=128)
|
||||
return aes.decrypt(ciphertext)
|
||||
except ImportError:
|
||||
from subprocess import PIPE, Popen
|
||||
|
||||
process = Popen(
|
||||
["openssl", "enc", "-aes-128-cfb", "-d", "-K", key.hex(), "-iv", iv.hex()],
|
||||
stdin=PIPE,
|
||||
stdout=PIPE,
|
||||
stderr=PIPE,
|
||||
text=False,
|
||||
)
|
||||
stdout, stderr = process.communicate(input=ciphertext)
|
||||
if process.returncode != 0:
|
||||
raise RuntimeError(
|
||||
f"OpenSSL error (install PyCryptodome instead): {stderr.decode()}"
|
||||
)
|
||||
return stdout
|
||||
|
||||
|
||||
def _caesar(text: str, shift: int) -> str:
|
||||
"""A simple Caesar cipher implementation for alphanumeric characters"""
|
||||
result = ""
|
||||
for char in text:
|
||||
if char.isalpha():
|
||||
base = ord("A") if char.isupper() else ord("a")
|
||||
result += chr((ord(char) - base + shift) % 26 + base)
|
||||
elif char.isdigit():
|
||||
result += chr((ord(char) - ord("0") + shift) % 10 + ord("0"))
|
||||
else:
|
||||
result += char
|
||||
return result
|
||||
|
||||
|
||||
__MMKV_TYPE_STREAM_KEY = 1
|
||||
|
||||
|
||||
def _derive_mmkv_config(udid: str, mmkv_type: int):
|
||||
"""Derive MMKV name and key from UDID, return (name, key)"""
|
||||
str1 = _caesar(udid, mmkv_type + 3)
|
||||
int1 = int(udid[5:7], 16)
|
||||
int2 = 5 + (int1 + mmkv_type) % 4
|
||||
mmkv_name = str1[0:int2]
|
||||
|
||||
int3 = mmkv_type + 0xA546
|
||||
str3 = f"{udid}{int3:04x}"
|
||||
mmkv_key = hashlib.md5(str3.encode()).hexdigest()
|
||||
|
||||
return mmkv_name, mmkv_key
|
||||
|
||||
|
||||
def _decrypt_mmkv(path: PathLike, key: bytes):
|
||||
"""Decrypt MMKV file using the given key, return decrypted data"""
|
||||
with open(path, "rb") as mmkv, open(str(path) + ".crc", "rb") as crc:
|
||||
crc.seek(12)
|
||||
iv = crc.read(16)
|
||||
(real_size,) = unpack("<I", crc.read(4))
|
||||
(mmkv_payload_size,) = unpack("<I", mmkv.read(4))
|
||||
|
||||
if mmkv_payload_size != real_size:
|
||||
raise ValueError("MMKV file size mismatch")
|
||||
decrypted_data = pack("<I", real_size)
|
||||
decrypted_data += _aes_128_cfb_decrypt(key, iv, mmkv.read(real_size))
|
||||
return decrypted_data
|
||||
|
||||
|
||||
def _dump_udid(plist_file: PathLike):
|
||||
"""Extract UDIDs from the given plist file"""
|
||||
with open(plist_file, "rb") as f:
|
||||
plist = f.read()
|
||||
for m in re.finditer(rb"_\x10\(([0-9a-f]{40})_", plist):
|
||||
yield m.group(1).decode()
|
||||
|
||||
|
||||
def _dump_mmkv(plist_file: PathLike, data_dir: PathLike):
|
||||
"""Dump all MMKV files from the given plist file and iData directory"""
|
||||
for udid in _dump_udid(plist_file):
|
||||
mmkv_name, mmkv_key = _derive_mmkv_config(udid, __MMKV_TYPE_STREAM_KEY)
|
||||
mmkv_path = Path(data_dir) / mmkv_name
|
||||
|
||||
if not mmkv_path.exists() or not mmkv_path.is_file():
|
||||
print(f"MMKV file not found, skipping (path={mmkv_path})", file=sys.stderr)
|
||||
continue
|
||||
|
||||
try:
|
||||
decrypted_mmkv = _decrypt_mmkv(mmkv_path, mmkv_key.encode())
|
||||
except Exception as e:
|
||||
print(
|
||||
"Error decrypting mmkv, skipping"
|
||||
f" (path={mmkv_path}, key={mmkv_key}, error={e})",
|
||||
file=sys.stderr,
|
||||
)
|
||||
continue
|
||||
yield MMKVDecryptionData(
|
||||
udid=udid,
|
||||
mmkv_path=mmkv_path,
|
||||
mmkv_key=mmkv_key,
|
||||
data=decrypted_mmkv,
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
parser = ArgumentParser(
|
||||
description="QQMusic Mac MMKV Decryptor by LSR@Unlock Music"
|
||||
)
|
||||
parser.add_argument(
|
||||
"-p",
|
||||
"--plist",
|
||||
type=str,
|
||||
nargs="+",
|
||||
help="Path to com.tencent.QQMusicMac.plist file or files",
|
||||
default=[],
|
||||
)
|
||||
parser.add_argument(
|
||||
"-i",
|
||||
"--idata",
|
||||
type=str,
|
||||
help="Path to iData directory",
|
||||
default="",
|
||||
)
|
||||
parser.add_argument("-f", "--force", action="store_true", help="Force overwrite")
|
||||
parser.add_argument(
|
||||
"-o",
|
||||
"--output",
|
||||
type=str,
|
||||
help="Output directory for decrypted MMKV files (default: script directory)",
|
||||
default=dirname(__file__),
|
||||
)
|
||||
parser.add_argument(
|
||||
"-v", "--verbose", action="store_true", help="Enable verbose output"
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
home_dir = Path.home()
|
||||
app_sandbox_dir = home_dir / "Library/Containers/com.tencent.QQMusicMac/Data"
|
||||
idata_dir = app_sandbox_dir / "Library/Application Support/QQMusicMac/iData"
|
||||
|
||||
if args.idata:
|
||||
idata_dir = Path(args.idata)
|
||||
|
||||
plists = []
|
||||
if args.plist:
|
||||
plists = [Path(p) for p in args.plist]
|
||||
else:
|
||||
for base_dir in (home_dir, app_sandbox_dir):
|
||||
plists.append(base_dir / "Library/Preferences/com.tencent.QQMusicMac.plist")
|
||||
|
||||
output_dir = Path(args.output)
|
||||
output_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
force = args.force
|
||||
verbose = args.verbose
|
||||
|
||||
for plist_file in plists:
|
||||
if plist_file.exists() and plist_file.is_file():
|
||||
for dump in _dump_mmkv(plist_file, idata_dir):
|
||||
out_path = output_dir / f"qqmusic-mac-{dump.mmkv_path.name}.mmkv"
|
||||
if out_path.exists() and not force:
|
||||
print(f"output exists, skipping (name={out_path.name})")
|
||||
continue
|
||||
|
||||
if verbose:
|
||||
print("*** MMKV DUMP ENTRY START ***")
|
||||
print(f"UDID: {dump.udid}")
|
||||
print(f"MMKV Name: {dump.mmkv_path.name}")
|
||||
print(f"MMKV Key: {dump.mmkv_key}")
|
||||
print(f"Output: {out_path.name}")
|
||||
print("**** MMKV DUMP ENTRY END ****")
|
||||
else:
|
||||
print(f"Dumping mmkv: {out_path.name}...")
|
||||
|
||||
try:
|
||||
with open(out_path, "wb") as f:
|
||||
f.write(dump.data)
|
||||
except Exception as e:
|
||||
print(f"Error writing decrypted mmkv: {e}", file=sys.stderr)
|
||||
continue
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo '补丁中…'
|
||||
|
||||
patch_count=0
|
||||
|
||||
patch_qqmusic() {
|
||||
SUDO="$1"
|
||||
APP="$2"
|
||||
|
||||
if [ ! -d "$APP" ]; then
|
||||
echo "路径不存在,跳过 $APP..."
|
||||
return
|
||||
fi
|
||||
|
||||
echo "修补 $APP..."
|
||||
$SUDO sed -i.bak 's#<string>8.8.0</string>#<string>88.8.0</string>#' \
|
||||
"$APP/Contents/Info.plist"
|
||||
$SUDO codesign --force --deep --sign - "$APP"
|
||||
$SUDO xattr -d com.apple.quarantine "$APP"
|
||||
|
||||
patch_count=$((patch_count + 1))
|
||||
}
|
||||
|
||||
patch_qqmusic sudo "/Applications/QQMusic.app"
|
||||
patch_qqmusic "" "$HOME/Applications/QQMusic.app"
|
||||
|
||||
echo "完成,已修补 $patch_count 个 QQ 音乐安装"
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 5.1 KiB |
@@ -1 +0,0 @@
|
||||
// TODO: Popup dialog for QingTing instructions
|
||||
Reference in new issue
Block a user