Merge commit 'e678e40b86a398a095cec88283c86aa3e8e2f096'

This commit is contained in:
鲁树人 2023-11-02 23:58:33 +00:00
commit fbf7749e55
7 changed files with 74 additions and 21 deletions

View File

@ -36,10 +36,19 @@ export function AndroidADBPullInstruction({ dir, file }: AndroidADBPullInstructi
return ( return (
<> <>
<Text> <Text>
<code>root</code> 访访
<ruby>
<rp> (</rp>
<rt>
<code>root</code>
</rt>
<rp>)</rp>
</ruby>
访访
</Text> </Text>
<Text> <Text>
<code>root</code>
<chakra.span color="red.400"></chakra.span> <chakra.span color="red.400"></chakra.span>
</Text> </Text>
@ -92,7 +101,7 @@ export function AndroidADBPullInstruction({ dir, file }: AndroidADBPullInstructi
<OrderedList> <OrderedList>
<ListItem> <ListItem>
<Text> <Text>
<code>adb</code> <Code>adb</Code>
</Text> </Text>
<Text> <Text>
💡 💡
@ -134,6 +143,11 @@ export function AndroidADBPullInstruction({ dir, file }: AndroidADBPullInstructi
</Heading> </Heading>
<AccordionPanel pb={4}> <AccordionPanel pb={4}>
<OrderedList> <OrderedList>
<ListItem>
<Text>
<Code>adb</Code>
</Text>
</ListItem>
<ListItem> <ListItem>
<Text></Text> <Text></Text>
</ListItem> </ListItem>

View File

@ -35,7 +35,9 @@ export function ImportSecretModal({ clientName, children, show, onClose, onImpor
<FileInput onReceiveFiles={handleFileReceived}></FileInput> <FileInput onReceiveFiles={handleFileReceived}></FileInput>
</Center> </Center>
<Text mt={2}>{clientName && <>{clientName}</>}</Text> <Text as="div" mt={2}>
{clientName && <>{clientName}</>}
</Text>
<Flex as={Tabs} variant="enclosed" flexDir="column" flex={1} minH={0}> <Flex as={Tabs} variant="enclosed" flexDir="column" flex={1} minH={0}>
{children} {children}
</Flex> </Flex>

View File

@ -1,7 +1,7 @@
import { Alert, AlertIcon, Container, Flex, List, ListItem, Text, UnorderedList, chakra } from '@chakra-ui/react'; import { Alert, AlertIcon, Container, Flex, List, ListItem, Text, UnorderedList, chakra } from '@chakra-ui/react';
import { Header4 } from '~/components/HelpText/Header4'; import { Header4 } from '~/components/HelpText/Header4';
import { SegmentTryOfficialPlayer } from './SegmentTryOfficialPlayer'; import { SegmentTryOfficialPlayer } from './SegmentTryOfficialPlayer';
import { QMCv2AllInstructions } from '~/features/settings/panels/QMCv2/QMCv2AllInstructions'; import { QMCv2QQMusicAllInstructions } from '~/features/settings/panels/QMCv2/QMCv2QQMusicAllInstructions';
import { SegmentKeyImportInstructions } from './SegmentKeyImportInstructions'; import { SegmentKeyImportInstructions } from './SegmentKeyImportInstructions';
import { ExtLink } from '~/components/ExtLink'; import { ExtLink } from '~/components/ExtLink';
@ -55,7 +55,7 @@ export function QQMusicFAQ() {
</Alert> </Alert>
</Container> </Container>
<SegmentKeyImportInstructions tab="QMCv2 密钥" clientInstructions={<QMCv2AllInstructions />} /> <SegmentKeyImportInstructions tab="QMCv2 密钥" clientInstructions={<QMCv2QQMusicAllInstructions />} />
</ListItem> </ListItem>
</List> </List>
</> </>

View File

@ -14,6 +14,7 @@ import {
MenuDivider, MenuDivider,
MenuItem, MenuItem,
MenuList, MenuList,
Select,
Text, Text,
Tooltip, Tooltip,
useToast, useToast,
@ -30,13 +31,15 @@ import { StagingQMCv2Key } from '../keyFormats';
import { DatabaseKeyExtractor } from '~/util/DatabaseKeyExtractor'; import { DatabaseKeyExtractor } from '~/util/DatabaseKeyExtractor';
import { MMKVParser } from '~/util/MMKVParser'; import { MMKVParser } from '~/util/MMKVParser';
import { getFileName } from '~/util/pathHelper'; import { getFileName } from '~/util/pathHelper';
import { QMCv2AllInstructions } from './QMCv2/QMCv2AllInstructions'; import { QMCv2QQMusicAllInstructions } from './QMCv2/QMCv2QQMusicAllInstructions';
import { QMCv2DoubanAllInstructions } from './QMCv2/QMCv2DoubanAllInstructions';
export function PanelQMCv2Key() { export function PanelQMCv2Key() {
const toast = useToast(); const toast = useToast();
const dispatch = useDispatch(); const dispatch = useDispatch();
const { keys: qmc2Keys, allowFuzzyNameSearch } = useSelector(selectStagingQMCv2Settings); const { keys: qmc2Keys, allowFuzzyNameSearch } = useSelector(selectStagingQMCv2Settings);
const [showImportModal, setShowImportModal] = useState(false); const [showImportModal, setShowImportModal] = useState(false);
const [secretType, setSecretType] = useState<'qm' | 'douban'>('qm');
const addKey = () => dispatch(qmc2AddKey()); const addKey = () => dispatch(qmc2AddKey());
const clearAll = () => dispatch(qmc2ClearKeys()); const clearAll = () => dispatch(qmc2ClearKeys());
@ -51,11 +54,11 @@ export function PanelQMCv2Key() {
let qmc2Keys: null | Omit<StagingQMCv2Key, 'id'>[] = null; let qmc2Keys: null | Omit<StagingQMCv2Key, 'id'>[] = null;
if (/[_.]db$/i.test(file.name)) { if (/(player_process[_.]db|music_audio_play)(\.db)?$/i.test(file.name)) {
const extractor = await DatabaseKeyExtractor.getInstance(); const extractor = await DatabaseKeyExtractor.getInstance();
qmc2Keys = extractor.extractQmAndroidDbKeys(fileBuffer); qmc2Keys = extractor.extractQmcV2KeysFromSqliteDb(fileBuffer);
if (!qmc2Keys) { if (!qmc2Keys) {
alert(`不是支持的 SQLite 数据库文件。\n表名${qmc2Keys}`); alert(`不是支持的 SQLite 数据库文件。`);
return; return;
} }
} else if (/MMKVStreamEncryptId|filenameEkeyMap/i.test(file.name)) { } else if (/MMKVStreamEncryptId|filenameEkeyMap/i.test(file.name)) {
@ -96,8 +99,8 @@ export function PanelQMCv2Key() {
</Heading> </Heading>
<Text> <Text>
QQ QMCv2使QQ Mac iOS QQ FM QMCv2使QQ Mac iOS 使
线 FM线
</Text> </Text>
<HStack pb={2} pt={2}> <HStack pb={2} pt={2}>
@ -155,16 +158,28 @@ export function PanelQMCv2Key() {
<QMCv2EKeyItem key={id} id={id} ekey={ekey} name={name} i={i} /> <QMCv2EKeyItem key={id} id={id} ekey={ekey} name={name} i={i} />
))} ))}
</List> </List>
{qmc2Keys.length === 0 && <Text></Text>} {qmc2Keys.length === 0 && <Text></Text>}
</Box> </Box>
<ImportSecretModal <ImportSecretModal
clientName="QQ 音乐" clientName={
<Select
value={secretType}
onChange={(e) => setSecretType(e.target.value as 'qm' | 'douban')}
variant="flushed"
display="inline"
css={{ paddingLeft: '0.75rem', width: 'auto' }}
>
<option value="qm">QQ </option>
<option value="douban"> FM</option>
</Select>
}
show={showImportModal} show={showImportModal}
onClose={() => setShowImportModal(false)} onClose={() => setShowImportModal(false)}
onImport={handleSecretImport} onImport={handleSecretImport}
> >
<QMCv2AllInstructions /> {secretType === 'qm' && <QMCv2QQMusicAllInstructions />}
{secretType === 'douban' && <QMCv2DoubanAllInstructions />}
</ImportSecretModal> </ImportSecretModal>
</Flex> </Flex>
); );

View File

@ -0,0 +1,17 @@
import { Tab, TabList, TabPanel, TabPanels } from '@chakra-ui/react';
import { AndroidADBPullInstruction } from '~/components/AndroidADBPullInstruction/AndroidADBPullInstruction';
export function QMCv2DoubanAllInstructions() {
return (
<>
<TabList>
<Tab></Tab>
</TabList>
<TabPanels flex={1} overflow="auto">
<TabPanel>
<AndroidADBPullInstruction dir="/data/data/com.douban.radio/databases" file="music_audio_play" />
</TabPanel>
</TabPanels>
</>
);
}

View File

@ -4,7 +4,7 @@ import { InstructionsIOS } from './InstructionsIOS';
import { InstructionsMac } from './InstructionsMac'; import { InstructionsMac } from './InstructionsMac';
import { InstructionsPC } from './InstructionsPC'; import { InstructionsPC } from './InstructionsPC';
export function QMCv2AllInstructions() { export function QMCv2QQMusicAllInstructions() {
return ( return (
<> <>
<TabList> <TabList>

View File

@ -23,16 +23,21 @@ export class DatabaseKeyExtractor {
return tables.includes(name); return tables.includes(name);
} }
extractQmAndroidDbKeys(buffer: ArrayBuffer): null | QMAndroidKeyEntry[] { extractQmcV2KeysFromSqliteDb(buffer: ArrayBuffer): null | QMAndroidKeyEntry[] {
let db: SQLDatabase | null = null; let db: SQLDatabase | null = null;
try { try {
db = new this.SQL.Database(new Uint8Array(buffer)); db = new this.SQL.Database(new Uint8Array(buffer));
if (!this.hasTable(db, 'audio_file_ekey_table')) {
return null;
}
const result = db.exec('select file_path, ekey from audio_file_ekey_table'); let sql: undefined | string;
if (this.hasTable(db, 'audio_file_ekey_table')) {
sql = 'select file_path, ekey from audio_file_ekey_table';
} else if (this.hasTable(db, 'EKeyFileInfo')) {
sql = 'select filePath, eKey from EKeyFileInfo';
}
if (!sql) return null;
const result = db.exec(sql);
if (result.length === 0) { if (result.length === 0) {
return []; return [];
} }