feat: handle remote clash config fields

This commit is contained in:
GyDi
2022-04-07 01:20:44 +08:00
parent 75f3fa5144
commit 797f0d92b3
7 changed files with 146 additions and 7 deletions

View File

@@ -66,6 +66,10 @@ export async function changeProfileChain(chain?: string[]) {
return invoke<void>("change_profile_chain", { chain });
}
export async function changeProfileValid(valid?: string[]) {
return invoke<void>("change_profile_valid", { valid });
}
export async function getClashInfo() {
return invoke<CmdType.ClashInfo | null>("get_clash_info");
}

View File

@@ -145,11 +145,12 @@ class Enhance {
// enhanced mode runner
private async runner(payload: CmdType.EnhancedPayload) {
const chain = payload.chain || [];
const valid = payload.valid || [];
if (!Array.isArray(chain)) throw new Error("unhandle error");
let pdata = payload.current || {};
let useList = [] as string[];
let useList = valid;
for (const each of chain) {
const { uid, type = "" } = each.item;

View File

@@ -116,6 +116,7 @@ export namespace CmdType {
export interface ProfilesConfig {
current?: string;
chain?: string[];
valid?: string[];
items?: ProfileItem[];
}
@@ -191,6 +192,7 @@ export namespace CmdType {
export interface EnhancedPayload {
chain: ChainItem[];
valid: string[];
current: ProfileData;
callback: string;
}