mirror of
https://github.com/KeyZox71/knl_meowscendence.git
synced 2026-01-01 06:06:41 +01:00
「🏗️」 wip: started fixing shit
This commit is contained in:
@ -4,11 +4,11 @@ import FriendsMenu from "./views/Friends.ts";
|
||||
let profile_view = new ProfileMenu;
|
||||
let friends_view = new FriendsMenu;
|
||||
|
||||
export const user_api = import.meta.env.VITE_USER_API as String;
|
||||
export const auth_api = import.meta.env.VITE_AUTH_API as String;
|
||||
export const user_api = import.meta.env.VITE_USER_URL as String;
|
||||
export const auth_api = import.meta.env.VITE_AUTH_URL as String;
|
||||
|
||||
export async function isLogged(): Promise<boolean> {
|
||||
let uuid_req = await fetch(auth_api + "/me", {
|
||||
let uuid_req = await fetch(`${auth_api}/me`, {
|
||||
method: "GET",
|
||||
credentials: "include",
|
||||
});
|
||||
@ -132,9 +132,9 @@ function updateClock()
|
||||
|
||||
async function pingClock() {
|
||||
if (await isLogged()) {
|
||||
fetch(user_api + "/ping", {
|
||||
fetch(`${user_api}/ping`, {
|
||||
method: "POST",
|
||||
credentials: "include"
|
||||
credentials: "include"
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -156,13 +156,13 @@ async function startMenuPP() {
|
||||
uuid = document.cookie.match(new RegExp('(^| )' + "uuid" + '=([^;]+)'))[2];
|
||||
|
||||
|
||||
const a = await fetch(`http://localhost:3002/users/${uuid}/avatar`, {
|
||||
const a = await fetch(`${user_api}/users/${uuid}/avatar`, {
|
||||
method: "GET",
|
||||
credentials: "include"
|
||||
});
|
||||
|
||||
profileButton.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";
|
||||
} catch (err){
|
||||
// console.log("not yet logged, going default for start icon...");
|
||||
|
||||
@ -103,7 +103,7 @@ export default class extends Aview {
|
||||
}
|
||||
|
||||
if (data.n_friends > 0) {
|
||||
const list_req = await fetch(user_api + "/users/" + uuid + "/friends?iStart=0&iEnd=2147483647", {
|
||||
const list_req = await fetch(user_api + "/users/" + uuid + "/friends?iStart=0&iEnd=50", {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
|
||||
@ -149,7 +149,7 @@ export default class extends Aview {
|
||||
totpButton.innerHTML = "disable 2fa";
|
||||
|
||||
document.getElementById("2fa-button")?.addEventListener("click", async () => {
|
||||
const totp_req = await fetch(`${user_api}/2fa`, {
|
||||
const totp_req = await fetch(`${auth_api}/2fa`, {
|
||||
method: "DELETE",
|
||||
credentials: "include"
|
||||
})
|
||||
@ -164,7 +164,7 @@ export default class extends Aview {
|
||||
totpButton.innerHTML = "enable 2fa";
|
||||
|
||||
document.getElementById("2fa-button")?.addEventListener("click", async () => {
|
||||
const totp_req = await fetch(`${user_api}/2fa`, {
|
||||
const totp_req = await fetch(`${auth_api}/2fa`, {
|
||||
method: "POST",
|
||||
credentials: "include"
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user