mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
finished server config page v1 - wanna add more later, but that's for alter
This commit is contained in:
parent
77021a5c0b
commit
568e1e8f41
@ -62,7 +62,6 @@ class AjaxHandler(BaseHandler):
|
||||
else:
|
||||
log_lines = helper.get_setting('virtual_terminal_lines')
|
||||
|
||||
print(log_lines)
|
||||
data = helper.tail_file(server_data['log_path'], log_lines)
|
||||
|
||||
for d in data:
|
||||
|
@ -8,7 +8,7 @@ from app.classes.shared.console import console
|
||||
from app.classes.shared.models import Users, installer
|
||||
from app.classes.web.base_handler import BaseHandler
|
||||
from app.classes.shared.controller import controller
|
||||
from app.classes.shared.models import db_helper
|
||||
from app.classes.shared.models import db_helper, Servers
|
||||
from app.classes.shared.helpers import helper
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -101,3 +101,46 @@ class PanelHandler(BaseHandler):
|
||||
template,
|
||||
data=page_data
|
||||
)
|
||||
|
||||
@tornado.web.authenticated
|
||||
def post(self, page):
|
||||
|
||||
if page == 'server_detail':
|
||||
server_id = self.get_argument('id', None)
|
||||
server_name = self.get_argument('server_name', None)
|
||||
server_path = self.get_argument('server_path', None)
|
||||
log_path = self.get_argument('log_path', None)
|
||||
executable = self.get_argument('executable', None)
|
||||
execution_command = self.get_argument('execution_command', None)
|
||||
stop_command = self.get_argument('stop_command', None)
|
||||
auto_start_delay = self.get_argument('auto_start_delay', None)
|
||||
server_port = self.get_argument('server_port', None)
|
||||
auto_start = self.get_argument('auto_start', '0')
|
||||
crash_detection = self.get_argument('crash_detection', '0')
|
||||
subpage = self.get_argument('subpage', None)
|
||||
|
||||
if server_id is None:
|
||||
self.redirect("/panel/error?error=Invalid Server ID")
|
||||
return False
|
||||
else:
|
||||
server_id = bleach.clean(server_id)
|
||||
|
||||
# does this server id exist?
|
||||
if not db_helper.server_id_exists(server_id):
|
||||
self.redirect("/panel/error?error=Invalid Server ID")
|
||||
return False
|
||||
|
||||
Servers.update({
|
||||
Servers.server_name: server_name,
|
||||
Servers.path: server_path,
|
||||
Servers.log_path: log_path,
|
||||
Servers.executable: executable,
|
||||
Servers.execution_command: execution_command,
|
||||
Servers.stop_command: stop_command,
|
||||
Servers.auto_start_delay: auto_start_delay,
|
||||
Servers.server_port: server_port,
|
||||
Servers.auto_start: auto_start,
|
||||
Servers.crash_detection: crash_detection,
|
||||
}).where(Servers.server_id == server_id).execute()
|
||||
|
||||
self.redirect("/panel/server_detail?id={}&subpage=config".format(server_id))
|
||||
|
@ -237,8 +237,8 @@
|
||||
</div>
|
||||
|
||||
<div class="wrapper d-flex align-items-start pt-3">
|
||||
His interests include Linux, gaming, and helping others.
|
||||
He enjoys long walks on the beach, with his favorite hat, "Turtles"
|
||||
His interests include Linux, gaming, and helping others. When he's able to
|
||||
unplug he enjoys biking, hiking, and playing soccer.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -311,7 +311,7 @@
|
||||
|
||||
<div class="wrapper d-flex align-items-center font-weight-medium text-muted">
|
||||
<i class="mdi mdi-map-marker-outline mr-2"></i>
|
||||
<p class="mb-0 text-muted">Somewhere, DE</p>
|
||||
<p class="mb-0 text-muted">Bavaria, DE</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -323,8 +323,8 @@
|
||||
</div>
|
||||
|
||||
<div class="wrapper d-flex align-items-start pt-3">
|
||||
His interests include Linux, gaming, and helping others.
|
||||
He enjoys learning, and Englisch sprechen
|
||||
Hi, my name is Tim, and I'm a huge fan of linux.
|
||||
I'm often gaming and occasionally coding some java
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -404,12 +404,6 @@
|
||||
<span class="btn btn-sm btn-info mr-2">Substainer</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Josef K</td>
|
||||
<td>
|
||||
<span class="btn btn-sm btn-primary mr-2">Advocate</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>John C</td>
|
||||
<td>
|
||||
@ -417,7 +411,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Quinn B</td>
|
||||
<td>Nicolas T</td>
|
||||
<td>
|
||||
<span class="btn btn-sm btn-info mr-2">Substainer</span>
|
||||
</td>
|
||||
|
@ -62,47 +62,49 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-sm-12">
|
||||
<form class="forms-sample" method="post" action="/panel/server_detail?id={{ data['server_stats'][0]['server_id']['server_id'] }}">
|
||||
<form class="forms-sample" method="post" action="/panel/server_detail">
|
||||
{% raw xsrf_form_html() %}
|
||||
<input type="hidden" name="id" value="{{ data['server_stats'][0]['server_id']['server_id'] }}">
|
||||
<input type="hidden" name="subpage" value="config">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="server_name">Server Name <small class="text-muted ml-1"> - What you wish to call this thing</small> </label>
|
||||
<input type="text" class="form-control" id="server_name" value="{{ data['server_stats'][0]['server_id']['server_name'] }}" placeholder="Server Name" >
|
||||
<label for="server_name">Server Name <small class="text-muted ml-1"> - What you wish to call this server</small> </label>
|
||||
<input type="text" class="form-control" name="server_name" id="server_name" value="{{ data['server_stats'][0]['server_id']['server_name'] }}" placeholder="Server Name" >
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="server_path">Server Path <small class="text-muted ml-1"> - Absolute full path</small> </label>
|
||||
<input type="text" class="form-control" id="server_path" value="{{ data['server_stats'][0]['server_id']['path'] }}" placeholder="Server Path" >
|
||||
<label for="server_path">Server Path <small class="text-muted ml-1"> - Absolute full path (not including executable)</small> </label>
|
||||
<input type="text" class="form-control" name="server_path" id="server_path" value="{{ data['server_stats'][0]['server_id']['path'] }}" placeholder="Server Path" >
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="log_path">Server Log Location <small class="text-muted ml-1"> - Absolute full path to the log file</small> </label>
|
||||
<input type="text" class="form-control" id="log_path" value="{{ data['server_stats'][0]['server_id']['log_path'] }}" placeholder="Server Log" >
|
||||
<input type="text" class="form-control" name="log_path" id="log_path" value="{{ data['server_stats'][0]['server_id']['log_path'] }}" placeholder="Server Log" >
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="executable">Server Executable <small class="text-muted ml-1"> - Just the executable file</small> </label>
|
||||
<input type="text" class="form-control" id="executable" value="{{ data['server_stats'][0]['server_id']['executable'] }}" placeholder="Server Executable" >
|
||||
<input type="text" class="form-control" name="executable" id="executable" value="{{ data['server_stats'][0]['server_id']['executable'] }}" placeholder="Server Executable" >
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="execution_command">Server Execution Command <small class="text-muted ml-1"> - What will be launched in a hidden terminal</small> </label>
|
||||
<input type="text" class="form-control" id="execution_command" value="{{ data['server_stats'][0]['server_id']['execution_command'] }}" placeholder="Server Execution Command" >
|
||||
<input type="text" class="form-control" name="execution_command" id="execution_command" value="{{ data['server_stats'][0]['server_id']['execution_command'] }}" placeholder="Server Execution Command" >
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="auto_start_delay">Server Stop Command <small class="text-muted ml-1"> - Command to send the program to stop it</small> </label>
|
||||
<input type="text" class="form-control" id="stop_command" value="{{ data['server_stats'][0]['server_id']['stop_command'] }}" placeholder="Server Stop Command" >
|
||||
<label for="stop_command">Server Stop Command <small class="text-muted ml-1"> - Command to send the program to stop it</small> </label>
|
||||
<input type="text" class="form-control" name="stop_command" id="stop_command" value="{{ data['server_stats'][0]['server_id']['stop_command'] }}" placeholder="Server Stop Command" >
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="auto_start_delay">Server Autostart Delay <small class="text-muted ml-1"> - Delay before auto starting (if enabled below)</small> </label>
|
||||
<input type="number" class="form-control" id="auto_start_delay" value="{{ data['server_stats'][0]['server_id']['auto_start_delay'] }}" step="1" max="999" min="10" >
|
||||
<input type="number" class="form-control" name="auto_start_delay" id="auto_start_delay" value="{{ data['server_stats'][0]['server_id']['auto_start_delay'] }}" step="1" max="999" min="10" >
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="server_port">Server Port <small class="text-muted ml-1"> - Port crafty should connect to for stats</small> </label>
|
||||
<input type="number" class="form-control" id="server_port" value="{{ data['server_stats'][0]['server_id']['server_port'] }}" step="1" max="65566" min="1" >
|
||||
<input type="number" class="form-control" name="server_port" id="server_port" value="{{ data['server_stats'][0]['server_id']['server_port'] }}" step="1" max="65566" min="1" >
|
||||
</div>
|
||||
|
||||
<div class="form-check-flat">
|
||||
@ -116,9 +118,9 @@
|
||||
|
||||
<label for="crash_detection" class="form-check-label ml-4 mb-4">
|
||||
{% if data['server_stats'][0]['server_id']['auto_start'] %}
|
||||
<input type="checkbox" class="form-check-input" id="crash_detection" name="auto_start" checked="" >Server Crash Detection
|
||||
<input type="checkbox" class="form-check-input" id="crash_detection" name="crash_detection" checked="" >Server Crash Detection
|
||||
{% else %}
|
||||
<input type="checkbox" class="form-check-input" id="crash_detection" name="auto_start" >Server Crash Detection
|
||||
<input type="checkbox" class="form-check-input" id="crash_detection" name="crash_detection" >Server Crash Detection
|
||||
{% end %}
|
||||
</label>
|
||||
|
||||
@ -132,10 +134,25 @@
|
||||
<div class="col-md-6 col-sm-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="card-title">Blockquotes</h4>
|
||||
<p class="card-description"> Wrap content inside <code><blockquote class="blockquote"></code> </p>
|
||||
<h4 class="card-title">Server Config Area</h4>
|
||||
<p class="card-description"> Here is where you can change the configuration of your server</p>
|
||||
<blockquote class="blockquote">
|
||||
<p class="mb-0">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
|
||||
<p class="mb-0">
|
||||
It is recommended to <code>NOT</code> change the paths of a server managed by Crafty.
|
||||
Changing paths <code>CAN</code> break things, especially on Linux type operating systems where
|
||||
file permissions are more locked down.
|
||||
<br /><br/>
|
||||
If you feel you have to change a where a server is located
|
||||
you may do so as long as you give the "Crafty" user permission to read / write to the server path.
|
||||
<br />
|
||||
<br />
|
||||
On Linux this is best done by executing the following:<br />
|
||||
<code>
|
||||
sudo chown crafty:crafty /path/to/your/server -R<br />
|
||||
sudo chmod 2775 /path/to/your/server -R<br />
|
||||
</code>
|
||||
|
||||
</p>
|
||||
</blockquote>
|
||||
</div>
|
||||
|
||||
@ -148,10 +165,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ data['server_stats'] }}
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!-- content-wrapper ends -->
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user