Files
um-react/src/features/kugou/panel/KugouEKeyItem.tsx
T
鲁树人 7a11d4f941 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.
2026-11-01 02:42:13 +09:00

27 lines
1017 B
TypeScript

import { kugouDeleteKey, kugouUpdateKey } from '~/features/settings/settingsSlice';
import { useAppDispatch } from '~/hooks';
import { memo } from 'react';
import type { StagingKugouKey } from '~/features/kugou/types';
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 位字符,没有空格。"
/>
);
});