mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-27 13:10:30 +08:00
keep profile name
This commit is contained in:
parent
3a7d123af9
commit
30e3aa2316
@ -104,7 +104,7 @@ export async function createProfile(item: Partial<IProfileItem>): Promise<IProfi
|
||||
const id = item.id || new Date().getTime().toString(16)
|
||||
const newItem = {
|
||||
id,
|
||||
name: item.name || 'Local File',
|
||||
name: item.name || item.type === 'remote' ? 'Remote File' : 'Local File',
|
||||
type: item.type || 'local',
|
||||
url: item.url,
|
||||
interval: item.interval || 0,
|
||||
@ -134,7 +134,7 @@ export async function createProfile(item: Partial<IProfileItem>): Promise<IProfi
|
||||
})
|
||||
const data = res.data
|
||||
const headers = res.headers
|
||||
if (headers['content-disposition']) {
|
||||
if (headers['content-disposition'] && newItem.name === 'Remote File') {
|
||||
newItem.name = parseFilename(headers['content-disposition'])
|
||||
}
|
||||
if (headers['profile-web-page-url']) {
|
||||
|
||||
@ -21,9 +21,7 @@ const Profiles: React.FC = () => {
|
||||
const handleImport = async (): Promise<void> => {
|
||||
setImporting(true)
|
||||
try {
|
||||
await addProfileItem({ name: 'Remote File', type: 'remote', url })
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
await addProfileItem({ name: '', type: 'remote', url })
|
||||
} finally {
|
||||
setImporting(false)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user