diff --git a/.gitignore b/.gitignore
index f160d1c1..e163e2bc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
servers/*.tgz
!servers/*.html
+mtm_db/
diff --git a/README.md b/README.md
index 137e4842..fb2e3ad2 100755
--- a/README.md
+++ b/README.md
@@ -56,6 +56,14 @@ Mods / Gamepacks
ChangeLog
----
+2/03/2021 - v1.1
+* Allow for user mods directory
+* Add user mod upload portal (ZIP only)
+* CSS tweaks
+* Bugfix in mod reset function
+* Server creation cleanup
+* Administration panel for registration token generation and server management
+* User / Server delete functions *TO BE ADDED*
2/01/2021 - v1.0
* Working PHP front end with user registeration and login
diff --git a/config.php b/config.php
index 08eed510..a400c5e6 100755
--- a/config.php
+++ b/config.php
@@ -17,6 +17,11 @@ $portrange = "30"; // xxx example 30, would be 30001 for port usage
// Default "admin" account password
$admin_passwd = "ChangeM3!";
+// Mod upload settings
+$max_modzip_size = "20971520"; // Max mod zip file size in bytes, default 20MB
+$allowed_file_extension = "zip"; // Allowed archive extension type.
+// File mimetype is checked by the index upload-modzip function
+
// IRC settings, for IRC plugin
$default_irc_server = "irc.edgy1.net";
$default_irc_port = "6667";
diff --git a/ctn/bg.jpg b/ctn/bg.jpg
new file mode 100644
index 00000000..f49afceb
Binary files /dev/null and b/ctn/bg.jpg differ
diff --git a/style.css b/ctn/style.css
similarity index 94%
rename from style.css
rename to ctn/style.css
index 148179da..f964c9af 100755
--- a/style.css
+++ b/ctn/style.css
@@ -6,10 +6,11 @@ MTSM Stylesheet - (C) Chris Dorman, 2021 CC-BY-SA 3.0
@import url('https://fonts.googleapis.com/css2?family=Roboto&family=Ubuntu&display=swap');
html, body {
- background-color: #626262;
+ background-color: #cccccc;
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
+ background-image: url('bg.jpg');
color: #e3e3e3;
margin: 0 auto;
font-size: 14px;
@@ -44,13 +45,13 @@ html, body {
#navbar a {
text-decoration: none;
font-family: "Ubuntu", "Roboto", sans-serif;
- font-size: 26px;
+ font-size: 22px;
text-align: center;
padding-top: 4px;
padding-bottom: 5px;
background-color: #ffffff;
color: #5577ff;
- width: 125px;
+ width: 100px;
display: inline-block;
}
@@ -132,6 +133,7 @@ a:hover {
.maincontain {
margin: 0 auto;
width: 702px;
+ box-shadow: 0px 0px 22px #111111;
}
pre, code {
diff --git a/functions.php b/functions.php
index 47be95b7..5d1c6b5b 100755
--- a/functions.php
+++ b/functions.php
@@ -85,6 +85,19 @@ EOD;
}*/
+function modUploadForm() {
+?>
+
+ Warning: Mod uploads MUST be in ZIP archive format and MUST have the mod contents WITHIN a parent directory
+ within the archive. Failure to do so would cause for non-working mod installations into your user mods menu.
+
\n");
+
// Trigger event to start server
file_put_contents("mtm_db/events/$userid", "tar -xzf servers/multicraft.tgz -C mtm_db/worlds/$userid");
file_put_contents("mtm_db/users/$userid.type", "multicraft");
@@ -157,13 +172,18 @@ else if(isset($_GET['do']))
}
}
- // Create private server for testing or private party reasons.
+ // Create private server for testing or private party reasons.
if($do=="create-minetest") {
if (!isset($_SESSION['mtm-user']) || !isset($_SESSION['mtm-pass'])) { loginForm(); } else {
include("mtm_db/users/$username.php");
if(!is_dir("mtm_db/worlds/$userid")) {
mkdir("mtm_db/worlds/$userid");
+ // Check if usermods folder exists, create if not!
+ if(!is_dir("mtm_db/usermods/$username")) {
+ mkdir("mtm_db/usermods/$username");
+ }
+
// Lets setup a default configuration script
$config_contents = "port = " . $portrange . $userid . "\n";
$config_contents .= "name = " . $username . "\n";
@@ -177,6 +197,10 @@ else if(isset($_GET['do']))
$config_contents .= "irc.channel = #$username\n";
file_put_contents("mtm_db/worlds/$userid/minetest.conf", $config_contents);
+ // Toggle server off, to the web panel
+ file_put_contents("mtm_db/users/$userid.pid.statuscode", "false");
+ file_put_contents("mtm_db/users/$userid.pid.status", "
Stopped
\n");
+
// Trigger event to start servver
file_put_contents("mtm_db/events/$userid", "tar -xzf servers/minetest-current.tgz -C mtm_db/worlds/$userid");
file_put_contents("mtm_db/users/$userid.type", "minetest");
@@ -290,6 +314,8 @@ else if(isset($_GET['do']))
} else {
$serverstatus = file_get_contents("mtm_db/users/$userid.pid.statuscode");
if($serverstatus == "false") {
+ // Let them know this might take a while
+ echo "Please wait, this might take a few seconds depending on the amount of mods being enabled...";
// Check to see which mods where selected, and go from there!
chdir("mods");
foreach(glob("*") as $modname) {
@@ -302,7 +328,7 @@ else if(isset($_GET['do']))
sleep(2);
}
}
-
+ chdir("..");
header("Location: index.php?do=manage");
} else {
echo "Shut down server before configuration...";
@@ -314,6 +340,43 @@ else if(isset($_GET['do']))
}
}
+ if($do=="configure-user-mods")
+ {
+ if (!isset($_SESSION['mtm-user']) || !isset($_SESSION['mtm-pass'])) { loginForm(); } else {
+ include("mtm_db/users/$username.php");
+ if(is_dir("mtm_db/worlds/$userid")) {
+ if(!is_dir("mtm_db/worlds/$userid/bin")) {
+ echo "Pending: Server is pending creation, this process shouldn't take longer than 30 seconds...";
+ } else {
+ $serverstatus = file_get_contents("mtm_db/users/$userid.pid.statuscode");
+ if($serverstatus == "false") {
+ // Let them know this might take a while
+ echo "Please wait, this might take a few seconds depending on the amount of mods being enabled...";
+ // Check to see which mods where selected, and go from there!
+ chdir("mtm_db/usermods/$username");
+ foreach(glob("*") as $modname) {
+ // server_announce = true
+ if(isset($_POST[$modname])) {
+ echo "Copying $modname...";
+ chdir("../..");
+ file_put_contents("events/$userid", "cp -a mtm_db/usermods/$username/$modname mtm_db/worlds/$userid/worlds/world/worldmods/$modname");
+ chdir("usermods/$username");
+ sleep(2);
+ }
+ }
+
+ chdir("../../../");
+
+ header("Location: index.php?do=manage");
+ } else {
+ echo "Shut down server before configuration...";
+ }
+ }
+ } else {
+ echo "ERROR: Server not found!";
+ }
+ }
+ }
if($do=="start") {
if (!isset($_SESSION['mtm-user']) || !isset($_SESSION['mtm-pass'])) { loginForm(); } else {
@@ -387,6 +450,35 @@ else if(isset($_GET['do']))
}
}
+ if($do=="info-debug") {
+ if (!isset($_SESSION['mtm-user']) || !isset($_SESSION['mtm-pass'])) { loginForm(); } else {
+ include("mtm_db/users/$username.php");
+ if(is_dir("mtm_db/worlds/$userid")) {
+ if(!is_dir("mtm_db/worlds/$userid/bin")) {
+ echo "Please wait: Server is being created, this process shouldn't take longer than 30 seconds...";
+ // Refresh the page every 5 seconds for updates on the VM status.
+ echo "";
+ } else {
+ echo $username . "'s Server Server status: ";
+ $serverstatus = file_get_contents("mtm_db/users/$userid.pid.status");
+ echo $serverstatus;
+ echo " Reset minetest.conf ";
+ echo " Reset logfile\n";
+ echo "
";
+ // In case someone fucks there shit up
+ echo "Delete user mods ";
+ userModsForm($username);
+
+ echo "
Personal mod upload
";
+ modUploadForm();
}
} else {
echo "ERROR: Server not found!";
@@ -499,7 +642,37 @@ else if(isset($_GET['do']))
echo "";
} else {
if(is_dir("mtm_db/worlds/$userid/worlds/world/worldmods")) {
- file_put_contents("mtm_db/events/$userid", "rm -r mtm_db/worlds/$userid/worlds/world/worldmods");
+ $serverstatus = file_get_contents("mtm_db/users/$userid.pid.statuscode");
+ if($serverstatus == "false") {
+ file_put_contents("mtm_db/events/$userid", "rm -r mtm_db/worlds/$userid/worlds/world/worldmods/*");
+ sleep(1);
+ header("Location: index.php?do=manage");
+ } else {
+ echo "Error: please shut down your server before deleting world mods!";
+ }
+ } else {
+ echo "Error: mods directory for your world doesn't exit!";
+ }
+ }
+ } else {
+ echo "ERROR: Server not found!";
+ }
+ }
+ }
+
+ if($do=="reset-user-mods")
+ {
+ if (!isset($_SESSION['mtm-user']) || !isset($_SESSION['mtm-pass'])) { loginForm(); } else {
+ include("mtm_db/users/$username.php");
+ if(is_dir("mtm_db/worlds/$userid")) {
+ if(!is_dir("mtm_db/worlds/$userid/bin")) {
+ echo "Please wait: Server is being created, this process shouldn't take longer than 30 seconds...";
+ // Refresh the page every 5 seconds for updates on the VM status.
+ echo "";
+ } else {
+ if(is_dir("mtm_db/usermods/$username")) {
+ file_put_contents("mtm_db/events/$userid", "rm -r mtm_db/usermods/$username/*");
+ sleep(2);
header("Location: index.php?do=manage");
}
}
@@ -675,8 +848,8 @@ else
if(!is_dir("mtm_db/worlds/$userid"))
{
echo "
Minetest server creation
";
- echo "
You will have the ability to create a server, and will have a consistent uptime based on server uptime, and automated server management!
";
-
+ echo "
You will have the ability to create a server, and will have a consistent uptime based on server uptime, and automated server management!";
+ echo "There's mods and gamepacks available to users and can be toggled on and off! Over time, more will be populated into the local repository.
";
// Get home page for non-users based on users wants
$useraboutmulticraft = file_get_contents("text/multicraft.txt");
$useraboutminetest = file_get_contents("text/minetest.txt");
@@ -692,9 +865,9 @@ else
}
else
- {
- echo "
You've been assigned a Minetest server, click "Manage" for more information on your server.
";
- }
+ {
+ header("Location: index.php?do=manage");
+ }
} else {
// This is the admin panel!
echo "
Administration panel
";
diff --git a/server b/server
index ab1ef034..2660e26a 100755
--- a/server
+++ b/server
@@ -25,7 +25,7 @@ case $1 in
esac
;;
start-minetest )
- ((./mtm_db/worlds/$2/bin/minetestserver --logfile mtm_db/users/$userid.slog --config mtm_db/worlds/$2/minetest.conf --world `pwd`/mtm_db/worlds/$2/worlds/world) & jobs -p > mtm_db/pids/$2.pid) &
+ ((./mtm_db/worlds/$2/bin/minetestserver --logfile mtm_db/users/$2.slog --config mtm_db/worlds/$2/minetest.conf --world `pwd`/mtm_db/worlds/$2/worlds/world) & jobs -p > mtm_db/pids/$2.pid) &
sleep 10
@@ -35,7 +35,7 @@ case $1 in
;;
start-multicraft )
- ((./mtm_db/worlds/$2/bin/multicraftserver --logfile mtm_db/users/$userid.slog --config mtm_db/worlds/$2/minetest.conf --world `pwd`/mtm_db/worlds/$2/worlds/world) & jobs -p > mtm_db/pids/$2.pid) &
+ ((./mtm_db/worlds/$2/bin/multicraftserver --logfile mtm_db/users/$2.slog --config mtm_db/worlds/$2/minetest.conf --world `pwd`/mtm_db/worlds/$2/worlds/world) & jobs -p > mtm_db/pids/$2.pid) &
sleep 20
diff --git a/start-mtsm b/start-mtsm
index 7c49e3dd..e8128607 100755
--- a/start-mtsm
+++ b/start-mtsm
@@ -2,7 +2,7 @@
# (C) Chris Dorman, 2021 - MTSM - CC-BY-SA 3.0
case $1 in
- start ) ./mtsm > /dev/null &;;
+ start ) ./mtsm > /dev/null 2>&1 &;;
stop ) killall mtsm;;
* ) echo "Usage: ./start-mtsm [start|stop]";;
esac
diff --git a/text/multicraft.txt b/text/multicraft.txt
index 6e1ebb3d..f1f1ed5c 100755
--- a/text/multicraft.txt
+++ b/text/multicraft.txt
@@ -2,4 +2,6 @@
MultiCraft is a fork of the original Minetest project in hopes to make a more complete front-end
to the minetest-server with server additions as well. This allows for an easy solution to managing
multiple game worlds by a single administration control panel. Also enhanced with a powerful user API,
-billing integration, built-in database provisioning for backups, and FTP server.
+billing integration, built-in database provisioning for backups, and FTP server. Lets not forget that
+MultiCraft merges the different version protocol incompatabilities that have risen over the years of
+development!