mirror of
https://github.com/dream-pep/koring-launcher.git
synced 2026-09-12 05:45:18 +08:00
feat: add auth flow and settings UI refactor
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
type AdvancedConfig,
|
||||
type DownloadConfig,
|
||||
type NetworkConfig,
|
||||
type InstanceMeta,
|
||||
} from "@/api/config";
|
||||
import { DEFAULT_BG } from "@/lib/mode";
|
||||
|
||||
@@ -39,6 +40,7 @@ interface ConfigState {
|
||||
setAdvanced: (patch: Partial<AdvancedConfig>) => void;
|
||||
setDownload: (patch: Partial<DownloadConfig>) => void;
|
||||
setNetwork: (patch: Partial<NetworkConfig>) => void;
|
||||
setInstances: (instances: InstanceMeta[]) => void;
|
||||
setOobe: (value: boolean) => void;
|
||||
}
|
||||
|
||||
@@ -53,6 +55,7 @@ const DEFAULT_CONFIG: AppConfig = {
|
||||
advanced: { afterLaunch: "close", winMode: "default", customWidth: 854, customHeight: 480, gameArgs: "", preLaunchCmd: "", debugMode: false },
|
||||
download: { fileSource: "mirror", versionSource: "mirror", threads: 16, speedLimit: 0 },
|
||||
network: { securityId: { enabled: false, authUrl: "" } },
|
||||
instances: [],
|
||||
};
|
||||
|
||||
export const useConfigStore = create<ConfigState>((set, get) => ({
|
||||
@@ -132,6 +135,13 @@ export const useConfigStore = create<ConfigState>((set, get) => ({
|
||||
debouncedSave(next);
|
||||
},
|
||||
|
||||
setInstances: (instances) => {
|
||||
const { config } = get();
|
||||
const next = { ...config, instances };
|
||||
set({ config: next });
|
||||
debouncedSave(next);
|
||||
},
|
||||
|
||||
setOobe: (value) => {
|
||||
const { config } = get();
|
||||
const next = { ...config, oobe: value };
|
||||
|
||||
Reference in New Issue
Block a user