nojo, teď je ten kód mnohem lepčejší a funkčnější
This commit is contained in:
parent
bec2cb7016
commit
7b565024db
@ -94,7 +94,7 @@ function jeCheck(barva: Hra["hraje"], deska: Deska) {
|
|||||||
|
|
||||||
// od pawnů
|
// od pawnů
|
||||||
[7, 9].forEach(i => {
|
[7, 9].forEach(i => {
|
||||||
let pis = deska[index - i];
|
const pis = deska[index - i];
|
||||||
if (pis?.typ == "pawn" && pis.barva != barva) check = true;
|
if (pis?.typ == "pawn" && pis.barva != barva) check = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -255,7 +255,7 @@ function legalniTahy(index: number, deska: Deska) {
|
|||||||
tahy.splice(i, 1);
|
tahy.splice(i, 1);
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
return tahy;
|
return tahy;
|
||||||
}
|
}
|
||||||
@ -474,7 +474,7 @@ const exp: Modul = {
|
|||||||
|
|
||||||
for (const player of [mes.author.id, druhej]) {
|
for (const player of [mes.author.id, druhej]) {
|
||||||
if (hraci[player]) return "zakaz symultanki";
|
if (hraci[player]) return "zakaz symultanki";
|
||||||
};
|
}
|
||||||
|
|
||||||
const message = await mes.channel.send("hraj zopiciva");
|
const message = await mes.channel.send("hraj zopiciva");
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import { Message } from "discord.js";
|
|
||||||
import { SRecord } from "./types";
|
import { SRecord } from "./types";
|
||||||
|
|
||||||
export const fokinLookupTable: SRecord<string> = {
|
export const fokinLookupTable: SRecord<string> = {
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import { join } from "path";
|
|||||||
import { readFileSync } from "fs";
|
import { readFileSync } from "fs";
|
||||||
import fetch from "node-fetch";
|
import fetch from "node-fetch";
|
||||||
import { TypedEmitter } from "tiny-typed-emitter";
|
import { TypedEmitter } from "tiny-typed-emitter";
|
||||||
import { log, rand } from "./utils";
|
import { log } from "./utils";
|
||||||
|
|
||||||
const basePath = join(__dirname, "../../res/sachy");
|
const basePath = join(__dirname, "../../res/sachy");
|
||||||
const sessions: SRecord<Session> = {};
|
const sessions: SRecord<Session> = {};
|
||||||
@ -148,15 +148,17 @@ const server = createServer((req, res) => {
|
|||||||
if (req.url?.startsWith("/oauth")) return overeni(req.url, session, res);
|
if (req.url?.startsWith("/oauth")) return overeni(req.url, session, res);
|
||||||
|
|
||||||
switch (url.pathname) {
|
switch (url.pathname) {
|
||||||
case "/":
|
case "/": {
|
||||||
const response = indexStranka.replace("$logged", session.logedIn ? "1" : "0")
|
const response = indexStranka.replace("$logged", session.logedIn ? "1" : "0")
|
||||||
.replace("$jmeno", session.discordName ?? "");
|
.replace("$jmeno", session.discordName ?? "");
|
||||||
return res.end(response);
|
return res.end(response);
|
||||||
|
}
|
||||||
|
|
||||||
case "/login":
|
case "/login": {
|
||||||
const path = url.searchParams.get("redirect");
|
const path = url.searchParams.get("redirect");
|
||||||
session.redirect = path || "";
|
session.redirect = path || "";
|
||||||
return login(session, res);
|
return login(session, res);
|
||||||
|
}
|
||||||
|
|
||||||
case "/logout":
|
case "/logout":
|
||||||
return logout(session, res);
|
return logout(session, res);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user