├── CODE_OF_CONDUCT.md ├── LICENSE ├── Makefile ├── README.md ├── msc-gui ├── msc-gui.service ├── public ├── favicon.ico └── msc.png └── templates ├── dashboard.html.ep ├── disabled-world.html.ep ├── disabled-world.json.ep ├── enabled-world.html.ep ├── enabled-world.json.ep ├── layouts └── default.html.ep ├── settings.html.ep ├── worlds.html.ep └── worlds.json.ep /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at sandain@hotmail.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018-2019 Jason M. Wood 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 18 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | MSC_USER := minecraft 2 | MSC_GROUP := minecraft 3 | MSC_MAPS := /opt/mscs/maps 4 | MSC_GUI_HOME := /opt/mscs/gui 5 | MSC_GUI_SERVICE := /etc/systemd/system/msc-gui.service 6 | 7 | .PHONY: install update clean 8 | 9 | install: $(MSC_GUI_HOME) update 10 | chown -R $(MSC_USER):$(MSC_GROUP) $(MSC_GUI_HOME) 11 | systemctl -f enable msc-gui.service; 12 | 13 | update: 14 | install -m 0755 msc-gui $(MSC_GUI_HOME) 15 | install -m 0644 msc-gui.service $(MSC_GUI_SERVICE); 16 | cp -R public $(MSC_GUI_HOME) 17 | cp -R templates $(MSC_GUI_HOME) 18 | ln -sf $(MSC_MAPS) $(MSC_GUI_HOME)/public/maps 19 | 20 | clean: 21 | systemctl -f disable msc-gui.service; 22 | rm -R $(MSC_GUI_HOME) 23 | 24 | $(MSC_GUI_HOME): 25 | mkdir -p -m 755 $(MSC_GUI_HOME) 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Minecraft Server Control GUI 2 | 3 | # Index 4 | * [Overview](#overview) 5 | * [Prerequisites for installation](#prerequisites-for-installation) 6 | * [Installation](#installation) 7 | * [Download](#download) 8 | * [Configuration](#configuration) 9 | * [Getting started guide](#getting-started-guide) 10 | * [Code of Conduct](CODE_OF_CONDUCT.md) 11 | * [License](LICENSE) 12 | * [Disclaimer](#disclaimer) 13 | 14 | ## Overview 15 | Minecraft Server Control GUI (MSC-GUI) is a new web-based interface to the 16 | [Minecraft Server Control Script](https://github.com/MinecraftServerControl/mscs) 17 | that has been controlling many Linux and UNIX powered Minecraft servers since 18 | it was first released in 2011. 19 | 20 | MSC-GUI is currently under heavy development and will be in various stages 21 | of usability for the immediate future. As of this writing, the only code 22 | available is at the proof-of-concept stage. This proof-of-concept code will 23 | evolve or be replaced as the concept matures. When the MSC-GUI is in a more 24 | usable state, this message will be removed. 25 | 26 | ## Prerequisites for installation 27 | 28 | The Minecraft Server Control GUI uses Perl and 29 | [Mojolicious](https://mojolicious.org/), a Perl-based web framework, to 30 | present a web-based interface to the 31 | [Minecraft Server Control Script](https://github.com/MinecraftServerControl/mscs). 32 | As such, the `mscs` script must be 33 | [installed](https://github.com/MinecraftServerControl/mscs/blob/master/README.md#installation) 34 | and working for the GUI to function. Likewise, Mojolicious must be installed 35 | for MSC-GUI to function. If you are running Debian or Ubuntu, you can make 36 | sure that Mojolicious is installed by running: 37 | 38 | sudo apt install libmojolicious-perl 39 | 40 | ## Installation 41 | 42 | ### Download 43 | 44 | If you followed the easiest way of [downloading the script](https://github.com/MinecraftServerControl/mscs/blob/master/README.md#downloading-the-script) when installing MSCS, then you will want to do the same here. With `git` already installed: 45 | 46 | git clone https://github.com/MinecraftServerControl/msc-gui.git 47 | 48 | ##### Other ways to download 49 | 50 | * Get the development version as a [zip file](https://github.com/MinecraftServerControl/msc-gui/archive/master.zip): 51 | 52 | wget https://github.com/MinecraftServerControl/msc-gui/archive/master.zip 53 | 54 | ### Configuration 55 | 56 | Navigate to the `msc-gui` directory that you just downloaded. Configuration 57 | can be done with the included Makefile in Debian and Ubuntu like environments 58 | by running: 59 | 60 | sudo make install 61 | 62 | ## Code of Conduct 63 | 64 | See [Code of Conduct](CODE_OF_CONDUCT.md) 65 | 66 | ## License 67 | 68 | See [LICENSE](LICENSE) 69 | 70 | ## Disclaimer 71 | 72 | Minecraft is a trademark of Mojang Synergies AB, a subsidiary of Microsoft 73 | Studios. MSCS and MSC-GUI are designed to ease the use of the Mojang produced 74 | Minecraft server software on Linux and UNIX servers. MSCS and MSC-GUI are 75 | independently developed by open software enthusiasts with no support or 76 | implied warranty provided by either Mojang or Microsoft. 77 | -------------------------------------------------------------------------------- /msc-gui: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | =head1 NAME 4 | 5 | MSC-GUI 6 | 7 | =head1 SYNOPSIS 8 | 9 | Minecraft Server Control GUI (MSC-GUI) is a web-based interface to the 10 | Minecraft Server Control Script. 11 | 12 | =head1 DESCRIPTION 13 | 14 | Minecraft Server Control GUI (MSC-GUI) is a new web-based interface to the 15 | Minecraft Server Control Script that has been controlling many Linux and 16 | UNIX powered Minecraft servers since it was first released in 2011. 17 | 18 | =head1 DEPENDENCIES 19 | 20 | MSC-GUI requires Perl version 5.10.1 or greater, in addition to Mojolicious. 21 | 22 | =head1 FEEDBACK 23 | 24 | =head2 Reporting Bugs 25 | 26 | Report bugs to the GitHub issue tracker at: 27 | https://github.com/MinecraftServerControl/msc-gui/issues 28 | 29 | =head1 AUTHOR - Jason Wood 30 | 31 | Email sandain@hotmail.com 32 | 33 | =head1 COPYRIGHT AND LICENSE 34 | 35 | Copyright (c) 2018 Jason M. Wood 36 | 37 | All rights reserved. 38 | 39 | Redistribution and use in source and binary forms, with or without 40 | modification, are permitted provided that the following conditions are met: 41 | 42 | 1. Redistributions of source code must retain the above copyright notice, 43 | this list of conditions and the following disclaimer. 44 | 2. Redistributions in binary form must reproduce the above copyright 45 | notice, this list of conditions and the following disclaimer in the 46 | documentation and/or other materials provided with the distribution. 47 | 48 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 49 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 50 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 51 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 52 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 53 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 54 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 55 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 56 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 57 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 58 | POSSIBILITY OF SUCH DAMAGE. 59 | 60 | =head1 APPENDIX 61 | 62 | The rest of the documentation details each of the object methods. 63 | 64 | =cut 65 | 66 | use strict; 67 | use warnings; 68 | use utf8; 69 | use feature ':5.10'; 70 | 71 | use Mojolicious::Lite; 72 | use Mojo::ByteStream; 73 | use Mojo::JSON qw(decode_json); 74 | 75 | =head2 Helper Functions 76 | 77 | =head3 mscs 78 | 79 | Run the mscs command and return the output. 80 | 81 | =cut 82 | 83 | helper 'mscs' => sub { 84 | my $self = shift; 85 | return `mscs @_`; 86 | }; 87 | 88 | =head3 getEnabledWorlds 89 | 90 | Returns a list of enabled worlds. 91 | 92 | =cut 93 | 94 | helper 'getEnabledWorlds' => sub { 95 | my $self = shift; 96 | my @worlds; 97 | foreach my $line ($self->mscs ("ls enabled")) { 98 | if ($line =~ /^\s*(\w+):/) { 99 | push @worlds, $1; 100 | } 101 | } 102 | return @worlds; 103 | }; 104 | 105 | =head3 getDisabledWorlds 106 | 107 | Returns a list of disabled worlds. 108 | 109 | =cut 110 | 111 | helper 'getDisabledWorlds' => sub { 112 | my $self = shift; 113 | my @worlds; 114 | foreach my $line ($self->mscs ("ls disabled")) { 115 | if ($line =~ /^\s*(\w+):/) { 116 | push @worlds, $1; 117 | } 118 | } 119 | return @worlds; 120 | }; 121 | 122 | =head2 HTTP Request Methods 123 | 124 | =head3 get / 125 | 126 | Renders the dashboard. 127 | 128 | =cut 129 | 130 | get '/' => sub { 131 | my $self = shift; 132 | my @enabled = $self->getEnabledWorlds; 133 | my @disabled = $self->getDisabledWorlds; 134 | $self->stash (title => "MSC GUI: Dashboard"); 135 | $self->stash (msc_enabled_worlds => \@enabled); 136 | $self->stash (msc_disabled_worlds => \@disabled); 137 | $self->stash (msc_menu_active => 'dashboard'); 138 | $self->render (template => "dashboard"); 139 | }; 140 | 141 | =head3 get /settings 142 | 143 | =cut 144 | 145 | get '/settings' => sub { 146 | my $self = shift; 147 | $self->stash (title => "MSC GUI: Settings"); 148 | $self->stash (msc_enabled_worlds => [ $self->getEnabledWorlds ]); 149 | $self->stash (msc_disabled_worlds => [ $self->getDisabledWorlds ]); 150 | $self->stash (msc_menu_active => 'settings'); 151 | $self->render (template => "settings"); 152 | }; 153 | 154 | =head3 get /worlds 155 | 156 | Renders a list of worlds. 157 | 158 | =cut 159 | 160 | get '/worlds' => sub { 161 | my $self = shift; 162 | $self->stash (title => "MSC GUI: World List"); 163 | $self->stash (msc_enabled_worlds => [ $self->getEnabledWorlds ]); 164 | $self->stash (msc_disabled_worlds => [ $self->getDisabledWorlds ]); 165 | $self->render (template => "worlds"); 166 | }; 167 | 168 | =head3 get /worlds/ 169 | 170 | Renders a specific world. 171 | 172 | =cut 173 | 174 | get '/worlds/:world' => sub { 175 | my $self = shift; 176 | my $world = $self->stash ('world'); 177 | my $status = decode_json $self->mscs ("status-json $world"); 178 | $self->stash (title => "MSC GUI: $world"); 179 | $self->stash (msc_enabled_worlds => [ $self->getEnabledWorlds ]); 180 | $self->stash (msc_disabled_worlds => [ $self->getDisabledWorlds ]); 181 | $self->stash (msc_menu_active => $world); 182 | $self->stash (msc_status => $status); 183 | my %enabledWorlds = map { $_ => 1 } $self->getEnabledWorlds; 184 | if (defined $enabledWorlds{$world}) { 185 | my $backups = $self->mscs ("list-backups", $world); 186 | $self->stash (msc_backup_list => $backups); 187 | $self->render (template => "enabled-world"); 188 | } 189 | else { 190 | $self->render (template => 'disabled-world'); 191 | } 192 | }; 193 | 194 | # Start the MSC-GUI app. 195 | app->start; 196 | -------------------------------------------------------------------------------- /msc-gui.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Minecraft Server Control GUI 3 | Documentation=https://github.com/MinecraftServerControl/msc-gui 4 | Requires=network.target 5 | After=network.target 6 | 7 | [Service] 8 | User=minecraft 9 | Group=minecraft 10 | PIDFile=/opt/mscs/gui/hypnotoad.pid 11 | ExecStart=/usr/bin/hypnotoad /opt/mscs/gui/msc-gui 12 | ExecReload=/usr/bin/hypnotoad /opt/mscs/gui/msc-gui 13 | KillMode=process 14 | 15 | [Install] 16 | WantedBy=multi-user.target 17 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftServerControl/msc-gui/5f7841b789a9c601b71eb52b5cdd3779037a4006/public/favicon.ico -------------------------------------------------------------------------------- /public/msc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftServerControl/msc-gui/5f7841b789a9c601b71eb52b5cdd3779037a4006/public/msc.png -------------------------------------------------------------------------------- /templates/dashboard.html.ep: -------------------------------------------------------------------------------- 1 | % layout 'default'; 2 | 3 | 93 | 94 |
95 |
96 | % foreach my $world (@{stash ('msc_enabled_worlds')}) { 97 | 110 |
111 |
112 | 113 | Map of world: <%= $world %> 114 | 115 |
116 |

117 | <%= ucfirst $world %>: 118 | Enabled 119 |

120 |
    121 |
  •  
  • 122 |
  •  
  • 123 |
  •  
  • 124 |
125 |
126 |
127 |
128 | % } 129 | % foreach my $world (@{stash ('msc_disabled_worlds')}) { 130 |
131 |
132 | 133 | Map of world: <%= $world %> 134 | 135 |
136 |

137 | <%= ucfirst $world %>: 138 | Disabled 139 |

140 |
    141 |
  •  
  • 142 |
  •  
  • 143 |
  •  
  • 144 |
145 |
146 |
147 |
148 | % } 149 |
150 |
151 | -------------------------------------------------------------------------------- /templates/disabled-world.html.ep: -------------------------------------------------------------------------------- 1 | % layout 'default'; 2 | 3 |

<%= ucfirst $world %>

4 | 5 | World Disabled 6 | -------------------------------------------------------------------------------- /templates/disabled-world.json.ep: -------------------------------------------------------------------------------- 1 | %== mscs ("status-json $world"); 2 | -------------------------------------------------------------------------------- /templates/enabled-world.html.ep: -------------------------------------------------------------------------------- 1 | % layout 'default'; 2 | 3 | % use Mojo::JSON qw(decode_json); 4 | 5 | % my $status = decode_json mscs ("status-json $world"); 6 | % my @players = (); 7 | % if (defined $status->{$world}->{query}->{players}) { 8 | % @players = @{$status->{$world}->{query}->{players}}; 9 | % } 10 | 11 |

<%= ucfirst $world %>

12 | 13 |
14 | List of backups:
15 | 
16 | <%= $msc_backup_list %>
17 | 
18 | 19 |
20 | Query:
21 | 
22 | MOTD: <%= $status->{$world}->{query}->{motd} %>
23 | Game type: <%= $status->{$world}->{query}->{gametype} %>
24 | Game ID: <%= $status->{$world}->{query}->{gameid} %>
25 | Server Version: <%= $status->{$world}->{query}->{version} %>
26 | Server Plugins: <%= $status->{$world}->{query}->{plugins} %>
27 | Server Map: <%= $status->{$world}->{query}->{map} %>
28 | Number of players online: <%= $status->{$world}->{query}->{numplayers} %>
29 | Maximum players: <%= $status->{$world}->{query}->{maxplayers} %>
30 | Host port: <%= $status->{$world}->{query}->{hostport} %>
31 | Host IP: <%= $status->{$world}->{query}->{hostip} %>
32 | Player list: <%= join ',', @players %>
33 | 
34 | 35 | 36 | Map of <%= $world %> 37 | 38 | -------------------------------------------------------------------------------- /templates/enabled-world.json.ep: -------------------------------------------------------------------------------- 1 | %== mscs ("status-json $world"); 2 | -------------------------------------------------------------------------------- /templates/layouts/default.html.ep: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | <%= title %> 5 | 6 | 7 | 8 | 9 | 10 | 11 | 22 | 23 | 24 | 63 | <%= content %> 64 | 65 | 66 | -------------------------------------------------------------------------------- /templates/settings.html.ep: -------------------------------------------------------------------------------- 1 | % layout 'default'; 2 | 3 |

Settings

4 | -------------------------------------------------------------------------------- /templates/worlds.html.ep: -------------------------------------------------------------------------------- 1 | % layout 'default'; 2 | 3 |

Enabled Worlds:

4 | 9 | 10 |

Disabled Worlds:

11 | 16 | -------------------------------------------------------------------------------- /templates/worlds.json.ep: -------------------------------------------------------------------------------- 1 | % use Mojo::JSON qw (to_json); 2 | % my $json = { 3 | % enabled_worlds => stash ('msc_enabled_worlds'), 4 | % disabled_worlds => stash ('msc_disabled_worlds') 5 | % }; 6 | %== to_json $json 7 | --------------------------------------------------------------------------------