mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 08:45:41 +08:00
fix: profile-view wrong type of http request timeout value
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
- 安装服务模式后无法立即开启 TUN 模式
|
- 安装服务模式后无法立即开启 TUN 模式
|
||||||
- 同步更新多语言翻译
|
- 同步更新多语言翻译
|
||||||
- 修复 .window-state.json 无法删除的问题
|
- 修复 .window-state.json 无法删除的问题
|
||||||
|
- 无法修改配置更新 HTTP 请求超时
|
||||||
|
|
||||||
#### 新增了:
|
#### 新增了:
|
||||||
- Mihomo(Meta)内核升级至 1.19.8
|
- Mihomo(Meta)内核升级至 1.19.8
|
||||||
|
|||||||
@@ -17,9 +17,13 @@ use crate::{
|
|||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use chrono::Local;
|
use chrono::Local;
|
||||||
use once_cell::sync::OnceCell;
|
use once_cell::sync::OnceCell;
|
||||||
use std::fs::{create_dir_all, File};
|
use std::{
|
||||||
use std::io::Write;
|
fmt,
|
||||||
use std::{fmt, path::PathBuf, sync::Arc};
|
fs::{create_dir_all, File},
|
||||||
|
io::Write,
|
||||||
|
path::PathBuf,
|
||||||
|
sync::Arc,
|
||||||
|
};
|
||||||
use tauri_plugin_shell::{process::CommandChild, ShellExt};
|
use tauri_plugin_shell::{process::CommandChild, ShellExt};
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
|
|
||||||
|
|||||||
@@ -89,6 +89,10 @@ export const ProfileViewer = forwardRef<ProfileViewerRef, Props>(
|
|||||||
|
|
||||||
const handleOk = useLockFn(
|
const handleOk = useLockFn(
|
||||||
formIns.handleSubmit(async (form) => {
|
formIns.handleSubmit(async (form) => {
|
||||||
|
if (form.option?.timeout_seconds) {
|
||||||
|
form.option.timeout_seconds = +form.option.timeout_seconds;
|
||||||
|
}
|
||||||
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
// 基本验证
|
// 基本验证
|
||||||
@@ -113,12 +117,13 @@ export const ProfileViewer = forwardRef<ProfileViewerRef, Props>(
|
|||||||
const isUpdate = openType === "edit";
|
const isUpdate = openType === "edit";
|
||||||
|
|
||||||
// 判断是否是当前激活的配置
|
// 判断是否是当前激活的配置
|
||||||
const isActivating = isUpdate && form.uid === (profiles?.current ?? "");
|
const isActivating =
|
||||||
|
isUpdate && form.uid === (profiles?.current ?? "");
|
||||||
|
|
||||||
// 保存原始代理设置以便回退成功后恢复
|
// 保存原始代理设置以便回退成功后恢复
|
||||||
const originalOptions = {
|
const originalOptions = {
|
||||||
with_proxy: form.option?.with_proxy,
|
with_proxy: form.option?.with_proxy,
|
||||||
self_proxy: form.option?.self_proxy
|
self_proxy: form.option?.self_proxy,
|
||||||
};
|
};
|
||||||
|
|
||||||
// 执行创建或更新操作,本地配置不需要回退机制
|
// 执行创建或更新操作,本地配置不需要回退机制
|
||||||
@@ -141,7 +146,10 @@ export const ProfileViewer = forwardRef<ProfileViewerRef, Props>(
|
|||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// 首次创建/更新失败,尝试使用自身代理
|
// 首次创建/更新失败,尝试使用自身代理
|
||||||
showNotice('info', t("Profile creation failed, retrying with Clash proxy..."));
|
showNotice(
|
||||||
|
"info",
|
||||||
|
t("Profile creation failed, retrying with Clash proxy..."),
|
||||||
|
);
|
||||||
|
|
||||||
// 使用自身代理的配置
|
// 使用自身代理的配置
|
||||||
const retryItem = {
|
const retryItem = {
|
||||||
@@ -149,8 +157,8 @@ export const ProfileViewer = forwardRef<ProfileViewerRef, Props>(
|
|||||||
option: {
|
option: {
|
||||||
...item.option,
|
...item.option,
|
||||||
with_proxy: false,
|
with_proxy: false,
|
||||||
self_proxy: true
|
self_proxy: true,
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// 使用自身代理再次尝试
|
// 使用自身代理再次尝试
|
||||||
@@ -164,7 +172,10 @@ export const ProfileViewer = forwardRef<ProfileViewerRef, Props>(
|
|||||||
await patchProfile(form.uid, { option: originalOptions });
|
await patchProfile(form.uid, { option: originalOptions });
|
||||||
}
|
}
|
||||||
|
|
||||||
showNotice('success', t("Profile creation succeeded with Clash proxy"));
|
showNotice(
|
||||||
|
"success",
|
||||||
|
t("Profile creation succeeded with Clash proxy"),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,11 +187,11 @@ export const ProfileViewer = forwardRef<ProfileViewerRef, Props>(
|
|||||||
// 只传递当前配置激活状态,让父组件决定是否需要触发配置重载
|
// 只传递当前配置激活状态,让父组件决定是否需要触发配置重载
|
||||||
props.onChange(isActivating);
|
props.onChange(isActivating);
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
showNotice('error', err.message || err.toString());
|
showNotice("error", err.message || err.toString());
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
@@ -284,10 +295,12 @@ export const ProfileViewer = forwardRef<ProfileViewerRef, Props>(
|
|||||||
label={t("HTTP Request Timeout")}
|
label={t("HTTP Request Timeout")}
|
||||||
slotProps={{
|
slotProps={{
|
||||||
input: {
|
input: {
|
||||||
endAdornment: (
|
endAdornment: (
|
||||||
<InputAdornment position="end">{t("seconds")}</InputAdornment>
|
<InputAdornment position="end">
|
||||||
),
|
{t("seconds")}
|
||||||
}
|
</InputAdornment>
|
||||||
|
),
|
||||||
|
},
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
@@ -308,9 +321,11 @@ export const ProfileViewer = forwardRef<ProfileViewerRef, Props>(
|
|||||||
slotProps={{
|
slotProps={{
|
||||||
input: {
|
input: {
|
||||||
endAdornment: (
|
endAdornment: (
|
||||||
<InputAdornment position="end">{t("mins")}</InputAdornment>
|
<InputAdornment position="end">
|
||||||
|
{t("mins")}
|
||||||
|
</InputAdornment>
|
||||||
),
|
),
|
||||||
}
|
},
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
@@ -364,7 +379,7 @@ export const ProfileViewer = forwardRef<ProfileViewerRef, Props>(
|
|||||||
)}
|
)}
|
||||||
</BaseDialog>
|
</BaseDialog>
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const StyledBox = styled(Box)(() => ({
|
const StyledBox = styled(Box)(() => ({
|
||||||
|
|||||||
Reference in New Issue
Block a user