diff options
author | Mattes D <github@xoft.cz> | 2015-09-06 10:05:18 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2015-09-06 10:05:18 +0200 |
commit | 7da79fdc19a9825b29cda58a698da1fa3cfb8e57 (patch) | |
tree | ec17a9703fe734956e4f151cb5306befc4fd7571 /Server/webadmin | |
parent | Merge pull request #2459 from cuberite/fixes (diff) | |
parent | Renamed output directory to Server (diff) | |
download | cuberite-7da79fdc19a9825b29cda58a698da1fa3cfb8e57.tar cuberite-7da79fdc19a9825b29cda58a698da1fa3cfb8e57.tar.gz cuberite-7da79fdc19a9825b29cda58a698da1fa3cfb8e57.tar.bz2 cuberite-7da79fdc19a9825b29cda58a698da1fa3cfb8e57.tar.lz cuberite-7da79fdc19a9825b29cda58a698da1fa3cfb8e57.tar.xz cuberite-7da79fdc19a9825b29cda58a698da1fa3cfb8e57.tar.zst cuberite-7da79fdc19a9825b29cda58a698da1fa3cfb8e57.zip |
Diffstat (limited to 'Server/webadmin')
22 files changed, 1095 insertions, 0 deletions
diff --git a/Server/webadmin/GenerateSelfSignedHTTPSCertUsingOpenssl.cmd b/Server/webadmin/GenerateSelfSignedHTTPSCertUsingOpenssl.cmd new file mode 100644 index 000000000..7022ef12a --- /dev/null +++ b/Server/webadmin/GenerateSelfSignedHTTPSCertUsingOpenssl.cmd @@ -0,0 +1,12 @@ +@echo off +echo This script generates the certificate and private key for the https webadmin +echo Note that the generated certificate is self-signed, and therefore not trusted by browsers +echo Note that this script requires openssl to be installed and in PATH +echo. +echo When OpenSSL asks you for Common Name, you need to enter the fully qualified domain name of the server, that is, e. g. gallery.xoft.cz +echo. +echo If OpenSSL fails with an error, "WARNING: can't open config file: /usr/local/ssl/openssl.cnf", you need to run this script as an administrator +echo. + +openssl req -x509 -newkey rsa:2048 -keyout httpskey.pem -out httpscert.crt -days 3650 -nodes +pause diff --git a/Server/webadmin/GenerateSelfSignedHTTPSCertUsingOpenssl.sh b/Server/webadmin/GenerateSelfSignedHTTPSCertUsingOpenssl.sh new file mode 100755 index 000000000..5cf1237c8 --- /dev/null +++ b/Server/webadmin/GenerateSelfSignedHTTPSCertUsingOpenssl.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +echo "This script generates the certificate and private key for the https webadmin" +echo "Note that the generated certificate is self-signed, and therefore not trusted by browsers" +echo "Note that this script requires openssl to be installed and in PATH" +echo "" +echo "When OpenSSL asks you for Common Name, you need to enter the fully qualified domain name of the server, that is, e. g. gallery.xoft.cz" +echo "" + +openssl req -x509 -newkey rsa:2048 -keyout httpskey.pem -out httpscert.crt -days 3650 -nodes diff --git a/Server/webadmin/files/background.gif b/Server/webadmin/files/background.gif Binary files differnew file mode 100644 index 000000000..cab9bed56 --- /dev/null +++ b/Server/webadmin/files/background.gif diff --git a/Server/webadmin/files/favicon.ico b/Server/webadmin/files/favicon.ico Binary files differnew file mode 100644 index 000000000..ea4bde926 --- /dev/null +++ b/Server/webadmin/files/favicon.ico diff --git a/Server/webadmin/files/guest.html b/Server/webadmin/files/guest.html new file mode 100644 index 000000000..4f965b75c --- /dev/null +++ b/Server/webadmin/files/guest.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<html lang="en"> + + <head> + <meta charset="UTF-8" /> + <title>Guest Information</title> + </head> + + <body> + <p> + Hello! Welcome to the MCServer WebAdmin. + </p> + <p> + This is a default message, edit <b>files/guest.html</b> to add your own custom message. + </p> + </body> + +</html> diff --git a/Server/webadmin/files/header.png b/Server/webadmin/files/header.png Binary files differnew file mode 100644 index 000000000..97b067715 --- /dev/null +++ b/Server/webadmin/files/header.png diff --git a/Server/webadmin/files/home.gif b/Server/webadmin/files/home.gif Binary files differnew file mode 100644 index 000000000..b10e0bed7 --- /dev/null +++ b/Server/webadmin/files/home.gif diff --git a/Server/webadmin/files/loading.gif b/Server/webadmin/files/loading.gif Binary files differnew file mode 100644 index 000000000..b8d06f669 --- /dev/null +++ b/Server/webadmin/files/loading.gif diff --git a/Server/webadmin/files/log_out.png b/Server/webadmin/files/log_out.png Binary files differnew file mode 100644 index 000000000..63232417a --- /dev/null +++ b/Server/webadmin/files/log_out.png diff --git a/Server/webadmin/files/login.css b/Server/webadmin/files/login.css new file mode 100644 index 000000000..5d87da4c5 --- /dev/null +++ b/Server/webadmin/files/login.css @@ -0,0 +1,219 @@ +/* Copyright Justin S and MCServer Team, licensed under CC-BY-SA 3.0 */ +* { + margin: 0; +} + +body { + font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; + -webkit-font-smoothing: antialiased; + background: #fff url(header.png) repeat-x top left; + width: 100%; + min-width: 100%; + overflow: hidden; +} + +a:link { + color: #555; + text-decoration: none; +} + +a:visited { + color: #444; + text-decoration: none; +} + +a:hover, a:active { + color: #000; + text-decoration: underline; +} + +img { + border: none; +} + +h1 { + color: #069; +} + +.row1 { + border-bottom: 1px solid #000; + height: 100px; + max-height: 100px; +} + +.row2 { + margin: 0 auto; + text-align: center; + vertical-align: middle; +} + +.contention { + color: #000; + text-align: left; + line-height: 1.4; + margin: 0; + font-family: Tahoma,Verdana,Arial,Sans-Serif; + font-size: 13px; +} + +button { + background: #fff; + color: #000; + border: 1px solid #ccc; + padding: 3px; + font-family: Tahoma,Verdana,Arial,Sans-Serif; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + border-radius: 5px; + margin: -3px 0; +} + +button:hover { + border-top-color: #28597a; + background: #28597a; + color: #ccc; +} + +button:active { + border-top-color: #1b435e; + background: #1b435e; +} + +.push10 { + padding-bottom: 75px; +} + +#panel .upper { + background: #dcdbdc url(tcat.png) repeat-x; + border-top: 1px solid #fff; + border-bottom: 1px solid #bbb; + padding: 7px; +} + +#footer { + z-index: 99999; +} + +#footer ul.menu { + margin: 0; + padding: 0; + list-style: none; +} + +#footer ul.menu li { + margin: 0 5px; + display: inline; +} + +#footer .upper { + background: #dcdbdc url(tcat.png) repeat-x; + border-top: 1px solid #bbb; + padding: 6px; + overflow: hidden; + font-size: 12px; +} + +#footer .upper ul.bottom_links { + float: left; + margin: 3px 0 0 -5px; +} + +#footer .lower { + background: #a1a2a2 url(thead.png) top left repeat-x; + color: #fff; + border-top: 1px solid #ccc; + border-bottom: 1px solid #ddd; + overflow: hidden; + padding: 8px; + font-size: 11px; +} + +#footer .lower a:link, #footer .lower a:visited { + color: #fff; + font-weight: 700; +} + +#footer .lower a:hover, #footer .lower a:active { + color: #fff; + font-weight: 700; +} + +#footer .lower #current_time { + float: right; + padding-right: 6px; +} + +.wrapper { + width: 85%; + min-width: 970px; + max-width: 1500px; + margin: auto; +} + +#footer { + position: fixed; + left: 0; + bottom: 0; + height: 60px; + width: 100%; + background: #999; + border-top: 1px #000 solid; +} + +* html #footer { + position: absolute; + top: expression((0-(footer.offsetHeight)+(document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight)+(ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop))+'px'); +} + +tr td.trow2:first-child { + border-left: 0; +} + +tr td.trow2:last-child { + border-right: 0; +} + +.tborder { + -moz-border-radius: 7px; + -webkit-border-radius: 7px; + border-radius: 7px; +} + +.thead, .rounded_top { + -moz-border-radius-topleft: 6px; + -moz-border-radius-topright: 6px; + -webkit-border-top-left-radius: 6px; + -webkit-border-top-right-radius: 6px; + border-top-left-radius: 6px; + border-top-right-radius: 6px; +} + +table { + color: #000; + font-size: 13px; +} + +.tborder { + background: #fff; + width: 100%; + margin: auto; + border: 1px solid #ccc; + padding: 1px; +} + +.thead { + background: #a1a2a2 url(thead.png) top left repeat-x; + color: #fff; + border-bottom: 1px solid #8e8f8f; + padding: 8px; +} + +.trow2 { + background: #efefef; + border: 1px solid; + border-color: #fff #ddd #ddd #fff; +} + +.padtopp { + padding-top: 25px; +} diff --git a/Server/webadmin/files/login.gif b/Server/webadmin/files/login.gif Binary files differnew file mode 100644 index 000000000..ce2cb6fc0 --- /dev/null +++ b/Server/webadmin/files/login.gif diff --git a/Server/webadmin/files/logo.png b/Server/webadmin/files/logo.png Binary files differnew file mode 100644 index 000000000..50733e824 --- /dev/null +++ b/Server/webadmin/files/logo.png diff --git a/Server/webadmin/files/logo_login.png b/Server/webadmin/files/logo_login.png Binary files differnew file mode 100644 index 000000000..d2155f928 --- /dev/null +++ b/Server/webadmin/files/logo_login.png diff --git a/Server/webadmin/files/mc-logo.png b/Server/webadmin/files/mc-logo.png Binary files differnew file mode 100644 index 000000000..9a77a490f --- /dev/null +++ b/Server/webadmin/files/mc-logo.png diff --git a/Server/webadmin/files/pmfolder.gif b/Server/webadmin/files/pmfolder.gif Binary files differnew file mode 100644 index 000000000..3fc68fdcb --- /dev/null +++ b/Server/webadmin/files/pmfolder.gif diff --git a/Server/webadmin/files/style.css b/Server/webadmin/files/style.css new file mode 100644 index 000000000..7c0671970 --- /dev/null +++ b/Server/webadmin/files/style.css @@ -0,0 +1,427 @@ +/* Copyright Justin S and MCServer Team, licensed under CC-BY-SA 3.0 */ +* { + margin: 0; +} + +body { + font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; + -webkit-font-smoothing: antialiased; + background: #fff; + width: 100%; + min-width: 100%; + height:100%; + min-height:100%; + overflow-y: scroll; + overflow-x: hidden; +} + +a:link { + color: #555; + text-decoration: none; +} + +a:visited { + color: #444; + text-decoration: none; +} + +a:hover, a:active { + color: #000; + text-decoration: underline; +} + +img { + border: none; +} + +h1 { + color: #069; + text-shadow: 2px 2px #000; +} + +.row1 { + border-bottom: 1px #000 solid; + height: 100px; + max-height: 100px; + background: #fff url(header.png) repeat-x top left; +} + +.row2 { + margin: 0 auto; + text-align: center; + vertical-align: middle; + margin-top: 25px; + margin-bottom: 25px; +} + +.contention { + color: #000; + text-align: left; + line-height: 1.4; + margin: 0; + font-family: Tahoma,Verdana,Arial,Sans-Serif; + font-size: 13px; + margin-bottom:75px; +} + +.push25 { +} + +#panel ul.menu { + margin: 0; + padding: 0; + list-style: none; +} + +#panel ul.menu li { + margin: 0 5px; + display: inline; +} + +#panel ul.menu li a { + padding-left: 20px; + background-repeat: no-repeat; + background-position: left center; +} + +#panel .upper ul.top_links { + float: right; + font-weight: 700; +} + +#panel .upper { + background: #dcdbdc url(tcat.png) repeat-x; + border-top: 1px solid #fff; + border-bottom: 1px solid #bbb; + padding: 7px; +} + +#footer ul.menu { + margin: 0; + padding: 0; + list-style: none; +} + +#footer ul.menu li { + margin: 0 5px; + display: inline; +} + +#footer .upper { + background: #dcdbdc url(tcat.png) repeat-x; + border-top: 1px solid #bbb; + padding: 6px; + overflow: hidden; + font-size: 12px; +} + +#footer .upper ul.bottom_links { + float: left; + margin: 3px 0 0 -5px; +} + +#footer .lower { + background: #a1a2a2 url(thead.png) top left repeat-x; + color: #fff; + border-top: 1px solid #ccc; + border-bottom: 1px solid #ddd; + overflow: hidden; + padding: 8px; + font-size: 11px; +} + +#footer .lower a:link,#footer .lower a:visited { + color: #fff; + font-weight: 700; +} + +#footer .lower a:hover,#footer .lower a:active { + color: #fff; + font-weight: 700; +} + +#footer .lower #current_time { + float: right; + padding-right: 6px; +} + +.wrapper { + width: 85%; + min-width: 970px; + max-width: 1500px; + margin: auto; +} + +#footer { + position: fixed; + left:0; + bottom:0; + height: 61px; + width: 100%; + background: #999; + border-top: 1px #000 solid; + border-bottom: 1px #000 solid; +} + +* html #footer { + position: absolute; + top: expression((0-(footer.offsetHeight)+(document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight)+(ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop))+'px'); +} + +tr td.trow1:first-child, tr td.trow2:first-child { + border-left: 0; +} + +tr td.trow1:last-child, tr td.trow2:last-child { + border-right: 0; +} + +.tborder { + -moz-border-radius: 7px; + -webkit-border-radius: 7px; + border-radius: 7px; +} + +.thead { + -moz-border-radius-topleft: 6px; + -moz-border-radius-topright: 6px; + -webkit-border-top-left-radius: 6px; + -webkit-border-top-right-radius: 6px; + border-top-left-radius: 6px; + border-top-right-radius: 6px; +} + +table { + color: #000; + font-size: 13px; +} + +.tborder { + background: #fff; + width: 100%; + margin: auto; + border: 1px solid #ccc; + padding: 1px; +} + +.thead { + background: #a1a2a2 url(thead.png) top left repeat-x; + color: #fff; + border-bottom: 1px solid #8e8f8f; + padding: 8px; +} + +.tcat { + background: #dcdbdc url(tcat.png) repeat-x; + color: #fff; + border-bottom: 1px solid #bbb; + padding: 6px; + font-size: 12px; +} + +.trow1 { + background: #f5f5f5; + border: 1px solid; + border-color: #fff #ddd #ddd #fff; +} + +.trow2 { + background: #efefef; + border: 1px solid; + border-color: #fff #ddd #ddd #fff; + padding: 15px; + box-sizing: border-box; + -moz-box-sizing: border-box; +} + +table { + color: #000; + font-size: 13px; + text-align: left; +} + +.tborder { + background: #fff; + width: 100%; + margin: auto; + border: 1px solid #ccc; + padding: 1px; +} + +.thead { + background: #a1a2a2 url(thead.png) top left repeat-x; + color: #fff; + border-bottom: 1px solid #8e8f8f; + padding: 8px; +} + +.tcat { + background: #dcdbdc url(tcat.png) repeat-x; + color: #fff; + border-bottom: 1px solid #bbb; + padding: 6px; + font-size: 12px; +} + +.trow1 { + background: #f5f5f5; + border: 1px solid; + border-color: #fff #ddd #ddd #fff; +} + +.trow2 { + background: #efefef; + border: 1px solid; + border-color: #fff #ddd #ddd #fff; +} + +.smalltext { + font-size: 11px; +} + +textarea { + background: #fff; + color: #000; + border: 1px solid #ccc; + padding: 2px; + line-height: 1.4; + font-family: Tahoma,Verdana,Arial,Sans-Serif; + font-size: 13px; +} + +select { + background: #fff; + padding: 3px; + border: 1px solid #ccc; + font-family: Tahoma,Verdana,Arial,Sans-Serif; +} + +.usercp_nav_item { + display: block; + padding: 1px 0 1px 23px; +} + +.usercp_nav_pmfolder { + background: url(pmfolder.gif) no-repeat left center; +} + +.usercp_nav_sub_pmfolder { + padding-left: 40px; + background: url(sub_pmfolder.gif) no-repeat left center; +} + +.usercp_nav_home { + background: url(home.gif) no-repeat left center; +} + +.pagehead { + top: 0; + left: 0; + width: 100%; +} + +table { + width: 100%; +} + +table th { + border-bottom: 1px solid rgba(0,0,0,0.12); + padding: 5px; + text-align: left; +} + +table tr:nth-child(odd) { + background-color: rgba(0,0,0,0.015); +} + +p { + margin: 4px 0; + padding: 4px 3px; +} + +a { + text-decoration: none; + color: #000; + -webkit-transition: color .1s linear; + -moz-transition: color .1s linear; + transition: color .1s linear; +} + +a:hover { + color: #888; +} + +input[type="text"] { + background: #fff; + color: #000; + border: 1px solid #ccc; + padding: 2px; + line-height: 1.4; + font-family: Tahoma,Verdana,Arial,Sans-Serif; + font-size: 13px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + border-radius: 5px; +} + +input[type="text"]:hover { + background-color: #E5E4E2; +} + +input[type="text"]:focus { + background-color: #E5E4E2; +} + +hr { + border: none; + height: 1px; + background-color: rgba(0,0,0,0.12); +} + +h4 { + padding-bottom: 10px; + margin-bottom: 12px; + border-bottom: 1px solid rgba(0,0,0,0.12); +} + +#ChatDiv { + margin-bottom: 10px; +} + +#ChatMessage { + width: 92%; + margin-right: 5px; + box-sizing: border-box; + -moz-box-sizing: border-box; +} + +input[type="submit"] { + padding: 3px; + padding-left: 5px; + padding-right: 5px; + cursor: pointer; + font-family: Tahoma,Verdana,Arial,Sans-Serif; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + border-radius: 5px; + background: #f5f5f5; + border: 1px solid #ccc; +} + +input[type="submit"]:hover { + background-color: #E5E4E2; +} + +button:disabled,input:disabled { + padding: 3px; + padding-left: 5px; + padding-right: 5px; + cursor: pointer; + font-family: Tahoma,Verdana,Arial,Sans-Serif; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + border-radius: 5px; + border: none!important; + color: #fff!important; + background-color: #ccc!important; +} diff --git a/Server/webadmin/files/sub_pmfolder.gif b/Server/webadmin/files/sub_pmfolder.gif Binary files differnew file mode 100644 index 000000000..3d0d6e627 --- /dev/null +++ b/Server/webadmin/files/sub_pmfolder.gif diff --git a/Server/webadmin/files/tcat.png b/Server/webadmin/files/tcat.png Binary files differnew file mode 100644 index 000000000..eb64eb3d6 --- /dev/null +++ b/Server/webadmin/files/tcat.png diff --git a/Server/webadmin/files/thead.png b/Server/webadmin/files/thead.png Binary files differnew file mode 100644 index 000000000..81aa04bac --- /dev/null +++ b/Server/webadmin/files/thead.png diff --git a/Server/webadmin/login_template.html b/Server/webadmin/login_template.html new file mode 100644 index 000000000..fb6f21b52 --- /dev/null +++ b/Server/webadmin/login_template.html @@ -0,0 +1,69 @@ +<!-- Copyright Justin S and MCServer Team, licensed under CC-BY-SA 3.0 */ --> +<html> +<head> + <title>Cuberite WebAdmin - Login</title> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <link href="login.css" rel="stylesheet" type="text/css"> + <link rel="icon" href="favicon.ico"> +</head> +<body> +<div class="contention"> + <div class="row1"> + <div class="wrapper"> + <img src="logo_login.png" alt="Cuberite Logo" class="logo"> + </div> + </div> + <div id="panel"> + <div class="upper"> + <div class="wrapper"> + <div> + <form method="get" action="webadmin/"> + <button type="submit" value="Log in" style="width:150px;height:25px;font-family:'Source Sans Pro',sans-serif;background:transparent;border:none!important;vertical-align:middle"> + <strong><img src="login.gif" style="vertical-align:bottom" /> WebAdmin Log in</strong> + </button> + </form> + </div> + </div> + </div> + </div> + <div class="row2 push10"> + <div class="wrapper padtopp"> + <table border="0" cellspacing="0" cellpadding="5" class="tborder" style="margin-bottom:5px"> + <tbody> + <tr> + <td class="thead rounded_top"> + <div style="float:left!important"><strong>MCServer WebAdmin</strong></div> + </td> + </tr> + <tr> + <td class="trow2 post_content"> + <div class="post_body"> + <iframe width="100%" height="100%" style="border:none;min-height:350px;max-height:450px" src="/guest.html"></iframe> + </div> + </td> + </tr> + </tbody> + </table> + </div> + </div> +</div> +<div id="footer"> + <div class="upper"> + <div class="wrapper"> + <ul class="menu bottom_links"> + <li><a href="http://cuberite.org" target="_blank">Cuberite</a></li> + <li><a href="http://forum.mc-server.org" target="_blank">Forums</a></li> + <li><a href="http://builds.cuberite.org" target="_blank">Buildserver</a></li> + <li><a href="http://api-docs.cuberite.org" target="_blank">API Documentation</a></li> + <li><a href="http://book.cuberite.org/" target="_blank">User's Manual</a></li> + </ul> + </div> + </div> + <div class="lower"> + <div class="wrapper"> + <span id="copyright">Copyright © <a href="http://www.cuberite.org" target="_blank">Cuberite Team</a>.</span> + </div> + </div> +</div> +</body> +</html> diff --git a/Server/webadmin/template.html b/Server/webadmin/template.html new file mode 100644 index 000000000..b0864e35d --- /dev/null +++ b/Server/webadmin/template.html @@ -0,0 +1,140 @@ +<!DOCTYPE html> +<html> + <head> + <title>{TITLE} | {PLUGIN_NAME}</title> + <style type="text/css"> + body { + line-height: 1; + background: #B8B8B8; + } + + #maincontent { + padding: 0px 25px 10px 25px; + } + + #wrapper { + min-width: 850px; + width: 75%; + margin: 10px auto; + background-color: white; + border: 4px #888888 solid; + border-radius: 10px; + font-family: Calibri, Trebuchet MS; + } + + header { + text-align:center; + padding: 10px; 0px; + } + + span { + text-align: right; + float: right; + border-left: 2px #C8C8C8 solid; + border-bottom: 2px #C8C8C8 solid; + padding: 2px 10px; + } + + footer { + font-family: helvetica; + font-size: 10px; + text-align: center; + border-top: 1px #000 dotted; + padding: 1px 0px 1px 0px; + } + + table { + border-collapse: collapse; + border-spacing: 10; + } + + table { + border-top: 1px solid #ddd; + width: 700px; + } + + table tr th { + text-align: left; + background: #f6f6f6; + padding: 0px 20px; + height: 25px; + line-height: 25px; + border: 1px solid #ddd; + border-radius: 3px; + } + + table tr td { + background: #f6f6f6; + padding: 0px 20px; + height: 29px; + line-height: 29px; + border: 1px solid #ddd; + border-radius: 3px; + } + + #main table tr.odd td { + background: #fbfbfb; + } + + table tr:hover td { + background: #fdfcf6; + } + + table .action { + text-align: right; + padding: 0 20px 0 10px; + } + + table tr .action a { + color: #9b9b9b; + } + + #cssmenu{ height:10px; display:table; padding:0; margin: 0 auto; border:1px #707070 solid; border-radius:5px; } + #cssmenu > ul {list-style:inside none; padding:0; margin:0;} + #cssmenu > ul > li {list-style:inside none; padding:0; margin:0; float:left; display:block; position:relative;} + #cssmenu > ul > li > a{ outline:none; display:block; position:relative; color:#E8E8E8; padding:10px 10px; font:bold 13px/100% Arial, Helvetica, sans-serif; text-align:center; text-decoration:none; text-shadow:1px 1px 0 rgba(0,0,0, 0.4); } + #cssmenu > ul > li:first-child > a{border-radius:5px 0 0 5px;} + /* #cssmenu > ul > li > a:after{ content:''; position:absolute; border-right:1px solid #FFFFFF; top:-1px; bottom:-1px; right:-2px; z-index:99; } */ + #cssmenu ul li.has-sub:hover > a:after{top:0; bottom:0;} + #cssmenu > ul > li.has-sub > a:before{ content:''; position:absolute; top:18px; right:6px; border:5px solid transparent; border-top:5px solid #707070; } + #cssmenu > ul > li.has-sub:hover > a:before{top:19px;} + #cssmenu ul li.has-sub:hover > a{ background:#3f3f3f; border-color:#707070; padding-bottom:13px; padding-top:13px; top:-1px; z-index:999; } + #cssmenu ul li.has-sub:hover > ul, #cssmenu ul li.has-sub:hover > div{display:block;} + #cssmenu ul li.has-sub > a:hover{background:#3f3f3f; border-color:#3f3f3f;} + #cssmenu ul li > ul, #cssmenu ul li > div{ display:none; width:auto; position:absolute; top:38px; padding:10px 0; background:#3f3f3f; border-radius:0 0 5px 5px; z-index:999; } + #cssmenu ul li > ul{width:200px;} + #cssmenu ul li > ul li{display:block; list-style:inside none; padding:0; margin:0; position:relative;} + #cssmenu ul li > ul li a{ outline:none; display:block; position:relative; margin:0; padding:8px 20px; font:10pt Arial, Helvetica, sans-serif; color:#fff; text-decoration:none; text-shadow:1px 1px 0 rgba(0,0,0, 0.5); } + #cssmenu, #cssmenu > ul > li > ul > li a:hover{ background:#C8C8C8;} + #cssmenu > ul > li > a { border-right:1px solid #707070; color:#FFFFFF; } + #cssmenu > ul > li > a:after { border-color:#707070; } + #cssmenu > ul > li > a:hover { background:#B8B8B8; } + </style> + <meta name="msapplication-tooltip" content="MCServer WebAdministrator"/> + <meta name="msapplication-navbutton-color" content="#B8B8B8" /> + <link rel="shortcut icon" href="http://mc-server.org/favicon.ico" /> + </head> + <body> + <div id="wrapper"> + <span> + <b>Login: {USERNAME}</b> + </span> + <br /> + <header> + <img alt="" src="files/logo.png" /> + </header> + <nav id="cssmenu"> + <ul> + {MENU} + </ul> + </nav> + <div id="maincontent"> + {CONTENT} + </div> + <footer> + <p>MCServer is using {MEM}MB of memory, with {NUMCHUNKS} chunks loaded.</p> + <p>Web Design by <a href="https://github.com/WebFreak001"@WebFreak001</a></p> + </footer> + </div> + </body> +</html> diff --git a/Server/webadmin/template.lua b/Server/webadmin/template.lua new file mode 100644 index 000000000..5b3ecf152 --- /dev/null +++ b/Server/webadmin/template.lua @@ -0,0 +1,200 @@ +-- Use a table for fast concatenation of strings +local SiteContent = {} +function Output(String) + table.insert(SiteContent, String) +end + + + + + +function GetTableSize(Table) + local Size = 0 + for key,value in pairs(Table) do + Size = Size + 1 + end + return Size +end + + + + + +function GetDefaultPage() + local PM = cRoot:Get():GetPluginManager() + + local SubTitle = "Current Game" + local Content = "" + + Content = Content .. "<h4>Plugins:</h4><ul>" + PM:ForEachPlugin( + function (a_CBPlugin) + if (a_CBPlugin:IsLoaded()) then + Content = Content .. "<li>" .. a_CBPlugin:GetName() .. " (version " .. a_CBPlugin:GetVersion() .. ")</li>" + end + end + ) + + Content = Content .. "</ul>" + Content = Content .. "<h4>Players:</h4><ul>" + + cRoot:Get():ForEachPlayer( + function(a_CBPlayer) + Content = Content .. "<li>" .. a_CBPlayer:GetName() .. "</li>" + end + ) + + Content = Content .. "</ul><br>"; + + return Content, SubTitle +end + + + + + +function ShowPage(WebAdmin, TemplateRequest) + SiteContent = {} + local BaseURL = WebAdmin:GetBaseURL(TemplateRequest.Request.Path) + local Title = "Cuberite WebAdmin" + local NumPlayers = cRoot:Get():GetServer():GetNumPlayers() + local MemoryUsageKiB = cRoot:GetPhysicalRAMUsage() + local NumChunks = cRoot:Get():GetTotalChunkCount() + local PluginPage = WebAdmin:GetPage(TemplateRequest.Request) + local PageContent = PluginPage.Content + local SubTitle = PluginPage.PluginName + if (PluginPage.TabName ~= "") then + SubTitle = PluginPage.PluginName .. " - " .. PluginPage.TabName + end + if (PageContent == "") then + PageContent, SubTitle = GetDefaultPage() + end + + local reqParamsClass = "" + + for key,value in pairs(TemplateRequest.Request.Params) do + reqParamsClass = reqParamsClass .. " param-" .. string.lower(string.gsub(key, "[^a-zA-Z0-9]+", "-") .. "-" .. string.gsub(value, "[^a-zA-Z0-9]+", "-")) + end + + if (string.gsub(reqParamsClass, "%s", "") == "") then + reqParamsClass = " no-param" + end + + Output([[ +<!-- Copyright Justin S and MCServer Team, licensed under CC-BY-SA 3.0 --> +<html> +<head> + <title>]] .. Title .. [[</title> + <meta charset="UTF-8"> + <link rel="stylesheet" type="text/css" href="/style.css"> + <link rel="icon" href="/favicon.ico"> +</head> +<body> +<div class="contention push25"> + <div class="pagehead"> + <div class="row1"> + <div class="wrapper"> + <img src="/logo_login.png" alt="MCServer Logo" class="logo"> + </div> + </div> + <div id="panel"> + <div class="upper"> + <div class="wrapper"> + <ul class="menu top_links"> + <li><a>Players online: <strong>]] .. NumPlayers .. [[</strong></a></li> + <li><a>Memory: <strong>]] .. string.format("%.2f", MemoryUsageKiB / 1024) .. [[MB</strong></a></li> + <li><a>Chunks: <strong>]] .. NumChunks .. [[</strong></a></li> + </ul> + <div class="welcome"><strong>Welcome back, ]] .. TemplateRequest.Request.Username .. [[</strong> <a href=".././"><img src="/log_out.png" style="vertical-align:bottom;"> Log Out</a></div> + </div> + </div> + </div> + </div> + <div class="row2"> + <div class="wrapper"> + <table width="100%" border="0" align="center"> + <tbody> + <tr> + <td width="180" valign="top"> + <table border="0" cellspacing="0" cellpadding="5" class="tborder"> + <tbody> + <tr> + <td class="thead"><strong>Menu</strong></td> + </tr> + <tr> + <td class="trow1 smalltext"><a href=']] .. BaseURL .. [[' class='usercp_nav_item usercp_nav_home'>Home</a></td> + </tr> + <tr> + <td class="tcat"><div><span class="smalltext"><strong><font color="#000">Server Management</font></strong></span></div></td> + </tr> + </tbody> + <tbody style="" id="usercppms_e"> + <tr> + <td class="trow1 smalltext"> + ]]) + + + local AllPlugins = WebAdmin:GetPlugins() + for key,value in pairs(AllPlugins) do + local PluginWebTitle = value:GetWebTitle() + local TabNames = value:GetTabNames() + if (GetTableSize(TabNames) > 0) then + Output("<div><a class='usercp_nav_item usercp_nav_pmfolder' style='text-decoration:none;'><b>"..PluginWebTitle.."</b></a></div>\n"); + + for webname,prettyname in pairs(TabNames) do + Output("<div><a href='" .. BaseURL .. PluginWebTitle .. "/" .. webname .. "' class='usercp_nav_item usercp_nav_sub_pmfolder'>" .. prettyname .. "</a></div>\n") + end + + Output("<br>\n"); + end + end + + + Output([[ + </td> + </tr> + </tbody> + </table> + </td> + <td valign="top" style='padding-left:25px;'> + <table border="0" cellspacing="0" cellpadding="5" class="tborder"> + <tbody> + <tr> + <td class="thead" colspan="2"><strong>]] .. SubTitle .. [[</strong></td> + </tr> + <tr> + <td class="trow2">]] .. PageContent .. [[</td> + </tr> + </tbody> + </table> + </td> + </tr> + </tbody> + </table> + </div> + </div> +<div id="footer"> + <div class="upper"> + <div class="wrapper"> + <ul class="menu bottom_links"> + <li><a href="http://cuberite.org" target="_blank">Cuberite</a></li> + <li><a href="http://forum.mc-server.org" target="_blank">Forums</a></li> + <li><a href="http://builds.cuberite.org" target="_blank">Buildserver</a></li> + <li><a href="http://api-docs.cuberite.org" target="_blank">API Documentation</a></li> + <li><a href="http://book.cuberite.org/" target="_blank">User's Manual</a></li> + </ul> + </div> + </div> + <div class="lower"> + <div class="wrapper"> + <span id="copyright">Copyright © <a href="http://www.cuberite.org" target="_blank">Cuberite Team</a>.</span> + </div> + </div> +</div> +</div> +</body> +</html> +]]) + + return table.concat(SiteContent) +end |