mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2026-04-12 23:50:31 +08:00
fix: fallback to global timeout when profile timeout is empty
This commit is contained in:
parent
a5c59ce689
commit
0bedac12ed
@ -250,7 +250,7 @@ export async function createProfile(item: Partial<IProfileItem>): Promise<IProfi
|
||||
authToken: item.authToken,
|
||||
userAgent: item.userAgent,
|
||||
updated: new Date().getTime(),
|
||||
updateTimeout: item.updateTimeout || 5
|
||||
updateTimeout: item.updateTimeout
|
||||
}
|
||||
|
||||
// Local
|
||||
@ -264,7 +264,10 @@ export async function createProfile(item: Partial<IProfileItem>): Promise<IProfi
|
||||
|
||||
const { userAgent, subscriptionTimeout = 30000 } = await getAppConfig()
|
||||
const { 'mixed-port': mixedPort = 7890 } = await getControledMihomoConfig()
|
||||
const userItemTimeoutMs = (newItem.updateTimeout || 5) * 1000
|
||||
const userItemTimeoutMs =
|
||||
typeof newItem.updateTimeout === 'number' && newItem.updateTimeout > 0
|
||||
? newItem.updateTimeout * 1000
|
||||
: subscriptionTimeout
|
||||
|
||||
const baseOptions: Omit<FetchOptions, 'useProxy' | 'timeout'> = {
|
||||
url: item.url,
|
||||
@ -454,7 +457,7 @@ export async function convertMrsRuleset(filePath: string, behavior: string): Pro
|
||||
|
||||
try {
|
||||
// 使用 mihomo convert-ruleset 命令转换 MRS 文件为 text 格式
|
||||
// 命令格式: mihomo convert-ruleset <behavior> <format> <source>
|
||||
// 命令格式:mihomo convert-ruleset <behavior> <format> <source>
|
||||
await execAsync(`"${corePath}" convert-ruleset ${behavior} mrs "${fullPath}" "${tempFilePath}"`)
|
||||
const content = await readFile(tempFilePath, 'utf-8')
|
||||
await unlink(tempFilePath)
|
||||
|
||||
@ -33,8 +33,7 @@ const EditInfoModal: React.FC<Props> = (props) => {
|
||||
const { overrideConfig } = useOverrideConfig()
|
||||
const { items: overrideItems = [] } = overrideConfig || {}
|
||||
const [values, setValues] = useState({
|
||||
...item,
|
||||
updateTimeout: item.updateTimeout ?? 5
|
||||
...item
|
||||
})
|
||||
const inputWidth = 'w-[400px] md:w-[400px] lg:w-[600px] xl:w-[800px]'
|
||||
const { t } = useTranslation()
|
||||
@ -43,7 +42,6 @@ const EditInfoModal: React.FC<Props> = (props) => {
|
||||
try {
|
||||
const updatedItem = {
|
||||
...values,
|
||||
updateTimeout: values.updateTimeout ?? 5,
|
||||
override: values.override?.filter(
|
||||
(i) =>
|
||||
overrideItems.find((t) => t.id === i) && !overrideItems.find((t) => t.id === i)?.global
|
||||
@ -215,7 +213,7 @@ const EditInfoModal: React.FC<Props> = (props) => {
|
||||
value={values.updateTimeout?.toString() ?? ''}
|
||||
onValueChange={(v) => {
|
||||
if (v === '') {
|
||||
setValues({ ...values, updateTimeout: undefined as unknown as number })
|
||||
setValues({ ...values, updateTimeout: undefined })
|
||||
return
|
||||
}
|
||||
if (/^\d+$/.test(v)) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user