sorting out merge stuff

This commit is contained in:
Me
2023-01-05 12:31:47 +01:00
parent eab2749c0e
commit 730b8c4e4a
2 changed files with 48 additions and 48 deletions

View File

@@ -2531,7 +2531,7 @@ var app = (function () {
validate_slots('Header', slots, []); validate_slots('Header', slots, []);
let handleClickLogout = async () => { let handleClickLogout = async () => {
await fetch(`http://${'localhost'}:${'8080'}/api/v2/auth/logout`, { method: 'POST' }).then(() => push('/')); await fetch(`http://${'transcendance'}:${'8080'}/api/v2/auth/logout`, { method: 'POST' }).then(() => push('/'));
console.log('clicked logout header'); console.log('clicked logout header');
}; };
@@ -2877,7 +2877,7 @@ var app = (function () {
onMount(async () => { onMount(async () => {
// using this for now cuz for some reason there is yet to be a way to fet another person's avatar // using this for now cuz for some reason there is yet to be a way to fet another person's avatar
if (primary) { if (primary) {
await fetch(`http://${'localhost'}:${'8080'}/api/v2/user/avatar`, { method: "GET" }).then(response => { await fetch(`http://${'transcendance'}:${'8080'}/api/v2/user/avatar`, { method: "GET" }).then(response => {
return response.blob(); return response.blob();
}).then(data => { }).then(data => {
const url = URL.createObjectURL(data); const url = URL.createObjectURL(data);
@@ -13597,7 +13597,7 @@ var app = (function () {
let { $$slots: slots = {}, $$scope } = $$props; let { $$slots: slots = {}, $$scope } = $$props;
validate_slots('Chat', slots, []); validate_slots('Chat', slots, []);
let { color = "transparent" } = $$props; let { color = "transparent" } = $$props;
const socket = lookup(`http://${'localhost'}:${'8080'}`, { path: '/chat' }); const socket = lookup(`http://${'transcendance'}:${'8080'}`, { path: '/chat' });
onMount(async => { onMount(async => {
socket.on('connect', function () { socket.on('connect', function () {
@@ -13894,7 +13894,7 @@ var app = (function () {
onMount(async () => { onMount(async () => {
// console.log('mounting profile display') // console.log('mounting profile display')
$$invalidate(0, user = await fetch(`http://${'localhost'}:${'8080'}/api/v2/user`).then(x => x.json())); $$invalidate(0, user = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/user`).then(x => x.json()));
}); });
const writable_props = []; const writable_props = [];
@@ -14727,7 +14727,7 @@ var app = (function () {
let success = { username: '', avatar: '' }; let success = { username: '', avatar: '' };
onMount(async () => { onMount(async () => {
user = await fetch(`http://${'localhost'}:${'8080'}/api/v2/user`).then(x => x.json()); user = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/user`).then(x => x.json());
// do a .catch? // do a .catch?
if (user === undefined) { if (user === undefined) {
@@ -14743,7 +14743,7 @@ var app = (function () {
// tmp // tmp
// console.log('this is what is in the avatar before fetch') // console.log('this is what is in the avatar before fetch')
// console.log(avatar) // console.log(avatar)
await fetch(`http://${'localhost'}:${'8080'}/api/v2/user/avatar`, { method: "GET" }).then(response => { await fetch(`http://${'transcendance'}:${'8080'}/api/v2/user/avatar`, { method: "GET" }).then(response => {
return response.blob(); return response.blob();
}).then(data => { }).then(data => {
const url = URL.createObjectURL(data); const url = URL.createObjectURL(data);
@@ -14768,7 +14768,7 @@ var app = (function () {
$$invalidate(4, errors.username = '', errors); $$invalidate(4, errors.username = '', errors);
} }
await fetch(`http://${'localhost'}:${'8080'}/api/v2/user`, { await fetch(`http://${'transcendance'}:${'8080'}/api/v2/user`, {
method: 'PATCH', method: 'PATCH',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ body: JSON.stringify({
@@ -14795,7 +14795,7 @@ var app = (function () {
// tmp // tmp
console.log(data); console.log(data);
const responseWhenChangeAvatar = fetch(`http://${'localhost'}:${'8080'}/api/v2/user/avatar`, { method: 'POST', body: data }); const responseWhenChangeAvatar = fetch(`http://${'transcendance'}:${'8080'}/api/v2/user/avatar`, { method: 'POST', body: data });
const responseFromServer = await responseWhenChangeAvatar; const responseFromServer = await responseWhenChangeAvatar;
if (responseFromServer.ok === true) { if (responseFromServer.ok === true) {
@@ -14805,7 +14805,7 @@ var app = (function () {
$$invalidate(4, errors.avatar = responseFromServer.statusText, errors); $$invalidate(4, errors.avatar = responseFromServer.statusText, errors);
} }
await fetch(`http://${'localhost'}:${'8080'}/api/v2/user/avatar`, { method: "GET" }).then(response => { await fetch(`http://${'transcendance'}:${'8080'}/api/v2/user/avatar`, { method: "GET" }).then(response => {
return response.blob(); return response.blob();
}).then(data => { }).then(data => {
const url = URL.createObjectURL(data); const url = URL.createObjectURL(data);
@@ -15106,15 +15106,15 @@ var app = (function () {
onMount(async () => { onMount(async () => {
console.log('Display aUser username: ' + aUsername); console.log('Display aUser username: ' + aUsername);
//`http://${'localhost'}:${'8080'}/api/v2/user?username=NomDuUserATrouve` //`http://${'transcendance'}:${'8080'}/api/v2/user?username=NomDuUserATrouve`
$$invalidate(1, user = await fetch(`http://${'localhost'}:${'8080'}/api/v2/user?username=${aUsername}`).then(x => x.json())); $$invalidate(1, user = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/user?username=${aUsername}`).then(x => x.json()));
}); });
const updateUser = async updatedUser => { const updateUser = async updatedUser => {
console.log('Display Update aUser username: ' + updateUser); console.log('Display Update aUser username: ' + updateUser);
//`http://${'localhost'}:${'8080'}/api/v2/user?username=NomDuUserATrouve` //`http://${'transcendance'}:${'8080'}/api/v2/user?username=NomDuUserATrouve`
$$invalidate(1, user = await fetch(`http://${'localhost'}:${'8080'}/api/v2/user?username=${updateUser}`).then(x => x.json())); $$invalidate(1, user = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/user?username=${updateUser}`).then(x => x.json()));
}; };
$$self.$$.on_mount.push(function () { $$self.$$.on_mount.push(function () {
@@ -15615,23 +15615,23 @@ var app = (function () {
let userBeingViewed; let userBeingViewed;
onMount(async () => { onMount(async () => {
user = await fetch(`http://${'localhost'}:${'8080'}/api/v2/user`).then(x => x.json()); user = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/user`).then(x => x.json());
myFriends = await fetch(`http://${'localhost'}:${'8080'}/api/v2/network/myfriends`).then(x => x.json()); myFriends = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/network/myfriends`).then(x => x.json());
requestsMade = await fetch(`http://${'localhost'}:${'8080'}/api/v2/network/pending`).then(x => x.json()); requestsMade = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/network/pending`).then(x => x.json());
requestsRecieved = await fetch(`http://${'localhost'}:${'8080'}/api/v2/network/received`).then(x => x.json()); requestsRecieved = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/network/received`).then(x => x.json());
$$invalidate(0, allUsers = await fetch(`http://${'localhost'}:${'8080'}/api/v2/user/all`).then(x => x.json())); $$invalidate(0, allUsers = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/user/all`).then(x => x.json()));
}); });
const displayAllUsers = async () => { const displayAllUsers = async () => {
$$invalidate(0, allUsers = await fetch(`http://${'localhost'}:${'8080'}/api/v2/user/all`).then(x => x.json())); $$invalidate(0, allUsers = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/user/all`).then(x => x.json()));
}; // console.log('got all users ' + allUsers) }; // console.log('got all users ' + allUsers)
const displayAllFriends = async () => { const displayAllFriends = async () => {
myFriends = await fetch(`http://${'localhost'}:${'8080'}/api/v2/network/myfriends`).then(x => x.json()); myFriends = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/network/myfriends`).then(x => x.json());
}; // console.log('got all friends ' + allFriends) }; // console.log('got all friends ' + allFriends)
const displayRequestsMade = async () => { const displayRequestsMade = async () => {
requestsMade = await fetch(`http://${'localhost'}:${'8080'}/api/v2/network/pending`).then(x => x.json()); requestsMade = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/network/pending`).then(x => x.json());
}; // console.log('got requests made ' + requestsMade) }; // console.log('got requests made ' + requestsMade)
let sentFriendRequest; let sentFriendRequest;
@@ -15650,7 +15650,7 @@ var app = (function () {
} }
if (valid) { if (valid) {
sentFriendRequest = await fetch(`http://${'localhost'}:${'8080'}/api/v2/network/myfriends`, { sentFriendRequest = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/network/myfriends`, {
method: "POST", method: "POST",
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ body: JSON.stringify({
@@ -15666,7 +15666,7 @@ var app = (function () {
$$invalidate(1, userBeingViewed = aUser); $$invalidate(1, userBeingViewed = aUser);
}; // sendUsername = userBeingViewed.username; }; // sendUsername = userBeingViewed.username;
// prolly like fetch if you're friends or not? // prolly like fetch if you're friends or not?
// GET `http://${'localhost'}:${'8080'}/api/v2/networks/myfriends?username=aUser` but i need to make that as long as Cherif // GET `http://${'transcendance'}:${'8080'}/api/v2/networks/myfriends?username=aUser` but i need to make that as long as Cherif
// doesn't have a better option // doesn't have a better option
// like i want this thing to return the Friendship ID ideally // like i want this thing to return the Friendship ID ideally
@@ -16273,7 +16273,7 @@ var app = (function () {
let user; let user;
onMount(async () => { onMount(async () => {
$$invalidate(0, user = await fetch(`http://${'localhost'}:${'8080'}/api/v2/user`).then(resp => resp.json())); $$invalidate(0, user = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/user`).then(resp => resp.json()));
// i mean i could do a failed to load user or some shit, maybe with a .catch or something? but atm why bother // i mean i could do a failed to load user or some shit, maybe with a .catch or something? but atm why bother
console.log('User var'); console.log('User var');
@@ -16294,14 +16294,14 @@ var app = (function () {
}); });
const login = async () => { const login = async () => {
window.location.href = `http://${'localhost'}:${'8080'}/api/v2/auth`; window.location.href = `http://${'transcendance'}:${'8080'}/api/v2/auth`;
console.log('you are now logged in'); console.log('you are now logged in');
}; };
// i could prolly put this in it's own compoent, i seem to use it in several places... or maybe just some JS? like no need for html // i could prolly put this in it's own compoent, i seem to use it in several places... or maybe just some JS? like no need for html
// we could .then( () => replace('/') ) need the func so TS compatible... // we could .then( () => replace('/') ) need the func so TS compatible...
const logout = async () => { const logout = async () => {
await fetch(`http://${'localhost'}:${'8080'}/api/v2/auth/logout`, { method: 'POST' }); await fetch(`http://${'transcendance'}:${'8080'}/api/v2/auth/logout`, { method: 'POST' });
$$invalidate(0, user = undefined); $$invalidate(0, user = undefined);
}; };
@@ -16635,7 +16635,7 @@ var app = (function () {
let wrongCode = ""; let wrongCode = "";
const fetchQrCodeImg = (async () => { const fetchQrCodeImg = (async () => {
await fetch(`http://${'localhost'}:${'8080'}/api/v2/auth/2fa/generate`, { method: 'POST' }).then(response => { await fetch(`http://${'transcendance'}:${'8080'}/api/v2/auth/2fa/generate`, { method: 'POST' }).then(response => {
return response.blob(); return response.blob();
}).then(blob => { }).then(blob => {
const url = URL.createObjectURL(blob); const url = URL.createObjectURL(blob);
@@ -16644,7 +16644,7 @@ var app = (function () {
})(); })();
const submitCode = async () => { const submitCode = async () => {
const response = await fetch(`http://${'localhost'}:${'8080'}/api/v2/auth/2fa/check`, { const response = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/auth/2fa/check`, {
method: 'POST', method: 'POST',
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
body: JSON.stringify({ "twoFaCode": qrCode }) body: JSON.stringify({ "twoFaCode": qrCode })
@@ -17025,10 +17025,10 @@ var app = (function () {
// export const soundPongArr: HTMLAudioElement[] = []; // export const soundPongArr: HTMLAudioElement[] = [];
const soundPongArr = [ const soundPongArr = [
new Audio("http://" + 'localhost' + ":" + '8080' + "/sound/pong/" + 1 + ".ogg"), new Audio("http://" + 'transcendance' + ":" + '8080' + "/sound/pong/" + 1 + ".ogg"),
new Audio("http://" + 'localhost' + ":" + '8080' + "/sound/pong/" + 2 + ".ogg") new Audio("http://" + 'transcendance' + ":" + '8080' + "/sound/pong/" + 2 + ".ogg")
]; ];
const soundRoblox = new Audio("http://" + 'localhost' + ":" + '8080' + "/sound/roblox-oof.ogg"); const soundRoblox = new Audio("http://" + 'transcendance' + ":" + '8080' + "/sound/roblox-oof.ogg");
function initAudio(sound) { function initAudio(sound) {
let muteFlag; let muteFlag;
if (sound === "on") { if (sound === "on") {
@@ -17118,7 +17118,7 @@ var app = (function () {
} }
class ClientInfoSpectator { class ClientInfoSpectator {
} }
const wsUrl = "ws://" + 'localhost' + ":" + '8080' + "/pong"; const wsUrl = "ws://" + 'transcendance' + ":" + '8080' + "/pong";
let socket; /* TODO: A way to still use "const" not "let" ? */ let socket; /* TODO: A way to still use "const" not "let" ? */
const clientInfo = new ClientInfo(); const clientInfo = new ClientInfo();
const clientInfoSpectator = new ClientInfoSpectator(); // WIP, could refactor this const clientInfoSpectator = new ClientInfoSpectator(); // WIP, could refactor this
@@ -19270,8 +19270,8 @@ var app = (function () {
let idOfIntevalCheckTerminationOfTheMatch; let idOfIntevalCheckTerminationOfTheMatch;
onMount(async () => { onMount(async () => {
$$invalidate(12, user = await fetch(`http://${'localhost'}:${'8080'}/api/v2/user`).then(x => x.json())); $$invalidate(12, user = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/user`).then(x => x.json()));
$$invalidate(0, allUsers = await fetch(`http://${'localhost'}:${'8080'}/api/v2/user/all`).then(x => x.json())); $$invalidate(0, allUsers = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/user/all`).then(x => x.json()));
$$invalidate(2, options.playerOneUsername = user.username, options); $$invalidate(2, options.playerOneUsername = user.username, options);
}); });
@@ -19285,7 +19285,7 @@ var app = (function () {
$$invalidate(3, showWaitPage = true); $$invalidate(3, showWaitPage = true);
const matchOptions = computeMatchOptions(options); const matchOptions = computeMatchOptions(options);
const responseWhenGrantToken = fetch(`http://${'localhost'}:${'8080'}/api/v2/game/ticket`, { const responseWhenGrantToken = fetch(`http://${'transcendance'}:${'8080'}/api/v2/game/ticket`, {
method: "POST", method: "POST",
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ body: JSON.stringify({
@@ -19383,7 +19383,7 @@ var app = (function () {
const showInvitation = async () => { const showInvitation = async () => {
$$invalidate(5, showGameOption = false); $$invalidate(5, showGameOption = false);
$$invalidate(4, showInvitations = true); $$invalidate(4, showInvitations = true);
$$invalidate(10, invitations = await fetch(`http://${'localhost'}:${'8080'}/api/v2/game/invitations`).then(x => x.json())); $$invalidate(10, invitations = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/game/invitations`).then(x => x.json()));
invitations.length !== 0 invitations.length !== 0
? $$invalidate(9, isThereAnyInvitation = true) ? $$invalidate(9, isThereAnyInvitation = true)
@@ -19391,7 +19391,7 @@ var app = (function () {
}; };
const rejectInvitation = async invitation => { const rejectInvitation = async invitation => {
await fetch(`http://${'localhost'}:${'8080'}/api/v2/game/decline`, { await fetch(`http://${'transcendance'}:${'8080'}/api/v2/game/decline`, {
method: "POST", method: "POST",
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ token: invitation.token }) body: JSON.stringify({ token: invitation.token })
@@ -19401,7 +19401,7 @@ var app = (function () {
}; };
const acceptInvitation = async invitation => { const acceptInvitation = async invitation => {
const res = await fetch(`http://${'localhost'}:${'8080'}/api/v2/game/accept`, { const res = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/game/accept`, {
method: "POST", method: "POST",
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ token: invitation.token }) body: JSON.stringify({ token: invitation.token })
@@ -19987,8 +19987,8 @@ var app = (function () {
let idInterval; let idInterval;
onMount(async () => { onMount(async () => {
$$invalidate(0, currentUser = await fetch(`http://${'localhost'}:${'8080'}/api/v2/user`).then(x => x.json())); $$invalidate(0, currentUser = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/user`).then(x => x.json()));
$$invalidate(1, allUsers = await fetch(`http://${'localhost'}:${'8080'}/api/v2/game/ranking`).then(x => x.json())); $$invalidate(1, allUsers = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/game/ranking`).then(x => x.json()));
idInterval = setInterval(fetchScores, 10000); idInterval = setInterval(fetchScores, 10000);
}); });
@@ -19997,7 +19997,7 @@ var app = (function () {
}); });
function fetchScores() { function fetchScores() {
fetch(`http://${'localhost'}:${'8080'}/api/v2/game/ranking`).then(x => x.json()).then(x => $$invalidate(1, allUsers = x)); fetch(`http://${'transcendance'}:${'8080'}/api/v2/game/ranking`).then(x => x.json()).then(x => $$invalidate(1, allUsers = x));
} }
const writable_props = []; const writable_props = [];
@@ -20830,11 +20830,11 @@ var app = (function () {
let hiddenMatchList = false; let hiddenMatchList = false;
onMount(async () => { onMount(async () => {
user = await fetch(`http://${'localhost'}:${'8080'}/api/v2/user`).then(x => x.json()); user = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/user`).then(x => x.json());
allUsers = await fetch(`http://${'localhost'}:${'8080'}/api/v2/user/all`).then(x => x.json()); allUsers = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/user/all`).then(x => x.json());
// WIP: fetch for match list here // WIP: fetch for match list here
const responseForMatchList = await fetch(`http://${'localhost'}:${'8080'}/api/v2/game/match/all`); const responseForMatchList = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/game/match/all`);
const jsonForMatchList = await responseForMatchList.json(); const jsonForMatchList = await responseForMatchList.json();
$$invalidate(1, matchList = jsonForMatchList); $$invalidate(1, matchList = jsonForMatchList);
@@ -20861,7 +20861,7 @@ var app = (function () {
destroy(); destroy();
// WIP: fetch for match list here // WIP: fetch for match list here
$$invalidate(1, matchList = await fetch(`http://${'localhost'}:${'8080'}/api/v2/game/match/all`).then(x => x.json())); $$invalidate(1, matchList = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/game/match/all`).then(x => x.json()));
console.log("matchList"); console.log("matchList");
if (matchList.length <= 0) $$invalidate(3, hiddenMatchList = true); if (matchList.length <= 0) $$invalidate(3, hiddenMatchList = true);
@@ -20956,7 +20956,7 @@ var app = (function () {
component: ProfilePage, component: ProfilePage,
conditions: [ conditions: [
async(detail) => { async(detail) => {
const user = await fetch('http://' + 'localhost' + ":" + '8080' + '/api/v2/user') const user = await fetch('http://' + 'transcendance' + ":" + '8080' + '/api/v2/user')
.then((resp) => resp.json()); .then((resp) => resp.json());
console.log('in /profile what is in user'); console.log('in /profile what is in user');
@@ -20973,7 +20973,7 @@ var app = (function () {
component: ProfilePage, component: ProfilePage,
conditions: [ conditions: [
async(detail) => { async(detail) => {
const user = await fetch('http://' + 'localhost' + ":" + '8080' + '/api/v2/user') const user = await fetch('http://' + 'transcendance' + ":" + '8080' + '/api/v2/user')
.then((resp) => resp.json()); .then((resp) => resp.json());
console.log('in /profile/* what is in user'); console.log('in /profile/* what is in user');

File diff suppressed because one or more lines are too long