2022-02-10 15:54:00 -05:00
{% extends ../base.html %}
{% block title %}Crafty Controller - {{ translate('serverWizard', 'newServer', data['lang']) }}{% end %}
{% block content %}
2024-06-21 13:25:07 -04:00
< link rel = "stylesheet" href = "../../static/assets/css/vendors/bootstrap-select-1.13.18.css" >
2022-02-10 15:54:00 -05:00
< div class = "content-wrapper" >
2023-09-25 20:15:17 +02:00
< ul class = "nav nav-pills tab-simple-styled " role = "tablist" >
2022-02-10 15:54:00 -05:00
< li class = "nav-item term-nav-item" >
2022-08-31 19:45:19 -04:00
< a class = "nav-link" href = "/server/step1" role = "tab" aria-selected = "false" >
2022-02-10 15:54:00 -05:00
< i class = "fas fa-file-signature" > < / i > Minecraft-Java< / a >
< / li >
< li class = "nav-item term-nav-item" >
< a class = "nav-link active" href = "/server/bedrock_step1" role = "tab" aria-selected = "false" >
< i class = "fas fa-file-signature" > < / i > Minecraft-Bedrock< / a >
< / li >
2022-08-31 19:45:19 -04:00
< / ul >
< div class = "d-none" id = "overlay" onclick = "hide(event)" > < / div >
< div class = "row" >
< div class = "col-sm-6 grid-margin stretch-card" >
< div class = "card" >
< div class = "card-body" >
< h4 > {{ translate('serverWizard', 'newServer', data['lang']) }}< / h4 >
< br / >
2023-08-25 13:54:31 -04:00
< form method = "post" id = "download_exe" name = "create_server" class = "server-wizard" >
2023-05-17 12:51:45 -04:00
{% if data["server_api"] and data["online"] %}
< fieldset >
2023-08-31 21:35:50 -04:00
{% else %}
< fieldset disabled = "disabled" >
< / style >
{% end %}
< div class = "form-group" >
< label for = "server_name" > {{ translate('serverWizard', 'serverName', data['lang']) }}< / label >
2024-08-13 23:08:00 +02:00
< input type = "text" class = "form-control" id = "server_name" name = "name" placeholder = "{{ translate('serverWizard', 'myNewServer', data['lang']) }}" required >
2023-08-31 21:35:50 -04:00
< / div >
2022-08-31 19:45:19 -04:00
2023-08-31 21:35:50 -04:00
< div class = "form-group" >
2024-08-13 23:08:00 +02:00
< p class = "mb-0 p-0" aria-expanded = "true" > {{ translate('serverWizard', 'addRole', data['lang']) }}
< small class = "text-none" > - {{ translate('serverWizard', 'autoCreate', data['lang']) }}< / small >
2024-06-21 13:25:07 -04:00
< / p >
2024-08-13 23:08:00 +02:00
< select data-container = "body" data-none-selected-text = "{{ translate('serverWizard', 'noneRoles', data['lang']) }}" data-none-results-text = "{{ translate('serverWizard', 'noRole', data['lang']) }} {0}" class = "selectpicker form-control form-control-lg select-css roles_select" data-styleBase = "form-control" data-style = "form-control" data-live-search = "true" name = "server_roles" multiple >
2024-06-21 13:25:07 -04:00
{% for r in data['roles'] %}
2024-06-23 20:54:30 -04:00
< option class = "roles" type = "checkbox" value = "{{ r['role_id'] }}" >
2024-08-13 23:08:00 +02:00
{{ r['role_name'].capitalize() }}
2024-06-21 13:25:07 -04:00
< / option >
{% end %}
< / select >
2022-08-31 19:45:19 -04:00
< / div >
2023-08-31 21:35:50 -04:00
< button onclick = "eula_confirm()" type = "button" class = "btn btn-primary mr-2" > {{ translate('serverWizard',
'buildServer',
data['lang']) }}< / button >
< button type = "reset" class = "btn btn-danger mr-2" > {{ translate('serverWizard', 'resetForm', data['lang'])
}}< / button >
< / fieldset >
{% if not data["server_api"] and data["online"] %}
< div class = "api-alert" style = "position: absolute; top: -5px; z-index: 100; opacity: .99;" >
2024-08-13 23:08:00 +02:00
< p style = "color: white !important;" > < i class = "fas fa-exclamation-triangle" style = "color: red;" > < / i > {{ translate('error', 'bedrockError', data['lang']) }}< a style = "color: red;" ; href = "https://status.craftycontrol.com/status/craftycontrol" target = "_blank" rel = "noopener noreferrer" > {{ translate('error', 'craftyStatus', data['lang']) }}< / a >
2023-08-31 21:35:50 -04:00
{{ translate('error', 'serverJars2', data['lang']) }}< / p >
2022-08-31 19:45:19 -04:00
< / div >
2023-08-31 21:35:50 -04:00
{% end %}
{% if not data["online"] %}
< div class = "api-alert" style = "position: absolute; top: -5px; z-index: 100; opacity: .99;" >
2024-08-13 23:08:00 +02:00
< p style = "color: white !important;" > < i class = "fas fa-exclamation-triangle" style = "color: red;" > < / i > {{ translate('error', 'noInternet', data['lang']) }}< / p >
2023-08-31 21:35:50 -04:00
< / div >
{% end %}
2022-08-31 19:45:19 -04:00
< / div >
< / form >
< / div >
< / div >
< div class = "col-sm-6 grid-margin stretch-card" >
< div class = "card" >
< div class = "card-body" >
< h4 > {{ translate('serverWizard', 'importServer', data['lang']) }}< / h4 >
< br / >
2023-08-25 13:54:31 -04:00
< form method = "post" id = "import-jar" class = "server-wizard" >
2023-02-02 23:47:54 +01:00
< div class = "form-group" >
< label for = "server_name" > {{ translate('serverWizard', 'serverName', data['lang']) }}< / label >
2024-08-13 23:08:00 +02:00
< input type = "text" class = "form-control" id = "server_name" name = "name" value = "" placeholder = "{{ translate('serverWizard', 'myNewServer', data['lang']) }}" required >
2023-02-02 23:47:54 +01:00
< / div >
< div class = "form-group" >
< label for = "server" > {{ translate('serverWizard', 'serverPath', data['lang']) }} < small > {{
translate('serverWizard', 'absoluteServerPath', data['lang']) }}< / small > < / label >
2024-08-13 23:08:00 +02:00
< input type = "text" class = "form-control" id = "server_path" name = "server_path" placeholder = "/var/opt/server" required >
2023-02-02 23:47:54 +01:00
< / div >
< div class = "form-group" >
< label for = "server_jar" > {{ translate('serverWizard', 'serverJar', data['lang']) }}< / label >
2024-08-13 23:08:00 +02:00
< input type = "text" class = "form-control" id = "server_jar" name = "server_jar" value = "" placeholder = "bedrock_server" required >
2022-08-31 19:45:19 -04:00
< / div >
< br / >
2024-08-13 23:08:00 +02:00
< h4 class = "card-title" > {{ translate('serverWizard', 'quickSettings', data['lang']) }} < small class = "text-none" > - {{ translate('serverWizard', 'quickSettingsDescription',
2022-08-31 19:45:19 -04:00
data['lang']) }}< / small > < / h4 >
< hr >
2023-02-02 23:47:54 +01:00
< div class = "form-group" >
< label for = "port2" > {{ translate('serverWizard', 'serverPort', data['lang']) }}
< small > < / small > < / label >
2024-08-13 23:08:00 +02:00
< input type = "number" class = "form-control" id = "port2" name = "port" value = "19132" step = "1" min = "1" max = "65535" required >
2023-02-02 23:47:54 +01:00
< / div >
2024-06-21 13:25:07 -04:00
2023-02-02 23:47:54 +01:00
< div class = "form-group" >
2024-06-21 13:25:07 -04:00
< p class = "mb-0 p-0" aria-expanded = "true" > {{ translate('serverWizard', 'addRole', data['lang'])
}}
2024-08-13 23:08:00 +02:00
< small class = "text-none" > - {{ translate('serverWizard', 'autoCreate',
2024-06-21 13:25:07 -04:00
data['lang']) }}< / small >
< / p >
2024-08-13 23:08:00 +02:00
< select data-container = "body" data-none-selected-text = "{{ translate('serverWizard', 'noneRoles', data['lang']) }}" data-none-results-text = "{{ translate('serverWizard', 'noRole', data['lang']) }} {0}" class = "selectpicker form-control form-control-lg select-css roles_select" data-styleBase = "form-control" data-style = "form-control" data-live-search = "true" name = "server_roles" multiple >
2024-06-21 13:25:07 -04:00
{% for r in data['roles'] %}
2024-06-23 20:54:30 -04:00
< option class = "roles" type = "checkbox" value = "{{ r['role_id'] }}" >
2024-06-21 13:25:07 -04:00
{{ r['role_name'].capitalize()
}}
< / option >
{% end %}
< / select >
2022-08-31 19:45:19 -04:00
< / div >
2024-06-21 13:25:07 -04:00
2022-08-31 19:45:19 -04:00
< button type = "submit" class = "btn btn-primary mr-2" > {{ translate('serverWizard', 'importServerButton',
data['lang']) }}< / button >
< button type = "reset" class = "btn btn-danger mr-2" > {{ translate('serverWizard', 'resetForm', data['lang'])
}}< / button >
< / form >
2022-02-10 15:54:00 -05:00
< / div >
< / div >
2022-08-31 19:45:19 -04:00
< / div >
2023-02-02 23:47:54 +01:00
< div class = "col-md-6 grid-margin stretch-card" >
2022-08-31 19:45:19 -04:00
< div class = "card" >
< div class = "card-body" >
< h4 > {{ translate('serverWizard', 'importZip', data['lang']) }}< / h4 >
< br / >
2023-09-03 13:23:18 -04:00
< form name = "zip" id = "import-zip" method = "post" class = "server-wizard" >
2022-08-31 19:45:19 -04:00
2023-02-02 23:47:54 +01:00
< div class = "form-group" >
< label for = "server_name" > {{ translate('serverWizard', 'serverName', data['lang']) }}< / label >
2024-08-13 23:08:00 +02:00
< input type = "text" class = "form-control" id = "server_name" name = "name" value = "" placeholder = "{{ translate('serverWizard', 'myNewServer', data['lang']) }}" required >
2022-08-31 19:45:19 -04:00
< / div >
2022-02-10 15:54:00 -05:00
2023-02-02 23:47:54 +01:00
< div class = "form-group" >
< label for = "server" > {{ translate('serverWizard', 'zipPath', data['lang']) }} < small > {{
translate('serverWizard', 'absoluteZipPath', data['lang']) }}< / small > < / label >
2024-08-13 23:08:00 +02:00
< input type = "text" class = "form-control" id = "zip_server_path" name = "server_path" placeholder = "/var/opt/server.zip" required >
2023-02-02 23:47:54 +01:00
< / div >
2022-02-10 15:54:00 -05:00
2023-02-02 23:47:54 +01:00
< div class = "form-group" >
< label for = "server" > {{ translate('serverWizard', 'selectRoot', data['lang']) }} < small > {{
translate('serverWizard', 'explainRoot', data['lang']) }}< / small > < / label >
< br >
< button class = "btn btn-primary mr-2" id = "root_files_button" type = "button" > {{
translate('serverWizard', 'clickRoot', data['lang']) }}< / button >
< / div >
< div class = "form-group" >
< label for = "server_jar" > {{ translate('serverWizard', 'serverJar', data['lang']) }}< / label >
2024-08-13 23:08:00 +02:00
< input type = "text" class = "form-control" id = "server_jar" name = "server_jar" value = "" placeholder = "bedrock_server" required >
2023-02-02 23:47:54 +01:00
< / div >
2024-08-13 23:08:00 +02:00
< h4 class = "card-title" > {{ translate('serverWizard', 'quickSettings', data['lang']) }} < small class = "text-none" > - {{ translate('serverWizard', 'quickSettingsDescription', data['lang'])
2023-08-31 21:35:50 -04:00
}}< / small >
2023-02-02 23:47:54 +01:00
< / h4 >
< hr >
< div class = "form-group" >
< label for = "port3" > {{ translate('serverWizard', 'serverPort', data['lang']) }}
< small > < / small > < / label >
2024-08-13 23:08:00 +02:00
< input type = "number" class = "form-control" id = "port3" name = "port" value = "19132" step = "1" min = "1" max = "65535" required >
2023-02-02 23:47:54 +01:00
< / div >
2024-06-21 13:25:07 -04:00
2023-02-02 23:47:54 +01:00
< div class = "form-group" >
2024-06-21 13:25:07 -04:00
< p class = "mb-0 p-0" aria-expanded = "true" > {{ translate('serverWizard', 'addRole', data['lang'])
}}
2024-08-13 23:08:00 +02:00
< small class = "text-none" > - {{ translate('serverWizard', 'autoCreate',
2024-06-21 13:25:07 -04:00
data['lang']) }}< / small >
< / p >
2024-08-13 23:08:00 +02:00
< select data-container = "body" data-none-selected-text = "{{ translate('serverWizard', 'noneRoles', data['lang']) }}" data-none-results-text = "{{ translate('serverWizard', 'noRole', data['lang']) }} {0}" class = "selectpicker form-control form-control-lg select-css roles_select" data-styleBase = "form-control" data-style = "form-control" data-live-search = "true" name = "server_roles" multiple >
2024-06-21 13:25:07 -04:00
{% for r in data['roles'] %}
2024-06-23 20:54:30 -04:00
< option class = "roles" type = "checkbox" value = "{{ r['role_id'] }}" >
2024-06-21 13:25:07 -04:00
{{ r['role_name'].capitalize()
}}
< / option >
{% end %}
< / select >
2023-02-02 23:47:54 +01:00
< / div >
2024-08-13 23:08:00 +02:00
< div class = "modal fade" id = "dir_select" tabindex = "-1" role = "dialog" aria-labelledby = "dir_select" aria-hidden = "true" >
2023-02-02 23:47:54 +01:00
< div class = "modal-dialog" role = "document" >
< div class = "modal-content" >
< div class = "modal-header" >
< h5 class = "modal-title" id = "exampleModalLongTitle" > {{ translate('serverWizard',
'selectZipDir', data['lang']) }}< / h5 >
< button type = "button" class = "close" data-dismiss = "modal" aria-label = "Close" >
< span aria-hidden = "true" > × < / span >
< / button >
2022-08-31 19:45:19 -04:00
< / div >
2023-02-02 23:47:54 +01:00
< div class = "modal-body" >
2024-08-13 23:08:00 +02:00
< div class = "tree-ctx-item overflow-scroll mh-75" id = "main-tree-div" data-path = "" >
2023-09-03 13:23:18 -04:00
< input type = "radio" class = "root-input" id = "main-tree-input" name = "root_path" value = "" checked >
2023-02-02 23:47:54 +01:00
< span id = "main-tree" class = "files-tree-title tree-caret-down root-dir" data-path = "" >
< i class = "far fa-folder" > < / i >
< i class = "far fa-folder-open" > < / i >
{{ translate('serverFiles', 'files', data['lang']) }}
< / span >
< / input >
2022-02-10 15:54:00 -05:00
< / div >
< / div >
2023-02-02 23:47:54 +01:00
< div class = "modal-footer" >
< button type = "button" class = "btn btn-secondary" data-dismiss = "modal" > {{
translate('serverWizard', 'close', data['lang']) }}< / button >
< button type = "button" id = "modal-okay" data-dismiss = "modal" class = "btn btn-primary" > {{
translate('serverWizard', 'save', data['lang']) }}< / button >
< / div >
2022-02-10 15:54:00 -05:00
< / div >
2022-08-31 19:45:19 -04:00
< / div >
< / div >
2024-08-13 23:08:00 +02:00
< button id = "zip_submit" type = "submit" title = "You must select server root dir first" disabled class = "btn btn-primary mr-2" > {{ translate('serverWizard', 'importServerButton', data['lang'])
2023-02-02 23:47:54 +01:00
}}< / button >
< button type = "button" class = "btn btn-danger mr-2 tree-reset" > {{ translate('serverWizard', 'resetForm',
data['lang'])
}}< / button >
< / form >
2022-02-10 15:54:00 -05:00
< / div >
< / div >
2022-08-31 19:45:19 -04:00
< / div >
2023-02-02 23:47:54 +01:00
< div class = "col-md-6 grid-margin stretch-card" >
2022-09-27 22:49:52 -04:00
< div class = "card" >
< div class = "card-body" >
< h4 > {{ translate('serverWizard', 'uploadZip', data['lang']) }}< / h4 >
< br / >
< p class = "card-description" >
2023-08-25 13:54:31 -04:00
< form name = "zip" id = "import-upload" method = "post" class = "server-wizard" >
2022-09-27 22:49:52 -04:00
2023-02-02 23:47:54 +01:00
< div class = "form-group" >
< label for = "server_name" > {{ translate('serverWizard', 'serverName', data['lang']) }}< / label >
2024-08-13 23:08:00 +02:00
< input type = "text" class = "form-control" id = "server_name" name = "name" value = "" placeholder = "{{ translate('serverWizard', 'myNewServer', data['lang']) }}" required >
2023-02-02 23:47:54 +01:00
< / div >
2022-09-27 22:49:52 -04:00
2023-02-02 23:47:54 +01:00
< div class = "form-group" >
< label for = "server" > Server Upload < / label >
< div id = "upload_input" class = "input-group" >
< div class = "custom-file" >
< input type = "file" multiple = "false" class = "custom-file-input" id = "file" name = "file" required >
2023-08-31 21:35:50 -04:00
< label id = "fileLabel" class = "custom-file-label" for = "file" > {{ translate('serverWizard',
'labelZipFile', data['lang']) }}< / label >
2022-09-27 22:49:52 -04:00
< / div >
2023-02-02 23:47:54 +01:00
< div class = "input-group-append" >
2024-08-13 23:08:00 +02:00
< button type = "button" class = "btn btn-info upload-button" id = "upload-button" onclick = "uploadFile('import')" disabled > {{ translate('serverWizard',
2023-03-12 10:43:50 +01:00
'uploadButton', data['lang']) }}< / button >
2022-09-27 22:49:52 -04:00
< / div >
2023-02-02 23:47:54 +01:00
< / div >
< / div >
< div id = "lower_half" style = "visibility: hidden;" >
< div class = "form-group" >
< label for = "server" > {{ translate('serverWizard', 'selectRoot', data['lang']) }} < small > {{
translate('serverWizard', 'explainRoot', data['lang']) }}< / small > < / label >
< br >
< button class = "btn btn-primary mr-2" id = "root_upload_button" type = "button" > {{
translate('serverWizard', 'clickRoot', data['lang']) }}< / button >
< / div >
2022-09-27 22:49:52 -04:00
2023-02-02 23:47:54 +01:00
< div class = "form-group" >
< label for = "server_jar" > {{ translate('serverWizard', 'serverJar', data['lang']) }}< / label >
2024-08-13 23:08:00 +02:00
< input type = "text" class = "form-control" id = "server_jar" name = "server_jar" value = "" placeholder = "paper.jar" required >
2023-02-02 23:47:54 +01:00
< / div >
2022-09-27 22:49:52 -04:00
2024-08-13 23:08:00 +02:00
< h4 class = "card-title" > {{ translate('serverWizard', 'quickSettings', data['lang']) }} < small class = "text-none" > - {{ translate('serverWizard', 'quickSettingsDescription',
2023-02-02 23:47:54 +01:00
data['lang']) }}< / small > < / h4 >
< hr >
2022-09-27 22:49:52 -04:00
2023-02-02 23:47:54 +01:00
< div class = "form-group" >
< label for = "port3" > {{ translate('serverWizard', 'serverPort', data['lang']) }} < small > - {{
translate('serverWizard', 'defaultPort', data['lang']) }}< / small > < / label >
2024-08-13 23:08:00 +02:00
< input type = "number" class = "form-control" id = "port4" name = "port" value = "19132" step = "1" min = "1" max = "65535" required >
2023-02-02 23:47:54 +01:00
< / div >
2022-09-27 22:49:52 -04:00
2023-02-02 23:47:54 +01:00
< div class = "form-group" >
2024-06-21 13:25:07 -04:00
< p class = "mb-0 p-0" aria-expanded = "true" > {{ translate('serverWizard', 'addRole', data['lang'])
}}
2024-08-13 23:08:00 +02:00
< small class = "text-none" > - {{ translate('serverWizard', 'autoCreate',
2024-06-21 13:25:07 -04:00
data['lang']) }}< / small >
< / p >
2024-08-13 23:08:00 +02:00
< select data-container = "body" data-none-selected-text = "{{ translate('serverWizard', 'noneRoles', data['lang']) }}" data-none-results-text = "{{ translate('serverWizard', 'noRole', data['lang']) }} {0}" class = "selectpicker form-control form-control-lg select-css roles_select" data-styleBase = "form-control" data-style = "form-control" data-live-search = "true" name = "server_roles" multiple >
2024-06-21 13:25:07 -04:00
{% for r in data['roles'] %}
2024-06-23 20:54:30 -04:00
< option class = "roles" type = "checkbox" value = "{{ r['role_id'] }}" >
2024-06-21 13:25:07 -04:00
{{ r['role_name'].capitalize()
}}
< / option >
{% end %}
< / select >
2023-02-02 23:47:54 +01:00
< / div >
2024-08-13 23:08:00 +02:00
< div class = "modal fade" id = "dir_upload_select" tabindex = "-1" role = "dialog" aria-labelledby = "dir_select" aria-hidden = "true" >
2023-02-02 23:47:54 +01:00
< div class = "modal-dialog" role = "document" >
< div class = "modal-content" >
< div class = "modal-header" >
< h5 class = "modal-title" id = "exampleModalLongTitle" > {{ translate('serverWizard',
'selectZipDir', data['lang']) }}< / h5 >
< button type = "button" class = "close" data-dismiss = "modal" aria-label = "Close" >
< span aria-hidden = "true" > × < / span >
< / button >
2022-09-27 22:49:52 -04:00
< / div >
2023-02-02 23:47:54 +01:00
< div class = "modal-body" >
2024-08-13 23:08:00 +02:00
< div class = "tree-ctx-item overflow-scroll mh-75" id = "main-tree-div-upload" data-path = "" >
< input type = "radio" class = "root-input" id = "main-tree-input-upload" name = "root_path" value = "" checked >
2023-02-02 23:47:54 +01:00
< span id = "main-tree" class = "files-tree-title tree-caret-down root-dir" data-path = "" >
< i class = "far fa-folder" > < / i >
< i class = "far fa-folder-open" > < / i >
{{ translate('serverFiles', 'files', data['lang']) }}
< / span >
< / input >
2022-09-27 22:49:52 -04:00
< / div >
< / div >
2023-02-02 23:47:54 +01:00
< div class = "modal-footer" >
< button type = "button" class = "btn btn-secondary" data-dismiss = "modal" > {{
translate('serverWizard', 'close', data['lang']) }}< / button >
< button type = "button" id = "modal-okay" data-dismiss = "modal" class = "btn btn-primary" > {{
translate('serverWizard', 'save', data['lang']) }}< / button >
< / div >
2022-09-27 22:49:52 -04:00
< / div >
< / div >
< / div >
2024-08-13 23:08:00 +02:00
< button id = "upload_submit" type = "submit" title = "You must select server root dir first" disabled class = "btn btn-primary mr-2" > {{ translate('serverWizard', 'importServerButton', data['lang'])
2023-02-02 23:47:54 +01:00
}}< / button >
< button type = "button" class = "btn btn-danger mr-2 tree-reset" > {{ translate('serverWizard', 'resetForm',
data['lang'])
}}< / button >
2022-09-27 22:49:52 -04:00
< / div >
< / form >
< / div >
< / div >
2022-09-04 18:27:45 -04:00
< / div >
2022-08-31 19:45:19 -04:00
< / div >
2022-02-10 15:54:00 -05:00
< / div >
2024-08-13 23:22:14 +02:00
< style rel = "stylesheet" href = "/static/assets/css/partial/crafty-wizard.css" > < / style >
2022-02-10 15:54:00 -05:00
{% end %}
{% block js%}
2024-05-26 23:31:06 -04:00
< script src = "../../static/assets/js/shared/upload.js" > < / script >
2022-02-10 15:54:00 -05:00
< script >
2023-08-31 21:35:50 -04:00
document.getElementById("root_upload_button").addEventListener("click", function (event) {
2022-09-27 22:49:52 -04:00
if (file) {
2022-12-15 18:48:15 -05:00
upload = true;
2022-09-27 22:49:52 -04:00
if (document.getElementById('root_upload_button').classList.contains('clicked')) {
2023-09-03 13:23:18 -04:00
document.getElementById('main-tree-div-upload').innerHTML = '< input type = "radio" class = "root-input" id = "main-tree-input-upload" name = "root_path" value = "" checked > < span id = "main-tree-upload" class = "files-tree-title tree-caret-down root-dir" > < i class = "far fa-folder" > < / i > < i class = "far fa-folder-open" > < / i > {{ translate("serverFiles", "files", data["lang"]) }}< / span > < / input > '
2022-09-27 22:49:52 -04:00
} else {
document.getElementById('root_upload_button').classList.add('clicked')
}
2023-09-04 19:22:11 -04:00
const token = getCookie("_xsrf");
2022-09-27 22:49:52 -04:00
var dialog = bootbox.dialog({
message: '< p class = "text-center mb-0" > < i class = "fa fa-spin fa-cog" > < / i > Please wait while we gather your files...< / p > ',
closeButton: false
});
2024-06-21 14:28:03 -04:00
setTimeout(function () {
2023-10-06 13:33:56 -04:00
getDirView();
}, 2000);
2022-09-27 22:49:52 -04:00
} else {
bootbox.alert("You must input a path before selecting this button");
}
});
2022-08-31 19:45:19 -04:00
function eula_confirm() {
bootbox.confirm({
title: "{% raw translate('error', 'eulaTitle', data['lang']) %}",
2022-09-01 14:18:04 -04:00
message: "{% raw translate('error', 'eulaMsg', data['lang']) %}< a href = 'https://www.minecraft.net/en-us/eula' target = '_blank' > Minecraft EULA< / a > {% raw translate('error', 'privMsg', data['lang']) %}< a target = '_blank' href = 'https://privacy.microsoft.com/en-us/privacystatement' > Microsoft Privacy Policy< / a > ",
2022-08-31 19:45:19 -04:00
buttons: {
confirm: {
2022-09-01 14:18:04 -04:00
label: "{% raw translate('error', 'agree', data['lang']) %}",
2022-08-31 19:45:19 -04:00
className: 'btn-info'
},
cancel: {
2022-09-01 14:18:04 -04:00
label: "{% raw translate('error', 'cancel', data['lang']) %}",
2022-08-31 19:45:19 -04:00
className: 'btn-secondary'
}
},
callback: function (result) {
if (result == true) {
2023-08-25 13:54:31 -04:00
$("#download_exe").submit();
2022-08-31 19:45:19 -04:00
}
else {
return;
}
}
})
}
< / script >
< script >
2022-10-02 15:54:13 -04:00
$(".tree-reset").on("click", function () {
location.href = "/server/bedrock_step1";
});
2023-08-31 21:35:50 -04:00
document.getElementById("root_files_button").addEventListener("click", function (event) {
2022-08-31 19:45:19 -04:00
if (document.forms["zip"]["server_path"].value != "") {
if (document.getElementById('root_files_button').classList.contains('clicked')) {
2023-09-03 13:23:18 -04:00
show_file_tree();
return;
2022-08-31 19:45:19 -04:00
} else {
2022-02-10 15:54:00 -05:00
document.getElementById('root_files_button').classList.add('clicked')
}
2022-08-31 19:45:19 -04:00
var dialog = bootbox.dialog({
message: '< p class = "text-center mb-0" > < i class = "fa fa-spin fa-cog" > < / i > Please wait while we gather your files...< / p > ',
closeButton: false
});
2024-06-21 14:28:03 -04:00
setTimeout(function () {
2023-10-06 13:33:56 -04:00
getDirView();
}, 2000);
2022-08-31 19:45:19 -04:00
} else {
bootbox.alert("You must input a path before selecting this button");
}
2022-02-10 15:54:00 -05:00
});
< / script >
< script >
2022-08-31 19:45:19 -04:00
function wait_msg(importing) {
2022-02-10 15:54:00 -05:00
bootbox.alert({
2022-08-31 19:45:19 -04:00
title: importing ? '{% raw translate("serverWizard", "importing", data['lang']) %}': '{% raw translate("serverWizard", "downloading", data['lang']) %}',
message: '< i class = "fas fa-cloud-download" > < / i > {% raw translate("serverWizard", "bePatient", data['lang']) %}',
});
2022-02-10 15:54:00 -05:00
}
2023-02-02 23:47:54 +01:00
$('#file').change(function () {
console.log("File changed");
if ($('#file').val()) {
$('#upload-button').prop("disabled", false);
document.getElementById("fileLabel").innerHTML = $('#file').val().split('\\').pop().split('/').pop();
console.log("File changed good");
}
});
2023-08-25 13:54:31 -04:00
function replacer(key, value) {
2023-08-31 21:35:50 -04:00
if (key === "roles") {
2023-08-25 13:54:31 -04:00
return value
}
if (key != "ignored_exits") {
if (typeof value == "boolean" || key === "host" || key === "version") {
return value
} else {
return (isNaN(value) ? value : +value);
}
} else {
return value;
}
}
function calcRoles() {
2024-06-21 13:25:07 -04:00
var combinedValues = [];
$('.roles_select').each(function () {
var selectedValues = $(this).val();
console.log(selectedValues)
if (selectedValues) {
combinedValues = combinedValues.concat(selectedValues);
2023-08-31 21:35:50 -04:00
}
2024-06-21 13:25:07 -04:00
});
return combinedValues;
2023-08-25 13:54:31 -04:00
}
2023-08-31 21:35:50 -04:00
async function send_server(data) {
2023-09-04 19:22:32 -04:00
let token = getCookie("_xsrf")
2023-08-25 13:54:31 -04:00
console.log(token)
let res = await fetch(`/api/v2/servers/`, {
method: 'POST',
headers: {
'X-XSRFToken': token
},
body: data,
});
let responseData = await res.json();
if (responseData.status === "ok") {
window.location.href = '/panel/dashboard';
} else {
bootbox.alert({
title: responseData.error,
message: responseData.error_data
});
}
}
2023-08-31 21:35:50 -04:00
$(document).ready(function () {
$("#download_exe").on("submit", async function (e) {
wait_msg();
e.preventDefault();
let jarForm = document.getElementById("download_exe");
let formData = new FormData(jarForm);
//Create an object from the form data entries
let formDataObject = Object.fromEntries(formData.entries());
console.log(formDataObject);
let send_data = {
"name": formDataObject.name,
"roles": calcRoles(),
"monitoring_type": "minecraft_bedrock",
"minecraft_bedrock_monitoring_data": {
"host": "127.0.0.1",
"port": 19132
},
"create_type": "minecraft_bedrock",
"minecraft_bedrock_create_data": {
"create_type": "download_exe",
"download_exe_create_data": {
//agree to eula since we confirmed before calling this function
"agree_to_eula": true,
}
}
}
console.log(send_data);
// Format the plain form data as JSON
let formDataJsonString = JSON.stringify(send_data, replacer);
console.log(formDataJsonString);
send_server(formDataJsonString);
});
$("#import-jar").on("submit", async function (e) {
wait_msg(true);
e.preventDefault();
let jarForm = document.getElementById("import-jar");
let formData = new FormData(jarForm);
//Create an object from the form data entries
let formDataObject = Object.fromEntries(formData.entries());
console.log(formDataObject);
let send_data = {
"name": formDataObject.name,
"roles": calcRoles(),
"monitoring_type": "minecraft_bedrock",
"minecraft_bedrock_monitoring_data": {
"host": "127.0.0.1",
"port": formDataObject.port
},
"create_type": "minecraft_bedrock",
"minecraft_bedrock_create_data": {
"create_type": "import_server",
"import_server_create_data": {
"existing_server_path": formDataObject.server_path,
"executable": formDataObject.server_jar,
}
}
}
console.log(send_data);
// Format the plain form data as JSON
let formDataJsonString = JSON.stringify(send_data, replacer);
send_server(formDataJsonString);
});
2023-02-02 23:47:54 +01:00
2023-08-31 21:35:50 -04:00
$("#import-zip").on("submit", async function (e) {
wait_msg(true);
e.preventDefault();
let jarForm = document.getElementById("import-zip");
2024-05-28 19:39:13 -04:00
var checkedRadio = $('.root-input:checked');
let zip_root_path = ""
if (checkedRadio.length > 0) {
// Get the value of the checked radio button
var checkedValue = checkedRadio.val();
zip_root_path = checkedValue; // Return the checked value if needed
}
2023-08-31 21:35:50 -04:00
let formData = new FormData(jarForm);
//Create an object from the form data entries
let formDataObject = Object.fromEntries(formData.entries());
console.log(formDataObject);
let send_data = {
"name": formDataObject.name,
"roles": calcRoles(),
"monitoring_type": "minecraft_bedrock",
"minecraft_bedrock_monitoring_data": {
"host": "127.0.0.1",
"port": formDataObject.port
},
"create_type": "minecraft_bedrock",
"minecraft_bedrock_create_data": {
"create_type": "import_server",
"import_server_create_data": {
2024-05-28 19:39:13 -04:00
"existing_server_path": zip_root_path,
2023-08-31 21:35:50 -04:00
"executable": formDataObject.server_jar,
}
}
}
console.log(send_data);
// Format the plain form data as JSON
let formDataJsonString = JSON.stringify(send_data, replacer);
send_server(formDataJsonString);
});
$("#import-upload").on("submit", async function (e) {
wait_msg(true);
e.preventDefault();
let jarForm = document.getElementById("import-upload");
let formData = new FormData(jarForm);
//Create an object from the form data entries
let formDataObject = Object.fromEntries(formData.entries());
console.log(formDataObject);
2024-05-28 19:39:13 -04:00
var checkedRadio = $('.root-input:checked');
let zip_root_path = ""
if (checkedRadio.length > 0) {
// Get the value of the checked radio button
var checkedValue = checkedRadio.val();
zip_root_path = checkedValue; // Return the checked value if needed
}
2023-08-31 21:35:50 -04:00
let send_data = {
"name": formDataObject.name,
"roles": calcRoles(),
"monitoring_type": "minecraft_bedrock",
"minecraft_bedrock_monitoring_data": {
"host": "127.0.0.1",
"port": formDataObject.port
},
"create_type": "minecraft_bedrock",
"minecraft_bedrock_create_data": {
"create_type": "import_server",
"import_server_create_data": {
2024-05-28 19:39:13 -04:00
"existing_server_path": zip_root_path,
2023-08-31 21:35:50 -04:00
"executable": formDataObject.server_jar,
}
}
}
console.log(send_data);
// Format the plain form data as JSON
let formDataJsonString = JSON.stringify(send_data, replacer);
send_server(formDataJsonString);
});
});
2022-02-10 15:54:00 -05:00
< / script >
2023-09-03 13:23:18 -04:00
< script type = "text/javascript" src = "../../static/assets/js/shared/root-dir.js" > < / script >
2024-06-21 13:25:07 -04:00
< script src = "../../static/assets/js/shared/bootstrap-select-1.13.18.js" > < / script >
2022-08-31 19:45:19 -04:00
{% end %}