mirror of
https://git.um-react.app/um/um-react.git
synced 2025-11-29 03:53:03 +00:00
feat(kgm): kgm v5 (aka. kgg) support
This commit is contained in:
@@ -2,7 +2,7 @@ import type { RootState } from '~/store';
|
||||
import { closestByLevenshtein } from '~/util/levenshtein';
|
||||
import { hasOwn } from '~/util/objects';
|
||||
import { kwm2StagingToProductionKey } from './keyFormats';
|
||||
import type { ParseKuwoHeaderResponse } from '~/decrypt-worker/types.ts';
|
||||
import type { ParseKugouHeaderResponse, ParseKuwoHeaderResponse } from '~/decrypt-worker/types.ts';
|
||||
|
||||
export const selectIsSettingsNotSaved = (state: RootState) => state.settings.dirty;
|
||||
|
||||
@@ -12,6 +12,9 @@ export const selectFinalQMCv2Settings = (state: RootState) => state.settings.pro
|
||||
export const selectStagingKWMv2Keys = (state: RootState) => state.settings.staging.kwm2.keys;
|
||||
export const selectFinalKWMv2Keys = (state: RootState) => state.settings.production.kwm2.keys;
|
||||
|
||||
export const selectStagingKugouV5Keys = (state: RootState) => state.settings.staging.kugou.keys;
|
||||
export const selectFinalKugouV5Keys = (state: RootState) => state.settings.production.kugou.keys;
|
||||
|
||||
export const selectQMCv2KeyByFileName = (state: RootState, name: string): string | undefined => {
|
||||
const normalizedName = name.normalize();
|
||||
|
||||
@@ -50,5 +53,16 @@ export const selectKWMv2Key = (state: RootState, hdr: ParseKuwoHeaderResponse):
|
||||
return ekey;
|
||||
};
|
||||
|
||||
export const selectKugouKey = (state: RootState, hdr: ParseKugouHeaderResponse): string | undefined => {
|
||||
if (!hdr) {
|
||||
return;
|
||||
}
|
||||
|
||||
const keys = selectFinalKugouV5Keys(state);
|
||||
const lookupKey = hdr.audioHash;
|
||||
|
||||
return hasOwn(keys, lookupKey) ? keys[lookupKey] : undefined;
|
||||
};
|
||||
|
||||
export const selectStagingQtfmAndroidKey = (state: RootState) => state.settings.staging.qtfm.android;
|
||||
export const selectQtfmAndroidKey = (state: RootState) => state.settings.production.qtfm.android;
|
||||
|
||||
Reference in New Issue
Block a user