|
@@ -11,12 +11,14 @@ import {
|
|
} from "@mui/material";
|
|
} from "@mui/material";
|
|
import { atomClashPort } from "@/services/states";
|
|
import { atomClashPort } from "@/services/states";
|
|
import { ArrowForward } from "@mui/icons-material";
|
|
import { ArrowForward } from "@mui/icons-material";
|
|
-import { openWebUrl, patchClashConfig } from "@/services/cmds";
|
|
|
|
|
|
+import { patchClashConfig } from "@/services/cmds";
|
|
import { SettingList, SettingItem } from "./setting";
|
|
import { SettingList, SettingItem } from "./setting";
|
|
import { getClashConfig, getVersion, updateConfigs } from "@/services/api";
|
|
import { getClashConfig, getVersion, updateConfigs } from "@/services/api";
|
|
|
|
+import useModalHandler from "@/hooks/use-modal-handler";
|
|
import Notice from "../base/base-notice";
|
|
import Notice from "../base/base-notice";
|
|
import GuardState from "./mods/guard-state";
|
|
import GuardState from "./mods/guard-state";
|
|
import CoreSwitch from "./mods/core-switch";
|
|
import CoreSwitch from "./mods/core-switch";
|
|
|
|
+import WebUIViewer from "./mods/web-ui-viewer";
|
|
|
|
|
|
interface Props {
|
|
interface Props {
|
|
onError: (err: Error) => void;
|
|
onError: (err: Error) => void;
|
|
@@ -37,6 +39,8 @@ const SettingClash = ({ onError }: Props) => {
|
|
|
|
|
|
const setGlobalClashPort = useSetRecoilState(atomClashPort);
|
|
const setGlobalClashPort = useSetRecoilState(atomClashPort);
|
|
|
|
|
|
|
|
+ const webUIHandler = useModalHandler();
|
|
|
|
+
|
|
const onSwitchFormat = (_e: any, value: boolean) => value;
|
|
const onSwitchFormat = (_e: any, value: boolean) => value;
|
|
const onChangeData = (patch: Partial<ApiType.ConfigData>) => {
|
|
const onChangeData = (patch: Partial<ApiType.ConfigData>) => {
|
|
mutate("getClashConfig", { ...clashConfig, ...patch }, false);
|
|
mutate("getClashConfig", { ...clashConfig, ...patch }, false);
|
|
@@ -68,6 +72,8 @@ const SettingClash = ({ onError }: Props) => {
|
|
|
|
|
|
return (
|
|
return (
|
|
<SettingList title={t("Clash Setting")}>
|
|
<SettingList title={t("Clash Setting")}>
|
|
|
|
+ <WebUIViewer handler={webUIHandler} onError={onError} />
|
|
|
|
+
|
|
<SettingItem label={t("Allow Lan")}>
|
|
<SettingItem label={t("Allow Lan")}>
|
|
<GuardState
|
|
<GuardState
|
|
value={allowLan ?? false}
|
|
value={allowLan ?? false}
|
|
@@ -94,6 +100,17 @@ const SettingClash = ({ onError }: Props) => {
|
|
</GuardState>
|
|
</GuardState>
|
|
</SettingItem>
|
|
</SettingItem>
|
|
|
|
|
|
|
|
+ <SettingItem label={t("Web UI")}>
|
|
|
|
+ <IconButton
|
|
|
|
+ color="inherit"
|
|
|
|
+ size="small"
|
|
|
|
+ sx={{ my: "2px" }}
|
|
|
|
+ onClick={() => webUIHandler.current.open()}
|
|
|
|
+ >
|
|
|
|
+ <ArrowForward />
|
|
|
|
+ </IconButton>
|
|
|
|
+ </SettingItem>
|
|
|
|
+
|
|
<SettingItem label={t("Log Level")}>
|
|
<SettingItem label={t("Log Level")}>
|
|
<GuardState
|
|
<GuardState
|
|
value={logLevel ?? "info"}
|
|
value={logLevel ?? "info"}
|
|
@@ -132,12 +149,6 @@ const SettingClash = ({ onError }: Props) => {
|
|
<SettingItem label={t("Clash Core")} extra={<CoreSwitch />}>
|
|
<SettingItem label={t("Clash Core")} extra={<CoreSwitch />}>
|
|
<Typography sx={{ py: "7px" }}>{clashVer}</Typography>
|
|
<Typography sx={{ py: "7px" }}>{clashVer}</Typography>
|
|
</SettingItem>
|
|
</SettingItem>
|
|
-
|
|
|
|
- {/* <SettingItem label={t("Web UI")}>
|
|
|
|
- <IconButton color="inherit" size="small" sx={{ my: "2px" }}>
|
|
|
|
- <ArrowForward />
|
|
|
|
- </IconButton>
|
|
|
|
- </SettingItem> */}
|
|
|
|
</SettingList>
|
|
</SettingList>
|
|
);
|
|
);
|
|
};
|
|
};
|