Save appearance settings on server
- app theme - theme mode - pure black mode - manga grid item width
This commit is contained in:
@@ -89,6 +89,10 @@ const APP_METADATA_OBJECT: Record<AppMetadataKeys, undefined> = {
|
||||
showNsfw: undefined,
|
||||
shouldUseInfiniteScroll: undefined,
|
||||
shouldShowTransitionPage: undefined,
|
||||
appTheme: undefined,
|
||||
themeMode: undefined,
|
||||
shouldUsePureBlackMode: undefined,
|
||||
mangaGridItemWidth: undefined,
|
||||
};
|
||||
|
||||
export const VALID_APP_METADATA_KEYS = Object.keys(APP_METADATA_OBJECT);
|
||||
|
||||
@@ -21,7 +21,7 @@ export interface IMetadataMigration {
|
||||
* Otherwise, all metadata keys will get migrated.
|
||||
*/
|
||||
key?: string;
|
||||
oldValue: string | RegExp;
|
||||
oldValue: string | RegExp | undefined;
|
||||
newValue: string | ((oldValue: string) => string);
|
||||
}[];
|
||||
keys?: { oldKey: string; newKey: string }[];
|
||||
|
||||
@@ -83,7 +83,10 @@ const applyMetadataValueMigration = (meta: Metadata, migration: IMetadataMigrati
|
||||
|
||||
metadataValueChanges.forEach(({ key, oldValue, newValue }) => {
|
||||
const migrateValue = (metaKey: string) => {
|
||||
if (meta[metaKey].match(oldValue)) {
|
||||
if (
|
||||
(oldValue === undefined && meta[metaKey] === oldValue) ||
|
||||
(oldValue !== undefined && meta[metaKey].match(oldValue))
|
||||
) {
|
||||
migratedMetadata[metaKey] = typeof newValue === 'function' ? newValue(meta[metaKey]) : newValue;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user