🐛 Fix: fix upload api copy error after changing to 0.0.0.0

This commit is contained in:
Kuingsmile 2023-10-09 23:27:44 +08:00
parent 54d289c8f1
commit 7e408082c7
2 changed files with 7 additions and 4 deletions

View File

@ -1746,7 +1746,7 @@ const logLevel = {
const server = ref({ const server = ref({
port: 36677, port: 36677,
host: '127.0.0.1', host: '0.0.0.0',
enable: true enable: true
}) })
@ -1859,7 +1859,7 @@ async function initData () {
mainWindowHeight.value = settings.mainWindowHeight || 800 mainWindowHeight.value = settings.mainWindowHeight || 800
server.value = settings.server || { server.value = settings.server || {
port: 36677, port: 36677,
host: '127.0.0.1', host: '0.0.0.0',
enable: true enable: true
} }
advancedRename.value = config.buildIn?.rename || { advancedRename.value = config.buildIn?.rename || {
@ -2305,7 +2305,7 @@ async function cancelServerSetting () {
serverVisible.value = false serverVisible.value = false
server.value = await getConfig('settings.server') || { server.value = await getConfig('settings.server') || {
port: 36677, port: 36677,
host: '127.0.0.1', host: '0.0.0.0',
enable: true enable: true
} }
} }

View File

@ -238,7 +238,10 @@ async function handleCopyApi () {
port: 36677, port: 36677,
host: '127.0.0.1' host: '127.0.0.1'
} }
const { port, host } = serverConfig let { port, host } = serverConfig
if (host === '0.0.0.0') {
host = '127.0.0.1'
}
const uploader = await getConfig('uploader') as IStringKeyMap || {} const uploader = await getConfig('uploader') as IStringKeyMap || {}
const picBedConfigList = uploader[$route.params.type as string].configList || [] const picBedConfigList = uploader[$route.params.type as string].configList || []
const picBedConfig = picBedConfigList.find((item: IUploaderConfigListItem) => item._id === $route.params.configId) const picBedConfig = picBedConfigList.find((item: IUploaderConfigListItem) => item._id === $route.params.configId)