From 787ed89c858116b55ca88c17bc7eb7ad3334d9de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Kr=C5=A1ka?= Date: Wed, 25 Sep 2024 21:04:23 +0200 Subject: [PATCH] =?UTF-8?q?nestabiln=C4=9Bj=C5=A1=C3=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.ts | 5 +++-- src/templates/index.ejs | 32 +++++++++++++++++++++++++++----- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/src/index.ts b/src/index.ts index b3128df..3ff6714 100644 --- a/src/index.ts +++ b/src/index.ts @@ -20,6 +20,7 @@ app.get("/", async (req, res) => { }).from(personTable) .leftJoin(pointsTable, eq(personTable.personId, pointsTable.personId)) .groupBy(personTable.personId) + .orderBy(sql`rand()`); ejs.renderFile('src/templates/index.ejs', { people: people }, function (err, str) { if (err) { @@ -95,7 +96,7 @@ app.get("/gamble/:id", async (req, res) => { if (person.gambleTime == null) { sendError(res, 423, "Gamble není dostupný"); } else { - sendError(res, 423, "Gamble nelze, gej nebudeš až v " + new Date(getNextGambleTime(person.gambleTime).getTime()).toLocaleString('cs', { + sendError(res, 423, "Na prolomení časoprostoru kvůli závislosti na gamblingu přijde čas až v " + new Date(getNextGambleTime(person.gambleTime).getTime()).toLocaleString('cs', { hour: "2-digit", minute: "2-digit", timeZone: "Europe/Prague" @@ -142,7 +143,7 @@ app.post("/gamble/:id", upload.none(), async (req, res) => { } if (person.secret != req.body['secret']) { - sendError(res, 423, "Nesprávé heslo. Also tvoje máma je gej."); + sendError(res, 423, "Heslo ti zjevně zapadlo do bariéry"); return; } diff --git a/src/templates/index.ejs b/src/templates/index.ejs index 734af37..f182e51 100644 --- a/src/templates/index.ejs +++ b/src/templates/index.ejs @@ -5,20 +5,42 @@ + - Nestabilní body + Nestabilnější body +<% +function hsl2rgb(h,s,l) { + let a=s*Math.min(l,1-l); + let f= (n,k=(n+h/30)%12) => l - a*Math.max(Math.min(k-3,9-k,1),-1); + return [f(0),f(8),f(4)]; +} + +function getRandomHoverBg() { + let rgb = hsl2rgb(Math.random()*360,0.4,0.2) + let hex = '#' + for (let i = 0; i < 3; i++) { + let subcolorValue = rgb[i]; + subcolorValue *= 255; + subcolorValue = Math.round(subcolorValue); + hex += subcolorValue.toString(16); + } + return hex; +} +%> +
-

Nestabilní body

+

Nestabilnější body