Ensure distributions always include address
This commit is contained in:
@@ -84,6 +84,7 @@ function deepClone(value){
|
||||
|
||||
function getDistributionTemplateProfileDefaults(profile){
|
||||
const safeId = slugify(profile?.id || profile?.name || 'example-profile') || 'example-profile'
|
||||
const fallbackPort = Number.isFinite(Number(profile?.serverPort)) ? Number(profile.serverPort) : 25565
|
||||
return {
|
||||
version: '1.0.0',
|
||||
rss: '',
|
||||
@@ -94,6 +95,7 @@ function getDistributionTemplateProfileDefaults(profile){
|
||||
description: profile?.description || '관리자 사이트에서 만든 distribution 템플릿입니다.',
|
||||
version: '1.0.0',
|
||||
minecraftVersion: '1.20.1',
|
||||
address: `127.0.0.1:${fallbackPort}`,
|
||||
mainServer: true,
|
||||
autoconnect: false,
|
||||
modules: []
|
||||
@@ -148,6 +150,7 @@ function buildDistributionDocumentFromForm(profile){
|
||||
const primaryServer = {
|
||||
...baseDocument.servers[0]
|
||||
}
|
||||
const fallbackPort = Number.isFinite(Number(profile?.serverPort)) ? Number(profile.serverPort) : 25565
|
||||
|
||||
baseDocument.version = distributionFieldElements.version.value.trim() || '1.0.0'
|
||||
baseDocument.rss = distributionFieldElements.rss.value.trim()
|
||||
@@ -157,6 +160,9 @@ function buildDistributionDocumentFromForm(profile){
|
||||
primaryServer.description = distributionFieldElements.serverDescription.value.trim()
|
||||
primaryServer.version = distributionFieldElements.serverVersion.value.trim() || '1.0.0'
|
||||
primaryServer.minecraftVersion = distributionFieldElements.minecraftVersion.value.trim() || '1.20.1'
|
||||
primaryServer.address = typeof primaryServer.address === 'string' && primaryServer.address.trim().length > 0
|
||||
? primaryServer.address.trim()
|
||||
: `127.0.0.1:${fallbackPort}`
|
||||
primaryServer.mainServer = distributionFieldElements.mainServer.checked
|
||||
primaryServer.autoconnect = distributionFieldElements.autoconnect.checked
|
||||
primaryServer.modules = Array.isArray(primaryServer.modules) ? primaryServer.modules : []
|
||||
|
||||
Reference in New Issue
Block a user