From 4479a8801e3c2aa901cd1499f459272805472222 Mon Sep 17 00:00:00 2001 From: Andrew Opalach Date: Tue, 27 May 2025 13:02:57 -0400 Subject: Reinit with old packs archived --- website/requirements.txt | 1 + website/run.sh | 4 +++ website/site.py | 24 ++++++++++++++++ website/static/capes/.gitignore | 1 + website/static/index.html | 26 ++++++++++++++++++ website/static/index.js | 25 +++++++++++++++++ website/static/mrpacks/.gitignore | 1 + website/static/style.css | 53 ++++++++++++++++++++++++++++++++++++ website/static/template.html | 56 ++++++++++++++++++++++++++++++++++++++ website/static/template.png | Bin 0 -> 766 bytes 10 files changed, 191 insertions(+) create mode 100644 website/requirements.txt create mode 100755 website/run.sh create mode 100644 website/site.py create mode 100644 website/static/capes/.gitignore create mode 100644 website/static/index.html create mode 100644 website/static/index.js create mode 100644 website/static/mrpacks/.gitignore create mode 100644 website/static/style.css create mode 100644 website/static/template.html create mode 100644 website/static/template.png (limited to 'website') 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 @@ + + + + + Cape Setter + + + + +
+ +
+ + +
+
+
+ +
+
+ +
+
+
+ + 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://: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 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 @@ + + + + + Cape Template + + + +
+ +
    +
    +

    Top

    +
    +
    +
    +

    Bottom

    +
    +
    +
    +

    Left Side

    +
    +
    +
    +

    Front

    +
    +
    +
    +

    Right Side

    +
    +
    +
    +

    Back

    +
    +
    +
    +

    Elytra (back is mirrored)

    +
    +
    +
    +

    Elytra Bottom

    +
    +
    +
    +

    Elytra Inner

    +
    +
    +
+
+
+

Right click and "Save Image As...", edit, then upload here.

+

If you don't want to edit the Elytra texture, you can crop it out.

+

Feel free to scale. Only use integer scaling (Multiply width/height by a whole number).

+
+ + diff --git a/website/static/template.png b/website/static/template.png new file mode 100644 index 0000000..102e5bf Binary files /dev/null and b/website/static/template.png differ -- cgit v1.2.3-101-g0448