feat: support clash fields filter in ui

This commit is contained in:
GyDi 2023-03-15 08:43:24 +08:00
parent c5289dc0e8
commit ab429dfeb6
No known key found for this signature in database
GPG Key ID: 9C3AD40F1F99880A
2 changed files with 15 additions and 0 deletions

View File

@ -20,6 +20,7 @@ export const MiscViewer = forwardRef<DialogRef>((props, ref) => {
const [open, setOpen] = useState(false);
const [values, setValues] = useState({
autoCloseConnection: false,
enableClashFields: true,
enableBuiltinEnhanced: true,
proxyLayoutColumn: 6,
defaultLatencyTest: "",
@ -30,6 +31,7 @@ export const MiscViewer = forwardRef<DialogRef>((props, ref) => {
setOpen(true);
setValues({
autoCloseConnection: verge?.auto_close_connection ?? false,
enableClashFields: verge?.enable_clash_fields ?? true,
enableBuiltinEnhanced: verge?.enable_builtin_enhanced ?? true,
proxyLayoutColumn: verge?.proxy_layout_column || 6,
defaultLatencyTest: verge?.default_latency_test || "",
@ -42,6 +44,7 @@ export const MiscViewer = forwardRef<DialogRef>((props, ref) => {
try {
await patchVerge({
auto_close_connection: values.autoCloseConnection,
enable_clash_fields: values.enableClashFields,
enable_builtin_enhanced: values.enableBuiltinEnhanced,
proxy_layout_column: values.proxyLayoutColumn,
default_latency_test: values.defaultLatencyTest,
@ -75,6 +78,17 @@ export const MiscViewer = forwardRef<DialogRef>((props, ref) => {
/>
</ListItem>
<ListItem sx={{ padding: "5px 2px" }}>
<ListItemText primary="Clash Fields Filter" />
<Switch
edge="end"
checked={values.enableClashFields}
onChange={(_, c) =>
setValues((v) => ({ ...v, enableClashFields: c }))
}
/>
</ListItem>
<ListItem sx={{ padding: "5px 2px" }}>
<ListItemText primary="Enable Builtin Enhanced" />
<Switch

View File

@ -182,6 +182,7 @@ interface IVergeConfig {
};
auto_close_connection?: boolean;
default_latency_test?: string;
enable_clash_fields?: boolean;
enable_builtin_enhanced?: boolean;
proxy_layout_column?: number;
}