summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/404.html4
-rw-r--r--templates/base.html46
-rw-r--r--templates/base_empty.html3
-rw-r--r--templates/canvas.html22
-rw-r--r--templates/home.html53
-rw-r--r--templates/portal.html66
-rw-r--r--templates/profile.html8
-rw-r--r--templates/waddlers.html3
8 files changed, 205 insertions, 0 deletions
diff --git a/templates/404.html b/templates/404.html
new file mode 100644
index 0000000..e4bb5e2
--- /dev/null
+++ b/templates/404.html
@@ -0,0 +1,4 @@
+{{ define "content" }}
+<h2>404 — lost on the ice</h2>
+<p><em>this page waddled off somewhere. <a href="/">head back home</a>.</em></p>
+{{ end }}
diff --git a/templates/base.html b/templates/base.html
new file mode 100644
index 0000000..3a9f582
--- /dev/null
+++ b/templates/base.html
@@ -0,0 +1,46 @@
+{{ define "base" }}
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <title>penguins.lan~</title>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <link rel="icon" href="/static/img/favicon.svg">
+ <link rel="stylesheet" type="text/css" href="/static/css/styles.css">
+ </head>
+ <body>
+ <div id="content" class="container">
+ <header>
+ <h1>~penguins.lan</h1>
+ <nav aria-label="Main">
+ <a href="/">home.</a>
+ <span> | </span>
+ <a href="/canvas">place.</a>
+ {{ if .User }}
+ <span class="spacer"></span>
+ <span>🐧 <a style="text-decoration: none;" class="whoami" href="/profile"><span id="me">{{ .User.Username }}</span></a></span>
+ <span> | </span>
+ <a href="/logout">logout.</a>
+ {{ end }}
+ </nav>
+ </header>
+ <hr>
+
+ <main>
+ {{ if and .Success (gt (len .Success.Messages) 0) }}
+ {{ range $message := .Success.Messages }}
+ <div class="info success">{{ $message }}</div>
+ {{ end }}
+ {{ end }}
+ {{ if and .Error (gt (len .Error.Messages) 0) }}
+ {{ range $error := .Error.Messages }}
+ <div class="info error">{{ $error }}</div>
+ {{ end }}
+ {{ end }}
+
+ {{ template "content" . }}
+ </main>
+ </div>
+ </body>
+</html>
+{{ end }}
diff --git a/templates/base_empty.html b/templates/base_empty.html
new file mode 100644
index 0000000..adda790
--- /dev/null
+++ b/templates/base_empty.html
@@ -0,0 +1,3 @@
+{{ define "base" }}
+ {{ template "content" . }}
+{{ end }}
diff --git a/templates/canvas.html b/templates/canvas.html
new file mode 100644
index 0000000..84e964d
--- /dev/null
+++ b/templates/canvas.html
@@ -0,0 +1,22 @@
+{{ define "content" }}
+<h2>~place</h2>
+<p>{{ .Canvas.Rows }}×{{ .Canvas.Cols }}, one pixel at a time. pick a color, click a cell. be nice to your fellow waddlers &lt;3</p>
+
+<div id="palette" class="palette"></div>
+
+<div class="canvas-wrap">
+ <canvas id="canvas" width="{{ .Canvas.Cols }}" height="{{ .Canvas.Rows }}"></canvas>
+</div>
+<p id="cooldown" class="muted"></p>
+
+<script>
+window.CANVAS = {
+ rows: {{ .Canvas.Rows }},
+ cols: {{ .Canvas.Cols }},
+ scale: {{ .Canvas.Scale }},
+ cooldownMs: {{ .Canvas.CooldownMs }},
+ palette: [{{ range $i, $c := .Canvas.Palette }}{{ if $i }}, {{ end }}"{{ $c }}"{{ end }}]
+};
+</script>
+<script src="/static/js/canvas.js"></script>
+{{ end }}
diff --git a/templates/home.html b/templates/home.html
new file mode 100644
index 0000000..aeb2739
--- /dev/null
+++ b/templates/home.html
@@ -0,0 +1,53 @@
+{{ define "content" }}
+<h2>~welcome</h2>
+
+<p>hey there penguin! or, <strong>{{ .User.Username }}</strong>, i guess.</p>
+<p>this network does not have access to the outside internet. everything runs off of this battery, phone, and mini AP; i carry it around sometimes.</p>
+
+<div style="text-align: center" >
+ <img width="60%" src="/static/img/lab.png">
+</div>
+
+<p>wanna fuck up this website? the code is available to you to fuck up. go crazy (put in a reverse shell if you want for all i care), but please be courteous &lt;3.</p>
+<pre>
+git clone you@penguins.lan:~/penguins.lan
+cd penguins.lan
+vim templates/home.html
+git add . && git commit -m "HAHAHA"
+git push
+</pre>
+
+<marquee class="marquee">* LONG LIVE THE MARQUEE TAG * THEY CAN'T TAKE IT FROM US *</marquee>
+
+<hr>
+
+<h3>~waddlers</h3>
+<p class="legend">
+ <span class="dot chat"></span> chatting
+ <span class="dot network"></span> online
+ <span class="dot offline"></span> offline
+</p>
+<ul class="roster" id="roster">
+ {{ range .Users }}
+ <li><span class="dot {{ .Status }}"></span> <strong>{{ .Username }}</strong> <span class="muted">— last seen {{ .LastSeen }}</span></li>
+ {{ end }}
+</ul>
+<script src="/static/js/waddlers.js"></script>
+
+<div id="log" class="chat-log" aria-live="polite"></div>
+
+<form id="chat-form" class="chat-form" autocomplete="off">
+ <input id="msg" name="msg" placeholder="hello fellow penguins!" maxlength="500" autofocus>
+ <button type="submit">send</button>
+</form>
+
+<hr>
+
+<h3>~minecraft</h3>
+<p>java edition — join <code>penguins.lan</code></p>
+<p id="mc-status" class="muted">checking…</p>
+<script src="/static/js/minecraft.js"></script>
+
+
+<script src="/static/js/chat.js"></script>
+{{ end }}
diff --git a/templates/portal.html b/templates/portal.html
new file mode 100644
index 0000000..a2959f1
--- /dev/null
+++ b/templates/portal.html
@@ -0,0 +1,66 @@
+{{ define "content" }}
+<p>welcome to ~penguins.lan</p>
+
+{{ with .Portal }}
+ {{ if .Taken }}
+ <div class="info">
+ <form action="/portal" method="post">
+ <p><strong>{{ .RequestedName }}</strong> is already taken, last seen <strong>{{ .LastSeen }}</strong>. is that you?</p>
+ <input type="hidden" name="username" value="{{ .RequestedName }}">
+ <input type="hidden" name="reclaim" value="1">
+ <button>yes, i am {{ .RequestedName }}</button>
+ </form>
+ </div>
+ {{ end }}
+ <br>
+ <form action="/portal" method="post" id="loginForm">
+ <label for="username">{{ if .Taken }} no? {{ end }} i want to be called</label>
+ <input id="username" name="username" placeholder="{{ .SuggestedName }}" maxlength="24" autofocus>
+ <button type="submit">enter</button>
+ </form>
+
+ {{ if .DetectedMAC }}
+ <p class="muted"><small>this device: <code>{{ .DetectedMAC }}</code>.</small></p>
+ {{ end }}
+{{ end }}
+{{ end }}
+
+<script>
+ const urlParamsText = window.location.href.split('?')[1];
+ const urlParams = new URLSearchParams(urlParamsText);
+ const paramsObj = Object.fromEntries(urlParams.entries());
+ if (paramsObject['_token'] && paramsObject['_authaction']) {
+ const form = document.getElementById("loginForm");
+ const isEmpty = (formData, keys) => {
+ const obj = Object.fromEntries(formData.entries());
+ if (keys === undefined) keys = Object.keys(obj);
+ return keys.every(key => !obj[key]);
+ }
+ const send = async () => {
+ await fetch(paramsObject['_authaction'] + '?tok' + paramsObject['_token'], {
+ mode: "no-cors"
+ });
+ const data = new FormData(form);
+ await fetch(form.action, {
+ method: form.method,
+ body: data
+ });
+ };
+ form.addEventListener("submit", (e) => {
+ e.preventDefault();
+ send().then(() => { window.location.href = "/"; });
+ })
+
+ }
+ function getQueryVariable(variable) {
+ query = window.location.search.substring(1);
+ vars = query.split("&");
+ for (var i=0;i<vars.length;i++) {
+ var pair = vars[i].split("=");
+ if (pair[0] == variable) {
+ return pair[1];
+ }
+ }
+ alert('Query Variable ' + variable + ' not found');
+ }
+</script> \ No newline at end of file
diff --git a/templates/profile.html b/templates/profile.html
new file mode 100644
index 0000000..f0f93d9
--- /dev/null
+++ b/templates/profile.html
@@ -0,0 +1,8 @@
+hellow
+{{ define "content" }}
+<form action="/rename" method="post" class="rename-form">
+ <label for="username">not your name? change it:</label>
+ <input id="username" name="username" value="{{ .User.Username }}" maxlength="24">
+ <button type="submit">rename</button>
+</form>
+{{ end }} \ No newline at end of file
diff --git a/templates/waddlers.html b/templates/waddlers.html
new file mode 100644
index 0000000..69d70bd
--- /dev/null
+++ b/templates/waddlers.html
@@ -0,0 +1,3 @@
+{{ range .Users }}
+<li><strong>{{ .Username }}</strong> <span class="muted">— last seen {{ .LastSeen }}</span></li>
+{{ end }} \ No newline at end of file