can create and join rooms, but messages are all mixed up
This commit is contained in:
@@ -30,7 +30,7 @@ export class ChatService {
|
|||||||
console.log("-- in getMyRooms service");
|
console.log("-- in getMyRooms service");
|
||||||
const rooms = await this.chatroomRepository
|
const rooms = await this.chatroomRepository
|
||||||
.createQueryBuilder('chatroom')
|
.createQueryBuilder('chatroom')
|
||||||
.where(':user_name ANY(chatroom.users)', { user_name: user.username })
|
.where('chatroom.users LIKE :user_name', { user_name: `%${user.username}%` })
|
||||||
.getMany();
|
.getMany();
|
||||||
|
|
||||||
return rooms;
|
return rooms;
|
||||||
@@ -53,7 +53,7 @@ export class ChatService {
|
|||||||
const rooms = await this.chatroomRepository
|
const rooms = await this.chatroomRepository
|
||||||
.createQueryBuilder('chatroom')
|
.createQueryBuilder('chatroom')
|
||||||
.where('chatroom.type != :type', { type: 'private' })
|
.where('chatroom.type != :type', { type: 'private' })
|
||||||
.andWhere(':user_name NOT IN (chatroom.users)', { user_name: user.username })
|
.andWhere('chatroom.users NOT LIKE :user_name', { user_name: `%${user.username}%` })
|
||||||
.getMany();
|
.getMany();
|
||||||
//const users = await this.findAllUsers();
|
//const users = await this.findAllUsers();
|
||||||
//let allRooms = [...rooms, ...users];
|
//let allRooms = [...rooms, ...users];
|
||||||
|
|||||||
@@ -2541,7 +2541,7 @@ var app = (function () {
|
|||||||
validate_slots('Header', slots, []);
|
validate_slots('Header', slots, []);
|
||||||
|
|
||||||
let handleClickLogout = async () => {
|
let handleClickLogout = async () => {
|
||||||
await fetch(`http://${'transcendance'}:${'8080'}/api/v2/auth/logout`, { method: 'POST' }).// .then(resp => resp.json)
|
await fetch(`http://${'localhost'}:${'8080'}/api/v2/auth/logout`, { method: 'POST' }).// .then(resp => resp.json)
|
||||||
// .then((resp) => console.log(resp))
|
// .then((resp) => console.log(resp))
|
||||||
then(() => push('/')); // i think for TS reasons it has to be a func not direclty push('/') or whatever
|
then(() => push('/')); // i think for TS reasons it has to be a func not direclty push('/') or whatever
|
||||||
|
|
||||||
@@ -2892,7 +2892,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://${'transcendance'}:${'8080'}/api/v2/user/avatar`, { method: "GET" }).then(response => {
|
await fetch(`http://${'localhost'}:${'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);
|
||||||
@@ -3912,7 +3912,7 @@ var app = (function () {
|
|||||||
return child_ctx;
|
return child_ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (49:1) <Button bind:layout new_layout="settings" my_class="settings dots icon">
|
// (50:1) <Button bind:layout new_layout="settings" my_class="settings dots icon">
|
||||||
function create_default_slot_3$5(ctx) {
|
function create_default_slot_3$5(ctx) {
|
||||||
let t;
|
let t;
|
||||||
|
|
||||||
@@ -3932,14 +3932,14 @@ var app = (function () {
|
|||||||
block,
|
block,
|
||||||
id: create_default_slot_3$5.name,
|
id: create_default_slot_3$5.name,
|
||||||
type: "slot",
|
type: "slot",
|
||||||
source: "(49:1) <Button bind:layout new_layout=\\\"settings\\\" my_class=\\\"settings dots icon\\\">",
|
source: "(50:1) <Button bind:layout new_layout=\\\"settings\\\" my_class=\\\"settings dots icon\\\">",
|
||||||
ctx
|
ctx
|
||||||
});
|
});
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (54:1) <Button bind:layout new_layout="new" my_class="new transparent">
|
// (55:1) <Button bind:layout new_layout="new" my_class="new transparent">
|
||||||
function create_default_slot_2$9(ctx) {
|
function create_default_slot_2$9(ctx) {
|
||||||
let t;
|
let t;
|
||||||
|
|
||||||
@@ -3959,14 +3959,14 @@ var app = (function () {
|
|||||||
block,
|
block,
|
||||||
id: create_default_slot_2$9.name,
|
id: create_default_slot_2$9.name,
|
||||||
type: "slot",
|
type: "slot",
|
||||||
source: "(54:1) <Button bind:layout new_layout=\\\"new\\\" my_class=\\\"new transparent\\\">",
|
source: "(55:1) <Button bind:layout new_layout=\\\"new\\\" my_class=\\\"new transparent\\\">",
|
||||||
ctx
|
ctx
|
||||||
});
|
});
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (59:1) <Button bind:layout new_layout="close" my_class="close icon">
|
// (60:1) <Button bind:layout new_layout="close" my_class="close icon">
|
||||||
function create_default_slot_1$9(ctx) {
|
function create_default_slot_1$9(ctx) {
|
||||||
let t;
|
let t;
|
||||||
|
|
||||||
@@ -3986,7 +3986,7 @@ var app = (function () {
|
|||||||
block,
|
block,
|
||||||
id: create_default_slot_1$9.name,
|
id: create_default_slot_1$9.name,
|
||||||
type: "slot",
|
type: "slot",
|
||||||
source: "(59:1) <Button bind:layout new_layout=\\\"close\\\" my_class=\\\"close icon\\\">",
|
source: "(60:1) <Button bind:layout new_layout=\\\"close\\\" my_class=\\\"close icon\\\">",
|
||||||
ctx
|
ctx
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -4015,7 +4015,7 @@ var app = (function () {
|
|||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (73:3) {:then}
|
// (74:3) {:then}
|
||||||
function create_then_block$2(ctx) {
|
function create_then_block$2(ctx) {
|
||||||
let each_1_anchor;
|
let each_1_anchor;
|
||||||
let current;
|
let current;
|
||||||
@@ -4104,14 +4104,14 @@ var app = (function () {
|
|||||||
block,
|
block,
|
||||||
id: create_then_block$2.name,
|
id: create_then_block$2.name,
|
||||||
type: "then",
|
type: "then",
|
||||||
source: "(73:3) {:then}",
|
source: "(74:3) {:then}",
|
||||||
ctx
|
ctx
|
||||||
});
|
});
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (75:5) <Button my_class="list" on_click={get_room_messages}>
|
// (76:5) <Button my_class="list" on_click={get_room_messages}>
|
||||||
function create_default_slot$b(ctx) {
|
function create_default_slot$b(ctx) {
|
||||||
let t0_value = /*room*/ ctx[7].name + "";
|
let t0_value = /*room*/ ctx[7].name + "";
|
||||||
let t0;
|
let t0;
|
||||||
@@ -4139,14 +4139,14 @@ var app = (function () {
|
|||||||
block,
|
block,
|
||||||
id: create_default_slot$b.name,
|
id: create_default_slot$b.name,
|
||||||
type: "slot",
|
type: "slot",
|
||||||
source: "(75:5) <Button my_class=\\\"list\\\" on_click={get_room_messages}>",
|
source: "(76:5) <Button my_class=\\\"list\\\" on_click={get_room_messages}>",
|
||||||
ctx
|
ctx
|
||||||
});
|
});
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (74:4) {#each rooms as room}
|
// (75:4) {#each rooms as room}
|
||||||
function create_each_block$6(ctx) {
|
function create_each_block$6(ctx) {
|
||||||
let button;
|
let button;
|
||||||
let current;
|
let current;
|
||||||
@@ -4196,14 +4196,14 @@ var app = (function () {
|
|||||||
block,
|
block,
|
||||||
id: create_each_block$6.name,
|
id: create_each_block$6.name,
|
||||||
type: "each",
|
type: "each",
|
||||||
source: "(74:4) {#each rooms as room}",
|
source: "(75:4) {#each rooms as room}",
|
||||||
ctx
|
ctx
|
||||||
});
|
});
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (70:21) <!-- promise is pending --> <p>rooms are loaded...</p> {:then}
|
// (71:21) <!-- promise is pending --> <p>rooms are loaded...</p> {:then}
|
||||||
function create_pending_block$2(ctx) {
|
function create_pending_block$2(ctx) {
|
||||||
let p;
|
let p;
|
||||||
|
|
||||||
@@ -4211,7 +4211,7 @@ var app = (function () {
|
|||||||
c: function create() {
|
c: function create() {
|
||||||
p = element("p");
|
p = element("p");
|
||||||
p.textContent = "rooms are loaded...";
|
p.textContent = "rooms are loaded...";
|
||||||
add_location(p, file$p, 71, 4, 1584);
|
add_location(p, file$p, 72, 4, 1632);
|
||||||
},
|
},
|
||||||
m: function mount(target, anchor) {
|
m: function mount(target, anchor) {
|
||||||
insert_dev(target, p, anchor);
|
insert_dev(target, p, anchor);
|
||||||
@@ -4228,7 +4228,7 @@ var app = (function () {
|
|||||||
block,
|
block,
|
||||||
id: create_pending_block$2.name,
|
id: create_pending_block$2.name,
|
||||||
type: "pending",
|
type: "pending",
|
||||||
source: "(70:21) <!-- promise is pending --> <p>rooms are loaded...</p> {:then}",
|
source: "(71:21) <!-- promise is pending --> <p>rooms are loaded...</p> {:then}",
|
||||||
ctx
|
ctx
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -4342,17 +4342,17 @@ var app = (function () {
|
|||||||
t6 = space();
|
t6 = space();
|
||||||
info.block.c();
|
info.block.c();
|
||||||
attr_dev(p0, "class", "title svelte-1jygwt2");
|
attr_dev(p0, "class", "title svelte-1jygwt2");
|
||||||
add_location(p0, file$p, 64, 2, 1352);
|
add_location(p0, file$p, 65, 2, 1400);
|
||||||
attr_dev(p1, "class", "__center");
|
attr_dev(p1, "class", "__center");
|
||||||
add_location(p1, file$p, 67, 4, 1462);
|
add_location(p1, file$p, 68, 4, 1510);
|
||||||
attr_dev(div0, "class", "__show_if_only_child");
|
attr_dev(div0, "class", "__show_if_only_child");
|
||||||
add_location(div0, file$p, 66, 3, 1423);
|
add_location(div0, file$p, 67, 3, 1471);
|
||||||
attr_dev(div1, "class", "room_list");
|
attr_dev(div1, "class", "room_list");
|
||||||
add_location(div1, file$p, 65, 2, 1396);
|
add_location(div1, file$p, 66, 2, 1444);
|
||||||
attr_dev(div2, "class", "panel panel_home __border_top svelte-1jygwt2");
|
attr_dev(div2, "class", "panel panel_home __border_top svelte-1jygwt2");
|
||||||
add_location(div2, file$p, 63, 1, 1306);
|
add_location(div2, file$p, 64, 1, 1354);
|
||||||
attr_dev(div3, "class", "grid_box svelte-1jygwt2");
|
attr_dev(div3, "class", "grid_box svelte-1jygwt2");
|
||||||
add_location(div3, file$p, 45, 0, 947);
|
add_location(div3, file$p, 46, 0, 995);
|
||||||
},
|
},
|
||||||
l: function claim(nodes) {
|
l: function claim(nodes) {
|
||||||
throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
|
throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
|
||||||
@@ -4493,7 +4493,8 @@ var app = (function () {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
msgs.update(msgs => msgs.concat(data.messages));
|
//msgs.update(msgs => msgs.concat(data.messages));
|
||||||
|
msgs.update(msgs => data.messages);
|
||||||
});
|
});
|
||||||
|
|
||||||
$$invalidate(0, layout = "room");
|
$$invalidate(0, layout = "room");
|
||||||
@@ -5400,11 +5401,11 @@ var app = (function () {
|
|||||||
|
|
||||||
function get_each_context$4(ctx, list, i) {
|
function get_each_context$4(ctx, list, i) {
|
||||||
const child_ctx = ctx.slice();
|
const child_ctx = ctx.slice();
|
||||||
child_ctx[7] = list[i];
|
child_ctx[8] = list[i];
|
||||||
return child_ctx;
|
return child_ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (67:1) <Button bind:layout new_layout={back} my_class="back icon" my_title="go back {back}">
|
// (62:1) <Button bind:layout new_layout={back} my_class="back icon" my_title="go back {back}">
|
||||||
function create_default_slot_4$2(ctx) {
|
function create_default_slot_4$2(ctx) {
|
||||||
let t;
|
let t;
|
||||||
|
|
||||||
@@ -5424,14 +5425,14 @@ var app = (function () {
|
|||||||
block,
|
block,
|
||||||
id: create_default_slot_4$2.name,
|
id: create_default_slot_4$2.name,
|
||||||
type: "slot",
|
type: "slot",
|
||||||
source: "(67:1) <Button bind:layout new_layout={back} my_class=\\\"back icon\\\" my_title=\\\"go back {back}\\\">",
|
source: "(62:1) <Button bind:layout new_layout={back} my_class=\\\"back icon\\\" my_title=\\\"go back {back}\\\">",
|
||||||
ctx
|
ctx
|
||||||
});
|
});
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (72:1) <Button my_class="new deactivate">
|
// (67:1) <Button my_class="new deactivate">
|
||||||
function create_default_slot_3$3(ctx) {
|
function create_default_slot_3$3(ctx) {
|
||||||
let t;
|
let t;
|
||||||
|
|
||||||
@@ -5451,14 +5452,14 @@ var app = (function () {
|
|||||||
block,
|
block,
|
||||||
id: create_default_slot_3$3.name,
|
id: create_default_slot_3$3.name,
|
||||||
type: "slot",
|
type: "slot",
|
||||||
source: "(72:1) <Button my_class=\\\"new deactivate\\\">",
|
source: "(67:1) <Button my_class=\\\"new deactivate\\\">",
|
||||||
ctx
|
ctx
|
||||||
});
|
});
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (77:1) <Button bind:layout new_layout="close" my_class="close icon">
|
// (72:1) <Button bind:layout new_layout="close" my_class="close icon">
|
||||||
function create_default_slot_2$7(ctx) {
|
function create_default_slot_2$7(ctx) {
|
||||||
let t;
|
let t;
|
||||||
|
|
||||||
@@ -5478,14 +5479,14 @@ var app = (function () {
|
|||||||
block,
|
block,
|
||||||
id: create_default_slot_2$7.name,
|
id: create_default_slot_2$7.name,
|
||||||
type: "slot",
|
type: "slot",
|
||||||
source: "(77:1) <Button bind:layout new_layout=\\\"close\\\" my_class=\\\"close icon\\\">",
|
source: "(72:1) <Button bind:layout new_layout=\\\"close\\\" my_class=\\\"close icon\\\">",
|
||||||
ctx
|
ctx
|
||||||
});
|
});
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (83:2) <Button bind:layout new_layout="create" my_class="create">
|
// (78:2) <Button bind:layout new_layout="create" my_class="create">
|
||||||
function create_default_slot_1$7(ctx) {
|
function create_default_slot_1$7(ctx) {
|
||||||
let t;
|
let t;
|
||||||
|
|
||||||
@@ -5505,14 +5506,14 @@ var app = (function () {
|
|||||||
block,
|
block,
|
||||||
id: create_default_slot_1$7.name,
|
id: create_default_slot_1$7.name,
|
||||||
type: "slot",
|
type: "slot",
|
||||||
source: "(83:2) <Button bind:layout new_layout=\\\"create\\\" my_class=\\\"create\\\">",
|
source: "(78:2) <Button bind:layout new_layout=\\\"create\\\" my_class=\\\"create\\\">",
|
||||||
ctx
|
ctx
|
||||||
});
|
});
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (1:0) <script> import Button from './Element_button.svelte'; export let layout = ""; export let back = ""; let rooms = []; // ask api for the rooms const get_rooms = fetch('/api/v2/chat/allrooms') .then(resp => resp.json()) .then(data => { console.log("data.rooms:", data.rooms); for (let room of data.rooms) console.log(room.name); rooms = data.rooms; }
|
// (1:0) <script> import Button from './Element_button.svelte'; import { msgs, user }
|
||||||
function create_catch_block$1(ctx) {
|
function create_catch_block$1(ctx) {
|
||||||
const block = {
|
const block = {
|
||||||
c: noop,
|
c: noop,
|
||||||
@@ -5527,14 +5528,14 @@ var app = (function () {
|
|||||||
block,
|
block,
|
||||||
id: create_catch_block$1.name,
|
id: create_catch_block$1.name,
|
||||||
type: "catch",
|
type: "catch",
|
||||||
source: "(1:0) <script> import Button from './Element_button.svelte'; export let layout = \\\"\\\"; export let back = \\\"\\\"; let rooms = []; // ask api for the rooms const get_rooms = fetch('/api/v2/chat/allrooms') .then(resp => resp.json()) .then(data => { console.log(\\\"data.rooms:\\\", data.rooms); for (let room of data.rooms) console.log(room.name); rooms = data.rooms; }",
|
source: "(1:0) <script> import Button from './Element_button.svelte'; import { msgs, user }",
|
||||||
ctx
|
ctx
|
||||||
});
|
});
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (94:3) {:then}
|
// (89:3) {:then}
|
||||||
function create_then_block$1(ctx) {
|
function create_then_block$1(ctx) {
|
||||||
let each_1_anchor;
|
let each_1_anchor;
|
||||||
let current;
|
let current;
|
||||||
@@ -5567,7 +5568,7 @@ var app = (function () {
|
|||||||
current = true;
|
current = true;
|
||||||
},
|
},
|
||||||
p: function update(ctx, dirty) {
|
p: function update(ctx, dirty) {
|
||||||
if (dirty & /*join_rooms, rooms*/ 4) {
|
if (dirty & /*join_rooms, rooms*/ 20) {
|
||||||
each_value = /*rooms*/ ctx[2];
|
each_value = /*rooms*/ ctx[2];
|
||||||
validate_each_argument(each_value);
|
validate_each_argument(each_value);
|
||||||
let i;
|
let i;
|
||||||
@@ -5623,16 +5624,16 @@ var app = (function () {
|
|||||||
block,
|
block,
|
||||||
id: create_then_block$1.name,
|
id: create_then_block$1.name,
|
||||||
type: "then",
|
type: "then",
|
||||||
source: "(94:3) {:then}",
|
source: "(89:3) {:then}",
|
||||||
ctx
|
ctx
|
||||||
});
|
});
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (96:5) <Button my_class="list" on_click={join_rooms}>
|
// (91:5) <Button my_class="list" on_click={join_rooms}>
|
||||||
function create_default_slot$9(ctx) {
|
function create_default_slot$9(ctx) {
|
||||||
let t0_value = /*room*/ ctx[7].name + "";
|
let t0_value = /*room*/ ctx[8].name + "";
|
||||||
let t0;
|
let t0;
|
||||||
let t1;
|
let t1;
|
||||||
|
|
||||||
@@ -5646,7 +5647,7 @@ var app = (function () {
|
|||||||
insert_dev(target, t1, anchor);
|
insert_dev(target, t1, anchor);
|
||||||
},
|
},
|
||||||
p: function update(ctx, dirty) {
|
p: function update(ctx, dirty) {
|
||||||
if (dirty & /*rooms*/ 4 && t0_value !== (t0_value = /*room*/ ctx[7].name + "")) set_data_dev(t0, t0_value);
|
if (dirty & /*rooms*/ 4 && t0_value !== (t0_value = /*room*/ ctx[8].name + "")) set_data_dev(t0, t0_value);
|
||||||
},
|
},
|
||||||
d: function destroy(detaching) {
|
d: function destroy(detaching) {
|
||||||
if (detaching) detach_dev(t0);
|
if (detaching) detach_dev(t0);
|
||||||
@@ -5658,14 +5659,14 @@ var app = (function () {
|
|||||||
block,
|
block,
|
||||||
id: create_default_slot$9.name,
|
id: create_default_slot$9.name,
|
||||||
type: "slot",
|
type: "slot",
|
||||||
source: "(96:5) <Button my_class=\\\"list\\\" on_click={join_rooms}>",
|
source: "(91:5) <Button my_class=\\\"list\\\" on_click={join_rooms}>",
|
||||||
ctx
|
ctx
|
||||||
});
|
});
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (95:4) {#each rooms as room}
|
// (90:4) {#each rooms as room}
|
||||||
function create_each_block$4(ctx) {
|
function create_each_block$4(ctx) {
|
||||||
let button;
|
let button;
|
||||||
let current;
|
let current;
|
||||||
@@ -5673,7 +5674,7 @@ var app = (function () {
|
|||||||
button = new Element_button({
|
button = new Element_button({
|
||||||
props: {
|
props: {
|
||||||
my_class: "list",
|
my_class: "list",
|
||||||
on_click: join_rooms,
|
on_click: /*join_rooms*/ ctx[4],
|
||||||
$$slots: { default: [create_default_slot$9] },
|
$$slots: { default: [create_default_slot$9] },
|
||||||
$$scope: { ctx }
|
$$scope: { ctx }
|
||||||
},
|
},
|
||||||
@@ -5691,7 +5692,7 @@ var app = (function () {
|
|||||||
p: function update(ctx, dirty) {
|
p: function update(ctx, dirty) {
|
||||||
const button_changes = {};
|
const button_changes = {};
|
||||||
|
|
||||||
if (dirty & /*$$scope, rooms*/ 1028) {
|
if (dirty & /*$$scope, rooms*/ 2052) {
|
||||||
button_changes.$$scope = { dirty, ctx };
|
button_changes.$$scope = { dirty, ctx };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5715,14 +5716,14 @@ var app = (function () {
|
|||||||
block,
|
block,
|
||||||
id: create_each_block$4.name,
|
id: create_each_block$4.name,
|
||||||
type: "each",
|
type: "each",
|
||||||
source: "(95:4) {#each rooms as room}",
|
source: "(90:4) {#each rooms as room}",
|
||||||
ctx
|
ctx
|
||||||
});
|
});
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (91:21) <!-- promise is pending --> <p>rooms are loaded...</p> {:then}
|
// (86:21) <!-- promise is pending --> <p>rooms are loaded...</p> {:then}
|
||||||
function create_pending_block$1(ctx) {
|
function create_pending_block$1(ctx) {
|
||||||
let p;
|
let p;
|
||||||
|
|
||||||
@@ -5730,7 +5731,7 @@ var app = (function () {
|
|||||||
c: function create() {
|
c: function create() {
|
||||||
p = element("p");
|
p = element("p");
|
||||||
p.textContent = "rooms are loaded...";
|
p.textContent = "rooms are loaded...";
|
||||||
add_location(p, file$m, 92, 4, 1943);
|
add_location(p, file$m, 87, 4, 1783);
|
||||||
},
|
},
|
||||||
m: function mount(target, anchor) {
|
m: function mount(target, anchor) {
|
||||||
insert_dev(target, p, anchor);
|
insert_dev(target, p, anchor);
|
||||||
@@ -5747,7 +5748,7 @@ var app = (function () {
|
|||||||
block,
|
block,
|
||||||
id: create_pending_block$1.name,
|
id: create_pending_block$1.name,
|
||||||
type: "pending",
|
type: "pending",
|
||||||
source: "(91:21) <!-- promise is pending --> <p>rooms are loaded...</p> {:then}",
|
source: "(86:21) <!-- promise is pending --> <p>rooms are loaded...</p> {:then}",
|
||||||
ctx
|
ctx
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -5777,7 +5778,7 @@ var app = (function () {
|
|||||||
let current;
|
let current;
|
||||||
|
|
||||||
function button0_layout_binding(value) {
|
function button0_layout_binding(value) {
|
||||||
/*button0_layout_binding*/ ctx[4](value);
|
/*button0_layout_binding*/ ctx[5](value);
|
||||||
}
|
}
|
||||||
|
|
||||||
let button0_props = {
|
let button0_props = {
|
||||||
@@ -5805,7 +5806,7 @@ var app = (function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function button2_layout_binding(value) {
|
function button2_layout_binding(value) {
|
||||||
/*button2_layout_binding*/ ctx[5](value);
|
/*button2_layout_binding*/ ctx[6](value);
|
||||||
}
|
}
|
||||||
|
|
||||||
let button2_props = {
|
let button2_props = {
|
||||||
@@ -5823,7 +5824,7 @@ var app = (function () {
|
|||||||
binding_callbacks.push(() => bind(button2, 'layout', button2_layout_binding));
|
binding_callbacks.push(() => bind(button2, 'layout', button2_layout_binding));
|
||||||
|
|
||||||
function button3_layout_binding(value) {
|
function button3_layout_binding(value) {
|
||||||
/*button3_layout_binding*/ ctx[6](value);
|
/*button3_layout_binding*/ ctx[7](value);
|
||||||
}
|
}
|
||||||
|
|
||||||
let button3_props = {
|
let button3_props = {
|
||||||
@@ -5874,17 +5875,17 @@ var app = (function () {
|
|||||||
p1.textContent = "/ there are no public rooms yet /";
|
p1.textContent = "/ there are no public rooms yet /";
|
||||||
t7 = space();
|
t7 = space();
|
||||||
info.block.c();
|
info.block.c();
|
||||||
add_location(p0, file$m, 85, 2, 1727);
|
add_location(p0, file$m, 80, 2, 1567);
|
||||||
attr_dev(p1, "class", "__center");
|
attr_dev(p1, "class", "__center");
|
||||||
add_location(p1, file$m, 88, 4, 1817);
|
add_location(p1, file$m, 83, 4, 1657);
|
||||||
attr_dev(div0, "class", "__show_if_only_child");
|
attr_dev(div0, "class", "__show_if_only_child");
|
||||||
add_location(div0, file$m, 87, 3, 1778);
|
add_location(div0, file$m, 82, 3, 1618);
|
||||||
attr_dev(div1, "class", "public_rooms");
|
attr_dev(div1, "class", "public_rooms");
|
||||||
add_location(div1, file$m, 86, 2, 1748);
|
add_location(div1, file$m, 81, 2, 1588);
|
||||||
attr_dev(div2, "class", "panel panel_new __border_top");
|
attr_dev(div2, "class", "panel panel_new __border_top");
|
||||||
add_location(div2, file$m, 81, 1, 1599);
|
add_location(div2, file$m, 76, 1, 1439);
|
||||||
attr_dev(div3, "class", "grid_box svelte-1b4c0qx");
|
attr_dev(div3, "class", "grid_box svelte-1b4c0qx");
|
||||||
add_location(div3, file$m, 63, 0, 1266);
|
add_location(div3, file$m, 58, 0, 1106);
|
||||||
},
|
},
|
||||||
l: function claim(nodes) {
|
l: function claim(nodes) {
|
||||||
throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
|
throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
|
||||||
@@ -5917,7 +5918,7 @@ var app = (function () {
|
|||||||
if (dirty & /*back*/ 2) button0_changes.new_layout = /*back*/ ctx[1];
|
if (dirty & /*back*/ 2) button0_changes.new_layout = /*back*/ ctx[1];
|
||||||
if (dirty & /*back*/ 2) button0_changes.my_title = "go back " + /*back*/ ctx[1];
|
if (dirty & /*back*/ 2) button0_changes.my_title = "go back " + /*back*/ ctx[1];
|
||||||
|
|
||||||
if (dirty & /*$$scope*/ 1024) {
|
if (dirty & /*$$scope*/ 2048) {
|
||||||
button0_changes.$$scope = { dirty, ctx };
|
button0_changes.$$scope = { dirty, ctx };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5930,14 +5931,14 @@ var app = (function () {
|
|||||||
button0.$set(button0_changes);
|
button0.$set(button0_changes);
|
||||||
const button1_changes = {};
|
const button1_changes = {};
|
||||||
|
|
||||||
if (dirty & /*$$scope*/ 1024) {
|
if (dirty & /*$$scope*/ 2048) {
|
||||||
button1_changes.$$scope = { dirty, ctx };
|
button1_changes.$$scope = { dirty, ctx };
|
||||||
}
|
}
|
||||||
|
|
||||||
button1.$set(button1_changes);
|
button1.$set(button1_changes);
|
||||||
const button2_changes = {};
|
const button2_changes = {};
|
||||||
|
|
||||||
if (dirty & /*$$scope*/ 1024) {
|
if (dirty & /*$$scope*/ 2048) {
|
||||||
button2_changes.$$scope = { dirty, ctx };
|
button2_changes.$$scope = { dirty, ctx };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5950,7 +5951,7 @@ var app = (function () {
|
|||||||
button2.$set(button2_changes);
|
button2.$set(button2_changes);
|
||||||
const button3_changes = {};
|
const button3_changes = {};
|
||||||
|
|
||||||
if (dirty & /*$$scope*/ 1024) {
|
if (dirty & /*$$scope*/ 2048) {
|
||||||
button3_changes.$$scope = { dirty, ctx };
|
button3_changes.$$scope = { dirty, ctx };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6008,38 +6009,6 @@ var app = (function () {
|
|||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
function join_rooms(evt) {
|
|
||||||
console.log("inside join_rooms");
|
|
||||||
let room_name = { room_name: evt.target.innerText };
|
|
||||||
|
|
||||||
fetch('/api/v2/chat/join', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: { 'Content-Type': 'application/json' },
|
|
||||||
body: JSON.stringify(room_name)
|
|
||||||
}).then(resp => resp.json()).then(data => {
|
|
||||||
console.log(data);
|
|
||||||
}); // data.messages.forEach(function(item) {
|
|
||||||
// if (item.name === user.username) {
|
|
||||||
// item.name = "me";
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
} // msgs.update(msgs => msgs.concat(data.messages));
|
|
||||||
/*
|
|
||||||
const messages = fetch('/api/v2/chat/messages')
|
|
||||||
.then(resp => resp.json())
|
|
||||||
.then(data =>
|
|
||||||
{
|
|
||||||
console.log(data.messages);
|
|
||||||
data.messages.forEach(function(item) {
|
|
||||||
if (item.name === user.username) {
|
|
||||||
item.name = "me";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
msgs.update(msgs => msgs.concat(data.messages));
|
|
||||||
});
|
|
||||||
layout = "room";
|
|
||||||
*/
|
|
||||||
|
|
||||||
function instance$p($$self, $$props, $$invalidate) {
|
function instance$p($$self, $$props, $$invalidate) {
|
||||||
let { $$slots: slots = {}, $$scope } = $$props;
|
let { $$slots: slots = {}, $$scope } = $$props;
|
||||||
validate_slots('Layout_new', slots, []);
|
validate_slots('Layout_new', slots, []);
|
||||||
@@ -6054,6 +6023,34 @@ var app = (function () {
|
|||||||
$$invalidate(2, rooms = data.rooms);
|
$$invalidate(2, rooms = data.rooms);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function join_rooms(evt) {
|
||||||
|
console.log("inside join_rooms");
|
||||||
|
let room_name = { room_name: evt.target.innerText };
|
||||||
|
|
||||||
|
fetch('/api/v2/chat/join', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify(room_name)
|
||||||
|
}).then(resp => resp.json()).then(data => {
|
||||||
|
console.log(data);
|
||||||
|
});
|
||||||
|
|
||||||
|
fetch('/api/v2/chat/messages').then(resp => resp.json()).then(data => {
|
||||||
|
console.log(data.messages);
|
||||||
|
|
||||||
|
data.messages.forEach(function (item) {
|
||||||
|
if (item.name === user.username) {
|
||||||
|
item.name = "me";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
msgs.update(msgs => data.messages);
|
||||||
|
});
|
||||||
|
|
||||||
|
$$invalidate(0, layout = "room");
|
||||||
|
} /*
|
||||||
|
*/
|
||||||
|
|
||||||
const writable_props = ['layout', 'back'];
|
const writable_props = ['layout', 'back'];
|
||||||
|
|
||||||
Object.keys($$props).forEach(key => {
|
Object.keys($$props).forEach(key => {
|
||||||
@@ -6082,6 +6079,8 @@ var app = (function () {
|
|||||||
|
|
||||||
$$self.$capture_state = () => ({
|
$$self.$capture_state = () => ({
|
||||||
Button: Element_button,
|
Button: Element_button,
|
||||||
|
msgs,
|
||||||
|
user,
|
||||||
layout,
|
layout,
|
||||||
back,
|
back,
|
||||||
rooms,
|
rooms,
|
||||||
@@ -6104,6 +6103,7 @@ var app = (function () {
|
|||||||
back,
|
back,
|
||||||
rooms,
|
rooms,
|
||||||
get_rooms,
|
get_rooms,
|
||||||
|
join_rooms,
|
||||||
button0_layout_binding,
|
button0_layout_binding,
|
||||||
button2_layout_binding,
|
button2_layout_binding,
|
||||||
button3_layout_binding
|
button3_layout_binding
|
||||||
@@ -15004,7 +15004,7 @@ var app = (function () {
|
|||||||
socket.on('pong', function () { console.log("socket.io pong"); });
|
socket.on('pong', function () { console.log("socket.io pong"); });
|
||||||
}
|
}
|
||||||
|
|
||||||
const address = `http://${'transcendance'}:${'8080'}`;
|
const address = `http://${'localhost'}:${'8080'}`;
|
||||||
async function init_socket() {
|
async function init_socket() {
|
||||||
const response = await fetch(`${address}/api/v2/user`);
|
const response = await fetch(`${address}/api/v2/user`);
|
||||||
const response_data = await response.json();
|
const response_data = await response.json();
|
||||||
@@ -15622,7 +15622,7 @@ var app = (function () {
|
|||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
// console.log('mounting profile display')
|
// console.log('mounting profile display')
|
||||||
$$invalidate(0, user = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/user`).then(x => x.json()));
|
$$invalidate(0, user = await fetch(`http://${'localhost'}:${'8080'}/api/v2/user`).then(x => x.json()));
|
||||||
});
|
});
|
||||||
|
|
||||||
const writable_props = [];
|
const writable_props = [];
|
||||||
@@ -16455,7 +16455,7 @@ var app = (function () {
|
|||||||
let success = { username: '', avatar: '' };
|
let success = { username: '', avatar: '' };
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
user = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/user`).then(x => x.json());
|
user = await fetch(`http://${'localhost'}:${'8080'}/api/v2/user`).then(x => x.json());
|
||||||
|
|
||||||
// do a .catch?
|
// do a .catch?
|
||||||
if (user === undefined) {
|
if (user === undefined) {
|
||||||
@@ -16471,7 +16471,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://${'transcendance'}:${'8080'}/api/v2/user/avatar`, { method: "GET" }).then(response => {
|
await fetch(`http://${'localhost'}:${'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);
|
||||||
@@ -16496,7 +16496,7 @@ var app = (function () {
|
|||||||
$$invalidate(4, errors.username = '', errors);
|
$$invalidate(4, errors.username = '', errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
await fetch(`http://${'transcendance'}:${'8080'}/api/v2/user`, {
|
await fetch(`http://${'localhost'}:${'8080'}/api/v2/user`, {
|
||||||
method: 'PATCH',
|
method: 'PATCH',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
@@ -16523,7 +16523,7 @@ var app = (function () {
|
|||||||
// tmp
|
// tmp
|
||||||
console.log(data);
|
console.log(data);
|
||||||
|
|
||||||
const responseWhenChangeAvatar = fetch(`http://${'transcendance'}:${'8080'}/api/v2/user/avatar`, { method: 'POST', body: data });
|
const responseWhenChangeAvatar = fetch(`http://${'localhost'}:${'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) {
|
||||||
@@ -16533,7 +16533,7 @@ var app = (function () {
|
|||||||
$$invalidate(4, errors.avatar = responseFromServer.statusText, errors);
|
$$invalidate(4, errors.avatar = responseFromServer.statusText, errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
await fetch(`http://${'transcendance'}:${'8080'}/api/v2/user/avatar`, { method: "GET" }).then(response => {
|
await fetch(`http://${'localhost'}:${'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);
|
||||||
@@ -16834,8 +16834,8 @@ var app = (function () {
|
|||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
console.log('Display aUser username: ' + aUsername);
|
console.log('Display aUser username: ' + aUsername);
|
||||||
|
|
||||||
//`http://${'transcendance'}:${'8080'}/api/v2/user?username=NomDuUserATrouve`
|
//`http://${'localhost'}:${'8080'}/api/v2/user?username=NomDuUserATrouve`
|
||||||
$$invalidate(1, user = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/user?username=${aUsername}`).then(x => x.json()));
|
$$invalidate(1, user = await fetch(`http://${'localhost'}:${'8080'}/api/v2/user?username=${aUsername}`).then(x => x.json()));
|
||||||
}); // console.log('Display a user: ')
|
}); // console.log('Display a user: ')
|
||||||
// console.log({...user})
|
// console.log({...user})
|
||||||
|
|
||||||
@@ -16845,8 +16845,8 @@ var app = (function () {
|
|||||||
const updateUser = async updatedUser => {
|
const updateUser = async updatedUser => {
|
||||||
console.log('Display Update aUser username: ' + updateUser);
|
console.log('Display Update aUser username: ' + updateUser);
|
||||||
|
|
||||||
//`http://${'transcendance'}:${'8080'}/api/v2/user?username=NomDuUserATrouve`
|
//`http://${'localhost'}:${'8080'}/api/v2/user?username=NomDuUserATrouve`
|
||||||
$$invalidate(1, user = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/user?username=${updateUser}`).then(x => x.json()));
|
$$invalidate(1, user = await fetch(`http://${'localhost'}:${'8080'}/api/v2/user?username=${updateUser}`).then(x => x.json()));
|
||||||
};
|
};
|
||||||
|
|
||||||
$$self.$$.on_mount.push(function () {
|
$$self.$$.on_mount.push(function () {
|
||||||
@@ -17349,37 +17349,37 @@ var app = (function () {
|
|||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
// yea no idea what
|
// yea no idea what
|
||||||
// i mean do i fetch user? i will for now
|
// i mean do i fetch user? i will for now
|
||||||
user = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/user`).then(x => x.json());
|
user = await fetch(`http://${'localhost'}:${'8080'}/api/v2/user`).then(x => x.json());
|
||||||
|
|
||||||
// userBeingViewed = user;
|
// userBeingViewed = user;
|
||||||
// console.log('user is ')
|
// console.log('user is ')
|
||||||
// console.log(user)
|
// console.log(user)
|
||||||
// console.log(user.username)
|
// console.log(user.username)
|
||||||
myFriends = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/network/myfriends`).then(x => x.json());
|
myFriends = await fetch(`http://${'localhost'}:${'8080'}/api/v2/network/myfriends`).then(x => x.json());
|
||||||
|
|
||||||
// console.log('my friends')
|
// console.log('my friends')
|
||||||
// console.log(myFriends)
|
// console.log(myFriends)
|
||||||
requestsMade = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/network/pending`).then(x => x.json());
|
requestsMade = await fetch(`http://${'localhost'}:${'8080'}/api/v2/network/pending`).then(x => x.json());
|
||||||
|
|
||||||
// console.log('Requests pending ');
|
// console.log('Requests pending ');
|
||||||
// console.log(requestsMade);
|
// console.log(requestsMade);
|
||||||
requestsRecieved = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/network/received`).then(x => x.json());
|
requestsRecieved = await fetch(`http://${'localhost'}:${'8080'}/api/v2/network/received`).then(x => x.json());
|
||||||
|
|
||||||
// console.log('Requests received ');
|
// console.log('Requests received ');
|
||||||
// console.log(requestsRecieved);
|
// console.log(requestsRecieved);
|
||||||
$$invalidate(0, allUsers = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/user/all`).then(x => x.json()));
|
$$invalidate(0, allUsers = await fetch(`http://${'localhost'}:${'8080'}/api/v2/user/all`).then(x => x.json()));
|
||||||
}); // console.log('got all users ' + allUsers)
|
}); // console.log('got all users ' + allUsers)
|
||||||
|
|
||||||
const displayAllUsers = async () => {
|
const displayAllUsers = async () => {
|
||||||
$$invalidate(0, allUsers = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/user/all`).then(x => x.json()));
|
$$invalidate(0, allUsers = await fetch(`http://${'localhost'}:${'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://${'transcendance'}:${'8080'}/api/v2/network/myfriends`).then(x => x.json());
|
myFriends = await fetch(`http://${'localhost'}:${'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://${'transcendance'}:${'8080'}/api/v2/network/pending`).then(x => x.json());
|
requestsMade = await fetch(`http://${'localhost'}:${'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;
|
||||||
@@ -17398,7 +17398,7 @@ var app = (function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (valid) {
|
if (valid) {
|
||||||
sentFriendRequest = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/network/myfriends`, {
|
sentFriendRequest = await fetch(`http://${'localhost'}:${'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({
|
||||||
@@ -17414,7 +17414,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://${'transcendance'}:${'8080'}/api/v2/networks/myfriends?username=aUser` but i need to make that as long as Cherif
|
// GET `http://${'localhost'}:${'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
|
||||||
@@ -18021,7 +18021,7 @@ var app = (function () {
|
|||||||
let user;
|
let user;
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
$$invalidate(0, user = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/user`).then(resp => resp.json()));
|
$$invalidate(0, user = await fetch(`http://${'localhost'}:${'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');
|
||||||
@@ -18042,14 +18042,14 @@ var app = (function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const login = async () => {
|
const login = async () => {
|
||||||
window.location.href = `http://${'transcendance'}:${'8080'}/api/v2/auth`;
|
window.location.href = `http://${'localhost'}:${'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://${'transcendance'}:${'8080'}/api/v2/auth/logout`, { method: 'POST' });
|
await fetch(`http://${'localhost'}:${'8080'}/api/v2/auth/logout`, { method: 'POST' });
|
||||||
$$invalidate(0, user = undefined);
|
$$invalidate(0, user = undefined);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -18383,7 +18383,7 @@ var app = (function () {
|
|||||||
let wrongCode = "";
|
let wrongCode = "";
|
||||||
|
|
||||||
const fetchQrCodeImg = (async () => {
|
const fetchQrCodeImg = (async () => {
|
||||||
await fetch(`http://${'transcendance'}:${'8080'}/api/v2/auth/2fa/generate`, { method: 'POST' }).then(response => {
|
await fetch(`http://${'localhost'}:${'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);
|
||||||
@@ -18392,7 +18392,7 @@ var app = (function () {
|
|||||||
})();
|
})();
|
||||||
|
|
||||||
const submitCode = async () => {
|
const submitCode = async () => {
|
||||||
const response = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/auth/2fa/check`, {
|
const response = await fetch(`http://${'localhost'}:${'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 })
|
||||||
@@ -18773,10 +18773,10 @@ var app = (function () {
|
|||||||
|
|
||||||
// export const soundPongArr: HTMLAudioElement[] = [];
|
// export const soundPongArr: HTMLAudioElement[] = [];
|
||||||
const soundPongArr = [
|
const soundPongArr = [
|
||||||
new Audio("http://" + 'transcendance' + ":" + '8080' + "/sound/pong/" + 1 + ".ogg"),
|
new Audio("http://" + 'localhost' + ":" + '8080' + "/sound/pong/" + 1 + ".ogg"),
|
||||||
new Audio("http://" + 'transcendance' + ":" + '8080' + "/sound/pong/" + 2 + ".ogg")
|
new Audio("http://" + 'localhost' + ":" + '8080' + "/sound/pong/" + 2 + ".ogg")
|
||||||
];
|
];
|
||||||
const soundRoblox = new Audio("http://" + 'transcendance' + ":" + '8080' + "/sound/roblox-oof.ogg");
|
const soundRoblox = new Audio("http://" + 'localhost' + ":" + '8080' + "/sound/roblox-oof.ogg");
|
||||||
function initAudio(sound) {
|
function initAudio(sound) {
|
||||||
let muteFlag;
|
let muteFlag;
|
||||||
if (sound === "on") {
|
if (sound === "on") {
|
||||||
@@ -18866,7 +18866,7 @@ var app = (function () {
|
|||||||
}
|
}
|
||||||
class ClientInfoSpectator {
|
class ClientInfoSpectator {
|
||||||
}
|
}
|
||||||
const wsUrl = "ws://" + 'transcendance' + ":" + '8080' + "/pong";
|
const wsUrl = "ws://" + 'localhost' + ":" + '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
|
||||||
@@ -21018,8 +21018,8 @@ var app = (function () {
|
|||||||
let idOfIntevalCheckTerminationOfTheMatch;
|
let idOfIntevalCheckTerminationOfTheMatch;
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
$$invalidate(12, user = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/user`).then(x => x.json()));
|
$$invalidate(12, user = await fetch(`http://${'localhost'}:${'8080'}/api/v2/user`).then(x => x.json()));
|
||||||
$$invalidate(0, allUsers = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/user/all`).then(x => x.json()));
|
$$invalidate(0, allUsers = await fetch(`http://${'localhost'}:${'8080'}/api/v2/user/all`).then(x => x.json()));
|
||||||
$$invalidate(2, options.playerOneUsername = user.username, options);
|
$$invalidate(2, options.playerOneUsername = user.username, options);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -21033,7 +21033,7 @@ var app = (function () {
|
|||||||
$$invalidate(3, showWaitPage = true);
|
$$invalidate(3, showWaitPage = true);
|
||||||
const matchOptions = computeMatchOptions(options);
|
const matchOptions = computeMatchOptions(options);
|
||||||
|
|
||||||
const responseWhenGrantToken = fetch(`http://${'transcendance'}:${'8080'}/api/v2/game/ticket`, {
|
const responseWhenGrantToken = fetch(`http://${'localhost'}:${'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({
|
||||||
@@ -21131,7 +21131,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://${'transcendance'}:${'8080'}/api/v2/game/invitations`).then(x => x.json()));
|
$$invalidate(10, invitations = await fetch(`http://${'localhost'}:${'8080'}/api/v2/game/invitations`).then(x => x.json()));
|
||||||
|
|
||||||
invitations.length !== 0
|
invitations.length !== 0
|
||||||
? $$invalidate(9, isThereAnyInvitation = true)
|
? $$invalidate(9, isThereAnyInvitation = true)
|
||||||
@@ -21139,7 +21139,7 @@ var app = (function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const rejectInvitation = async invitation => {
|
const rejectInvitation = async invitation => {
|
||||||
await fetch(`http://${'transcendance'}:${'8080'}/api/v2/game/decline`, {
|
await fetch(`http://${'localhost'}:${'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 })
|
||||||
@@ -21149,7 +21149,7 @@ var app = (function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const acceptInvitation = async invitation => {
|
const acceptInvitation = async invitation => {
|
||||||
const res = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/game/accept`, {
|
const res = await fetch(`http://${'localhost'}:${'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 })
|
||||||
@@ -21735,8 +21735,8 @@ var app = (function () {
|
|||||||
let idInterval;
|
let idInterval;
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
$$invalidate(0, currentUser = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/user`).then(x => x.json()));
|
$$invalidate(0, currentUser = await fetch(`http://${'localhost'}:${'8080'}/api/v2/user`).then(x => x.json()));
|
||||||
$$invalidate(1, allUsers = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/game/ranking`).then(x => x.json()));
|
$$invalidate(1, allUsers = await fetch(`http://${'localhost'}:${'8080'}/api/v2/game/ranking`).then(x => x.json()));
|
||||||
idInterval = setInterval(fetchScores, 10000);
|
idInterval = setInterval(fetchScores, 10000);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -21745,7 +21745,7 @@ var app = (function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function fetchScores() {
|
function fetchScores() {
|
||||||
fetch(`http://${'transcendance'}:${'8080'}/api/v2/game/ranking`).then(x => x.json()).then(x => $$invalidate(1, allUsers = x));
|
fetch(`http://${'localhost'}:${'8080'}/api/v2/game/ranking`).then(x => x.json()).then(x => $$invalidate(1, allUsers = x));
|
||||||
}
|
}
|
||||||
|
|
||||||
const writable_props = [];
|
const writable_props = [];
|
||||||
@@ -22578,11 +22578,11 @@ var app = (function () {
|
|||||||
let hiddenMatchList = false;
|
let hiddenMatchList = false;
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
user = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/user`).then(x => x.json());
|
user = await fetch(`http://${'localhost'}:${'8080'}/api/v2/user`).then(x => x.json());
|
||||||
allUsers = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/user/all`).then(x => x.json());
|
allUsers = await fetch(`http://${'localhost'}:${'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://${'transcendance'}:${'8080'}/api/v2/game/match/all`);
|
const responseForMatchList = await fetch(`http://${'localhost'}:${'8080'}/api/v2/game/match/all`);
|
||||||
|
|
||||||
const jsonForMatchList = await responseForMatchList.json();
|
const jsonForMatchList = await responseForMatchList.json();
|
||||||
$$invalidate(1, matchList = jsonForMatchList);
|
$$invalidate(1, matchList = jsonForMatchList);
|
||||||
@@ -22609,7 +22609,7 @@ var app = (function () {
|
|||||||
destroy();
|
destroy();
|
||||||
|
|
||||||
// WIP: fetch for match list here
|
// WIP: fetch for match list here
|
||||||
$$invalidate(1, matchList = await fetch(`http://${'transcendance'}:${'8080'}/api/v2/game/match/all`).then(x => x.json()));
|
$$invalidate(1, matchList = await fetch(`http://${'localhost'}:${'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);
|
||||||
@@ -22704,7 +22704,7 @@ var app = (function () {
|
|||||||
component: ProfilePage,
|
component: ProfilePage,
|
||||||
conditions: [
|
conditions: [
|
||||||
async(detail) => {
|
async(detail) => {
|
||||||
const user = await fetch('http://' + 'transcendance' + ":" + '8080' + '/api/v2/user')
|
const user = await fetch('http://' + 'localhost' + ":" + '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');
|
||||||
@@ -22721,7 +22721,7 @@ var app = (function () {
|
|||||||
component: ProfilePage,
|
component: ProfilePage,
|
||||||
conditions: [
|
conditions: [
|
||||||
async(detail) => {
|
async(detail) => {
|
||||||
const user = await fetch('http://' + 'transcendance' + ":" + '8080' + '/api/v2/user')
|
const user = await fetch('http://' + 'localhost' + ":" + '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
@@ -36,7 +36,8 @@
|
|||||||
item.name = "me";
|
item.name = "me";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
msgs.update(msgs => msgs.concat(data.messages));
|
//msgs.update(msgs => msgs.concat(data.messages));
|
||||||
|
msgs.update(msgs => msgs = data.messages);
|
||||||
});
|
});
|
||||||
layout = "room";
|
layout = "room";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
import Button from './Element_button.svelte';
|
import Button from './Element_button.svelte';
|
||||||
|
import { msgs, user } from './Store_chat';
|
||||||
export let layout = "";
|
export let layout = "";
|
||||||
export let back = "";
|
export let back = "";
|
||||||
|
|
||||||
@@ -24,7 +25,7 @@
|
|||||||
room_name: evt.target.innerText,
|
room_name: evt.target.innerText,
|
||||||
}
|
}
|
||||||
|
|
||||||
const messages = fetch('/api/v2/chat/join',
|
fetch('/api/v2/chat/join',
|
||||||
{
|
{
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
@@ -34,15 +35,8 @@
|
|||||||
.then(data =>
|
.then(data =>
|
||||||
{
|
{
|
||||||
console.log(data);
|
console.log(data);
|
||||||
// data.messages.forEach(function(item) {
|
|
||||||
// if (item.name === user.username) {
|
|
||||||
// item.name = "me";
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// msgs.update(msgs => msgs.concat(data.messages));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
|
||||||
const messages = fetch('/api/v2/chat/messages')
|
const messages = fetch('/api/v2/chat/messages')
|
||||||
.then(resp => resp.json())
|
.then(resp => resp.json())
|
||||||
.then(data =>
|
.then(data =>
|
||||||
@@ -53,9 +47,10 @@
|
|||||||
item.name = "me";
|
item.name = "me";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
msgs.update(msgs => msgs.concat(data.messages));
|
msgs.update(msgs => msgs = data.messages);
|
||||||
});
|
});
|
||||||
layout = "room";
|
layout = "room";
|
||||||
|
/*
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user