complete override

This commit is contained in:
pompurin404 2024-08-18 19:21:01 +08:00
parent 82edf850b8
commit 2dead0f521
No known key found for this signature in database
2 changed files with 53 additions and 12 deletions

View File

@ -33,11 +33,13 @@ const Override: React.FC = () => {
const handleImport = async (): Promise<void> => {
setImporting(true)
try {
const urlObj = new URL(url)
const name = urlObj.pathname.split('/').pop()
await addOverrideItem({
name: '',
name: name ? decodeURIComponent(name) : undefined,
type: 'remote',
url,
ext: url.endsWith('.js') ? 'js' : 'yaml'
ext: urlObj.pathname.endsWith('.js') ? 'js' : 'yaml'
})
} finally {
setImporting(false)
@ -106,7 +108,31 @@ const Override: React.FC = () => {
}, [items])
return (
<BasePage ref={pageRef} title="覆写">
<BasePage
ref={pageRef}
title="覆写"
header={
<>
<Button
size="sm"
className="mr-2"
onPress={() => {
open('https://mihomo.party/guides/function/override/yaml/')
}}
>
使
</Button>
<Button
size="sm"
onPress={() => {
open('https://github.com/pompurin404/override-hub')
}}
>
</Button>
</>
}
>
<div className="sticky top-[48px] z-40 backdrop-blur bg-background/40 flex p-2">
<Input
variant="bordered"

View File

@ -17,6 +17,7 @@ import {
webdavBackup,
listWebdavBackups
} from '@renderer/utils/ipc'
import { CgWebsite } from 'react-icons/cg'
import { IoLogoGithub } from 'react-icons/io5'
import { platform, version } from '@renderer/utils/init'
import useSWR from 'swr'
@ -130,15 +131,29 @@ const Settings: React.FC = () => {
<BasePage
title="应用设置"
header={
<Button
isIconOnly
size="sm"
onPress={() => {
window.open('https://github.com/pompurin404/mihomo-party')
}}
>
<IoLogoGithub className="text-lg" />
</Button>
<>
<Button
isIconOnly
size="sm"
title="官方文档"
className="mr-2"
onPress={() => {
window.open('https://mihomo.party')
}}
>
<CgWebsite className="text-lg" />
</Button>
<Button
isIconOnly
size="sm"
title="GitHub仓库"
onPress={() => {
window.open('https://github.com/pompurin404/mihomo-party')
}}
>
<IoLogoGithub className="text-lg" />
</Button>
</>
}
>
<SettingCard>