Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,54 @@ Please note:
>
> The other parameters are pretty self-explanatory

## [traxo-xx's WebGUI plugin](https://github.com/StarryPy/StarryPy_plugins/tree/master/plugins/web_gui)
> If activated, this give you a web-GUI to administrate your StarryPy server. Still in a very alpha-ish state, which is why it is deactivated by default. For now it only has some basic functions ( I will add more soon), but those should work. Well, except for the chat... the order old messages get's f**ked up when you reload the dashboard. I'll try to fix that soon. When it's activated you can log in to the GUI with the name of the server owner and the password you set in the config file.

> ### Required Python packages:

> * tornado

> ### Add the following block to your config file:

> ```javascript
"web_gui": {
"auto_activate": false,
"cookie_token": "",
"log_path": "webgui.log",
"log_path_access": "webgui_access.log",
"ownerpassword": "!!PUT A PASSWORD HERE",
"port": 8083,
"remember_cookie_token": true,
"restart_script": "",
"serverurl": "localhost"
},
>```

> **cookie_token**: A secure token for Cookies. Leave this blank. The plugin will fill it.
> **ownerpassword**: Password for the web-GUI.
> **port**: The port the web-GUI will listen on.
> **remember_cookie_token**: If set to true, you will stay logged in until you log out (even after you restart StarryPy). If set to false, a new cookie_token will be generated on every start of StarryPy.
> **restart_script**: Path to a script to restart starbound and/or StarryPy.
> **serverurl**: URL or IP of your StarryPy server.

> ### Credits:

> DevOOPS Bootstrap 3 Admin theme https://github.com/devoopsme/devoops/

> jQuery-Knob http://anthonyterrien.com/knob/ (MIT or GPL) 1.2.5
> D3 http://d3js.org/ 3.4.1 AS IS
> Select2 https://github.com/ivaynberg/select2 3.4.5 GPL2
> Bootstrap Validator https://github.com/nghuuphuoc/bootstrapvalidator 0.2.3 MIT
> TinyMCE http://www.tinymce.com 4.0.16 GPL2
> jQuery Timepicker http://trentrichardson.com/examples/timepicker/ 1.4.3 MIT
> xCharts http://tenxer.github.io/xcharts/ 0.3.0 AS IS
> Fancybox http://fancyapps.com/fancybox/ 2.1.5 ?
> Widen FineUploader https://github.com/Widen/fine-uploader (GPL3) v 4.3.1
> Datatables http://datatables.net 1.9.4 GPL or BSD
> jQuery-UI 1.10.4
> Twitter Bootstrap http://getbootstrap.com 3.1.0
> Flot www.flotcharts.org 0.8.2 AS IS
> Fullcalendar http://arshaw.com/fullcalendar 2.0..0beta MIT
> Moment http://momentjs.com/ 2.5.1 MIT
> Justified Gallery https://github.com/miromannino/Justified-Gallery 2.1 Creative Commons 3.0
> Morris Charts http://www.oesmith.co.uk/morris.js/ v0.4.3 MIT
1 change: 1 addition & 0 deletions plugins/web_gui/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .web_gui_plugin import WebGuiPlugin
37 changes: 37 additions & 0 deletions plugins/web_gui/static/adminstop.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>StarryPy WebGUI</title>
<meta name="description" content="description">
<meta name="author" content="Evgeniya">
<meta name="keyword" content="keywords">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="../plugins/bootstrap/bootstrap.css" rel="stylesheet">
<link href="http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
<link href='http://fonts.googleapis.com/css?family=Righteous' rel='stylesheet' type='text/css'>
<link href="../css/style.min.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="http://getbootstrap.com/docs-assets/js/html5shiv.js"></script>
<script src="http://getbootstrap.com/docs-assets/js/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container-fluid">
<div id="page-resart" class="row">
<div class="col-xs-12 col-md-4 col-md-offset-4 col-sm-6 col-sm-offset-3">
<div class="box text-center">
<div class="box-content">
{% if handler.error_message == "" %}
<h3>Server is being stopped!</h3>
{% else %}
<h3 style="color: #ff3a35">{{ handler.error_message }}</h3>
{% end %}
</div>
</div>
</div>
</div>
</div>
</body>
</html>
92 changes: 92 additions & 0 deletions plugins/web_gui/static/ajax/dashboard.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<script src="../js/webgui.chat.js" type="text/javascript"></script>
<div class="row">
<div id="breadcrumb" class="col-xs-12">
<ol class="breadcrumb">
<li><a href="#">Dashboard</a></li>
</ol>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-9">
<div class="box">
<div class="box-header">
<div class="box-name">
<i class="fa fa-comment"></i>
<span>Chat</span>
</div>
<div class="box-icons">
<a class="collapse-link">
<i class="fa fa-chevron-up"></i>
</a>
<a class="expand-link">
<i class="fa fa-expand"></i>
</a>
<a class="close-link">
<i class="fa fa-times"></i>
</a>
</div>
<div class="no-move"></div>
</div>
<div class="box-content">
<div class="col-xs-12 col-sm-9" id="chat">
</div>
<input id="username" type="hidden" value="{{ handler.get_current_user() }}">
<div class="col-xs-12 col-sm-9">
<input type="text" id="message" class="form-control" placeholder="Type your message here..." onkeydown="if(event.keyCode==13){sendMessage()}">
</div>
<button type="button" class="btn btn-default btn-label-right" onclick="sendMessage();">Send <span><i class="fa fa-envelope"></i></span></button>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-3">
<div class="box">
<div class="box-header">
<div class="box-name">
<i class="fa fa-sitemap"></i>
<span>Online Players</span>
</div>
<div class="box-icons">
<a class="collapse-link">
<i class="fa fa-chevron-up"></i>
</a>
<a class="expand-link">
<i class="fa fa-expand"></i>
</a>
<a class="close-link">
<i class="fa fa-times"></i>
</a>
</div>
<div class="no-move"></div>
</div>
<div class="box-content text-center" id="players_online">
</div>
</div>
<script type="text/javascript">
$("#players_online").load("ajax/playersonline.html");
</script>
<div class="box">
<div class="box-header">
<div class="box-name">
<i class="fa fa-warning"></i>
<span>Administration</span>
</div>
<div class="box-icons">
<a class="collapse-link">
<i class="fa fa-chevron-up"></i>
</a>
<a class="expand-link">
<i class="fa fa-expand"></i>
</a>
<a class="close-link">
<i class="fa fa-times"></i>
</a>
</div>
<div class="no-move"></div>
</div>
<div class="box-content text-center">
<button type="button" class="btn btn-warning btn-label-right" onclick="restartServer()">Restart Server <span><i class="fa fa-refresh"></i></span></button><br />
<button type="button" class="btn btn-danger btn-label-right" onclick="stopServer()">Stop StarryPy <span><i class="fa fa-power-off"></i></span></button><br />
</div>
</div>
</div>
</div>
85 changes: 85 additions & 0 deletions plugins/web_gui/static/ajax/playeredit.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<div class="row">
<div id="breadcrumb" class="col-xs-12">
<ol class="breadcrumb">
<li><a href="index.html">Dashboard</a></li>
<li><a href="#">Players</a></li>
<li><a href="#">Edit Players</a></li>
</ol>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-6">
{% set iconcolour = "#54ae86" if handler.edit_player.logged_in else "#D15E5E" %}
<h3 style="margin-bottom: 10px" ><strong>Edit {{ handler.edit_player.name }} <i class="fa fa-user" style="color: {{ iconcolour }}"></i></strong></h3>
{% if handler.edit_player.logged_in %}
<button class="btn btn-warning" onclick="kickPlayer('{{ handler.edit_player.name }}')">Kick</button>
{% end %}
{% if handler.player_manager.check_bans(handler.edit_player.ip) %}
<button class="btn btn-success" onclick="unBanPlayer('{{ handler.edit_player.name }}')">Unban</button>
{% else %}
<button class="btn btn-warning" onclick="banPlayer('{{ handler.edit_player.name }}')">Ban</button>
{% end %}
<button class="btn btn-danger" onclick="deletePlayer('{{ handler.edit_player.name }}')">Delete</button>
<div class="box">
<div class="box-content">

<form id="player_edit_form" action="ajax/playeredit.html">
<input type="hidden" name="playername" value="{{ handler.edit_player.name }}">
{% if handler.error_message != "" %}
<span style="color: #ff3a35">{{ handler.error_message }}</span>
{% end %}
<table class="table table-bordered">
<tr>
<td>UUID</td>
<td>{{ handler.edit_player.uuid }}</td>
</tr>
<tr>
<td>Access Level</td>
<td>
<select name="access_level">
{% for optionkey, optionvalue in handler.levels.iteritems() %}
{% set selectedvalue = " selected" if optionvalue == handler.edit_player.access_level else "" %}
<option value="{{ optionvalue }}"{{ selectedvalue }}>{{ optionkey }}</option>
{% end %}
</select>
</td>
</tr>
<tr>
<td>IP</td>
<td>{{ handler.edit_player.ip }}</td>
</tr>
<tr>
<td>Last Seen</td>
<td>{{ str(handler.edit_player.last_seen).rpartition('.')[0] }}</td>
</tr>
<tr>
<td>planet</td>
<td>{{ handler.edit_player.planet }}</td>
</tr>
<tr>
<td>On Ship</td>
<td>{{ handler.edit_player.on_ship }}</td>
</tr>
</table>
{% raw xsrf_form_html() %}
<input type="submit" class="btn btn-default" value="Save">
</form>
<script>
$( "#player_edit_form" ).submit(function( event ) {
event.preventDefault();
var $form = $( this ),
url = $form.attr( "action" );

var posting = $.post( url, $( "#player_edit_form" ).serialize() );

// Put the results in a div
posting.done(function( data ) {
$( "#ajax-content" ).empty().append( data );
});
});
</script>
<br />
</div>
</div>
</div>
</div>
37 changes: 37 additions & 0 deletions plugins/web_gui/static/ajax/playerlist.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<link href="css/bootstrap-sortable.css" rel="stylesheet">
<script src="js/bootstrap-sortable.js"></script>
<div class="row">
<div id="breadcrumb" class="col-xs-12">
<ol class="breadcrumb">
<li><a href="#">Dashboard</a></li>
<li><a href="#">Players</a></li>
<li><a href="#">All Players</a></li>
</ol>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12">
<table class="table table-bordered sortable">
<thead>
<tr>
<th data-defaultsort='asc'>Name</th>
<th>Planet</th>
<th>Access Level</th>
<th>Last Seen</th>
</tr>
</thead>
<tbody>
{% for player in handler.playerlist %}
<tr>
{% set iconcolour = "#54ae86" if player.logged_in else "#D15E5E" %}
<td data-value="{{ player.name }}"><a href="#" onclick='LoadAjaxContent("ajax/playeredit.html?playername=" + encodeURIComponent("{{ player.name }}"));'>{{ player.name }}</a> <i class="fa fa-user" style="color: {{ iconcolour }}"></i>{% if handler.player_manager.check_bans(player.ip) %} <i class="fa fa-lock" style="color: #d9ce00" title="User is banned"></i>{% end %}</td>
<td>{{ player.planet }}</td>
<td>{{ player.access_level }}</td>
<td>{{ str(player.last_seen).rpartition('.')[0] }}</td>
</tr>
{% end %}
</tbody>
</table>
</div>
</div>

36 changes: 36 additions & 0 deletions plugins/web_gui/static/ajax/playerlistonline.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<link href="css/bootstrap-sortable.css" rel="stylesheet">
<script src="js/bootstrap-sortable.js"></script>
<div class="row">
<div id="breadcrumb" class="col-xs-12">
<ol class="breadcrumb">
<li><a href="#">Dashboard</a></li>
<li><a href="#">Players</a></li>
<li><a href="#">Online Players</a></li>
</ol>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12">
<table class="table table-bordered sortable">
<thead>
<tr>
<th data-defaultsort='asc'>Name</th>
<th>Planet</th>
<th>Access Level</th>
<th>Last Seen</th>
</tr>
</thead>
<tbody>
{% for player in handler.playerlistonline %}
<tr>
<td data-value="{{ player.name }}"><a href="#" onclick="LoadAjaxContent('ajax/playeredit.html?playername={{ player.name }}');">{{ player.name }}</a></td>
<td>{{ player.planet }}</td>
<td>{{ player.access_level }}</td>
<td>{{ str(player.last_seen).rpartition('.')[0] }}</td>
</tr>
{% end %}
</tbody>
</table>
</div>
</div>

10 changes: 10 additions & 0 deletions plugins/web_gui/static/ajax/playerquickmenu.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{% if handler.edit_player.logged_in %}
<button class="btn btn-success" onclick="LoadAjaxContent('ajax/playeredit.html?playername={{ handler.edit_player.name }}');">Edit</button>
{% end %}
<button class="btn btn-warning" onclick="kickPlayer('{{ handler.edit_player.name }}')">Kick</button>
{% if handler.player_manager.check_bans(handler.edit_player.ip) %}
<button class="btn btn-success" onclick="unBanPlayer('{{ handler.edit_player.name }}')">Unban</button>
{% else %}
<button class="btn btn-warning" onclick="banPlayer('{{ handler.edit_player.name }}')">Ban</button>
{% end %}
<button class="btn btn-danger" onclick="deletePlayer('{{ handler.edit_player.name }}')">Delete</button>
3 changes: 3 additions & 0 deletions plugins/web_gui/static/ajax/playersonline.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% for player in handler.playerlistonline %}
<a href="#" onclick="playQuickMenu('{{ player.name }}');">{{ player.name }}</a><br />
{% end %}
Loading