mirror of
https://github.com/KeyZox71/knl_meowscendence.git
synced 2026-01-01 06:06:41 +01:00
「✨」 feat: tournament done, added env vars
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import Aview from "./Aview.ts"
|
||||
import { dragElement } from "./drag.ts";
|
||||
import { setOnekoState } from "../oneko.ts"
|
||||
import { isLogged, navigationManager } from "../main.ts"
|
||||
import { isLogged, navigationManager, user_api, auth_api } from "../main.ts"
|
||||
|
||||
|
||||
export default class extends Aview {
|
||||
@ -49,7 +49,7 @@ export default class extends Aview {
|
||||
let uuid: String;
|
||||
uuid = document.cookie.match(new RegExp('(^| )' + "uuid" + '=([^;]+)'))[2];
|
||||
|
||||
const userdata_req = await fetch(`http://localhost:3002/users/${uuid}`, {
|
||||
const userdata_req = await fetch(`${user_api}/users/${uuid}`, {
|
||||
method: "GET",
|
||||
credentials: "include",
|
||||
});
|
||||
@ -59,14 +59,14 @@ export default class extends Aview {
|
||||
}
|
||||
let userdata = await userdata_req.json();
|
||||
|
||||
let matchCount_req = await fetch(`http://localhost:3002/users/${uuid}/matchHistory/count?game=pong`, {
|
||||
let matchCount_req = await fetch(`${user_api}/users/${uuid}/matchHistory/count?game=pong`, {
|
||||
method: "GET",
|
||||
credentials: "include",
|
||||
});
|
||||
let matchCount = await matchCount_req.json();
|
||||
pc += matchCount.n_matches;
|
||||
|
||||
let matches_req = await fetch(`http://localhost:3002/users/${uuid}/matchHistory?game=pong&iStart=0&iEnd=${matchCount.n_matches}`, {
|
||||
let matches_req = await fetch(`${user_api}/users/${uuid}/matchHistory?game=pong&iStart=0&iEnd=${matchCount.n_matches}`, {
|
||||
method: "GET",
|
||||
credentials: "include",
|
||||
});
|
||||
@ -78,7 +78,7 @@ export default class extends Aview {
|
||||
|
||||
if (matches.matchHistory) {
|
||||
for (let match of matches.matchHistory) {
|
||||
const p2_req = await fetch(`http://localhost:3002/users/${match.score.p2}`, {
|
||||
const p2_req = await fetch(`${user_api}/users/${match.score.p2}`, {
|
||||
method: "GET",
|
||||
credentials: "include",
|
||||
});
|
||||
@ -121,14 +121,14 @@ export default class extends Aview {
|
||||
}
|
||||
}
|
||||
|
||||
matchCount_req = await fetch(`http://localhost:3002/users/${uuid}/matchHistory/count?game=tetris`, {
|
||||
matchCount_req = await fetch(`${user_api}/users/${uuid}/matchHistory/count?game=tetris`, {
|
||||
method: "GET",
|
||||
credentials: "include",
|
||||
});
|
||||
matchCount = await matchCount_req.json();
|
||||
pc += matchCount.n_matches;
|
||||
|
||||
matches_req = await fetch(`http://localhost:3002/users/${uuid}/matchHistory?game=tetris&iStart=0&iEnd=${matchCount.n_matches}`, {
|
||||
matches_req = await fetch(`${user_api}/users/${uuid}/matchHistory?game=tetris&iStart=0&iEnd=${matchCount.n_matches}`, {
|
||||
method: "GET",
|
||||
credentials: "include",
|
||||
});
|
||||
@ -143,7 +143,7 @@ export default class extends Aview {
|
||||
for (let match of matches.matchHistory) {
|
||||
if (match.score.p2 != undefined)
|
||||
{
|
||||
const p2_req = await fetch(`http://localhost:3002/users/${match.score.p2}`, {
|
||||
const p2_req = await fetch(`${user_api}/users/${match.score.p2}`, {
|
||||
method: "GET",
|
||||
credentials: "include",
|
||||
});
|
||||
@ -199,12 +199,12 @@ export default class extends Aview {
|
||||
if (!profile) return;
|
||||
|
||||
const picture = profile.appendChild(document.createElement("img"));
|
||||
const a = await fetch(`http://localhost:3002/users/${uuid}/avatar`, {
|
||||
const a = await fetch(`${user_api}/users/${uuid}/avatar`, {
|
||||
method: "GET",
|
||||
credentials: "include",
|
||||
});
|
||||
picture.src = a.status === 200
|
||||
? `http://localhost:3002/users/${uuid}/avatar?t=${Date.now()}`
|
||||
? `${user_api}/users/${uuid}/avatar?t=${Date.now()}`
|
||||
: "https://api.kanel.ovh/pp";
|
||||
picture.classList.add("text-neutral-900", "dark:text-white", "center", "h-18", "w-18", "mx-3", "reverse-border");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user