Browse Source

added live page stuff

master
Jared Dunbar 4 years ago
parent
commit
90742ecd95
Signed by: jared GPG Key ID: CF202CC859BAC692
  1. 1
      .gitignore
  2. 11
      index.html
  3. 94
      status/sample.txt
  4. 81
      status/templates/index.html
  5. 56
      status/update.py
  6. 9
      style.css

1
.gitignore

@ -1,2 +1,3 @@
files/
old/
/index.html

11
index.html

@ -36,6 +36,16 @@
<h4>IP and Port:</h4>
<code class="indent">128.153.145.150:2424</code>
<h4>Current Status:</h4>
<p class="indent">Number of Players Online: 1</p>
<table>
<tr>
<td>jrddunbr</td><td><img width=32px src="https://crafatar.com/avatars/c0c9c646-b4a8-4f76-b5ad-6a7e3ba9a343.png" alt="jrddunbr"></img></td>
</tr>
</table>
<h2>Installation Instructions</h2>
<p class="indent">
Click <a href="install.html">here</a> for help on installing games and
@ -75,3 +85,4 @@
<audio src="music/epic-song.mp3" style="display:hidden" autoplay loop></audio>
</body>
</html>

94
status/sample.txt

@ -0,0 +1,94 @@
{'description': '007 [ The Big World ]',
'modinfo': {'modList': [{'modid': 'mcp', 'version': '9.05'},
{'modid': 'FML', 'version': '7.10.99.99'},
{'modid': 'Forge', 'version': '10.13.4.1614'},
{'modid': 'appliedenergistics2-core',
'version': 'rv2-stable-10'},
{'modid': 'CodeChickenCore', 'version': '1.0.7.47'},
{'modid': 'Micdoodlecore', 'version': ''},
{'modid': 'NotEnoughItems', 'version': '1.0.5.120'},
{'modid': 'OpenComputers|Core',
'version': '1.7.2.1166'},
{'modid': 'OpenModsCore', 'version': '0.10'},
{'modid': '<CoFH ASM>', 'version': '000'},
{'modid': 'appliedenergistics2',
'version': 'rv2-stable-10'},
{'modid': 'Baubles', 'version': '1.0.1.10'},
{'modid': 'Thaumcraft', 'version': '4.2.3.5'},
{'modid': 'Botania', 'version': 'r1.8-249'},
{'modid': 'CoFHCore', 'version': '1.7.10R3.1.4'},
{'modid': 'BuildCraft|Core', 'version': '7.1.23'},
{'modid': 'BuildCraft|Transport', 'version': '7.1.23'},
{'modid': 'BuildCraft|Factory', 'version': '7.1.23'},
{'modid': 'BuildCraft|Silicon', 'version': '7.1.23'},
{'modid': 'BuildCraft|Robotics', 'version': '7.1.23'},
{'modid': 'BuildCraft|Energy', 'version': '7.1.23'},
{'modid': 'BuildCraft|Builders', 'version': '7.1.23'},
{'modid': 'Railcraft', 'version': '9.12.2.1'},
{'modid': 'ForgeMultipart', 'version': '1.2.0.345'},
{'modid': 'chisel', 'version': '2.9.5.11'},
{'modid': 'CarpentersBlocks', 'version': '3.3.8.2'},
{'modid': 'cookiecore', 'version': '1.4.0'},
{'modid': 'Eln', 'version': '@VERSION@'},
{'modid': 'Waila', 'version': '1.5.10'},
{'modid': 'extracells', 'version': '2.3.14'},
{'modid': 'ThermalFoundation',
'version': '1.7.10R1.2.6'},
{'modid': 'ExtraUtilities', 'version': '1.2.12'},
{'modid': 'Forestry', 'version': '4.2.16.64'},
{'modid': 'ForgeRelocation', 'version': '0.0.1.4'},
{'modid': 'MCFrames', 'version': '1.0'},
{'modid': 'RelocationFMP', 'version': '0.0.1.2'},
{'modid': 'Mantle',
'version': '1.7.10-0.3.2.jenkins191'},
{'modid': 'ImmersiveEngineering', 'version': '0.7.7'},
{'modid': 'ThermalExpansion',
'version': '1.7.10R4.1.5'},
{'modid': 'tc', 'version': '4.3.5_014'},
{'modid': 'TConstruct',
'version': '1.7.10-1.8.8.build988'},
{'modid': 'GalacticraftCore', 'version': '3.0.12'},
{'modid': 'GalacticraftMars', 'version': '3.0.12'},
{'modid': 'journeymap', 'version': '5.1.4p2'},
{'modid': 'Mekanism', 'version': '9.1.1'},
{'modid': 'NEIAddons', 'version': '1.12.15.41'},
{'modid': 'NEIAddons|Developer',
'version': '1.12.15.41'},
{'modid': 'NEIAddons|AppEng', 'version': '1.12.15.41'},
{'modid': 'NEIAddons|Botany', 'version': '1.12.15.41'},
{'modid': 'NEIAddons|Forestry',
'version': '1.12.15.41'},
{'modid': 'NEIAddons|CraftingTables',
'version': '1.12.15.41'},
{'modid': 'NEIAddons|ExNihilo',
'version': '1.12.15.41'},
{'modid': 'neiintegration', 'version': '1.1.2'},
{'modid': 'OpenMods', 'version': '0.10'},
{'modid': 'OpenBlocks', 'version': '1.6'},
{'modid': 'MrTJPCoreMod', 'version': '1.1.0.33'},
{'modid': 'ProjRed|Core', 'version': '4.7.0pre12.95'},
{'modid': 'ProjRed|Transmission',
'version': '4.7.0pre12.95'},
{'modid': 'OpenComputers', 'version': '1.7.2.1166'},
{'modid': 'ProjRed|Compatibility',
'version': '4.7.0pre12.95'},
{'modid': 'ProjRed|Integration',
'version': '4.7.0pre12.95'},
{'modid': 'ProjRed|Illumination',
'version': '4.7.0pre12.95'},
{'modid': 'ThermalDynamics',
'version': '1.7.10R1.2.1'},
{'modid': 'ThermalSmeltery', 'version': '1.0'},
{'modid': 'TSteelworks', 'version': '1.7.10-1.1.2'},
{'modid': 'wawla', 'version': '1.3.1'},
{'modid': 'worldedit', 'version': '6.1.1'},
{'modid': 'zettaindustries', 'version': '1.1'},
{'modid': 'McMultipart', 'version': '1.2.0.345'},
{'modid': 'ForgeMicroblock', 'version': '1.2.0.345'}],
'type': 'FML'},
'players': {'max': 20,
'online': 1,
'sample': [{'id': 'c0c9c646-b4a8-4f76-b5ad-6a7e3ba9a343',
'name': 'jrddunbr'}]},
'version': {'name': '1.7.10', 'protocol': 5}}

81
status/templates/index.html

@ -0,0 +1,81 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="style.css">
<title>GMx</title>
</head>
<body>
<div class="content">
<h1>GMx</h1>
<p>
Welcome to GMx, the game server of COSI.
</p>
<h2>Available Game Servers</h2>
<p class="indent">
All of our minecraft servers are alliterations -
their first letter has to match, specifically.
<br/><br/>
Each new major version is a new alliteration.
<br/><br/>
Every minior change is indicated with a version label.
</p>
<h3>Server List:</h3>
<ul>
<li>007 v2 (Survival)</li>
</ul>
<h3>007</h3>
<p class="indent">
Modpack wth most tech mods, and some magic mods to change it up. The structure of the world is very special, due to the nature of the world. The world is a map of the continental US, which is ingame about 12km across, and we have scattered "admin producers" across the world. What happens is that instead of mining, you have to make train tracks to these locations (which are mostly established, but shoddy), and make factories to make materials on a very large scale.
<p class="indent">
<h4>IP and Port:</h4>
<code class="indent">128.153.145.150:2424</code>
<h4>Current Status:</h4>
<!-- CONTENT -->
<h2>Installation Instructions</h2>
<p class="indent">
Click <a href="install.html">here</a> for help on installing games and
which game modifications you will need.
</p>
<h2>Files, and Old Versions</h2>
<p class="indent">
All of the current versions can be found at <a href="/files">/files</a>,
and older versions of mods can be found at <a href="/old">/old</a>.
<br/><br/>
Old worlds can be fetched by contacting us, below.
</p>
<h2>Administration</h2>
<p class="indent">
Currently, there are a handful of administrators.
<br/><br/>
If you would like to be an OP on any of the game servers,
please use the contact information below.
</p>
<h2>Contact Information</h2>
<p class="indent">
<a href="mailto:jrddunbr@gmail.com">contact</a> the operator here.
<br/><br/>
We will reply as soon as possible
</p>
<h4>Licensing</h4>
<p class="indent">
for music licensing, click <a href="music.html">here</a>
<br/><br/>
for font licensing, click <a href="font/">here</a>
</p>
</div>
<audio src="music/epic-song.mp3" style="display:hidden" autoplay loop></audio>
</body>
</html>

56
status/update.py

@ -0,0 +1,56 @@
#!/usr/bin/python3
from mcstatus import MinecraftServer
from time import sleep
from pprint import pprint
server = MinecraftServer("gmx.cosi.clarkson.edu", 2424)
outputName = "../index.html"
templateName = "templates/index.html"
HTML = ""
f = open(templateName)
for line in f:
HTML += line
f.close()
def uuidToImgURI(uuid):
return "https://crafatar.com/avatars/{}.png".format(uuid)
def makeTable(playerList):
text = "<table>\n"
for player in playerList:
name = player[0]
uuid = player[1]
text += "<tr>\n"
text += "<td>{}</td><td><img width=32px src=\"{}\" alt=\"{}\"></img></td>\n".format(name, uuidToImgURI(uuid), name)
text += "</tr>\n"
text += "</table>\n"
return text
def renderHTML(content):
output = ""
outFile = open(outputName, "w")
for line in HTML.split("\n"):
if "CONTENT" in line:
output += content + "\n"
else:
output += line + "\n"
outFile.write(output)
outFile.close()
while 1:
playerList = [] # list of pairs of ("name", "uuid")
status = server.status()
for player in status.players.sample:
playerList.append((player.name, player.id))
output = "<p class=\"indent\">Number of Players Online: {}</p>\n".format(status.players.online)
output += makeTable(playerList)
renderHTML(output)
sleep(5)

9
style.css

@ -44,3 +44,12 @@ code, pre {
.indent {
margin-left: 20px;
}
table {
margin-left: 20px;
border-collapse: collapse;
}
td {
padding: 10px;
}
Loading…
Cancel
Save