Add eula to download

This commit is contained in:
amcmanu3 2023-08-27 14:55:21 -04:00
parent 18252fae0f
commit d9e405e56c
2 changed files with 21 additions and 10 deletions

View File

@ -346,12 +346,18 @@ new_server_schema = {
"title": "Import server data",
"type": "object",
"required": [],
"properties": {},
"properties": {
"agree_to_eula": {
"title": "Agree to the EULA",
"type": "boolean",
"enum": [True],
},
},
},
"import_server_create_data": {
"title": "Import server data",
"type": "object",
"required": ["existing_server_path"],
"required": ["existing_server_path", "executable"],
"properties": {
"existing_server_path": {
"title": "Server path",
@ -420,7 +426,9 @@ new_server_schema = {
"allOf": [
{
"if": {
"properties": {"create_type": {"const": "import_exec"}}
"properties": {
"create_type": {"const": "import_server"}
}
},
"then": {"required": ["import_server_create_data"]},
},
@ -434,16 +442,20 @@ new_server_schema = {
"if": {
"properties": {"create_type": {"const": "download_exe"}}
},
"then": {"required": []},
"then": {
"required": [
"download_exe_create_data",
]
},
},
],
},
{
"title": "Only one creation data",
"oneOf": [
{"required": []},
{"required": ["import_server_create_data"]},
{"required": ["import_zip_create_data"]},
{"required": ["download_exe_create_data"]},
],
},
],
@ -684,7 +696,6 @@ class ApiServersIndexHandler(BaseApiHandler):
return self.finish_json(
400, {"status": "error", "error": "INVALID_JSON", "error_data": str(e)}
)
print(data)
try:
validate(data, new_server_schema)
except ValidationError as e:

View File

@ -840,7 +840,10 @@ $(document).ready(function () {
"create_type": "minecraft_bedrock",
"minecraft_bedrock_create_data": {
"create_type": "download_exe",
"download_exe_create_data": {}
"download_exe_create_data": {
//agree to eula since we confirmed before calling this function
"agree_to_eula": true,
}
}
}
console.log(send_data);
@ -876,7 +879,6 @@ $("#import-jar").on("submit", async function (e) {
"import_server_create_data": {
"existing_server_path": formDataObject.server_path,
"executable": formDataObject.server_jar,
"server_properties_port": formDataObject.port
}
}
}
@ -910,7 +912,6 @@ $("#import-jar").on("submit", async function (e) {
"import_server_create_data": {
"existing_server_path": formDataObject.root_path,
"executable": formDataObject.server_jar,
"server_properties_port": formDataObject.port
}
}
}
@ -944,7 +945,6 @@ $("#import-upload").on("submit", async function (e) {
"import_server_create_data": {
"existing_server_path": formDataObject.root_path,
"executable": formDataObject.server_jar,
"server_properties_port": formDataObject.port
}
}
}