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