mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-27 05:00:30 +08:00
adjust
This commit is contained in:
parent
c338051802
commit
ec3efe89c7
@ -241,6 +241,11 @@ const resolveMmdb = () =>
|
|||||||
file: 'country.mmdb',
|
file: 'country.mmdb',
|
||||||
downloadURL: `https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/country-lite.mmdb`
|
downloadURL: `https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/country-lite.mmdb`
|
||||||
})
|
})
|
||||||
|
const resolveMetadb = () =>
|
||||||
|
resolveResource({
|
||||||
|
file: 'geoip.metadb',
|
||||||
|
downloadURL: `https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip.metadb`
|
||||||
|
})
|
||||||
const resolveGeosite = () =>
|
const resolveGeosite = () =>
|
||||||
resolveResource({
|
resolveResource({
|
||||||
file: 'geosite.dat',
|
file: 'geosite.dat',
|
||||||
@ -351,6 +356,7 @@ const tasks = [
|
|||||||
retry: 5
|
retry: 5
|
||||||
},
|
},
|
||||||
{ name: 'mmdb', func: resolveMmdb, retry: 5 },
|
{ name: 'mmdb', func: resolveMmdb, retry: 5 },
|
||||||
|
{ name: 'metadb', func: resolveMetadb, retry: 5 },
|
||||||
{ name: 'geosite', func: resolveGeosite, retry: 5 },
|
{ name: 'geosite', func: resolveGeosite, retry: 5 },
|
||||||
{ name: 'geoip', func: resolveGeoIP, retry: 5 },
|
{ name: 'geoip', func: resolveGeoIP, retry: 5 },
|
||||||
{ name: 'asn', func: resolveASN, retry: 5 },
|
{ name: 'asn', func: resolveASN, retry: 5 },
|
||||||
|
|||||||
@ -56,6 +56,7 @@ async function prepareProfileWorkDir(current: string | undefined): Promise<void>
|
|||||||
}
|
}
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
copy('country.mmdb'),
|
copy('country.mmdb'),
|
||||||
|
copy('geoip.metadb'),
|
||||||
copy('geoip.dat'),
|
copy('geoip.dat'),
|
||||||
copy('geosite.dat'),
|
copy('geosite.dat'),
|
||||||
copy('ASN.mmdb')
|
copy('ASN.mmdb')
|
||||||
@ -125,7 +126,7 @@ function runOverrideScript(
|
|||||||
log('info', '脚本执行成功')
|
log('info', '脚本执行成功')
|
||||||
return newProfile
|
return newProfile
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log('exception', `脚本执行失败: ${e}`)
|
log('exception', `脚本执行失败:${e}`)
|
||||||
return profile
|
return profile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -114,11 +114,6 @@ export const mihomoUpdateProxyProviders = async (name: string): Promise<void> =>
|
|||||||
return await instance.put(`/providers/proxies/${encodeURIComponent(name)}`)
|
return await instance.put(`/providers/proxies/${encodeURIComponent(name)}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const mihomoRunProxyProviders = async (): Promise<IMihomoProxyProviders> => {
|
|
||||||
const runtime = await getRuntimeConfig()
|
|
||||||
return runtime?.['proxy-providers']
|
|
||||||
}
|
|
||||||
|
|
||||||
export const mihomoRuleProviders = async (): Promise<IMihomoRuleProviders> => {
|
export const mihomoRuleProviders = async (): Promise<IMihomoRuleProviders> => {
|
||||||
const instance = await getAxios()
|
const instance = await getAxios()
|
||||||
return await instance.get('/providers/rules')
|
return await instance.get('/providers/rules')
|
||||||
@ -129,11 +124,6 @@ export const mihomoUpdateRuleProviders = async (name: string): Promise<void> =>
|
|||||||
return await instance.put(`/providers/rules/${encodeURIComponent(name)}`)
|
return await instance.put(`/providers/rules/${encodeURIComponent(name)}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const mihomoRunRuleProviders = async (): Promise<IMihomoRuleProviders> => {
|
|
||||||
const runtime = await getRuntimeConfig()
|
|
||||||
return runtime?.['rule-providers']
|
|
||||||
}
|
|
||||||
|
|
||||||
export const mihomoChangeProxy = async (group: string, proxy: string): Promise<IMihomoProxy> => {
|
export const mihomoChangeProxy = async (group: string, proxy: string): Promise<IMihomoProxy> => {
|
||||||
const instance = await getAxios()
|
const instance = await getAxios()
|
||||||
return await instance.put(`/proxies/${encodeURIComponent(group)}`, { name: proxy })
|
return await instance.put(`/proxies/${encodeURIComponent(group)}`, { name: proxy })
|
||||||
|
|||||||
@ -99,6 +99,7 @@ async function initFiles(): Promise<void> {
|
|||||||
}
|
}
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
copy('country.mmdb'),
|
copy('country.mmdb'),
|
||||||
|
copy('geoip.metadb'),
|
||||||
copy('geoip.dat'),
|
copy('geoip.dat'),
|
||||||
copy('geosite.dat'),
|
copy('geosite.dat'),
|
||||||
copy('ASN.mmdb')
|
copy('ASN.mmdb')
|
||||||
|
|||||||
@ -8,9 +8,7 @@ import {
|
|||||||
mihomoProxies,
|
mihomoProxies,
|
||||||
mihomoProxyDelay,
|
mihomoProxyDelay,
|
||||||
mihomoProxyProviders,
|
mihomoProxyProviders,
|
||||||
mihomoRunProxyProviders,
|
|
||||||
mihomoRuleProviders,
|
mihomoRuleProviders,
|
||||||
mihomoRunRuleProviders,
|
|
||||||
mihomoRules,
|
mihomoRules,
|
||||||
mihomoUnfixedProxy,
|
mihomoUnfixedProxy,
|
||||||
mihomoUpdateProxyProviders,
|
mihomoUpdateProxyProviders,
|
||||||
@ -119,12 +117,10 @@ export function registerIpcMainHandlers(): void {
|
|||||||
ipcMain.handle('mihomoProxies', ipcErrorWrapper(mihomoProxies))
|
ipcMain.handle('mihomoProxies', ipcErrorWrapper(mihomoProxies))
|
||||||
ipcMain.handle('mihomoGroups', ipcErrorWrapper(mihomoGroups))
|
ipcMain.handle('mihomoGroups', ipcErrorWrapper(mihomoGroups))
|
||||||
ipcMain.handle('mihomoProxyProviders', ipcErrorWrapper(mihomoProxyProviders))
|
ipcMain.handle('mihomoProxyProviders', ipcErrorWrapper(mihomoProxyProviders))
|
||||||
ipcMain.handle('mihomoRunProxyProviders', ipcErrorWrapper(mihomoRunProxyProviders))
|
|
||||||
ipcMain.handle('mihomoUpdateProxyProviders', (_e, name) =>
|
ipcMain.handle('mihomoUpdateProxyProviders', (_e, name) =>
|
||||||
ipcErrorWrapper(mihomoUpdateProxyProviders)(name)
|
ipcErrorWrapper(mihomoUpdateProxyProviders)(name)
|
||||||
)
|
)
|
||||||
ipcMain.handle('mihomoRuleProviders', ipcErrorWrapper(mihomoRuleProviders))
|
ipcMain.handle('mihomoRuleProviders', ipcErrorWrapper(mihomoRuleProviders))
|
||||||
ipcMain.handle('mihomoRunRuleProviders', ipcErrorWrapper(mihomoRunRuleProviders))
|
|
||||||
ipcMain.handle('mihomoUpdateRuleProviders', (_e, name) =>
|
ipcMain.handle('mihomoUpdateRuleProviders', (_e, name) =>
|
||||||
ipcErrorWrapper(mihomoUpdateRuleProviders)(name)
|
ipcErrorWrapper(mihomoUpdateRuleProviders)(name)
|
||||||
)
|
)
|
||||||
|
|||||||
@ -107,7 +107,7 @@ export const defaultControledMihomoConfig: Partial<IMihomoConfig> = {
|
|||||||
'geox-url': {
|
'geox-url': {
|
||||||
geoip: 'https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip-lite.dat',
|
geoip: 'https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip-lite.dat',
|
||||||
geosite: 'https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geosite.dat',
|
geosite: 'https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geosite.dat',
|
||||||
mmdb: 'https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/country-lite.mmdb',
|
mmdb: 'https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip.metadb',
|
||||||
asn: 'https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/GeoLite2-ASN.mmdb'
|
asn: 'https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/GeoLite2-ASN.mmdb'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,20 +26,41 @@ const CopyableSettingItem: React.FC<{
|
|||||||
{ key: 'raw', text: displayName || (Array.isArray(value) ? value.join(', ') : value) },
|
{ key: 'raw', text: displayName || (Array.isArray(value) ? value.join(', ') : value) },
|
||||||
...(Array.isArray(value) && value.length === prefix.length
|
...(Array.isArray(value) && value.length === prefix.length
|
||||||
? prefix.map((p, i) => value[i] ? ({
|
? prefix.map((p, i) => value[i] ? ({
|
||||||
key: `${p},${value[i]}${suffix}`,
|
key: `${p},${p === 'IP-ASN' ? value[i].split(' ')[0] : value[i]}${suffix}`,
|
||||||
text: `${p},${value[i]}${suffix}`
|
text: `${p},${p === 'IP-ASN' ? value[i].split(' ')[0] : value[i]}${suffix}`
|
||||||
}) : null).filter(Boolean)
|
}) : null).filter(Boolean)
|
||||||
: prefix.flatMap(p =>
|
: prefix.flatMap(p =>
|
||||||
(p === 'DOMAIN-SUFFIX'
|
(Array.isArray(value)
|
||||||
? getSubDomains(Array.isArray(value) ? value[0] : value)
|
? value.map(v => p === 'DOMAIN-SUFFIX'
|
||||||
: p === 'IP-ASN'
|
? getSubDomains(v).map(subV => ({
|
||||||
? [(Array.isArray(value) ? value[0] : value).split(' ')[0]]
|
key: `${p},${subV}${suffix}`,
|
||||||
: [Array.isArray(value) ? value[0] : value]
|
text: `${p},${subV}${suffix}`
|
||||||
).map(v => ({
|
}))
|
||||||
|
: p === 'IP-ASN' || p === 'SRC-IP-ASN'
|
||||||
|
? [{
|
||||||
|
key: `${p},${v.split(' ')[0]}${suffix}`,
|
||||||
|
text: `${p},${v.split(' ')[0]}${suffix}`
|
||||||
|
}]
|
||||||
|
: [{
|
||||||
|
key: `${p},${v}${suffix}`,
|
||||||
|
text: `${p},${v}${suffix}`
|
||||||
|
}]
|
||||||
|
).flat()
|
||||||
|
: p === 'DOMAIN-SUFFIX'
|
||||||
|
? getSubDomains(value).map(v => ({
|
||||||
key: `${p},${v}${suffix}`,
|
key: `${p},${v}${suffix}`,
|
||||||
text: `${p},${v}${suffix}`
|
text: `${p},${v}${suffix}`
|
||||||
}))
|
}))
|
||||||
))
|
: p === 'IP-ASN' || p === 'SRC-IP-ASN'
|
||||||
|
? [{
|
||||||
|
key: `${p},${value.split(' ')[0]}${suffix}`,
|
||||||
|
text: `${p},${value.split(' ')[0]}${suffix}`
|
||||||
|
}]
|
||||||
|
: [{
|
||||||
|
key: `${p},${value}${suffix}`,
|
||||||
|
text: `${p},${value}${suffix}`
|
||||||
|
}]
|
||||||
|
)))
|
||||||
]
|
]
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -137,7 +158,7 @@ const ConnectionDetailModal: React.FC<Props> = (props) => {
|
|||||||
suffix='/32'
|
suffix='/32'
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{connection.metadata.sourceGeoIP && (
|
{connection.metadata.sourceGeoIP && connection.metadata.sourceGeoIP.length > 0 && (
|
||||||
<CopyableSettingItem
|
<CopyableSettingItem
|
||||||
title='来源GeoIP'
|
title='来源GeoIP'
|
||||||
value={connection.metadata.sourceGeoIP}
|
value={connection.metadata.sourceGeoIP}
|
||||||
@ -159,7 +180,7 @@ const ConnectionDetailModal: React.FC<Props> = (props) => {
|
|||||||
suffix='/32'
|
suffix='/32'
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{connection.metadata.destinationGeoIP && (
|
{connection.metadata.destinationGeoIP && connection.metadata.destinationGeoIP.length > 0 && (
|
||||||
<CopyableSettingItem
|
<CopyableSettingItem
|
||||||
title='目标GeoIP'
|
title='目标GeoIP'
|
||||||
value={connection.metadata.destinationGeoIP}
|
value={connection.metadata.destinationGeoIP}
|
||||||
|
|||||||
@ -12,7 +12,7 @@ const GeoData: React.FC = () => {
|
|||||||
'geox-url': geoxUrl = {
|
'geox-url': geoxUrl = {
|
||||||
geoip: 'https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip-lite.dat',
|
geoip: 'https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip-lite.dat',
|
||||||
geosite: 'https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geosite.dat',
|
geosite: 'https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geosite.dat',
|
||||||
mmdb: 'https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/country-lite.mmdb',
|
mmdb: 'https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip.metadb',
|
||||||
asn: 'https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/GeoLite2-ASN.mmdb'
|
asn: 'https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/GeoLite2-ASN.mmdb'
|
||||||
},
|
},
|
||||||
'geodata-mode': geoMode = false,
|
'geodata-mode': geoMode = false,
|
||||||
|
|||||||
@ -1,4 +1,8 @@
|
|||||||
import { mihomoProxyProviders, mihomoUpdateProxyProviders, mihomoRunProxyProviders } from '@renderer/utils/ipc'
|
import {
|
||||||
|
mihomoProxyProviders,
|
||||||
|
mihomoUpdateProxyProviders,
|
||||||
|
getRuntimeConfig
|
||||||
|
} from '@renderer/utils/ipc'
|
||||||
import { Fragment, useEffect, useMemo, useState } from 'react'
|
import { Fragment, useEffect, useMemo, useState } from 'react'
|
||||||
import Viewer from './viewer'
|
import Viewer from './viewer'
|
||||||
import useSWR from 'swr'
|
import useSWR from 'swr'
|
||||||
@ -7,6 +11,7 @@ import SettingItem from '../base/base-setting-item'
|
|||||||
import { Button, Chip } from '@nextui-org/react'
|
import { Button, Chip } from '@nextui-org/react'
|
||||||
import { IoMdRefresh, IoMdEye } from 'react-icons/io'
|
import { IoMdRefresh, IoMdEye } from 'react-icons/io'
|
||||||
import { CgLoadbarDoc } from 'react-icons/cg'
|
import { CgLoadbarDoc } from 'react-icons/cg'
|
||||||
|
import { MdEditDocument } from 'react-icons/md'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import { calcTraffic } from '@renderer/utils/calc'
|
import { calcTraffic } from '@renderer/utils/calc'
|
||||||
import { getHash } from '@renderer/utils/hash'
|
import { getHash } from '@renderer/utils/hash'
|
||||||
@ -19,8 +24,9 @@ const ProxyProvider: React.FC = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchProviderPath = async (name: string) => {
|
const fetchProviderPath = async (name: string) => {
|
||||||
try {
|
try {
|
||||||
const providers = await mihomoRunProxyProviders()
|
const providers = await getRuntimeConfig()
|
||||||
const provider = providers[name]
|
const provider = providers['proxy-providers'][name]
|
||||||
|
console.log(provider)
|
||||||
if (provider?.path) {
|
if (provider?.path) {
|
||||||
setShowPath(provider.path)
|
setShowPath(provider.path)
|
||||||
} else if (provider?.url) {
|
} else if (provider?.url) {
|
||||||
@ -73,7 +79,17 @@ const ProxyProvider: React.FC = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<SettingCard>
|
<SettingCard>
|
||||||
{ShowProvider && <Viewer onClose={() => { setShowProvider(false); setShowPath(''); setShowType('')}} path={ShowPath} type={ShowType} />}
|
{ShowProvider && (
|
||||||
|
<Viewer
|
||||||
|
onClose={() => {
|
||||||
|
setShowProvider(false)
|
||||||
|
setShowPath('')
|
||||||
|
setShowType('')
|
||||||
|
}}
|
||||||
|
path={ShowPath}
|
||||||
|
type={ShowType}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<SettingItem title="代理集合" divider>
|
<SettingItem title="代理集合" divider>
|
||||||
<Button
|
<Button
|
||||||
size="sm"
|
size="sm"
|
||||||
@ -100,21 +116,7 @@ const ProxyProvider: React.FC = () => {
|
|||||||
>
|
>
|
||||||
<div className="flex h-[32px] leading-[32px] text-foreground-500">
|
<div className="flex h-[32px] leading-[32px] text-foreground-500">
|
||||||
<div>{dayjs(provider.updatedAt).fromNow()}</div>
|
<div>{dayjs(provider.updatedAt).fromNow()}</div>
|
||||||
<Button
|
<Button isIconOnly className="ml-2" size="sm">
|
||||||
isIconOnly
|
|
||||||
className="ml-2"
|
|
||||||
size="sm"
|
|
||||||
onPress={() => {
|
|
||||||
onUpdate(provider.name, index)
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<IoMdRefresh className={`text-lg ${updating[index] ? 'animate-spin' : ''}`} />
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
isIconOnly
|
|
||||||
className="ml-2"
|
|
||||||
size="sm"
|
|
||||||
>
|
|
||||||
<IoMdEye className="text-lg" />
|
<IoMdEye className="text-lg" />
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
@ -126,7 +128,21 @@ const ProxyProvider: React.FC = () => {
|
|||||||
setShowPath(provider.name)
|
setShowPath(provider.name)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<CgLoadbarDoc className="text-lg" />
|
{provider.vehicleType == 'File' ? (
|
||||||
|
<MdEditDocument className={`text-lg`} />
|
||||||
|
) : (
|
||||||
|
<CgLoadbarDoc className={`text-lg`} />
|
||||||
|
)}
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
isIconOnly
|
||||||
|
className="ml-2"
|
||||||
|
size="sm"
|
||||||
|
onPress={() => {
|
||||||
|
onUpdate(provider.name, index)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<IoMdRefresh className={`text-lg ${updating[index] ? 'animate-spin' : ''}`} />
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</SettingItem>
|
</SettingItem>
|
||||||
|
|||||||
@ -1,4 +1,8 @@
|
|||||||
import { mihomoRuleProviders, mihomoUpdateRuleProviders, mihomoRunRuleProviders } from '@renderer/utils/ipc'
|
import {
|
||||||
|
mihomoRuleProviders,
|
||||||
|
mihomoUpdateRuleProviders,
|
||||||
|
getRuntimeConfig
|
||||||
|
} from '@renderer/utils/ipc'
|
||||||
import { getHash } from '@renderer/utils/hash'
|
import { getHash } from '@renderer/utils/hash'
|
||||||
import Viewer from './viewer'
|
import Viewer from './viewer'
|
||||||
import { Fragment, useEffect, useMemo, useState } from 'react'
|
import { Fragment, useEffect, useMemo, useState } from 'react'
|
||||||
@ -8,6 +12,7 @@ import SettingItem from '../base/base-setting-item'
|
|||||||
import { Button, Chip } from '@nextui-org/react'
|
import { Button, Chip } from '@nextui-org/react'
|
||||||
import { IoMdRefresh } from 'react-icons/io'
|
import { IoMdRefresh } from 'react-icons/io'
|
||||||
import { CgLoadbarDoc } from 'react-icons/cg'
|
import { CgLoadbarDoc } from 'react-icons/cg'
|
||||||
|
import { MdEditDocument } from 'react-icons/md'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
|
|
||||||
const RuleProvider: React.FC = () => {
|
const RuleProvider: React.FC = () => {
|
||||||
@ -27,8 +32,8 @@ const RuleProvider: React.FC = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchProviderPath = async (name: string) => {
|
const fetchProviderPath = async (name: string) => {
|
||||||
try {
|
try {
|
||||||
const providers = await mihomoRunRuleProviders()
|
const providers = await getRuntimeConfig()
|
||||||
const provider = providers[name]
|
const provider = providers['rule-providers'][name]
|
||||||
if (provider?.path) {
|
if (provider?.path) {
|
||||||
setShowPath(provider.path)
|
setShowPath(provider.path)
|
||||||
} else if (provider?.url) {
|
} else if (provider?.url) {
|
||||||
@ -68,12 +73,18 @@ const RuleProvider: React.FC = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<SettingCard>
|
<SettingCard>
|
||||||
{ShowProvider && <Viewer
|
{ShowProvider && (
|
||||||
|
<Viewer
|
||||||
path={ShowPath}
|
path={ShowPath}
|
||||||
type={ShowType}
|
type={ShowType}
|
||||||
format={ShowFormat}
|
format={ShowFormat}
|
||||||
onClose={() => { setShowProvider(false); setShowPath(''); setShowType('') }}
|
onClose={() => {
|
||||||
/>}
|
setShowProvider(false)
|
||||||
|
setShowPath('')
|
||||||
|
setShowType('')
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<SettingItem title="规则集合" divider>
|
<SettingItem title="规则集合" divider>
|
||||||
<Button
|
<Button
|
||||||
size="sm"
|
size="sm"
|
||||||
@ -99,17 +110,7 @@ const RuleProvider: React.FC = () => {
|
|||||||
>
|
>
|
||||||
<div className="flex h-[32px] leading-[32px] text-foreground-500">
|
<div className="flex h-[32px] leading-[32px] text-foreground-500">
|
||||||
<div>{dayjs(provider.updatedAt).fromNow()}</div>
|
<div>{dayjs(provider.updatedAt).fromNow()}</div>
|
||||||
<Button
|
{provider.format !== 'MrsRule' && (
|
||||||
isIconOnly
|
|
||||||
className="ml-2"
|
|
||||||
size="sm"
|
|
||||||
onPress={() => {
|
|
||||||
onUpdate(provider.name, index)
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<IoMdRefresh className={`text-lg ${updating[index] ? 'animate-spin' : ''}`} />
|
|
||||||
</Button>
|
|
||||||
{provider.format !== "MrsRule" && (
|
|
||||||
<Button
|
<Button
|
||||||
isIconOnly
|
isIconOnly
|
||||||
className="ml-2"
|
className="ml-2"
|
||||||
@ -120,9 +121,23 @@ const RuleProvider: React.FC = () => {
|
|||||||
setShowPath(provider.name)
|
setShowPath(provider.name)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
{provider.vehicleType == 'File' ? (
|
||||||
|
<MdEditDocument className={`text-lg`} />
|
||||||
|
) : (
|
||||||
<CgLoadbarDoc className={`text-lg`} />
|
<CgLoadbarDoc className={`text-lg`} />
|
||||||
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
<Button
|
||||||
|
isIconOnly
|
||||||
|
className="ml-2"
|
||||||
|
size="sm"
|
||||||
|
onPress={() => {
|
||||||
|
onUpdate(provider.name, index)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<IoMdRefresh className={`text-lg ${updating[index] ? 'animate-spin' : ''}`} />
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</SettingItem>
|
</SettingItem>
|
||||||
<SettingItem
|
<SettingItem
|
||||||
|
|||||||
@ -43,10 +43,6 @@ export async function mihomoUpdateProxyProviders(name: string): Promise<void> {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function mihomoRunProxyProviders(): Promise<IMihomoRuleProviders> {
|
|
||||||
return ipcErrorWrapper(await window.electron.ipcRenderer.invoke('mihomoRunProxyProviders'))
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function mihomoRuleProviders(): Promise<IMihomoRuleProviders> {
|
export async function mihomoRuleProviders(): Promise<IMihomoRuleProviders> {
|
||||||
return ipcErrorWrapper(await window.electron.ipcRenderer.invoke('mihomoRuleProviders'))
|
return ipcErrorWrapper(await window.electron.ipcRenderer.invoke('mihomoRuleProviders'))
|
||||||
}
|
}
|
||||||
@ -57,10 +53,6 @@ export async function mihomoUpdateRuleProviders(name: string): Promise<void> {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function mihomoRunRuleProviders(): Promise<IMihomoRuleProviders> {
|
|
||||||
return ipcErrorWrapper(await window.electron.ipcRenderer.invoke('mihomoRunRuleProviders'))
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function mihomoChangeProxy(group: string, proxy: string): Promise<IMihomoProxy> {
|
export async function mihomoChangeProxy(group: string, proxy: string): Promise<IMihomoProxy> {
|
||||||
return ipcErrorWrapper(
|
return ipcErrorWrapper(
|
||||||
await window.electron.ipcRenderer.invoke('mihomoChangeProxy', group, proxy)
|
await window.electron.ipcRenderer.invoke('mihomoChangeProxy', group, proxy)
|
||||||
|
|||||||
8
src/shared/types.d.ts
vendored
8
src/shared/types.d.ts
vendored
@ -88,10 +88,10 @@ interface IMihomoConnectionDetail {
|
|||||||
network: 'tcp' | 'udp'
|
network: 'tcp' | 'udp'
|
||||||
type: string
|
type: string
|
||||||
sourceIP: string
|
sourceIP: string
|
||||||
sourceGeoIP: string
|
sourceGeoIP: string[]
|
||||||
sourceIPASN: string
|
sourceIPASN: string
|
||||||
destinationIP: string
|
destinationIP: string
|
||||||
destinationGeoIP: string
|
destinationGeoIP: string[]
|
||||||
destinationIPASN: string
|
destinationIPASN: string
|
||||||
sourcePort: string
|
sourcePort: string
|
||||||
destinationPort: string
|
destinationPort: string
|
||||||
@ -181,8 +181,6 @@ interface IMihomoRuleProvider {
|
|||||||
type: string
|
type: string
|
||||||
updatedAt: string
|
updatedAt: string
|
||||||
vehicleType: string
|
vehicleType: string
|
||||||
url: string
|
|
||||||
path: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IMihomoProxyProviders {
|
interface IMihomoProxyProviders {
|
||||||
@ -205,8 +203,6 @@ interface IMihomoProxyProvider {
|
|||||||
testUrl?: string
|
testUrl?: string
|
||||||
updatedAt?: string
|
updatedAt?: string
|
||||||
vehicleType: string
|
vehicleType: string
|
||||||
url: string
|
|
||||||
path: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ISysProxyConfig {
|
interface ISysProxyConfig {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user