Compare commits

...

4 Commits

Author SHA1 Message Date
1c4d13c8c6 experimental 2025-12-10 16:40:21 +01:00
f7aedb5fc7 /ms -> /mc.html x /mc -> /mc/ 2025-12-09 00:25:19 +01:00
3d95d19da5 add server.py 2025-12-09 00:03:09 +01:00
30142a0425 Fix typo 2025-12-08 23:41:16 +01:00
3 changed files with 469 additions and 1 deletions

View File

@@ -1 +1 @@
# The Krzak.og homepage
# The [Krzak.org](https://krzak.org) homepage

31
server.py Normal file
View File

@@ -0,0 +1,31 @@
import os
import sys
from http.server import HTTPServer as S
from http.server import SimpleHTTPRequestHandler as H
class C(H):
def do_GET(self):
p = self.path
if p.endswith("/"):
base_path = p.rstrip("/")
html_file = base_path + ".html"
if os.path.exists(os.path.join(os.getcwd(), html_file.lstrip("/"))):
p = html_file
else:
p += "index.html"
elif "." not in p.split("/")[-1]:
r = os.path.join(os.getcwd(), p.lstrip("/"))
if os.path.exists(r + ".html"):
p += ".html"
elif os.path.isdir(r):
p += "/index.html"
self.path = p
return H.do_GET(self)
if __name__ == "__main__":
d = sys.argv[1] if len(sys.argv) > 1 else "."
p = int(sys.argv[2]) if len(sys.argv) > 2 else 8000
os.chdir(d)
S(("0.0.0.0", p), C).serve_forever()

437
thingy.html Normal file
View File

@@ -0,0 +1,437 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Krzak.org - Portal</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
/* Base Styles */
body {
background-color: #1a0f3e;
color: #ffe8d6;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
margin: 0;
padding: 0;
/* Scanline effect */
background-image:
linear-gradient(
rgba(18, 16, 16, 0) 50%,
rgba(0, 0, 0, 0.25) 50%
),
linear-gradient(
90deg,
rgba(255, 0, 0, 0.06),
rgba(0, 255, 0, 0.02),
rgba(0, 0, 255, 0.06)
);
background-size:
100% 2px,
3px 100%;
}
/* Layout Container */
.main-table {
width: 800px;
background-color: #2a1a5e;
border: 2px solid #f4a261;
border-right: 4px solid #c47e45;
border-bottom: 4px solid #c47e45;
}
/* Links */
a {
color: #f4a261;
text-decoration: none;
font-weight: bold;
}
a:hover {
color: #ffffff;
text-decoration: underline;
background-color: #8b4789;
cursor: help;
}
/* Sidebar Styling */
.sidebar {
background-color: #1f1345;
padding: 10px;
border-right: 1px solid #f4a261;
vertical-align: top;
}
.nav-header {
color: #dda15e;
font-family: "Courier New", Courier, monospace;
font-weight: bold;
border-bottom: 1px dashed #dda15e;
margin-bottom: 5px;
margin-top: 15px;
display: block;
}
.nav-link {
display: block;
padding: 4px;
border-left: 3px solid transparent;
}
.nav-link:hover {
border-left: 3px solid #f4a261;
background-color: #2a1a5e;
}
/* Main Content Styling */
.content {
padding: 20px;
vertical-align: top;
}
h1 {
font-family: "Courier New", Courier, monospace;
color: #f4a261;
font-size: 24px;
margin-top: 0;
text-shadow: 2px 2px #000000;
}
/* The "Window" Box style for sections */
.retro-box {
border: 2px ridge #8b4789;
background-color: #251752;
padding: 10px;
margin-bottom: 15px;
}
.marquee-container {
border: 1px inset #f4a261;
background: #000000;
color: #00ff00;
font-family: monospace;
padding: 2px;
margin-bottom: 15px;
}
/* Pixelated dividers */
hr {
border: 0;
border-bottom: 1px dashed #f4a261;
height: 1px;
}
/* Footer */
.footer {
font-size: 10px;
color: #dda15e;
text-align: center;
padding-top: 20px;
}
</style>
</head>
<body>
<br />
<center>
<!-- Main Layout Table -->
<table class="main-table" cellpadding="0" cellspacing="0">
<tr>
<!-- SIDEBAR (Left Column) -->
<td width="200" class="sidebar">
<center>
<img
src="/icon.svg"
width="80"
height="80"
alt="Krzak Logo"
style="
border: 2px solid #f4a261;
margin-bottom: 10px;
"
/>
<br />
<font size="1">est. 2024</font>
</center>
<span class="nav-header">:: MAIN ::</span>
<a href="/" class="nav-link">[ Home ]</a>
<a href="/contact" class="nav-link">[ Contact ]</a>
<a href="/applications" class="nav-link">[ Apps ]</a>
<span class="nav-header">:: SERVICES ::</span>
<a href="https://fedi.krzak.org" class="nav-link"
>Fediverse</a
>
<a href="https://git.krzak.org" class="nav-link"
>Git Repo</a
>
<a href="https://music.krzak.org" class="nav-link"
>Music</a
>
<a href="https://rss.krzak.org" class="nav-link">RSS</a>
<span class="nav-header">:: GAME ::</span>
<a href="/mc" class="nav-link">Minecraft</a>
<br /><br />
<center>
<div
style="
border: 1px inset #8b4789;
background: #000;
padding: 4px;
font-family: monospace;
font-size: 10px;
"
>
SERVER STATUS<br />
<font id="mc-status-text" color="#ffff00"
>CHECKING...</font
><br />
<span id="mc-players"></span>
</div>
</center>
</td>
<!-- CONTENT (Right Column) -->
<td class="content">
<!-- Header -->
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td><h1>Welcome to Krzak.org</h1></td>
<td align="right">
<font size="1" color="#dda15e"
>Logged in as: Guest</font
>
</td>
</tr>
</table>
<!-- Marquee -->
<div class="marquee-container">
<marquee
id="system-marquee"
scrollamount="4"
scrolldelay="100"
>
++ WELCOME TO THE NETWORK ++ UPDATES: MINECRAFT
SERVER 1.21.10 LIVE ++ CHECK OUT THE NEW APPS
SECTION ++
</marquee>
</div>
<p>
Hi, welcome to krzak.org. This is my personal corner
of the interwebs.
<br />
Use the navigation on the left to explore my
services.
</p>
<!-- "Latest News" Box -->
<div class="retro-box">
<b>:: LATEST NEWS ::</b>
<ul>
<li>
Added
<a href="/applications"
>Recommended Applications</a
>
page.
</li>
<li>
Updated Minecraft server to Fabric 1.21.10.
</li>
<li>Fixed RSS feed integration.</li>
</ul>
</div>
<!-- Services Grid (Nested Table) -->
<b>:: QUICK LINKS ::</b>
<table width="100%" border="0" cellpadding="5">
<tr>
<td width="33%" align="center">
<a href="https://paste.krzak.org">
<div
style="
border: 1px solid #f4a261;
padding: 5px;
margin: 2px;
"
>
<b>PASTE</b><br />
<font size="1">Opengist</font>
</div>
</a>
</td>
<td width="33%" align="center">
<a href="https://share.krzak.org">
<div
style="
border: 1px solid #f4a261;
padding: 5px;
margin: 2px;
"
>
<b>SHARE</b><br />
<font size="1">FilePizza</font>
</div>
</a>
</td>
<td width="33%" align="center">
<a href="https://link.krzak.org">
<div
style="
border: 1px solid #f4a261;
padding: 5px;
margin: 2px;
"
>
<b>LINK</b><br />
<font size="1">Shlink</font>
</div>
</a>
</td>
</tr>
</table>
<br />
<p>
If you want an account on any of these, want to
suggest something new or get a subdomain, just
<a href="mailto:admin@krzak.org">message me</a>.
</p>
<hr />
<div class="footer">
<!-- Hidden Counter Image to increment stats -->
<img
src="https://librecounter.org/counter.svg"
referrerpolicy="unsafe-url"
width="0"
height="0"
alt=""
style="display: none"
/>
Total Visitors:
<b><span id="visitor-count">...</span></b
><br />
Indexed by
<a
href="https://librecounter.org/referer/show"
target="_blank"
>LibreCounter</a
>
<br />
&copy; 2024 Krzak.org | <a href="#">Top of Page</a>
<br /><br />
<!-- Fake Buttons for aesthetic -->
<img
src="https://imgs.search.brave.com/a80w-button-placeholder"
width="88"
height="31"
style="
background: #8b4789;
border: 1px solid #000;
"
alt="HTML4"
/>
<img
src="https://imgs.search.brave.com/a80w-button-placeholder"
width="88"
height="31"
style="
background: #f4a261;
border: 1px solid #000;
"
alt="CSS"
/>
</div>
</td>
</tr>
</table>
</center>
<!-- Legacy JavaScript for Functionality -->
<script type="text/javascript">
// Helper for cross-browser JSON fetching (IE7+ compatible logic)
function fetchJSON(url, callback) {
var proxyUrl = `https://cors.krzak.org/get?url=${encodeURIComponent(url)}`;
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
try {
var data = JSON.parse(xhr.responseText);
// Handle double-encoded JSON in the contents field
var contents =
typeof data.contents === "string"
? JSON.parse(data.contents)
: data.contents;
callback(contents);
} catch (e) {
console.error("JSON Parse Error:", e);
}
} else {
console.error(
"Request failed with status:",
xhr.status,
);
}
}
};
xhr.open("GET", proxyUrl, true);
xhr.setRequestHeader("Accept", "application/json");
xhr.send();
}
// 1. Fetch Visitor Count
fetchJSON(
"https://librecounter.org/krzak.org/siteStats",
function (data) {
var countEl = document.getElementById("visitor-count");
if (countEl && data && data.total) {
countEl.innerHTML = data.total;
}
},
);
// 2. Fetch Minecraft Server Status
fetchJSON("https://api.mcsrvstat.us/3/krzak.org", function (data) {
var statusText = document.getElementById("mc-status-text");
var playersEl = document.getElementById("mc-players");
var marquee = document.getElementById("system-marquee");
if (data.online) {
if (statusText) {
statusText.innerHTML = "ONLINE";
statusText.color = "#00ff00"; // Green
}
if (playersEl) {
playersEl.innerHTML =
"[" +
data.players.online +
"/" +
data.players.max +
"] Players";
}
// Update marquee with dynamic info
if (marquee) {
marquee.innerHTML =
"++ SERVER ONLINE: " +
data.players.online +
" PLAYERS CONNECTED ++ VERSION: " +
data.version +
" ++ WELCOME TO KRZAK.ORG ++";
}
} else {
if (statusText) {
statusText.innerHTML = "OFFLINE";
statusText.color = "#ff0000"; // Red
}
if (playersEl) {
playersEl.innerHTML = "";
}
}
});
</script>
</body>
</html>