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 id = item.id || new Date().getTime().toString(16)
|
||||||
const newItem = {
|
const newItem = {
|
||||||
id,
|
id,
|
||||||
name: item.name || 'Local File',
|
name: item.name || item.type === 'remote' ? 'Remote File' : 'Local File',
|
||||||
type: item.type || 'local',
|
type: item.type || 'local',
|
||||||
url: item.url,
|
url: item.url,
|
||||||
interval: item.interval || 0,
|
interval: item.interval || 0,
|
||||||
|
@ -134,7 +134,7 @@ export async function createProfile(item: Partial<IProfileItem>): Promise<IProfi
|
||||||
})
|
})
|
||||||
const data = res.data
|
const data = res.data
|
||||||
const headers = res.headers
|
const headers = res.headers
|
||||||
if (headers['content-disposition']) {
|
if (headers['content-disposition'] && newItem.name === 'Remote File') {
|
||||||
newItem.name = parseFilename(headers['content-disposition'])
|
newItem.name = parseFilename(headers['content-disposition'])
|
||||||
}
|
}
|
||||||
if (headers['profile-web-page-url']) {
|
if (headers['profile-web-page-url']) {
|
||||||
|
|
|
@ -21,9 +21,7 @@ const Profiles: React.FC = () => {
|
||||||
const handleImport = async (): Promise<void> => {
|
const handleImport = async (): Promise<void> => {
|
||||||
setImporting(true)
|
setImporting(true)
|
||||||
try {
|
try {
|
||||||
await addProfileItem({ name: 'Remote File', type: 'remote', url })
|
await addProfileItem({ name: '', type: 'remote', url })
|
||||||
} catch (e) {
|
|
||||||
console.error(e)
|
|
||||||
} finally {
|
} finally {
|
||||||
setImporting(false)
|
setImporting(false)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user