mirror of
https://github.com/pompurin404/mihomo-party.git
synced 2024-11-16 03:32:17 +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…
Reference in New Issue
Block a user