mirror of
https://github.com/KeyZox71/knl_meowscendence.git
synced 2025-12-31 21:56:41 +01:00
「🏗️」 wip: starting being a fullstack dev
This commit is contained in:
@ -7,8 +7,7 @@ export async function isLogged(): Promise<boolean> {
|
|||||||
method: "GET",
|
method: "GET",
|
||||||
credentials: "include",
|
credentials: "include",
|
||||||
});
|
});
|
||||||
if (uuid_req.status === 200)
|
if (uuid_req.status === 200) {
|
||||||
{
|
|
||||||
let uuid = await uuid_req.json();
|
let uuid = await uuid_req.json();
|
||||||
document.cookie = `uuid=${uuid.user};max-age=${60 * 60 * 24 * 7}`;
|
document.cookie = `uuid=${uuid.user};max-age=${60 * 60 * 24 * 7}`;
|
||||||
return true;
|
return true;
|
||||||
@ -40,6 +39,8 @@ const routes = [
|
|||||||
|
|
||||||
{ path: "/login", view: () => import("./views/LoginPage.ts") },
|
{ path: "/login", view: () => import("./views/LoginPage.ts") },
|
||||||
{ path: "/register", view: () => import("./views/RegisterPage.ts") },
|
{ path: "/register", view: () => import("./views/RegisterPage.ts") },
|
||||||
|
|
||||||
|
{ path: "/friends", view: () => import("./views/Friends.ts") }
|
||||||
];
|
];
|
||||||
|
|
||||||
const router = async () => {
|
const router = async () => {
|
||||||
@ -72,13 +73,11 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
isLogged();
|
isLogged();
|
||||||
|
|
||||||
document.body.addEventListener("click", e => {
|
document.body.addEventListener("click", e => {
|
||||||
if (!e.target.closest("#taskbar-menu") && !e.target.matches("#profile-button"))
|
if (!e.target.closest("#taskbar-menu") && !e.target.matches("#profile-button")) {
|
||||||
{
|
|
||||||
profile_view.open = false;
|
profile_view.open = false;
|
||||||
document.getElementById("taskbar-menu").innerHTML = "";
|
document.getElementById("taskbar-menu").innerHTML = "";
|
||||||
}
|
}
|
||||||
if (e.target.matches("[data-link]"))
|
if (e.target.matches("[data-link]")) {
|
||||||
{
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
navigationManager(e.target.href);
|
navigationManager(e.target.href);
|
||||||
}
|
}
|
||||||
@ -87,8 +86,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
document.body.addEventListener("dblclick", e => {
|
document.body.addEventListener("dblclick", e => {
|
||||||
if (e.target.closest("[data-icon]"))
|
if (e.target.closest("[data-icon]")) {
|
||||||
{
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
navigationManager(e.target.closest("[data-icon]").href);
|
navigationManager(e.target.closest("[data-icon]").href);
|
||||||
}
|
}
|
||||||
@ -99,8 +97,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
|
|
||||||
oneko();
|
oneko();
|
||||||
|
|
||||||
function updateClock()
|
function updateClock() {
|
||||||
{
|
|
||||||
const days = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];
|
const days = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];
|
||||||
const months = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
|
const months = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
|
||||||
const clock = document.getElementById("taskbar-clock");
|
const clock = document.getElementById("taskbar-clock");
|
||||||
|
|||||||
45
src/front/static/ts/views/Friends.ts
Normal file
45
src/front/static/ts/views/Friends.ts
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
import Aview from "./Aview.ts"
|
||||||
|
import { setOnekoState } from "../oneko.ts"
|
||||||
|
|
||||||
|
export default class extends Aview {
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
this.setTitle("Friends list");
|
||||||
|
setOnekoState("default");
|
||||||
|
}
|
||||||
|
|
||||||
|
async getHTML() {
|
||||||
|
return `
|
||||||
|
<div id="window" class="absolute default-border">
|
||||||
|
<div id="window-header" class="bg-linear-to-r from-orange-200 to-orange-300 flex flex-row min-w-75 justify-between px-2">
|
||||||
|
<span class="font-[Kubasta]">friends.ts</span>
|
||||||
|
<div>
|
||||||
|
<button> - </button>
|
||||||
|
<button> □ </button>
|
||||||
|
<a href="/" data-link> × </a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="bg-neutrbg-neutral-200 dark:bg-neutral-800 text-center pb-10 pt-5 px-10 spcae-y-4 reverse-border">
|
||||||
|
<p class="text-gray-900 dark:text-white text-lg pt-0 pb-4"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
async run() {
|
||||||
|
let uuid: String;
|
||||||
|
|
||||||
|
uuid = document.cookie.match(new RegExp('(^| )' + "uuid" + '=([^;]+)'))[2];
|
||||||
|
|
||||||
|
const userdata_req = await fetch(`http://localhost:3002/users/${uuid}`, {
|
||||||
|
method: "GET",
|
||||||
|
credentials: "include",
|
||||||
|
});
|
||||||
|
if (userdata_req.status == 404) {
|
||||||
|
console.error("invalid user");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user