summaryrefslogtreecommitdiff
path: root/website
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2025-05-27 13:02:57 -0400
committerAndrew Opalach <andrew@akon.city> 2025-05-27 13:16:18 -0400
commit4479a8801e3c2aa901cd1499f459272805472222 (patch)
treedcb116fd101f6a5a437783359434f622fb94992d /website
downloadmodpacks-4479a8801e3c2aa901cd1499f459272805472222.tar.gz
modpacks-4479a8801e3c2aa901cd1499f459272805472222.tar.bz2
modpacks-4479a8801e3c2aa901cd1499f459272805472222.zip
Reinit with old packs archived
Diffstat (limited to 'website')
-rw-r--r--website/requirements.txt1
-rwxr-xr-xwebsite/run.sh4
-rw-r--r--website/site.py24
-rw-r--r--website/static/capes/.gitignore1
-rw-r--r--website/static/index.html26
-rw-r--r--website/static/index.js25
-rw-r--r--website/static/mrpacks/.gitignore1
-rw-r--r--website/static/style.css53
-rw-r--r--website/static/template.html56
-rw-r--r--website/static/template.pngbin0 -> 766 bytes
10 files changed, 191 insertions, 0 deletions
diff --git a/website/requirements.txt b/website/requirements.txt
new file mode 100644
index 0000000..e4045e2
--- /dev/null
+++ b/website/requirements.txt
@@ -0,0 +1 @@
+web.py
diff --git a/website/run.sh b/website/run.sh
new file mode 100755
index 0000000..851c47c
--- /dev/null
+++ b/website/run.sh
@@ -0,0 +1,4 @@
+#! /usr/bin/env sh
+export PYTHONDONTWRITEBYTECODE=1
+export PYTHONOPTIMIZE=2
+python3 site.py
diff --git a/website/site.py b/website/site.py
new file mode 100644
index 0000000..83b34e8
--- /dev/null
+++ b/website/site.py
@@ -0,0 +1,24 @@
+import re
+import web
+
+urls = (
+ '/capes', 'Capes',
+)
+
+app = web.application(urls, globals())
+
+class Capes():
+ def GET(self, name=None):
+ web.seeother('/static/index.html')
+
+ def POST(self):
+ username = web.input().username
+ username = re.sub(r'[^a-zA-Z0-9_]', '', username)
+ with open(f'static/capes/{username}.png', 'wb+') as f:
+ if type(web.input().data) == bytes:
+ f.write(web.input().data)
+ else:
+ print('Unsupported type')
+
+if __name__ == "__main__":
+ app.run()
diff --git a/website/static/capes/.gitignore b/website/static/capes/.gitignore
new file mode 100644
index 0000000..e33609d
--- /dev/null
+++ b/website/static/capes/.gitignore
@@ -0,0 +1 @@
+*.png
diff --git a/website/static/index.html b/website/static/index.html
new file mode 100644
index 0000000..6394fcf
--- /dev/null
+++ b/website/static/index.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>Cape Setter</title>
+ <link rel="stylesheet" href="./style.css">
+ <script src="./index.js"></script>
+ </head>
+ <body onload="init()">
+ <div id="main">
+ <img id="preview" src="">
+ <div id="input">
+ <input id="username" type="text" placeholder="Username"/>
+ <input id="file" type="file"/>
+ </div>
+ <div id="resources">
+ <form action="http://<IP>:12444/static/template.html" method="get">
+ <button type="submit">Get Template</button>
+ </form>
+ <form action="https://api.labymod.net/capes/capecreator/" method="get" target="_blank">
+ <button type="submit">Online Cape Creator</button>
+ </form>
+ </div>
+ </div>
+ </body>
+</html>
diff --git a/website/static/index.js b/website/static/index.js
new file mode 100644
index 0000000..22bfc20
--- /dev/null
+++ b/website/static/index.js
@@ -0,0 +1,25 @@
+const IP = "http://<IP>:12444";
+
+function init() {
+ document.getElementById('file').addEventListener('change', handleFileSelect, false);
+}
+
+function handleFileSelect(event) {
+ var username = document.getElementById('username').value
+ if (!username) {
+ return;
+ }
+ const reader = new FileReader();
+ const url = IP + '/capes';
+ var formData = new FormData();
+ formData.append('username', username);
+ formData.append('data', event.target.files[0]);
+ fetch(url, {
+ method : "POST",
+ body: formData
+ }).then((response) => {
+ if (response.ok) {
+ document.getElementById('preview').src = IP + '/static/capes/' + username + '.png';
+ }
+ });
+}
diff --git a/website/static/mrpacks/.gitignore b/website/static/mrpacks/.gitignore
new file mode 100644
index 0000000..bca65f2
--- /dev/null
+++ b/website/static/mrpacks/.gitignore
@@ -0,0 +1 @@
+*.mrpack
diff --git a/website/static/style.css b/website/static/style.css
new file mode 100644
index 0000000..242ced7
--- /dev/null
+++ b/website/static/style.css
@@ -0,0 +1,53 @@
+#main {
+ display: flex;
+ flex-direction: column;
+}
+
+#preview {
+ width: 35%;
+ height: 35%;
+ /* IE, only works on <img> tags */
+ -ms-interpolation-mode: nearest-neighbor;
+ /* Firefox */
+ image-rendering: crisp-edges;
+ /* Chromium + Safari */
+ image-rendering: pixelated;
+}
+
+#template {
+ width: 100%;
+ display: flex;
+ align-items: center;
+ flex-direction: row;
+}
+
+ul {
+ margin-left: 2px;
+}
+
+.input-color {
+ position: relative;
+ margin-top: -10px;
+}
+
+.input-color p {
+ padding-left: 30px;
+}
+
+.input-color .color-box {
+ width: 20px;
+ height: 20px;
+ display: inline-block;
+ background-color: #ccc;
+ position: absolute;
+ left: 5px;
+ top: -1px;
+}
+
+#desc {
+ margin-top: 0px;
+}
+
+#desc p {
+ margin-bottom: -10px;
+}
diff --git a/website/static/template.html b/website/static/template.html
new file mode 100644
index 0000000..f7d62de
--- /dev/null
+++ b/website/static/template.html
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>Cape Template</title>
+ <link rel="stylesheet" href="./style.css">
+ </head>
+ <body>
+ <div id="template">
+ <img id="preview" src="http://<IP>:12444/static/template.png"/>
+ <ul>
+ <div class="input-color">
+ <p>Top</p>
+ <div class="color-box" style="background-color: #F7D9E6;"></div>
+ </div>
+ <div class="input-color">
+ <p>Bottom</p>
+ <div class="color-box" style="background-color: #FBFFC4;"></div>
+ </div>
+ <div class="input-color">
+ <p>Left Side</p>
+ <div class="color-box" style="background-color: #B6C9D5;"></div>
+ </div>
+ <div class="input-color">
+ <p>Front</p>
+ <div class="color-box" style="background-color: #D5B6C6;"></div>
+ </div>
+ <div class="input-color">
+ <p>Right Side</p>
+ <div class="color-box" style="background-color: #C2B6D5;"></div>
+ </div>
+ <div class="input-color">
+ <p>Back</p>
+ <div class="color-box" style="background-color: #B6D5C9;"></div>
+ </div>
+ <div class="input-color">
+ <p>Elytra (back is mirrored)</p>
+ <div class="color-box" style="background-color: #FFB8B8;"></div>
+ </div>
+ <div class="input-color">
+ <p>Elytra Bottom</p>
+ <div class="color-box" style="background-color: #D9E4CE;"></div>
+ </div>
+ <div class="input-color">
+ <p>Elytra Inner</p>
+ <div class="color-box" style="background-color: #F6CBBC;"></div>
+ </div>
+ </ul>
+ </div>
+ <div id="desc">
+ <p>Right click and "Save Image As...", edit, then upload <a href="http://<IP>:12444/capes">here</a>.</p>
+ <p>If you don't want to edit the Elytra texture, you can crop it out.</p>
+ <p>Feel free to scale. Only use integer scaling (Multiply width/height by a whole number).</p>
+ </div>
+ </body>
+</html>
diff --git a/website/static/template.png b/website/static/template.png
new file mode 100644
index 0000000..102e5bf
--- /dev/null
+++ b/website/static/template.png
Binary files differ