2020-09-04 04:02:03 +00:00
|
|
|
{% extends ../base.html %}
|
|
|
|
|
|
|
|
{% block meta %}
|
|
|
|
{% end %}
|
|
|
|
|
2021-09-29 02:25:47 +00:00
|
|
|
{% block title %}Crafty Controller - {{ translate('serverDetails', 'serverDetails', data['lang']) }}{% end %}
|
2020-09-04 04:02:03 +00:00
|
|
|
|
|
|
|
{% block content %}
|
|
|
|
|
|
|
|
<div class="content-wrapper">
|
|
|
|
|
2022-01-21 22:50:04 +00:00
|
|
|
<!-- Page Title Header Starts-->
|
2020-09-04 04:02:03 +00:00
|
|
|
<div class="row page-title-header">
|
|
|
|
<div class="col-12">
|
|
|
|
<div class="page-header">
|
|
|
|
<h4 class="page-title">
|
2022-01-21 22:50:04 +00:00
|
|
|
{{ translate('serverDetails', 'serverDetails', data['lang']) }} - {{
|
|
|
|
data['server_stats']['server_id']['server_name'] }}
|
|
|
|
<br />
|
|
|
|
<small>UUID: {{ data['server_stats']['server_id']['server_uuid'] }}</small>
|
2020-09-04 04:02:03 +00:00
|
|
|
</h4>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<!-- Page Title Header Ends-->
|
|
|
|
|
2022-01-21 22:50:04 +00:00
|
|
|
{% include "parts/details_stats.html" %}
|
2020-09-04 04:02:03 +00:00
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
|
|
|
|
<div class="col-sm-12 grid-margin">
|
|
|
|
<div class="card">
|
|
|
|
<div class="card-body pt-0">
|
2022-08-06 00:04:34 +00:00
|
|
|
{% if not data['failed'] %}
|
2022-06-21 19:59:34 +00:00
|
|
|
<span class="d-none d-sm-block">
|
|
|
|
{% include "parts/server_controls_list.html %}
|
|
|
|
</span>
|
|
|
|
<span class="d-block d-sm-none">
|
|
|
|
{% include "parts/m_server_controls_list.html %}
|
|
|
|
</span>
|
2022-08-06 00:04:34 +00:00
|
|
|
{% end %}
|
2022-01-21 22:50:04 +00:00
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-6 col-sm-12">
|
2023-03-03 22:16:53 +00:00
|
|
|
<form class="forms-sample" method="post" id="config_form">
|
2022-01-21 22:50:04 +00:00
|
|
|
|
|
|
|
<div class="form-group">
|
2023-05-18 07:53:23 +00:00
|
|
|
<label for="server_name">{{ translate('serverConfig', 'serverName', data['lang']) }} <small class="text-muted ml-1"> - {{ translate('serverConfig', 'serverNameDesc', data['lang']) }}</small>
|
2022-01-21 22:50:04 +00:00
|
|
|
</label>
|
2023-05-18 07:53:23 +00:00
|
|
|
<input type="text" class="form-control" name="server_name" id="server_name" value="{{ data['server_stats']['server_id']['server_name'] }}" placeholder="{{ translate('serverConfig', 'serverName', data['lang']) }}" required>
|
2020-09-04 18:05:42 +00:00
|
|
|
</div>
|
2020-09-04 04:02:03 +00:00
|
|
|
|
2022-06-21 00:50:34 +00:00
|
|
|
{% if data['super_user'] %}
|
2022-01-21 22:50:04 +00:00
|
|
|
<div class="form-group">
|
2023-05-18 07:53:23 +00:00
|
|
|
<label for="server_path">{{ translate('serverConfig', 'serverPath', data['lang']) }} <small class="text-muted ml-1"> - {{ translate('serverConfig', 'serverPathDesc', data['lang']) }}</small>
|
2022-01-21 22:50:04 +00:00
|
|
|
</label>
|
2022-12-17 17:21:15 +00:00
|
|
|
<div class="card-header header-sm d-flex justify-content-between align-items-center">
|
2023-05-22 21:10:50 +00:00
|
|
|
<span style="color: gray; font-size: .9vw;">{{ data['server_stats']['server_id']['path'] }}</span>
|
2022-12-17 17:21:15 +00:00
|
|
|
🔒
|
|
|
|
</div>
|
2022-01-21 22:50:04 +00:00
|
|
|
|
|
|
|
</div>
|
2022-08-31 16:39:52 +00:00
|
|
|
{% if data['server_stats']['server_type'] != "minecraft-bedrock" %}
|
2022-01-21 22:50:04 +00:00
|
|
|
<div class="form-group">
|
2023-05-18 07:53:23 +00:00
|
|
|
<label for="log_path">{{ translate('serverConfig', 'serverLogLocation', data['lang']) }} <small class="text-muted ml-1"> - {{ translate('serverConfig', 'serverLogLocationDesc', data['lang'])
|
2022-01-21 22:50:04 +00:00
|
|
|
}}</small> </label>
|
2023-05-18 07:53:23 +00:00
|
|
|
<input type="text" class="form-control" name="log_path" id="log_path" value="{{ data['server_stats']['server_id']['log_path'] }}" placeholder="{{ translate('serverConfig', 'serverLogLocation', data['lang']) }}" required>
|
2022-01-21 22:50:04 +00:00
|
|
|
</div>
|
2022-08-31 16:39:52 +00:00
|
|
|
{% end %}
|
2022-01-21 22:50:04 +00:00
|
|
|
|
|
|
|
<div class="form-group">
|
2023-05-18 07:53:23 +00:00
|
|
|
<label for="executable">{{ translate('serverConfig', 'serverExecutable', data['lang']) }} <small class="text-muted ml-1"> - {{ translate('serverConfig', 'serverExecutableDesc', data['lang'])
|
2022-01-21 22:50:04 +00:00
|
|
|
}}</small> </label>
|
2023-05-18 07:53:23 +00:00
|
|
|
<input type="text" class="form-control" name="executable" id="executable" value="{{ data['server_stats']['server_id']['executable'] }}" placeholder="{{ translate('serverConfig', 'serverExecutable', data['lang']) }}" required>
|
2022-01-21 22:50:04 +00:00
|
|
|
</div>
|
2022-06-21 00:50:34 +00:00
|
|
|
{% end %}
|
2022-06-21 18:05:56 +00:00
|
|
|
{% if data['server_stats']['server_type'] == "minecraft-java" %}
|
2022-06-20 22:44:33 +00:00
|
|
|
<div class="form-group">
|
2022-06-21 18:53:23 +00:00
|
|
|
<label for="java_selection">{{ translate('serverConfig', 'javaVersion', data['lang']) }}
|
2022-06-21 19:59:34 +00:00
|
|
|
<small class="text-muted ml-1">{{ translate('serverConfig', 'javaVersionDesc', data['lang'])
|
|
|
|
}}</small>
|
2022-06-21 18:53:23 +00:00
|
|
|
</label>
|
2023-05-18 07:53:23 +00:00
|
|
|
<select class="form-select form-control form-control-lg select-css" id="java_selection" name="java_selection" form="config_form">
|
|
|
|
<option value="none">{{ translate('serverConfig', 'javaNoChange', data['lang'])}}</option>
|
2022-06-20 22:53:19 +00:00
|
|
|
{% for path in data['java_versions'] %}
|
2022-06-21 19:59:34 +00:00
|
|
|
<option value="{{path}}">{{path}}</option>
|
2022-06-20 22:53:19 +00:00
|
|
|
{% end %}
|
|
|
|
</select>
|
2022-06-20 22:44:33 +00:00
|
|
|
</div>
|
2022-06-21 18:05:56 +00:00
|
|
|
{% end %}
|
|
|
|
|
2022-06-21 00:50:34 +00:00
|
|
|
{% if data['super_user'] %}
|
2022-01-21 22:50:04 +00:00
|
|
|
<div class="form-group">
|
|
|
|
<label for="execution_command">{{ translate('serverConfig', 'serverExecutionCommand', data['lang']) }}
|
|
|
|
<small class="text-muted ml-1"> - {{ translate('serverConfig', 'serverExecutionCommandDesc',
|
|
|
|
data['lang']) }}</small> </label>
|
2023-05-18 07:53:23 +00:00
|
|
|
<input type="text" class="form-control" name="execution_command" id="execution_command" value="{{ data['server_stats']['server_id']['execution_command'] }}" placeholder="{{ translate('serverConfig', 'serverExecutionCommand', data['lang']) }}" required>
|
2022-01-21 22:50:04 +00:00
|
|
|
</div>
|
2022-06-21 19:11:01 +00:00
|
|
|
{% else %}
|
|
|
|
<label for="execution_command">{{ translate('serverConfig', 'serverExecutionCommand', data['lang']) }}
|
2022-06-21 19:59:34 +00:00
|
|
|
<div class="card-header header-sm d-flex justify-content-between align-items-center">
|
2023-05-22 21:10:37 +00:00
|
|
|
<span style="color: gray; font-size: .9vw;">{{ data['server_stats']['server_id']['execution_command'] }}</span> 🔒
|
2022-06-21 19:59:34 +00:00
|
|
|
</div>
|
|
|
|
<br>
|
|
|
|
{% end %}
|
|
|
|
<div class="form-group">
|
2023-05-18 07:53:23 +00:00
|
|
|
<label for="stop_command">{{ translate('serverConfig', 'serverStopCommand', data['lang']) }} <small class="text-muted ml-1"> - {{ translate('serverConfig', 'serverStopCommandDesc', data['lang'])
|
2022-06-21 19:59:34 +00:00
|
|
|
}}</small> </label>
|
2023-05-18 07:53:23 +00:00
|
|
|
<input type="text" class="form-control" name="stop_command" id="stop_command" value="{{ data['server_stats']['server_id']['stop_command'] }}" placeholder="{{ translate('serverConfig', 'serverStopCommand', data['lang']) }}" required>
|
2022-06-21 19:59:34 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="auto_start_delay">{{ translate('serverConfig', 'serverAutostartDelay', data['lang']) }}
|
|
|
|
<small class="text-muted ml-1"> - {{ translate('serverConfig', 'serverAutostartDelayDesc',
|
|
|
|
data['lang']) }}</small> </label>
|
2023-05-18 07:53:23 +00:00
|
|
|
<input type="number" class="form-control" name="auto_start_delay" id="auto_start_delay" value="{{ data['server_stats']['server_id']['auto_start_delay'] }}" step="1" max="999" min="10" required>
|
2022-06-21 19:59:34 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
{% if data['super_user'] %}
|
2022-08-31 23:36:43 +00:00
|
|
|
{% if data['server_stats']['server_type'] != "minecraft-bedrock" %}
|
2022-06-21 19:59:34 +00:00
|
|
|
<div class="form-group">
|
|
|
|
<label for="executable_update_url">{{ translate('serverConfig', 'exeUpdateURL', data['lang']) }}
|
|
|
|
<small class="text-muted ml-1"> - {{ translate('serverConfig', 'exeUpdateURLDesc', data['lang'])
|
|
|
|
}}</small> </label>
|
2023-05-18 07:53:23 +00:00
|
|
|
<input type="text" class="form-control" name="executable_update_url" id="executable_update_url" value="{{ data['server_stats']['server_id']['executable_update_url'] }}" placeholder="{{ translate('serverConfig', 'exeUpdateURL', data['lang']) }}">
|
2022-06-21 19:59:34 +00:00
|
|
|
</div>
|
2022-08-31 23:36:43 +00:00
|
|
|
{% end %}
|
2022-06-21 19:59:34 +00:00
|
|
|
|
|
|
|
<div class="form-group">
|
2023-05-18 07:53:23 +00:00
|
|
|
<label for="server_ip">{{ translate('serverConfig', 'serverIP', data['lang']) }} <small class="text-muted ml-1">- {{ translate('serverConfig', 'serverIPDesc', data['lang']) }}</small>
|
2022-06-21 19:59:34 +00:00
|
|
|
</label>
|
2023-05-18 07:53:23 +00:00
|
|
|
<input type="text" class="form-control" name="server_ip" id="server_ip" value="{{ data['server_stats']['server_id']['server_ip'] }}" required>
|
2022-06-21 19:59:34 +00:00
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
2023-05-18 07:53:23 +00:00
|
|
|
<label for="server_port">{{ translate('serverConfig', 'serverPort', data['lang']) }} <small class="text-muted ml-1"> - {{ translate('serverConfig', 'serverPortDesc', data['lang']) }}
|
2022-06-21 19:59:34 +00:00
|
|
|
</small> </label>
|
2023-05-18 07:53:23 +00:00
|
|
|
<input type="number" class="form-control" name="server_port" id="server_port" value="{{ data['server_stats']['server_id']['server_port'] }}" step="1" max="65566" min="1" required>
|
2023-10-18 17:51:38 +00:00
|
|
|
<span data-html="true" class="port-hint text-center" title="<i class='fa-solid fa-triangle-exclamation'></i> " , data-content="{{
|
2023-05-18 07:53:23 +00:00
|
|
|
translate('serverConfig', 'statsHint1' , data['lang'])}} <br> <br> <strong>{{ translate('serverConfig', 'statsHint2', data['lang'])}}</strong>" , data-placement="right"></span>
|
2022-06-21 19:59:34 +00:00
|
|
|
</div>
|
2022-08-21 16:46:07 +00:00
|
|
|
{% end %}
|
|
|
|
|
2022-08-21 16:41:28 +00:00
|
|
|
<div class="form-group">
|
|
|
|
<label for="shutdown_timeout">{{ translate('serverConfig', 'shutdownTimeout', data['lang']) }}
|
|
|
|
<small class="text-muted ml-1"> - {{ translate('serverConfig', 'timeoutExplain1', data['lang'])
|
|
|
|
}}
|
|
|
|
{{ data['server_stats']['server_id']['stop_command'] }} {{ translate('serverConfig',
|
|
|
|
'timeoutExplain2', data['lang']) }}
|
|
|
|
</small> </label>
|
2023-05-18 07:53:23 +00:00
|
|
|
<input type="number" class="form-control" name="shutdown_timeout" id="shutdown_timeout" value="{{ data['server_stats']['server_id']['shutdown_timeout'] }}" step="2" max="300" min="60" required>
|
2022-08-21 16:41:28 +00:00
|
|
|
</div>
|
2023-02-10 19:02:26 +00:00
|
|
|
<div class="form-group">
|
|
|
|
<label for="ignored_exits">{{ translate('serverConfig', 'ignoredExits', data['lang']) }}
|
|
|
|
<small class="text-muted ml-1"> - {{ translate('serverConfig', 'ignoredExitsExplain',
|
|
|
|
data['lang'])
|
2023-02-10 19:48:19 +00:00
|
|
|
}}
|
2023-02-10 19:02:26 +00:00
|
|
|
</small> </label>
|
2023-05-18 07:53:23 +00:00
|
|
|
<input type="text" class="form-control" name="ignored_exits" id="ignored_exits" value="{{ data['server_stats']['server_id']['ignored_exits'] }}">
|
2023-02-10 19:02:26 +00:00
|
|
|
</div>
|
2022-06-21 19:59:34 +00:00
|
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="logs_delete_after">{{ translate('serverConfig', 'removeOldLogsAfter', data['lang']) }}
|
|
|
|
<small class="text-muted ml-1"> - {{ translate('serverConfig', 'removeOldLogsAfterDesc',
|
|
|
|
data['lang']) }}</small> </label>
|
2023-05-18 07:53:23 +00:00
|
|
|
<input type="number" class="form-control" name="logs_delete_after" id="logs_delete_after" value="{{ data['server_stats']['server_id']['logs_delete_after'] }}" step="1" max="365" min="0" required>
|
2022-06-21 19:59:34 +00:00
|
|
|
</div>
|
|
|
|
|
2023-01-31 19:20:08 +00:00
|
|
|
<div class="form-group">
|
|
|
|
<div class="custom-control custom-switch">
|
|
|
|
{% if data['server_stats']['server_id']['auto_start'] %}
|
|
|
|
<input type="checkbox" class="custom-control-input" id="auto_start" name="auto_start" checked="" value="1">
|
|
|
|
<label class="custom-control-label" for="auto_start"> {{ translate('serverConfig', 'serverAutoStart', data['lang']) }}</label>
|
|
|
|
{% else %}
|
|
|
|
<input type="checkbox" class="custom-control-input" id="auto_start" name="auto_start" value="1">
|
|
|
|
<label class="custom-control-label" for="auto_start"> {{ translate('serverConfig', 'serverAutoStart', data['lang']) }}</label>
|
|
|
|
{% end %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<div class="custom-control custom-switch">
|
|
|
|
{% if data['server_stats']['server_id']['crash_detection'] %}
|
|
|
|
<input type="checkbox" class="custom-control-input" id="crash_detection" name="crash_detection" checked="" value="1">
|
|
|
|
<label class="custom-control-label" for="crash_detection"> {{ translate('serverConfig', 'serverCrashDetection', data['lang']) }}</label>
|
|
|
|
{% else %}
|
|
|
|
<input type="checkbox" class="custom-control-input" id="crash_detection" name="crash_detection" value="1">
|
|
|
|
<label class="custom-control-label" for="crash_detection"> {{ translate('serverConfig', 'serverCrashDetection', data['lang']) }}</label>
|
|
|
|
{% end %}
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-01-13 21:43:16 +00:00
|
|
|
<div class="form-group">
|
|
|
|
<div class="custom-control custom-switch">
|
|
|
|
{% if data['server_stats']['server_id']['count_players'] %}
|
|
|
|
<input type="checkbox" class="custom-control-input" id="count_players" name="count_players" checked="" value="1">
|
|
|
|
<label class="custom-control-label" for="count_players"> {{ translate('serverConfig', 'countPlayers', data['lang']) }}</label>
|
|
|
|
{% else %}
|
|
|
|
<input type="checkbox" class="custom-control-input" id="count_players" name="count_players" value="1">
|
|
|
|
<label class="custom-control-label" for="count_players"> {{ translate('serverConfig', 'countPlayers', data['lang']) }}</label>
|
|
|
|
{% end %}
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-01-31 19:20:08 +00:00
|
|
|
<div class="form-group">
|
|
|
|
<div class="custom-control custom-switch">
|
|
|
|
{% if data['super_user'] %}
|
|
|
|
{% if data['server_stats']['server_id']['show_status'] %}
|
|
|
|
<input type="checkbox" class="custom-control-input" id="show_status" name="show_status" checked="" value="1">
|
|
|
|
<label class="custom-control-label" for="show_status"> {{ translate('serverConfig', 'showStatus', data['lang']) }}</label>
|
|
|
|
{% else %}
|
2024-01-12 18:43:04 +00:00
|
|
|
<input type="checkbox" class="custom-control-input" id="show_status" name="show_status" value="1">
|
2023-01-31 19:20:08 +00:00
|
|
|
<label class="custom-control-label" for="show_status"> {{ translate('serverConfig', 'showStatus', data['lang']) }}</label>
|
|
|
|
{% end %}
|
|
|
|
{% end %}
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-06-21 19:59:34 +00:00
|
|
|
|
|
|
|
<button type="submit" class="btn btn-success mr-2"><i class="fas fa-save"></i> {{
|
|
|
|
translate('serverConfig', 'save', data['lang']) }}</button>
|
|
|
|
<button type="reset" class="btn btn-light"><i class="fas fa-times"></i> {{ translate('serverConfig',
|
|
|
|
'cancel', data['lang']) }}</button>
|
2022-01-21 22:50:04 +00:00
|
|
|
</form>
|
2020-09-04 04:02:03 +00:00
|
|
|
</div>
|
|
|
|
|
2022-01-21 22:50:04 +00:00
|
|
|
<div class="col-md-6 col-sm-12">
|
|
|
|
<div class="card">
|
|
|
|
<div class="card-body">
|
|
|
|
<h4 class="card-title">{{ translate('serverConfigHelp', 'title', data['lang']) }}</h4>
|
|
|
|
<p class="card-description"> {{ translate('serverConfigHelp', 'desc', data['lang']) }}</p>
|
|
|
|
<blockquote class="blockquote">
|
|
|
|
<p class="mb-0">
|
|
|
|
{% raw translate('serverConfigHelp', 'perms', data['lang']) %}
|
|
|
|
</p>
|
|
|
|
</blockquote>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="text-center">
|
|
|
|
{% if data['server_stats']['running'] %}
|
2022-09-01 16:46:37 +00:00
|
|
|
{% if data['server_stats']['updating'] %}
|
2023-05-18 07:53:23 +00:00
|
|
|
<i id="update-spinner" class="fa fa-spinner fa-spin"></i> <button onclick="send_command(serverId, 'update_executable');" id="update_executable" style="max-width: 7rem;" class="btn btn-warning m-1 flex-grow-1 disabled">{{ translate('serverConfig',
|
2022-09-04 21:50:08 +00:00
|
|
|
'update', data['lang']) }}</button>
|
2022-09-01 16:46:37 +00:00
|
|
|
{% else %}
|
2023-05-18 07:53:23 +00:00
|
|
|
<i style="visibility: hidden;" id="update-spinner" class="fa fa-spinner fa-spin"></i> <button onclick="send_command(serverId, 'update_executable');" id="update_executable" style="max-width: 7rem;" class="btn btn-warning m-1 flex-grow-1 disabled">{{ translate('serverConfig',
|
2022-09-04 21:50:08 +00:00
|
|
|
'update', data['lang']) }}</button>
|
2022-09-01 16:46:37 +00:00
|
|
|
{% end %}
|
2022-01-21 22:50:04 +00:00
|
|
|
<a class="btn btn-sm btn-danger disabled">{{ translate('serverConfig', 'deleteServer', data['lang'])
|
|
|
|
}}</a><br />
|
|
|
|
<small>{{ translate('serverConfig', 'stopBeforeDeleting', data['lang']) }}</small>
|
|
|
|
{% else %}
|
2022-08-06 00:24:42 +00:00
|
|
|
{% if not data['failed'] %}
|
2022-09-01 16:46:37 +00:00
|
|
|
{% if data['server_stats']['updating'] %}
|
2023-05-18 07:53:23 +00:00
|
|
|
<i id="update-spinner" class="fa fa-spinner fa-spin"></i> <button onclick="send_command(serverId, 'update_executable');" id="update_executable" style="max-width: 7rem;" class="btn btn-warning m-1 flex-grow-1">{{ translate('serverConfig',
|
2022-09-04 21:50:08 +00:00
|
|
|
'update', data['lang']) }}</button>
|
2022-09-01 16:46:37 +00:00
|
|
|
{% else %}
|
2023-05-18 07:53:23 +00:00
|
|
|
<i style="visibility: hidden;" id="update-spinner" class="fa fa-spinner fa-spin"></i> <button onclick="send_command(serverId, 'update_executable');" id="update_executable" style="max-width: 7rem;" class="btn btn-warning m-1 flex-grow-1">{{ translate('serverConfig',
|
2022-09-04 21:50:08 +00:00
|
|
|
'update', data['lang']) }}</button>
|
2022-09-01 16:46:37 +00:00
|
|
|
{% end %}
|
2022-08-06 00:24:42 +00:00
|
|
|
{% end %}
|
2022-08-06 00:04:34 +00:00
|
|
|
{% if not data['failed'] %}
|
2022-01-21 22:50:04 +00:00
|
|
|
<button onclick="deleteConfirm()" class="btn btn-sm btn-danger">{{ translate('serverConfig',
|
|
|
|
'deleteServer', data['lang']) }}</button>
|
2022-08-06 00:04:34 +00:00
|
|
|
{% else %}
|
|
|
|
<button onclick="deleteUnloadedConfirm()" class="btn btn-sm btn-danger">{{ translate('serverConfig',
|
|
|
|
'deleteServer', data['lang']) }}</button>
|
|
|
|
{% end %}
|
2022-01-21 22:50:04 +00:00
|
|
|
{% end %}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-09-04 04:02:03 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-02-02 22:48:12 +00:00
|
|
|
|
2022-07-14 22:26:42 +00:00
|
|
|
<style>
|
2023-01-31 19:20:08 +00:00
|
|
|
.custom-control-input:checked~.custom-control-label::before {
|
2022-07-14 22:26:42 +00:00
|
|
|
color: black !important;
|
|
|
|
background-color: blueviolet !important;
|
2023-01-31 19:20:08 +00:00
|
|
|
border-color: var(--outline) !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
.custom-control-label::before {
|
|
|
|
background-color: white !important;
|
|
|
|
top: calc(-0.2rem);
|
2022-08-06 00:04:34 +00:00
|
|
|
}
|
2022-07-14 22:26:42 +00:00
|
|
|
|
2023-01-31 19:20:08 +00:00
|
|
|
.custom-switch .custom-control-label::after {
|
|
|
|
top: calc(-0.125rem + 1px);
|
2022-08-06 00:04:34 +00:00
|
|
|
}
|
2022-07-14 22:26:42 +00:00
|
|
|
</style>
|
2020-09-04 04:02:03 +00:00
|
|
|
<!-- content-wrapper ends -->
|
|
|
|
|
|
|
|
{% end %}
|
|
|
|
|
|
|
|
{% block js %}
|
|
|
|
<script>
|
2022-08-06 00:04:34 +00:00
|
|
|
$(function () {
|
2022-07-14 22:26:42 +00:00
|
|
|
$('.form-check-input').bootstrapToggle({
|
|
|
|
on: '',
|
|
|
|
off: ''
|
|
|
|
});
|
|
|
|
})
|
2022-02-27 17:26:54 +00:00
|
|
|
const serverId = new URLSearchParams(document.location.search).get('id')
|
|
|
|
|
2020-09-04 04:02:03 +00:00
|
|
|
|
2022-01-21 22:50:04 +00:00
|
|
|
//used to get cookies from browser - this is part of tornados xsrf protection - it's for extra security
|
|
|
|
function getCookie(name) {
|
|
|
|
var r = document.cookie.match("\\b" + name + "=([^;]*)\\b");
|
|
|
|
return r ? r[1] : undefined;
|
|
|
|
}
|
|
|
|
|
|
|
|
$(document).ready(function () {
|
|
|
|
console.log("ready!");
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
function deleteServerE(callback) {
|
2023-09-04 23:22:11 +00:00
|
|
|
const token = getCookie("_xsrf")
|
2022-01-21 22:50:04 +00:00
|
|
|
$.ajax({
|
|
|
|
type: "DELETE",
|
|
|
|
headers: { 'X-XSRFToken': token },
|
2023-03-01 18:30:21 +00:00
|
|
|
url: `/api/v2/servers/${serverId}`,
|
2022-01-21 22:50:04 +00:00
|
|
|
data: {
|
|
|
|
},
|
|
|
|
success: function (data) {
|
|
|
|
console.log("got response:");
|
|
|
|
console.log(data);
|
|
|
|
},
|
2020-09-04 04:02:03 +00:00
|
|
|
});
|
2022-01-21 22:50:04 +00:00
|
|
|
}
|
|
|
|
function deleteServerFilesE(path, callback) {
|
2023-09-04 23:22:11 +00:00
|
|
|
const token = getCookie("_xsrf")
|
2022-01-21 22:50:04 +00:00
|
|
|
$.ajax({
|
|
|
|
type: "DELETE",
|
|
|
|
headers: { 'X-XSRFToken': token },
|
2023-03-01 18:30:21 +00:00
|
|
|
url: `/api/v2/servers/${serverId}?files=true`,
|
2022-01-21 22:50:04 +00:00
|
|
|
data: {
|
|
|
|
},
|
|
|
|
success: function (data) {
|
|
|
|
console.log("got response:");
|
|
|
|
console.log(data);
|
|
|
|
},
|
2021-07-25 01:09:39 +00:00
|
|
|
});
|
2022-01-21 22:50:04 +00:00
|
|
|
}
|
|
|
|
|
2022-02-27 17:26:54 +00:00
|
|
|
function send_command(serverId, command) {
|
2022-01-21 22:50:04 +00:00
|
|
|
//<!-- this getCookie function is in base.html-->
|
2023-09-04 23:22:11 +00:00
|
|
|
const token = getCookie("_xsrf");
|
2022-09-01 16:46:37 +00:00
|
|
|
if (command == "update_executable") {
|
|
|
|
document.getElementById("update-spinner").style.visibility = "visible";
|
|
|
|
}
|
2022-01-21 22:50:04 +00:00
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
headers: { 'X-XSRFToken': token },
|
2023-03-01 18:30:21 +00:00
|
|
|
url: `/api/v2/servers/${serverId}/action/${command}`,
|
2022-01-21 22:50:04 +00:00
|
|
|
success: function (data) {
|
|
|
|
console.log("got response:");
|
|
|
|
console.log(data);
|
2022-09-04 21:50:08 +00:00
|
|
|
if (command != "update_executable") {
|
|
|
|
setTimeout(function () { location.reload(); }, 10000);
|
|
|
|
}
|
2021-08-10 02:16:13 +00:00
|
|
|
}
|
2022-01-21 22:50:04 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function deleteServer() {
|
|
|
|
path = "{{data['server_stats']['server_id']['path']}}";
|
|
|
|
name = "{{data['server_stats']['server_id']['server_name']}}";
|
|
|
|
bootbox.dialog({
|
|
|
|
size: "",
|
|
|
|
title: "{% raw translate('serverConfig', 'deleteFilesQuestion', data['lang']) %}",
|
|
|
|
closeButton: false,
|
|
|
|
message: "{% raw translate('serverConfig', 'deleteFilesQuestionMessage', data['lang']) %}",
|
|
|
|
buttons: {
|
|
|
|
files: {
|
|
|
|
label: "{{ translate('serverConfig', 'yesDeleteFiles', data['lang']) }}",
|
|
|
|
className: 'btn-danger',
|
|
|
|
callback: function () {
|
|
|
|
deleteServerFilesE();
|
|
|
|
setTimeout(function () { window.location = '/panel/dashboard'; }, 5000);
|
|
|
|
bootbox.dialog({
|
|
|
|
backdrop: true,
|
|
|
|
title: '{% raw translate("serverConfig", "sendingDelete", data['lang']) %}',
|
|
|
|
message: '<div align="center"><i class="fas fa-spin fa-spinner"></i> {% raw translate("serverConfig", "bePatientDeleteFiles", data['lang']) %} </div>',
|
|
|
|
closeButton: false
|
|
|
|
})
|
|
|
|
|
|
|
|
return;
|
2021-11-29 21:22:46 +00:00
|
|
|
}
|
2022-01-21 22:50:04 +00:00
|
|
|
},
|
|
|
|
noFiles: {
|
|
|
|
label: "{{ translate('serverConfig', 'noDeleteFiles', data['lang']) }}",
|
|
|
|
className: 'btn-outline-danger',
|
|
|
|
callback: function () {
|
|
|
|
deleteServerE()
|
|
|
|
setTimeout(function () { window.location = '/panel/dashboard'; }, 5000);
|
|
|
|
bootbox.dialog({
|
|
|
|
backdrop: true,
|
|
|
|
title: '{% raw translate("serverConfig", "sendingDelete", data['lang']) %}',
|
|
|
|
message: '<div align="center"><i class="fas fa-spin fa-spinner"></i> {% raw translate("serverConfig", "bePatientDelete", data['lang']) %} </div>',
|
|
|
|
closeButton: false
|
|
|
|
})
|
|
|
|
return;
|
2021-08-10 00:48:22 +00:00
|
|
|
}
|
2022-01-21 22:50:04 +00:00
|
|
|
},
|
|
|
|
cancel: {
|
|
|
|
label: "{{ translate('serverConfig', 'cancel', data['lang']) }}",
|
|
|
|
className: 'btn-secondary',
|
|
|
|
callback: function () {
|
|
|
|
return;
|
2021-08-10 00:48:22 +00:00
|
|
|
}
|
2022-01-21 22:50:04 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
callback: function (result) {
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
function deleteConfirm() {
|
|
|
|
path = "{{data['server_stats']['server_id']['path']}}";
|
|
|
|
name = "{{data['server_stats']['server_id']['server_name']}}";
|
|
|
|
bootbox.confirm({
|
|
|
|
size: "",
|
|
|
|
title: "{% raw translate('serverConfig', 'deleteServerQuestion', data['lang']) %}",
|
|
|
|
closeButton: false,
|
|
|
|
message: "{% raw translate('serverConfig', 'deleteServerQuestionMessage', data['lang']) %}",
|
|
|
|
buttons: {
|
|
|
|
confirm: {
|
|
|
|
label: "{{ translate('serverConfig', 'yesDelete', data['lang']) }}",
|
|
|
|
className: 'btn-danger',
|
|
|
|
},
|
|
|
|
cancel: {
|
|
|
|
label: "{{ translate('serverConfig', 'noDelete', data['lang']) }}",
|
|
|
|
className: 'btn-link',
|
|
|
|
}
|
|
|
|
},
|
|
|
|
callback: function (result) {
|
|
|
|
if (!result) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
deleteServer();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2022-08-06 00:04:34 +00:00
|
|
|
function deleteUnloadedConfirm() {
|
|
|
|
path = "{{data['server_stats']['server_id']['path']}}";
|
|
|
|
name = "{{data['server_stats']['server_id']['server_name']}}";
|
|
|
|
bootbox.confirm({
|
|
|
|
size: "",
|
|
|
|
title: "{% raw translate('serverConfig', 'deleteServerQuestion', data['lang']) %}",
|
|
|
|
closeButton: false,
|
|
|
|
message: "{% raw translate('serverConfig', 'deleteServerQuestionMessage', data['lang']) %}",
|
|
|
|
buttons: {
|
|
|
|
confirm: {
|
|
|
|
label: "{{ translate('serverConfig', 'yesDelete', data['lang']) }}",
|
|
|
|
className: 'btn-danger',
|
|
|
|
},
|
|
|
|
cancel: {
|
|
|
|
label: "{{ translate('serverConfig', 'noDelete', data['lang']) }}",
|
|
|
|
className: 'btn-link',
|
|
|
|
}
|
|
|
|
},
|
|
|
|
callback: function (result) {
|
|
|
|
if (!result) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else {
|
2023-09-04 23:22:11 +00:00
|
|
|
const token = getCookie("_xsrf")
|
2022-08-06 00:04:34 +00:00
|
|
|
setTimeout(function () { window.location = '/panel/dashboard'; }, 5000);
|
|
|
|
bootbox.dialog({
|
|
|
|
backdrop: true,
|
|
|
|
title: '{% raw translate("serverConfig", "sendingDelete", data['lang']) %}',
|
|
|
|
message: '<div align="center"><i class="fas fa-spin fa-spinner"></i> {% raw translate("serverConfig", "bePatientDelete", data['lang']) %} </div>',
|
|
|
|
closeButton: false
|
|
|
|
})
|
|
|
|
$.ajax({
|
|
|
|
type: "DELETE",
|
|
|
|
headers: { 'X-XSRFToken': token },
|
2023-03-01 18:30:21 +00:00
|
|
|
url: `/api/v2/servers/${serverId}`,
|
2022-08-06 00:04:34 +00:00
|
|
|
data: {
|
|
|
|
},
|
|
|
|
success: function (data) {
|
|
|
|
console.log("got response:");
|
|
|
|
console.log(data);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2021-08-10 00:48:22 +00:00
|
|
|
|
2022-12-19 23:42:05 +00:00
|
|
|
$("#server_port").focus(function () {
|
|
|
|
|
|
|
|
$('[data-toggle="popover"]').popover();
|
|
|
|
if ($(window).width() < 1000) {
|
|
|
|
$('.port-hint').attr("data-placement", "top")
|
|
|
|
} else {
|
|
|
|
$('.port-hint').attr("data-placement", "right")
|
|
|
|
}
|
|
|
|
$('.port-hint').popover("show");
|
|
|
|
});
|
|
|
|
$("#server_port").focusout(function () {
|
|
|
|
$('.port-hint').popover("hide");
|
|
|
|
});
|
|
|
|
|
2023-03-03 22:16:53 +00:00
|
|
|
async function postFormFieldsAsJson({ url, formData }) {
|
|
|
|
//Create an object from the form data entries
|
|
|
|
let formDataObject = Object.fromEntries(formData.entries());
|
|
|
|
// Format the plain form data as JSON
|
|
|
|
let formDataJsonString = JSON.stringify(formDataObject);
|
|
|
|
|
|
|
|
//Set the fetch options (headers, body)
|
|
|
|
let fetchOptions = {
|
|
|
|
//HTTP method set to POST.
|
|
|
|
method: "PATCH",
|
|
|
|
//Set the headers that specify you're sending a JSON body request and accepting JSON response
|
|
|
|
headers: {
|
|
|
|
"Content-Type": "application/json",
|
|
|
|
Accept: "application/json",
|
|
|
|
},
|
|
|
|
// POST request body as JSON string.
|
|
|
|
body: formDataJsonString,
|
|
|
|
};
|
|
|
|
|
|
|
|
//Get the response body as JSON.
|
|
|
|
//If the response was not OK, throw an error.
|
|
|
|
let res = await fetch(url, fetchOptions);
|
|
|
|
|
|
|
|
//If the response is not ok throw an error (for debugging)
|
|
|
|
if (!res.ok) {
|
|
|
|
let error = await res.text();
|
|
|
|
throw new Error(error);
|
|
|
|
}
|
|
|
|
//If the response was OK, return the response body.
|
|
|
|
return res.json();
|
|
|
|
}
|
|
|
|
function replacer(key, value) {
|
|
|
|
if (key != "ignored_exits") {
|
2023-03-10 23:25:26 +00:00
|
|
|
if (typeof value == "boolean" || key === "executable_update_url") {
|
2023-03-03 22:16:53 +00:00
|
|
|
return value
|
|
|
|
} else {
|
|
|
|
return (isNaN(value) ? value : +value);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-01 16:46:37 +00:00
|
|
|
$(document).ready(function () {
|
2023-03-03 22:16:53 +00:00
|
|
|
let token = getCookie("_xsrf")
|
2022-09-01 16:46:37 +00:00
|
|
|
webSocket.on('remove_spinner', function () {
|
|
|
|
document.getElementById("update-spinner").style.visibility = "hidden";
|
|
|
|
});
|
2023-03-03 22:16:53 +00:00
|
|
|
$("#config_form").on("submit", async function (e) {
|
|
|
|
e.preventDefault();
|
2023-09-04 23:22:11 +00:00
|
|
|
const token = getCookie("_xsrf")
|
2023-03-03 22:16:53 +00:00
|
|
|
let configForm = document.getElementById("config_form");
|
|
|
|
|
|
|
|
let formData = new FormData(configForm);
|
|
|
|
//Create an object from the form data entries
|
|
|
|
let formDataObject = Object.fromEntries(formData.entries());
|
|
|
|
//We need to make sure these are sent regardless of whether or not they're checked
|
|
|
|
formDataObject.show_status = $("#show_status").prop('checked');
|
|
|
|
formDataObject.crash_detection = $("#crash_detection").prop('checked');
|
|
|
|
formDataObject.auto_start = $("#auto_start").prop('checked');
|
2024-01-13 21:43:16 +00:00
|
|
|
formDataObject.count_players = $("#count_players").prop('checked');
|
2023-03-03 22:16:53 +00:00
|
|
|
console.log(formDataObject);
|
|
|
|
// Format the plain form data as JSON
|
|
|
|
let formDataJsonString = JSON.stringify(formDataObject, replacer);
|
|
|
|
formDataJsonString["ignored_exits"] = toString(formDataJsonString["ignored_exits"]);
|
|
|
|
console.log(formDataJsonString.ignored_exits)
|
|
|
|
|
|
|
|
console.log(formDataJsonString);
|
|
|
|
|
|
|
|
let res = await fetch(`/api/v2/servers/${serverId}`, {
|
|
|
|
method: 'PATCH',
|
|
|
|
headers: {
|
|
|
|
'X-XSRFToken': token
|
|
|
|
},
|
|
|
|
body: formDataJsonString,
|
|
|
|
});
|
2023-03-05 03:45:31 +00:00
|
|
|
let responseData = await res.json();
|
|
|
|
if (responseData.status === "ok") {
|
2023-09-04 18:19:21 +00:00
|
|
|
location.reload(true);
|
2023-03-05 03:45:31 +00:00
|
|
|
} else {
|
|
|
|
|
|
|
|
bootbox.alert({
|
2023-03-10 23:25:26 +00:00
|
|
|
title: responseData.error,
|
|
|
|
message: responseData.error_data
|
2023-05-18 07:53:23 +00:00
|
|
|
});
|
|
|
|
}
|
2023-03-03 22:16:53 +00:00
|
|
|
});
|
2022-09-01 16:46:37 +00:00
|
|
|
});
|
2020-09-04 04:02:03 +00:00
|
|
|
</script>
|
|
|
|
|
2022-06-21 19:59:34 +00:00
|
|
|
{% end %}
|