2022-02-10 20:54:00 +00:00
{% extends ../base.html %}
{% block title %}Crafty Controller - {{ translate('serverWizard', 'newServer', data['lang']) }}{% end %}
{% block content %}
< div class = "content-wrapper" >
< ul class = "nav nav-tabs col-md-12 tab-simple-styled " role = "tablist" >
< li class = "nav-item term-nav-item" >
2022-08-31 23:45:19 +00:00
< a class = "nav-link" href = "/server/step1" role = "tab" aria-selected = "false" >
2022-02-10 20:54:00 +00: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 23:45:19 +00: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 17:54:31 +00:00
< form method = "post" id = "download_exe" name = "create_server" class = "server-wizard" >
2023-05-17 16:51:45 +00:00
{% if data["server_api"] and data["online"] %}
< fieldset >
{% else %}
< fieldset disabled = "disabled" >
< style >
.api-alert{
position:absolute;
top:-5px;
left:0;
font-size: 50px !important;
color:#fff;
background:rgb(127, 133, 133);
opacity:.4;
width:100%;
height:100%;
z-index: 100;
}
.api-alert p {
margin: 0;
position: absolute;
top: 50%;
left: 50%;
text-align: center;
font-size: 20px;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
< / style >
{% end %}
2023-02-02 22:47:54 +00:00
< div class = "form-group" >
< label for = "server_name" > {{ translate('serverWizard', 'serverName', data['lang']) }}< / label >
2023-08-25 17:54:31 +00:00
< input type = "text" class = "form-control" id = "server_name" name = "name" placeholder = "{{ translate('serverWizard', 'myNewServer', data['lang']) }}" required >
2022-08-31 23:45:19 +00:00
< / div >
2023-02-02 22:47:54 +00:00
< div class = "form-group" >
< div id = "accordion-1" >
< div class = "card" >
< div class = "card-header p-2" id = "Role-1" >
2023-03-12 09:43:50 +00:00
< p class = "mb-0 p-0" data-toggle = "collapse" data-target = "#collapseRole-1" aria-expanded = "true" aria-controls = "collapseRole-1" >
2023-02-02 22:47:54 +00:00
< i class = "fas fa-chevron-down" > < / i > {{ translate('serverWizard', 'addRole', data['lang']) }}
< small style = "text-transform: none;" > - {{ translate('serverWizard', 'autoCreate',
data['lang']) }}< / small >
< / p >
< / div >
< div id = "collapseRole-1" class = "collapse" aria-labelledby = "Role-1" data-parent = "" >
< div class = "card-body scroll" >
< div class = "form-group" >
{% for r in data['roles'] %}
2023-03-12 09:43:50 +00:00
< span class = "d-block menu-option" > < label > < input name = "{{ r['role_id'] }}" type = "checkbox" >
2023-02-02 22:47:54 +00:00
{{ r['role_name'].capitalize() }}< / label > < / span >
{% end %}
2022-08-31 23:45:19 +00:00
< / div >
2022-02-10 20:54:00 +00:00
< / div >
< / div >
2022-08-31 23:45:19 +00:00
< / div >
< / div >
< / div >
< 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 >
2023-05-17 16:51:45 +00:00
< / fieldset >
{% if not data["server_api"] and data["online"] %}
< div class = "api-alert" style = "position: absolute; top: -5px; z-index: 100; opacity: .99;" >
< 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"> {{ translate('error', 'craftyStatus', data['lang']) }}< / a >
{{ translate('error', 'serverJars2', data['lang']) }}< / p > < / div >
{% end %}
{% if not data["online"] %}
< div class = "api-alert" style = "position: absolute; top: -5px; z-index: 100; opacity: .99;" >
< p style = "color: white !important;" > < i class = "fas fa-exclamation-triangle" style = "color: red;" > < / i > {{ translate('error', 'noInternet', data['lang']) }}< / p > < / div >
{% end %}
2022-08-31 23:45:19 +00: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 17:54:31 +00:00
< form method = "post" id = "import-jar" class = "server-wizard" >
2023-02-02 22:47:54 +00:00
< div class = "form-group" >
< label for = "server_name" > {{ translate('serverWizard', 'serverName', data['lang']) }}< / label >
2023-08-25 17:54:31 +00:00
< input type = "text" class = "form-control" id = "server_name" name = "name" value = "" placeholder = "{{ translate('serverWizard', 'myNewServer', data['lang']) }}" required >
2023-02-02 22:47:54 +00:00
< / div >
< div class = "form-group" >
< label for = "server" > {{ translate('serverWizard', 'serverPath', data['lang']) }} < small > {{
translate('serverWizard', 'absoluteServerPath', data['lang']) }}< / small > < / label >
2023-03-12 09:43:50 +00:00
< input type = "text" class = "form-control" id = "server_path" name = "server_path" placeholder = "/var/opt/server" required >
2023-02-02 22:47:54 +00:00
< / div >
< div class = "form-group" >
< label for = "server_jar" > {{ translate('serverWizard', 'serverJar', data['lang']) }}< / label >
2023-03-12 09:43:50 +00:00
< input type = "text" class = "form-control" id = "server_jar" name = "server_jar" value = "" placeholder = "bedrock_server" required >
2022-08-31 23:45:19 +00:00
< / div >
< br / >
2023-03-12 09:43:50 +00:00
< h4 class = "card-title" > {{ translate('serverWizard', 'quickSettings', data['lang']) }} < small style = "text-transform: none;" > - {{ translate('serverWizard', 'quickSettingsDescription',
2022-08-31 23:45:19 +00:00
data['lang']) }}< / small > < / h4 >
< hr >
2023-02-02 22:47:54 +00:00
< div class = "form-group" >
< label for = "port2" > {{ translate('serverWizard', 'serverPort', data['lang']) }}
< small > < / small > < / label >
2023-03-12 09:43:50 +00:00
< input type = "number" class = "form-control" id = "port2" name = "port" value = "19132" step = "1" min = "1" max = "65535" required >
2023-02-02 22:47:54 +00:00
< / div >
< div class = "form-group" >
< div id = "accordion-2" >
< div class = "card" >
< div class = "card-header p-2" id = "Role-2" >
2023-03-12 09:43:50 +00:00
< p class = "mb-0 p-0" data-toggle = "collapse" data-target = "#collapseRole-2" aria-expanded = "true" aria-controls = "collapseRole-2" >
2023-02-02 22:47:54 +00:00
< i class = "fas fa-chevron-down" > < / i > {{ translate('serverWizard', 'addRole', data['lang']) }}
< small style = "text-transform: none;" > - {{ translate('serverWizard', 'autoCreate',
data['lang']) }}< / small >
< / p >
< / div >
< div id = "collapseRole-2" class = "collapse" aria-labelledby = "Role-2" data-parent = "" >
< div class = "card-body scroll" >
< div class = "form-group" >
{% for r in data['roles'] %}
2023-03-12 09:43:50 +00:00
< span class = "d-block menu-option" > < label > < input name = "{{ r['role_id'] }}" type = "checkbox" >
2023-02-02 22:47:54 +00:00
{{ r['role_name'].capitalize() }}< / label > < / span >
{% end %}
2022-02-10 20:54:00 +00:00
< / div >
< / div >
< / div >
< / div >
2022-08-31 23:45:19 +00:00
< / div >
< / div >
< 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 20:54:00 +00:00
< / div >
< / div >
2022-08-31 23:45:19 +00:00
< / div >
2023-02-02 22:47:54 +00:00
< div class = "col-md-6 grid-margin stretch-card" >
2022-08-31 23:45:19 +00:00
< div class = "card" >
< div class = "card-body" >
< h4 > {{ translate('serverWizard', 'importZip', data['lang']) }}< / h4 >
< br / >
2023-08-25 17:54:31 +00:00
< form name = "zip" id = "import-zip" method = "post" class = "server-wizard" > \
2022-08-31 23:45:19 +00:00
2023-02-02 22:47:54 +00:00
< div class = "form-group" >
< label for = "server_name" > {{ translate('serverWizard', 'serverName', data['lang']) }}< / label >
2023-08-25 17:54:31 +00:00
< input type = "text" class = "form-control" id = "server_name" name = "name" value = "" placeholder = "{{ translate('serverWizard', 'myNewServer', data['lang']) }}" required >
2022-08-31 23:45:19 +00:00
< / div >
2022-02-10 20:54:00 +00:00
2023-02-02 22:47:54 +00:00
< div class = "form-group" >
< label for = "server" > {{ translate('serverWizard', 'zipPath', data['lang']) }} < small > {{
translate('serverWizard', 'absoluteZipPath', data['lang']) }}< / small > < / label >
2023-03-12 09:43:50 +00:00
< input type = "text" class = "form-control" id = "server_path" name = "server_path" placeholder = "/var/opt/server.zip" required >
2023-02-02 22:47:54 +00:00
< / div >
2022-02-10 20:54:00 +00:00
2023-02-02 22:47:54 +00: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 >
2023-03-12 09:43:50 +00:00
< input type = "text" class = "form-control" id = "server_jar" name = "server_jar" value = "" placeholder = "bedrock_server" required >
2023-02-02 22:47:54 +00:00
< / div >
< h4 class = "card-title" > {{ translate('serverWizard', 'quickSettings', data['lang']) }} < small style = "text-transform: none;" > - {{ translate('serverWizard', 'quickSettingsDescription', data['lang']) }}< / small >
< / h4 >
< hr >
< div class = "form-group" >
< label for = "port3" > {{ translate('serverWizard', 'serverPort', data['lang']) }}
< small > < / small > < / label >
2023-03-12 09:43:50 +00:00
< input type = "number" class = "form-control" id = "port3" name = "port" value = "19132" step = "1" min = "1" max = "65535" required >
2023-02-02 22:47:54 +00:00
< / div >
< div class = "form-group" >
< div id = "accordion-3" >
< div class = "card" >
< div class = "card-header p-2" id = "Role-3" >
2023-03-12 09:43:50 +00:00
< p class = "mb-0 p-0" data-toggle = "collapse" data-target = "#collapseRole-3" aria-expanded = "true" aria-controls = "collapseRole-3" >
2023-02-02 22:47:54 +00:00
< i class = "fas fa-chevron-down" > < / i > {{ translate('serverWizard', 'addRole', data['lang'])
}} < small style = "text-transform: none;" > - {{ translate('serverWizard', 'autoCreate',
data['lang']) }}< / small >
< / p >
2022-08-31 23:45:19 +00:00
< / div >
2023-02-02 22:47:54 +00:00
< div id = "collapseRole-3" class = "collapse" aria-labelledby = "Role-3" data-parent = "" >
< div class = "card-body scroll" >
< div class = "form-group" >
{% for r in data['roles'] %}
2023-03-12 09:43:50 +00:00
< span class = "d-block menu-option" > < label > < input name = "{{ r['role_id'] }}" type = "checkbox" >
2023-02-02 22:47:54 +00:00
{{ r['role_name'].capitalize() }}< / label > < / span >
{% end %}
2022-02-10 20:54:00 +00:00
< / div >
2022-08-31 23:45:19 +00:00
< / div >
< / div >
< / div >
2023-02-02 22:47:54 +00:00
< / div >
< / div >
< div style = "visibility: hidden;" >
< div class = "form-group" >
< input type = "text" class = "form-control" id = "zip_root_path" name = "zip_root_path" >
< / div >
< / div >
2023-03-12 09:43:50 +00:00
< div class = "modal fade" id = "dir_select" tabindex = "-1" role = "dialog" aria-labelledby = "dir_select" aria-hidden = "true" >
2023-02-02 22:47:54 +00: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 23:45:19 +00:00
< / div >
2023-02-02 22:47:54 +00:00
< div class = "modal-body" >
2023-03-12 09:43:50 +00:00
< div class = "tree-ctx-item" id = "main-tree-div" data-path = "" style = "overflow: scroll; max-height:75%;" >
2023-02-02 22:47:54 +00:00
< input type = "radio" id = "main-tree-input" name = "root_path" value = "" checked >
< 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 20:54:00 +00:00
< / div >
< / div >
2023-02-02 22:47:54 +00: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 20:54:00 +00:00
< / div >
2022-08-31 23:45:19 +00:00
< / div >
< / div >
2023-03-12 09:43:50 +00: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 22:47:54 +00:00
}}< / button >
< button type = "button" class = "btn btn-danger mr-2 tree-reset" > {{ translate('serverWizard', 'resetForm',
data['lang'])
}}< / button >
< / form >
2022-02-10 20:54:00 +00:00
< / div >
< / div >
2022-08-31 23:45:19 +00:00
< / div >
2023-02-02 22:47:54 +00:00
< div class = "col-md-6 grid-margin stretch-card" >
2022-09-28 02:49:52 +00:00
< div class = "card" >
< div class = "card-body" >
< h4 > {{ translate('serverWizard', 'uploadZip', data['lang']) }}< / h4 >
< br / >
< p class = "card-description" >
2023-08-25 17:54:31 +00:00
< form name = "zip" id = "import-upload" method = "post" class = "server-wizard" >
2022-09-28 02:49:52 +00:00
2023-02-02 22:47:54 +00:00
< div class = "form-group" >
< label for = "server_name" > {{ translate('serverWizard', 'serverName', data['lang']) }}< / label >
2023-08-25 17:54:31 +00:00
< input type = "text" class = "form-control" id = "server_name" name = "name" value = "" placeholder = "{{ translate('serverWizard', 'myNewServer', data['lang']) }}" required >
2023-02-02 22:47:54 +00:00
< / div >
2022-09-28 02:49:52 +00:00
2023-02-02 22:47:54 +00: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 >
< label id = "fileLabel" class = "custom-file-label" for = "file" > {{ translate('serverWizard', 'labelZipFile', data['lang']) }}< / label >
2022-09-28 02:49:52 +00:00
< / div >
2023-02-02 22:47:54 +00:00
< div class = "input-group-append" >
2023-05-18 07:53:23 +00:00
< button type = "button" class = "btn btn-info upload-button" id = "upload-button" onclick = "sendFile()" disabled > {{ translate('serverWizard',
2023-03-12 09:43:50 +00:00
'uploadButton', data['lang']) }}< / button >
2022-09-28 02:49:52 +00:00
< / div >
2023-02-02 22:47:54 +00: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-28 02:49:52 +00:00
2023-02-02 22:47:54 +00:00
< div class = "form-group" >
< label for = "server_jar" > {{ translate('serverWizard', 'serverJar', data['lang']) }}< / label >
2023-03-12 09:43:50 +00:00
< input type = "text" class = "form-control" id = "server_jar" name = "server_jar" value = "" placeholder = "paper.jar" required >
2023-02-02 22:47:54 +00:00
< / div >
2022-09-28 02:49:52 +00:00
2023-03-12 09:43:50 +00:00
< h4 class = "card-title" > {{ translate('serverWizard', 'quickSettings', data['lang']) }} < small style = "text-transform: none;" > - {{ translate('serverWizard', 'quickSettingsDescription',
2023-02-02 22:47:54 +00:00
data['lang']) }}< / small > < / h4 >
< hr >
2022-09-28 02:49:52 +00:00
2023-02-02 22:47:54 +00:00
< div class = "form-group" >
< label for = "port3" > {{ translate('serverWizard', 'serverPort', data['lang']) }} < small > - {{
translate('serverWizard', 'defaultPort', data['lang']) }}< / small > < / label >
2023-03-12 09:43:50 +00:00
< input type = "number" class = "form-control" id = "port4" name = "port" value = "19132" step = "1" min = "1" max = "65535" required >
2023-02-02 22:47:54 +00:00
< / div >
2022-09-28 02:49:52 +00:00
2023-02-02 22:47:54 +00:00
< div class = "form-group" >
< div id = "accordion-3" >
< div class = "card" >
< div class = "card-header p-2" id = "Role-3" >
2023-03-12 09:43:50 +00:00
< p class = "mb-0 p-0" data-toggle = "collapse" data-target = "#collapseRole-3" aria-expanded = "true" aria-controls = "collapseRole-3" >
2023-02-02 22:47:54 +00:00
< i class = "fas fa-chevron-down" > < / i > {{ translate('serverWizard', 'addRole',
data['lang'])
}} < small style = "text-transform: none;" > - {{ translate('serverWizard', 'autoCreate',
data['lang']) }}< / small >
< / p >
2022-09-28 02:49:52 +00:00
< / div >
2023-02-02 22:47:54 +00:00
< div id = "collapseRole-3" class = "collapse" aria-labelledby = "Role-3" data-parent = "" >
< div class = "card-body scroll" >
< div class = "form-group" >
{% for r in data['roles'] %}
2023-03-12 09:43:50 +00:00
< span class = "d-block menu-option" > < label > < input name = "{{ r['role_id'] }}" type = "checkbox" >
2023-02-02 22:47:54 +00:00
{{ r['role_name'].capitalize() }}< / label > < / span >
{% end %}
2022-09-28 02:49:52 +00:00
< / div >
< / div >
< / div >
2023-02-02 22:47:54 +00:00
< / div >
< / div >
< / div >
< div style = "visibility: hidden;" >
< div class = "form-group" >
< input type = "text" class = "form-control" id = "zip_root_path" name = "zip_root_path" >
< / div >
< / div >
2023-03-12 09:43:50 +00:00
< div class = "modal fade" id = "dir_upload_select" tabindex = "-1" role = "dialog" aria-labelledby = "dir_select" aria-hidden = "true" >
2023-02-02 22:47:54 +00: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-28 02:49:52 +00:00
< / div >
2023-02-02 22:47:54 +00:00
< div class = "modal-body" >
2023-03-12 09:43:50 +00:00
< div class = "tree-ctx-item" id = "main-tree-div-upload" data-path = "" style = "overflow: scroll; max-height:75%;" >
2023-02-02 22:47:54 +00:00
< input type = "radio" id = "main-tree-input-upload" name = "root_path" value = "" checked >
< 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-28 02:49:52 +00:00
< / div >
< / div >
2023-02-02 22:47:54 +00: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-28 02:49:52 +00:00
< / div >
< / div >
< / div >
2023-03-12 09:43:50 +00: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 22:47:54 +00:00
}}< / button >
< button type = "button" class = "btn btn-danger mr-2 tree-reset" > {{ translate('serverWizard', 'resetForm',
data['lang'])
}}< / button >
2022-09-28 02:49:52 +00:00
< / div >
< / form >
< / div >
< / div >
2022-09-04 22:27:45 +00:00
< / div >
2022-08-31 23:45:19 +00:00
< / div >
2022-02-10 20:54:00 +00:00
< / div >
< style >
2023-02-02 22:47:54 +00:00
div>.input-group>.custom-file-input {
position: relative !important;
-webkit-box-flex: 1 !important;
-ms-flex: 1 1 auto !important;
flex: 1 1 auto !important;
width: 1% !important;
margin-bottom: 0 !important;
border: 1px solid var(--outline);
}
2022-08-31 23:45:19 +00:00
.scroll {
2022-02-10 20:54:00 +00:00
max-height: 12em;
overflow-y: auto;
2022-08-31 23:45:19 +00:00
}
.menu-btn {
2022-02-10 20:54:00 +00:00
font-size: 0.9em;
padding: 2px 10px;
2022-08-31 23:45:19 +00:00
}
.menu {
2022-02-10 20:54:00 +00:00
padding-top: 10px;
z-index: 200;
margin-top: 4px;
position: absolute;
2022-09-25 21:52:01 +00:00
background-color: var(--card-banner-bg);
2022-08-31 23:45:19 +00:00
}
.menu-option {
2022-02-10 20:54:00 +00:00
padding: 6px 20px 6px;
color: white;
2022-08-31 23:45:19 +00:00
}
#overlay {
2022-02-10 20:54:00 +00:00
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
z-index: 100;
2022-08-31 23:45:19 +00:00
}
2022-09-04 22:27:45 +00:00
#op_logo {
position: relative;
top: 50%;
transform: translateY(-50%);
}
2022-02-10 20:54:00 +00:00
< / style >
< style >
/* Remove default bullets */
2022-08-31 23:45:19 +00:00
.tree-view,
.tree-nested {
list-style-type: none;
margin: 0;
padding: 0;
margin-left: 10px;
}
/* Style the items */
.tree-item,
.files-tree-title {
cursor: pointer;
user-select: none;
/* Prevent text selection */
}
/* Create the caret/arrow with a unicode, and style it */
.tree-caret .fa-folder {
display: inline-block;
}
.tree-caret .fa-folder-open {
display: none;
}
/* Rotate the caret/arrow icon when clicked on (using JavaScript) */
.tree-caret-down .fa-folder {
display: none;
}
.tree-caret-down .fa-folder-open {
display: inline-block;
}
/* Hide the nested list */
.tree-nested {
display: none;
}
2022-02-10 20:54:00 +00:00
< / style >
{% end %}
{% block js%}
< script >
2022-12-15 23:48:15 +00:00
var upload;
2022-09-28 02:49:52 +00:00
var file;
function sendFile() {
file = $("#file")[0].files[0]
2023-02-02 22:47:54 +00:00
document.getElementById("upload_input").innerHTML = '< div class = "progress" style = "width: 100%;" > < div class = "progress-bar progress-bar-striped progress-bar-animated" role = "progressbar" aria-valuenow = "100" aria-valuemin = "0" aria-valuemax = "100" style = "width: 100%" > < i class = "fa-solid fa-spinner" > < / i > < / div > < / div > '
2022-09-28 02:49:52 +00:00
let xmlHttpRequest = new XMLHttpRequest();
let token = getCookie("_xsrf")
2022-12-01 01:28:24 +00:00
let fileName = encodeURIComponent(file.name)
2022-09-28 02:49:52 +00:00
let target = '/upload'
let mimeType = file.type
let size = file.size
let type = 'server_import'
2023-02-01 20:43:17 +00:00
xmlHttpRequest.upload.addEventListener('progress', function (e) {
if (e.loaded < = size) {
var percent = Math.round(e.loaded / size * 100);
$(`#upload-progress-bar`).css('width', percent + '%');
$(`#upload-progress-bar`).html(percent + '%');
}
});
2022-09-28 02:49:52 +00:00
xmlHttpRequest.open('POST', target, true);
xmlHttpRequest.setRequestHeader('X-Content-Type', mimeType);
xmlHttpRequest.setRequestHeader('X-XSRFToken', token);
xmlHttpRequest.setRequestHeader('X-Content-Length', size);
xmlHttpRequest.setRequestHeader('X-Content-Disposition', 'attachment; filename="' + fileName + '"');
xmlHttpRequest.setRequestHeader('X-Content-Upload-Type', type);
xmlHttpRequest.setRequestHeader('X-FileName', fileName);
xmlHttpRequest.addEventListener('load', (event) => {
if (event.target.responseText == 'success') {
console.log('Upload for file', file.name, 'was successful!')
2023-02-02 22:47:54 +00:00
document.getElementById("upload_input").innerHTML = '< div class = "card-header header-sm d-flex justify-content-between align-items-center" style = "width: 100%;" > < span id = "file-uploaded" style = "color: gray;" > ' + fileName + '< / span > 🔒< / div > ';
2022-09-28 02:49:52 +00:00
document.getElementById("lower_half").style.visibility = "visible";
}
else {
2023-02-01 22:09:39 +00:00
let response_text = JSON.parse(event.target.responseText);
var x = document.querySelector('.bootbox');
console.log(JSON.parse(event.target.responseText).info)
bootbox.alert({
message: JSON.parse(event.target.responseText).info,
callback: function () {
window.location.reload();
}
});
2022-09-28 02:49:52 +00:00
doUpload = false;
}
}, false);
xmlHttpRequest.addEventListener('error', (e) => {
console.error('Error while uploading file', file.name + '.', 'Event:', e)
}, false);
xmlHttpRequest.send(file);
}
document.getElementById("root_upload_button").addEventListener("click", function () {
if (file) {
2022-12-15 23:48:15 +00:00
upload = true;
2022-09-28 02:49:52 +00:00
if (document.getElementById('root_upload_button').classList.contains('clicked')) {
2022-12-15 23:48:15 +00:00
document.getElementById('main-tree-div-upload').innerHTML = '< input type = "radio" id = "main-tree-input-upload" name = "root_path" value = "" checked > < span id = "main-tree-upload" 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-28 02:49:52 +00:00
} else {
document.getElementById('root_upload_button').classList.add('clicked')
}
var token = getCookie("_xsrf");
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
});
$.ajax({
type: "POST",
headers: { 'X-XSRFToken': token },
2022-12-01 01:28:24 +00:00
url: '/ajax/unzip_server?id=-1& file=' + encodeURIComponent(file.name),
2022-09-28 02:49:52 +00:00
});
} else {
bootbox.alert("You must input a path before selecting this button");
}
});
2022-08-31 23:45:19 +00:00
function eula_confirm() {
bootbox.confirm({
title: "{% raw translate('error', 'eulaTitle', data['lang']) %}",
2022-09-01 18:18:04 +00: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 23:45:19 +00:00
buttons: {
confirm: {
2022-09-01 18:18:04 +00:00
label: "{% raw translate('error', 'agree', data['lang']) %}",
2022-08-31 23:45:19 +00:00
className: 'btn-info'
},
cancel: {
2022-09-01 18:18:04 +00:00
label: "{% raw translate('error', 'cancel', data['lang']) %}",
2022-08-31 23:45:19 +00:00
className: 'btn-secondary'
}
},
callback: function (result) {
if (result == true) {
2023-08-25 17:54:31 +00:00
$("#download_exe").submit();
2022-08-31 23:45:19 +00:00
}
else {
return;
}
}
})
}
< / script >
< script >
2022-10-02 19:54:13 +00:00
$(".tree-reset").on("click", function () {
location.href = "/server/bedrock_step1";
});
2022-08-31 23:45:19 +00:00
document.getElementById("root_files_button").addEventListener("click", function () {
if (document.forms["zip"]["server_path"].value != "") {
if (document.getElementById('root_files_button').classList.contains('clicked')) {
2022-02-10 20:54:00 +00:00
document.getElementById('main-tree-div').innerHTML = '< input type = "radio" id = "main-tree-input" name = "root_path" value = "" checked > < 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-08-31 23:45:19 +00:00
} else {
2022-02-10 20:54:00 +00:00
document.getElementById('root_files_button').classList.add('clicked')
}
2022-08-31 23:45:19 +00:00
path = document.forms["zip"]["server_path"].value;
console.log(document.forms["zip"]["server_path"].value)
var token = getCookie("_xsrf");
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
});
$.ajax({
type: "POST",
headers: { 'X-XSRFToken': token },
2022-12-01 01:28:24 +00:00
url: '/ajax/unzip_server?id=-1& path=' + encodeURIComponent(path),
2022-08-31 23:45:19 +00:00
});
} else {
bootbox.alert("You must input a path before selecting this button");
}
2022-02-10 20:54:00 +00:00
});
< / script >
< script >
2022-08-31 23:45:19 +00:00
function dropDown(event) {
2022-02-10 20:54:00 +00:00
event.target.parentElement.children[1].classList.remove("d-none");
document.getElementById("overlay").classList.remove("d-none");
2022-08-31 23:45:19 +00:00
}
function hide(event) {
2022-02-10 20:54:00 +00:00
var items = document.getElementsByClassName('menu');
for (let i = 0; i < items.length ; i + + ) {
2022-08-31 23:45:19 +00:00
items[i].classList.add("d-none");
2022-02-10 20:54:00 +00:00
}
document.getElementById("overlay").classList.add("d-none");
2022-08-31 23:45:19 +00:00
}
2022-02-10 20:54:00 +00:00
2022-08-31 23:45:19 +00:00
function wait_msg(importing) {
2022-02-10 20:54:00 +00:00
bootbox.alert({
2022-08-31 23:45:19 +00: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 20:54:00 +00:00
}
2022-08-31 23:45:19 +00:00
function show_file_tree() {
2022-12-15 23:48:15 +00:00
if (upload) {
$("#dir_upload_select").modal();
} else {
$("#dir_select").modal();
}
2022-02-10 20:54:00 +00:00
}
2022-08-31 23:45:19 +00:00
function getTreeView(path) {
2022-10-03 19:38:45 +00:00
const styles = window.getComputedStyle(document.getElementById("lower_half"));
//If this value is still hidden we know the user is executing a zip import and not an upload
if (styles.visibility === "hidden") {
2022-09-28 02:49:52 +00:00
document.getElementById('zip_submit').disabled = false;
} else {
document.getElementById('upload_submit').disabled = false;
}
2022-08-31 23:45:19 +00:00
path = path
2022-02-10 20:54:00 +00:00
2022-08-31 23:45:19 +00:00
$.ajax({
type: "GET",
url: '/ajax/get_zip_tree?id=-1& path=' + path,
dataType: 'text',
success: function (data) {
console.log("got response:");
console.log(data);
dataArr = data.split('\n');
serverDir = dataArr.shift(); // Remove & return first element (server directory)
text = dataArr.join('\n');
2022-12-15 23:48:15 +00:00
if (styles.visibility === "hidden") {
try {
document.getElementById('main-tree-div').innerHTML += text;
document.getElementById('main-tree').parentElement.classList.add("clicked");
} catch {
document.getElementById('files-tree').innerHTML = text;
}
} else {
try {
document.getElementById('main-tree-div-upload').innerHTML += text;
document.getElementById('main-tree-upload').parentElement.classList.add("clicked");
} catch {
document.getElementById('files-tree').innerHTML = text;
}
2022-08-31 23:45:19 +00:00
}
2022-06-03 18:50:58 +00:00
2022-02-10 20:54:00 +00:00
2022-08-31 23:45:19 +00:00
document.getElementsByClassName('files-tree-title')[0].setAttribute('data-path', serverDir);
document.getElementsByClassName('files-tree-title')[0].setAttribute('data-name', 'Files');
2022-02-10 20:54:00 +00:00
2022-08-31 23:45:19 +00:00
},
});
}
2022-02-10 20:54:00 +00:00
2022-08-31 23:45:19 +00:00
function getToggleMain(event) {
path = event.target.parentElement.getAttribute('data-path');
document.getElementById("files-tree").classList.toggle("d-block");
document.getElementById(path + "span").classList.toggle("tree-caret-down");
document.getElementById(path + "span").classList.toggle("tree-caret");
}
2022-06-03 18:50:58 +00:00
2022-02-10 20:54:00 +00:00
2022-08-31 23:45:19 +00:00
function getDirView(event) {
path = event.target.parentElement.getAttribute('data-path');
2022-02-10 20:54:00 +00:00
2022-08-31 23:45:19 +00:00
if (document.getElementById(path).classList.contains('clicked')) {
2022-02-10 20:54:00 +00:00
2022-08-31 23:45:19 +00:00
var toggler = document.getElementById(path + "span");
2022-02-10 20:54:00 +00:00
2022-08-31 23:45:19 +00:00
if (toggler.classList.contains('files-tree-title')) {
document.getElementById(path + "ul").classList.toggle("d-block");
document.getElementById(path + "span").classList.toggle("tree-caret-down");
}
return;
} else {
2022-02-10 20:54:00 +00:00
$.ajax({
type: "GET",
2022-08-31 23:45:19 +00:00
url: '/ajax/get_zip_dir?id=-1& path=' + path,
2022-02-10 20:54:00 +00:00
dataType: 'text',
2022-08-31 23:45:19 +00:00
success: function (data) {
2022-02-10 20:54:00 +00:00
console.log("got response:");
dataArr = data.split('\n');
serverDir = dataArr.shift(); // Remove & return first element (server directory)
text = dataArr.join('\n');
2022-08-31 23:45:19 +00:00
try {
document.getElementById(path + "span").classList.add('tree-caret-down');
2022-02-10 20:54:00 +00:00
document.getElementById(path).innerHTML += text;
document.getElementById(path).classList.add("clicked");
2022-08-31 23:45:19 +00:00
} catch {
2022-02-10 20:54:00 +00:00
console.log("Bad")
}
var toggler = document.getElementById(path);
2022-06-03 18:50:58 +00:00
2022-08-31 23:45:19 +00:00
if (toggler.classList.contains('files-tree-title')) {
document.getElementById(path + "span").addEventListener("click", function caretListener() {
document.getElementById(path + "ul").classList.toggle("d-block");
document.getElementById(path + "span").classList.toggle("tree-caret-down");
2022-02-10 20:54:00 +00:00
});
}
},
});
}
2022-08-31 23:45:19 +00:00
}
if (webSocket) {
webSocket.on('send_temp_path', function (data) {
setTimeout(function () {
var x = document.querySelector('.bootbox');
if (x) {
x.remove()
}
var x = document.querySelector('.modal-backdrop');
if (x) {
x.remove()
}
document.getElementById('main-tree-input').setAttribute('value', data.path)
2022-09-28 02:49:52 +00:00
document.getElementById('main-tree-input-upload').setAttribute('value', data.path)
2022-08-31 23:45:19 +00:00
getTreeView(data.path);
show_file_tree();
2022-10-02 19:54:13 +00:00
$("#root_files_button").attr("disabled", "disabled");
$("#root_upload_button").attr("disabled", "disabled");
2022-06-03 18:50:58 +00:00
2022-03-01 01:02:30 +00:00
}, 5000);
2022-08-31 23:45:19 +00:00
});
}
2022-02-10 20:54:00 +00:00
2023-02-02 22:47:54 +00: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 17:54:31 +00:00
function replacer(key, value) {
if (key === "roles"){
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() {
let role_ids = $('.roles').map(function() {
if ($(this).is(':checked')){
return $(this).val();
}
}).get();
console.log(role_ids)
return role_ids
}
async function send_server(data){
let token = getCookie("_xsrf")
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
});
}
}
$(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",
2023-08-27 18:55:21 +00:00
"download_exe_create_data": {
//agree to eula since we confirmed before calling this function
"agree_to_eula": true,
}
2023-08-25 17:54:31 +00:00
}
}
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);
});
$("#import-zip").on("submit", async function (e) {
wait_msg(true);
e.preventDefault();
let jarForm = document.getElementById("import-zip");
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.root_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);
});
$("#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);
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.root_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 22:47:54 +00:00
2023-08-25 17:54:31 +00:00
});
2022-02-10 20:54:00 +00:00
< / script >
2022-08-31 23:45:19 +00:00
{% end %}