Ensure distributions always include address
This commit is contained in:
@@ -1,5 +1,17 @@
|
||||
{
|
||||
"version": "1.0.0",
|
||||
"rss": "",
|
||||
"servers": []
|
||||
"servers": [
|
||||
{
|
||||
"id": "template-map-base",
|
||||
"name": "Map Base Template",
|
||||
"description": "맵만 사용하는 기본 프로필용 샘플 distribution입니다.",
|
||||
"version": "1.20.1",
|
||||
"minecraftVersion": "1.20.1",
|
||||
"address": "127.0.0.1:25565",
|
||||
"mainServer": true,
|
||||
"autoconnect": false,
|
||||
"modules": []
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"description": "맵과 모드를 함께 쓰는 프로필용 샘플 distribution입니다.",
|
||||
"version": "1.20.1",
|
||||
"minecraftVersion": "1.20.1",
|
||||
"address": "127.0.0.1:25565",
|
||||
"mainServer": true,
|
||||
"autoconnect": false,
|
||||
"modules": []
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"description": "맵, 플러그인, 서버를 함께 쓰는 프로필용 샘플 distribution입니다.",
|
||||
"version": "1.20.1",
|
||||
"minecraftVersion": "1.20.1",
|
||||
"address": "127.0.0.1:25565",
|
||||
"mainServer": true,
|
||||
"autoconnect": false,
|
||||
"modules": []
|
||||
|
||||
@@ -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 : []
|
||||
|
||||
@@ -189,6 +189,7 @@ async function ensureLocalSampleDistribution(profileId, profileName){
|
||||
description: '관리자 사이트 로컬 샘플 distribution입니다.',
|
||||
version: '1.20.1',
|
||||
minecraftVersion: '1.20.1',
|
||||
address: '127.0.0.1:25565',
|
||||
mainServer: true,
|
||||
autoconnect: false,
|
||||
modules: []
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"description": "관리자 사이트에서 만든 distribution 템플릿입니다.",
|
||||
"version": "1.20.1",
|
||||
"minecraftVersion": "1.20.1",
|
||||
"address": "127.0.0.1:25565",
|
||||
"mainServer": true,
|
||||
"autoconnect": false,
|
||||
"modules": []
|
||||
|
||||
Reference in New Issue
Block a user