fix some errors in make_env, and in svelte replace instances of domain url by a variable
This commit is contained in:
36
make_env.sh
36
make_env.sh
@@ -9,7 +9,10 @@ ENV_FILE_NESTJS=./srcs/requirements/nestjs/api_back/.env
|
|||||||
# Create a new environment for docker
|
# Create a new environment for docker
|
||||||
if [ -f "$ENV_FILE_DOCKER" ] && [ -f "$ENV_FILE_NESTJS" ]; then
|
if [ -f "$ENV_FILE_DOCKER" ] && [ -f "$ENV_FILE_NESTJS" ]; then
|
||||||
echo "The file $ENV_FILE_DOCKER and $ENV_FILE_NESTJS already exists. Do you want to overwrite them ? (y/n)"
|
echo "The file $ENV_FILE_DOCKER and $ENV_FILE_NESTJS already exists. Do you want to overwrite them ? (y/n)"
|
||||||
read -p "Enter your choice : " OVERWRITE
|
OVERWRITE=""
|
||||||
|
while [ "$OVERWRITE" != "y" ] && [ "$OVERWRITE" != "n" ]; do
|
||||||
|
read -p "Enter your choice : " OVERWRITE
|
||||||
|
done
|
||||||
if [ "$OVERWRITE" = "y" ]; then
|
if [ "$OVERWRITE" = "y" ]; then
|
||||||
rm "$ENV_FILE_DOCKER" && rm "$ENV_FILE_NESTJS"
|
rm "$ENV_FILE_DOCKER" && rm "$ENV_FILE_NESTJS"
|
||||||
else
|
else
|
||||||
@@ -33,7 +36,8 @@ read -p "Enter the name of the host like \"localhost\" : " PROJECT_HOST
|
|||||||
echo "WEBSITE_HOST=$PROJECT_HOST" >> "$ENV_FILE_DOCKER"
|
echo "WEBSITE_HOST=$PROJECT_HOST" >> "$ENV_FILE_DOCKER"
|
||||||
echo "WEBSITE_PORT=8080" >> "$ENV_FILE_DOCKER"
|
echo "WEBSITE_PORT=8080" >> "$ENV_FILE_DOCKER"
|
||||||
echo "POSTGRES_USER=postgres" >> "$ENV_FILE_DOCKER"
|
echo "POSTGRES_USER=postgres" >> "$ENV_FILE_DOCKER"
|
||||||
echo "POSTGRES_PASSWORD=$(openssl rand -base64 32)" >> "$ENV_FILE_DOCKER"
|
POSTGRES_PASSWORD=$(openssl rand -base64 32)
|
||||||
|
echo "POSTGRES_PASSWORD=$POSTGRES_PASSWORD" >> "$ENV_FILE_DOCKER"
|
||||||
echo "POSTGRES_DB=transcendance_db" >> "$ENV_FILE_DOCKER"
|
echo "POSTGRES_DB=transcendance_db" >> "$ENV_FILE_DOCKER"
|
||||||
echo "POSTGRES_HOST=postgresql" >> "$ENV_FILE_DOCKER"
|
echo "POSTGRES_HOST=postgresql" >> "$ENV_FILE_DOCKER"
|
||||||
echo "POSTGRES_PORT=5432" >> "$ENV_FILE_DOCKER"
|
echo "POSTGRES_PORT=5432" >> "$ENV_FILE_DOCKER"
|
||||||
@@ -44,22 +48,14 @@ echo "REDIS_PASSWORD=$(openssl rand -base64 32)" >> "$ENV_FILE_DOCKER"
|
|||||||
# Create a new environment for nestjs
|
# Create a new environment for nestjs
|
||||||
echo "Creating a new environment for nestjs"
|
echo "Creating a new environment for nestjs"
|
||||||
|
|
||||||
if [ "$NODE_ENV" = "1" ]; then
|
echo "NODE_ENV=\$NODE_ENV" > "$ENV_FILE_NESTJS"
|
||||||
echo "NODE_ENV=development" > "$ENV_FILE_NESTJS"
|
echo "WEBSITE_HOST=\$WEBSITE_HOST" >> "$ENV_FILE_NESTJS"
|
||||||
elif [ "$NODE_ENV" = "2" ]; then
|
echo "WEBSITE_PORT=\$WEBSITE_PORT" >> "$ENV_FILE_NESTJS"
|
||||||
echo "NODE_ENV=production" > "$ENV_FILE_NESTJS"
|
echo "POSTGRES_USER=\$POSTGRES_USER" >> "$ENV_FILE_NESTJS"
|
||||||
else
|
echo "POSTGRES_PASSWORD=\$POSTGRES_PASSWORD" >> "$ENV_FILE_NESTJS"
|
||||||
echo "NODE_ENV=development" > "$ENV_FILE_NESTJS"
|
echo "POSTGRES_DB=\$POSTGRES_DB" >> "$ENV_FILE_NESTJS"
|
||||||
fi
|
echo "POSTGRES_HOST=\$POSTGRES_HOST" >> "$ENV_FILE_NESTJS"
|
||||||
|
echo "POSTGRES_PORT=\$POSTGRES_PORT" >> "$ENV_FILE_NESTJS"
|
||||||
|
|
||||||
echo "WEBSITE_HOST=$PROJECT_HOST" >> "$ENV_FILE_NESTJS"
|
|
||||||
echo "WEBSITE_PORT=8080" >> "$ENV_FILE_NESTJS"
|
|
||||||
echo "POSTGRES_USER=postgres" >> "$ENV_FILE_NESTJS"
|
|
||||||
echo "POSTGRES_PASSWORD=$POSTGRES_PASSSWORD" >> "$ENV_FILE_NESTJS"
|
|
||||||
echo "POSTGRES_DB=transcendance_db" >> "$ENV_FILE_NESTJS"
|
|
||||||
echo "POSTGRES_HOST=postgresql" >> "$ENV_FILE_NESTJS"
|
|
||||||
echo "POSTGRES_PORT=5432" >> "$ENV_FILE_NESTJS"
|
|
||||||
|
|
||||||
echo "In the next steps, we'll need to enter the client secret and client id of the 42 api"
|
echo "In the next steps, we'll need to enter the client secret and client id of the 42 api"
|
||||||
|
|
||||||
@@ -69,7 +65,7 @@ echo "FORTYTWO_CLIENT_ID=$CLIENT_ID" >> "$ENV_FILE_NESTJS"
|
|||||||
|
|
||||||
read -p "Enter the client secret of the 42 api : " CLIENT_SECRET
|
read -p "Enter the client secret of the 42 api : " CLIENT_SECRET
|
||||||
echo "FORTYTWO_CLIENT_SECRET=$CLIENT_SECRET" >> "$ENV_FILE_NESTJS"
|
echo "FORTYTWO_CLIENT_SECRET=$CLIENT_SECRET" >> "$ENV_FILE_NESTJS"
|
||||||
echo "FORTYTWO_CALLBACK_URL=http://$PROJECT_HOST:8080/api/v2/auth/redirect" >> "$ENV_FILE_NESTJS"
|
echo "FORTYTWO_CALLBACK_URL=http://\$WEBSITE_HOST:\$WEBSITE_PORT/api/v2/auth/redirect" >> "$ENV_FILE_NESTJS"
|
||||||
|
|
||||||
echo "COOKIE_SECRET=$(openssl rand -base64 32)" >> "$ENV_FILE_NESTJS"
|
echo "COOKIE_SECRET=$(openssl rand -base64 32)" >> "$ENV_FILE_NESTJS"
|
||||||
|
|
||||||
@@ -84,3 +80,5 @@ echo "TWO_FACTOR_AUTHENTICATION_APP_NAME=Transcendance" >> "$ENV_FILE_NESTJS"
|
|||||||
echo "TICKET_FOR_PLAYING_GAME_SECRET=$(openssl rand -base64 32)" >> "$ENV_FILE_NESTJS"
|
echo "TICKET_FOR_PLAYING_GAME_SECRET=$(openssl rand -base64 32)" >> "$ENV_FILE_NESTJS"
|
||||||
|
|
||||||
echo "The environment has been created successfully. You can now wait for the docker to build the project."
|
echo "The environment has been created successfully. You can now wait for the docker to build the project."
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,13 +2,13 @@ NODE_ENV=development
|
|||||||
WEBSITE_HOST=transcendance
|
WEBSITE_HOST=transcendance
|
||||||
WEBSITE_PORT=8080
|
WEBSITE_PORT=8080
|
||||||
POSTGRES_USER=postgres
|
POSTGRES_USER=postgres
|
||||||
POSTGRES_PASSWORD=VgtUH4IqVd1OE0SPD6qEMO83yVbTVhD8iluWpgkH+ww=
|
POSTGRES_PASSWORD=9eEaqeSmDcCIOzartYU3RsZKuH6jqu5F3CTAOViMeFc=
|
||||||
POSTGRES_DB=transcendance_db
|
POSTGRES_DB=transcendance_db
|
||||||
POSTGRES_HOST=postgresql
|
POSTGRES_HOST=postgresql
|
||||||
POSTGRES_PORT=5432
|
POSTGRES_PORT=5432
|
||||||
REDIS_HOST=redis
|
REDIS_HOST=redis
|
||||||
REDIS_PORT=6379
|
REDIS_PORT=6379
|
||||||
REDIS_PASSWORD=ajnlLyMcXVAT0wK5Of91WBoY7U5Z+Pl81kRK7LFf/U4=
|
REDIS_PASSWORD=UsEgAyQdMYFwf1m2n8zyQNBcD7osoVahq1YHlkq6HUY=
|
||||||
REDIS_HOST=redis
|
REDIS_HOST=redis
|
||||||
REDIS_PORT=6379
|
REDIS_PORT=6379
|
||||||
REDIS_PASSWORD=
|
REDIS_PASSWORD=
|
||||||
|
|||||||
@@ -13,6 +13,13 @@ services:
|
|||||||
- .env
|
- .env
|
||||||
environment:
|
environment:
|
||||||
NODE_ENV: "${NODE_ENV}"
|
NODE_ENV: "${NODE_ENV}"
|
||||||
|
WEBSITE_HOST: "${WEBSITE_HOST}"
|
||||||
|
WEBSITE_PORT: "${WEBSITE_PORT}"
|
||||||
|
POSTGRES_USER: "${POSTGRES_USER}"
|
||||||
|
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}"
|
||||||
|
POSTGRES_DB: "${POSTGRES_DB}"
|
||||||
|
POSTGRES_HOST: "${POSTGRES_HOST}"
|
||||||
|
POSTGRES_PORT: "${POSTGRES_PORT}"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgresql
|
- postgresql
|
||||||
|
|||||||
@@ -2,9 +2,27 @@ FROM node:alpine AS development
|
|||||||
|
|
||||||
WORKDIR /usr/app
|
WORKDIR /usr/app
|
||||||
|
|
||||||
|
ARG NODE_ENV
|
||||||
|
ARG WEBSITE_HOST
|
||||||
|
ARG WEBSITE_PORT
|
||||||
|
ARG POSTGRES_USER
|
||||||
|
ARG POSTGRES_PASSWORD
|
||||||
|
ARG POSTGRES_DB
|
||||||
|
ARG POSTGRES_HOST
|
||||||
|
ARG POSTGRES_PORT
|
||||||
|
|
||||||
COPY ./api_back ./
|
COPY ./api_back ./
|
||||||
COPY ./api_back/.env ./.env
|
|
||||||
COPY ./api_back/src/uploads/avatars/default.png ./uploads/avatars/default.png
|
COPY ./api_back/src/uploads/avatars/default.png ./uploads/avatars/default.png
|
||||||
|
COPY ./api_back/.env ./.env
|
||||||
|
RUN sed -i "s/\$NODE_ENV/${NODE_ENV}/g" ./.env && \
|
||||||
|
sed -i "s/\$WEBSITE_HOST/${WEBSITE_HOST}/g" ./.env && \
|
||||||
|
sed -i "s/\$WEBSITE_PORT/${WEBSITE_PORT}/g" ./.env && \
|
||||||
|
sed -i "s/\$POSTGRES_USER/${POSTGRES_USER}/g" ./.env && \
|
||||||
|
sed -i "s/\$POSTGRES_PASSWORD/${POSTGRES_PASSWORD}/g" ./.env && \
|
||||||
|
sed -i "s/\$POSTGRES_DB/${POSTGRES_DB}/g" ./.env && \
|
||||||
|
sed -i "s/\$POSTGRES_HOST/${POSTGRES_HOST}/g" ./.env && \
|
||||||
|
sed -i "s/\$POSTGRES_PORT/${POSTGRES_PORT}/g" ./.env
|
||||||
|
|
||||||
RUN npm install
|
RUN npm install
|
||||||
RUN npm ci
|
RUN npm ci
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
NODE_ENV=development
|
NODE_ENV=$NODE_ENV
|
||||||
WEBSITE_HOST=transcendance
|
WEBSITE_HOST=$WEBSITE_HOST
|
||||||
WEBSITE_PORT=8080
|
WEBSITE_PORT=$WEBSITE_PORT
|
||||||
POSTGRES_USER=postgres
|
POSTGRES_USER=$POSTGRES_USER
|
||||||
POSTGRES_PASSWORD=
|
POSTGRES_PASSWORD=
|
||||||
POSTGRES_DB=transcendance_db
|
POSTGRES_DB=$POSTGRES_DB
|
||||||
POSTGRES_HOST=postgresql
|
POSTGRES_HOST=$POSTGRES_HOST
|
||||||
POSTGRES_PORT=5432
|
POSTGRES_PORT=$POSTGRES_PORT
|
||||||
FORTYTWO_CLIENT_ID=u-s4t2ud-49dc7b539bcfe1acb48b928b2b281671c99fc5bfab1faca57a536ab7e0075500
|
FORTYTWO_CLIENT_ID=u-s4t2ud-49dc7b539bcfe1acb48b928b2b281671c99fc5bfab1faca57a536ab7e0075500
|
||||||
FORTYTWO_CLIENT_SECRET=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
|
FORTYTWO_CLIENT_SECRET=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
|
||||||
FORTYTWO_CALLBACK_URL=http://transcendance:8080/api/v2/auth/redirect
|
FORTYTWO_CALLBACK_URL=http://$WEBSITE_HOST:$WEBSITE_PORT/api/v2/auth/redirect
|
||||||
COOKIE_SECRET=6fhCMqk34E+vzal8EtRHX0HnFkBOjjTCQiT/ARGlv54=
|
COOKIE_SECRET=612IIHKJW6uUFSXTJZWh7UpnhykPlsAi1Adm6hOSVmc=
|
||||||
PORT=3000
|
PORT=3000
|
||||||
TWO_FACTOR_AUTHENTICATION_APP_NAME=Transcendance
|
TWO_FACTOR_AUTHENTICATION_APP_NAME=Transcendance
|
||||||
TICKET_FOR_PLAYING_GAME_SECRET=B5CE5nAuhBqcJzHF+3aTCgK7Y25vh/AEeTPwEOHq1FM=
|
TICKET_FOR_PLAYING_GAME_SECRET=0Z8t/fr9WN0rVMeeieO2DoubHFE+Zw0/9q8Af4s9KBg=
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ header.svelte-7t4byu.svelte-7t4byu{overflow-y:hidden}.grid-container.svelte-7t4b
|
|||||||
' panel_new panel_new panel_new ' 1fr
|
' panel_new panel_new panel_new ' 1fr
|
||||||
/ auto 1fr auto }.grid_box.svelte-1lfmc2m .back {grid-area:back}.grid_box.svelte-1lfmc2m .settings {grid-area:settings}.grid_box.svelte-1lfmc2m .close {grid-area:close}.grid_box.svelte-1lfmc2m .panel_settings{grid-area:panel_settings}.grid_box.svelte-1lfmc2m{grid:' back settings close ' auto
|
/ auto 1fr auto }.grid_box.svelte-1lfmc2m .back {grid-area:back}.grid_box.svelte-1lfmc2m .settings {grid-area:settings}.grid_box.svelte-1lfmc2m .close {grid-area:close}.grid_box.svelte-1lfmc2m .panel_settings{grid-area:panel_settings}.grid_box.svelte-1lfmc2m{grid:' back settings close ' auto
|
||||||
' panel_settings panel_settings panel_settings ' 1fr
|
' panel_settings panel_settings panel_settings ' 1fr
|
||||||
/ auto 1fr auto }.grid_box.svelte-1sv7l8q .back {grid-area:back}.grid_box.svelte-1sv7l8q .room_name {grid-area:room_name}.grid_box.svelte-1sv7l8q .close {grid-area:close}.grid_box.svelte-1sv7l8q .panel_room_set{grid-area:panel_room_set}.grid_box.svelte-1sv7l8q{grid:' back room_name close ' auto
|
/ auto 1fr auto }.grid_box.svelte-2tekts .back {grid-area:back}.grid_box.svelte-2tekts .room_name {grid-area:room_name}.grid_box.svelte-2tekts .close {grid-area:close}.grid_box.svelte-2tekts .panel_protected{grid-area:panel_protected}.grid_box.svelte-2tekts.svelte-2tekts{grid:' back room_name close ' auto
|
||||||
' panel_room_set panel_room_set panel_room_set ' 1fr
|
|
||||||
/ auto 1fr auto }.grid_box.svelte-2tekts .back {grid-area:back}.grid_box.svelte-2tekts .room_name {grid-area:room_name}.grid_box.svelte-2tekts .close {grid-area:close}.grid_box.svelte-2tekts .panel_protected{grid-area:panel_protected}.grid_box.svelte-2tekts.svelte-2tekts{grid:' back room_name close ' auto
|
|
||||||
' panel_protected panel_protected panel_protected ' 1fr
|
' panel_protected panel_protected panel_protected ' 1fr
|
||||||
/ auto 1fr auto }form.svelte-2tekts input[type=submit].svelte-2tekts{margin-top:20px}.grid_box.svelte-1cmnkcw .back {grid-area:back}.grid_box.svelte-1cmnkcw .create {grid-area:create}.grid_box.svelte-1cmnkcw .close {grid-area:close}.grid_box.svelte-1cmnkcw .panel_create{grid-area:panel_create}.grid_box.svelte-1cmnkcw.svelte-1cmnkcw.svelte-1cmnkcw{grid:' back create close ' auto
|
/ auto 1fr auto }form.svelte-2tekts input[type=submit].svelte-2tekts{margin-top:20px}.grid_box.svelte-1sv7l8q .back {grid-area:back}.grid_box.svelte-1sv7l8q .room_name {grid-area:room_name}.grid_box.svelte-1sv7l8q .close {grid-area:close}.grid_box.svelte-1sv7l8q .panel_room_set{grid-area:panel_room_set}.grid_box.svelte-1sv7l8q{grid:' back room_name close ' auto
|
||||||
|
' panel_room_set panel_room_set panel_room_set ' 1fr
|
||||||
|
/ auto 1fr auto }.grid_box.svelte-1cmnkcw .back {grid-area:back}.grid_box.svelte-1cmnkcw .create {grid-area:create}.grid_box.svelte-1cmnkcw .close {grid-area:close}.grid_box.svelte-1cmnkcw .panel_create{grid-area:panel_create}.grid_box.svelte-1cmnkcw.svelte-1cmnkcw.svelte-1cmnkcw{grid:' back create close ' auto
|
||||||
' panel_create panel_create panel_create ' 1fr
|
' panel_create panel_create panel_create ' 1fr
|
||||||
/ auto 1fr auto }form.svelte-1cmnkcw input[type=radio].svelte-1cmnkcw.svelte-1cmnkcw{display:none}form.svelte-1cmnkcw label._radio.svelte-1cmnkcw.svelte-1cmnkcw{margin:0px 20px 0px auto;padding-right:10px;cursor:pointer}form.svelte-1cmnkcw label._radio p.svelte-1cmnkcw.svelte-1cmnkcw{margin-top:0px;margin-bottom:0px}form.svelte-1cmnkcw label._radio.svelte-1cmnkcw.svelte-1cmnkcw::after{content:"";position:absolute;top:calc(50% - 6px);right:0px;width:12px;height:12px;border-radius:6px;border:2px solid rgb(150, 150, 150);box-sizing:border-box;cursor:pointer}form.svelte-1cmnkcw input[type=radio].svelte-1cmnkcw:checked+label._radio.svelte-1cmnkcw::after{background-color:rgb(200, 200, 200)}form.svelte-1cmnkcw input[type=submit].svelte-1cmnkcw.svelte-1cmnkcw{margin-top:20px}.grid_box.svelte-yo0any .back {grid-area:back}.grid_box.svelte-yo0any .back {grid-area:back}.grid_box.svelte-yo0any .user {grid-area:user}.grid_box.svelte-yo0any .close {grid-area:close}.grid_box.svelte-yo0any .panel_mute{grid-area:panel_mute}.grid_box.svelte-yo0any.svelte-yo0any.svelte-yo0any{grid:' back user close ' auto
|
/ auto 1fr auto }form.svelte-1cmnkcw input[type=radio].svelte-1cmnkcw.svelte-1cmnkcw{display:none}form.svelte-1cmnkcw label._radio.svelte-1cmnkcw.svelte-1cmnkcw{margin:0px 20px 0px auto;padding-right:10px;cursor:pointer}form.svelte-1cmnkcw label._radio p.svelte-1cmnkcw.svelte-1cmnkcw{margin-top:0px;margin-bottom:0px}form.svelte-1cmnkcw label._radio.svelte-1cmnkcw.svelte-1cmnkcw::after{content:"";position:absolute;top:calc(50% - 6px);right:0px;width:12px;height:12px;border-radius:6px;border:2px solid rgb(150, 150, 150);box-sizing:border-box;cursor:pointer}form.svelte-1cmnkcw input[type=radio].svelte-1cmnkcw:checked+label._radio.svelte-1cmnkcw::after{background-color:rgb(200, 200, 200)}form.svelte-1cmnkcw input[type=submit].svelte-1cmnkcw.svelte-1cmnkcw{margin-top:20px}.grid_box.svelte-yo0any .back {grid-area:back}.grid_box.svelte-yo0any .back {grid-area:back}.grid_box.svelte-yo0any .user {grid-area:user}.grid_box.svelte-yo0any .close {grid-area:close}.grid_box.svelte-yo0any .panel_mute{grid-area:panel_mute}.grid_box.svelte-yo0any.svelte-yo0any.svelte-yo0any{grid:' back user close ' auto
|
||||||
' panel_mute panel_mute panel_mute ' 1fr
|
' panel_mute panel_mute panel_mute ' 1fr
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
4
srcs/requirements/svelte/api_front/src/Constantes.svelte
Normal file
4
srcs/requirements/svelte/api_front/src/Constantes.svelte
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<script context="module">
|
||||||
|
export const Domain = "transcendance";
|
||||||
|
export const Port = 8080;
|
||||||
|
</script>
|
||||||
@@ -3,12 +3,13 @@
|
|||||||
import { push } from "svelte-spa-router";
|
import { push } from "svelte-spa-router";
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { get } from "svelte/store";
|
import { get } from "svelte/store";
|
||||||
|
import { Domain } from "../Constantes.svelte";
|
||||||
|
|
||||||
|
|
||||||
let user;
|
let user;
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
user = await fetch('http://transcendance:8080/api/v2/user')
|
user = await fetch('http://{Domain}:8080/api/v2/user')
|
||||||
.then((resp) => resp.json())
|
.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
|
||||||
@@ -32,14 +33,14 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
const login = async() => {
|
const login = async() => {
|
||||||
window.location.href = 'http://transcendance:8080/api/v2/auth';
|
window.location.href = 'http://{Domain}: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', {
|
await fetch('http://{Domain}:8080/api/v2/auth/logout', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
});
|
});
|
||||||
user = undefined;
|
user = undefined;
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount } from "svelte";
|
import { onMount } from "svelte";
|
||||||
import { push } from "svelte-spa-router";
|
import { push } from "svelte-spa-router";
|
||||||
|
import { Domain, Port } from "../Constantes.svelte";
|
||||||
|
|
||||||
// onMount( async() => {
|
// onMount( async() => {
|
||||||
// await fetch("http://transcendance:8080/api/v2/auth/2fa/generate",
|
// await fetch("http://{Domain}:{Port}/api/v2/auth/2fa/generate",
|
||||||
// {
|
// {
|
||||||
// method: 'POST',
|
// method: 'POST',
|
||||||
// })
|
// })
|
||||||
@@ -19,7 +20,7 @@
|
|||||||
let qrCode = "";
|
let qrCode = "";
|
||||||
let wrongCode = "";
|
let wrongCode = "";
|
||||||
const fetchQrCodeImg = (async() => {
|
const fetchQrCodeImg = (async() => {
|
||||||
await fetch("http://transcendance:8080/api/v2/auth/2fa/generate",
|
await fetch("http://{Domain}:{Port}/api/v2/auth/2fa/generate",
|
||||||
{
|
{
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
})
|
})
|
||||||
@@ -31,7 +32,7 @@
|
|||||||
})()
|
})()
|
||||||
|
|
||||||
const submitCode = async() => {
|
const submitCode = async() => {
|
||||||
const response = await fetch("http://transcendance:8080/api/v2/auth/2fa/check",
|
const response = await fetch("http://{Domain}:{Port}/api/v2/auth/2fa/check",
|
||||||
{
|
{
|
||||||
method : 'POST',
|
method : 'POST',
|
||||||
headers : {
|
headers : {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import { onMount, onDestroy } from "svelte";
|
import { onMount, onDestroy } from "svelte";
|
||||||
import Header from '../../pieces/Header.svelte';
|
import Header from '../../pieces/Header.svelte';
|
||||||
import { fade, fly } from 'svelte/transition';
|
import { fade, fly } from 'svelte/transition';
|
||||||
|
import { Domain, Port } from "../../Constantes.svelte";
|
||||||
|
|
||||||
import * as pong from "./client/pong";
|
import * as pong from "./client/pong";
|
||||||
|
|
||||||
@@ -36,9 +37,9 @@
|
|||||||
let idOfIntevalCheckTerminationOfTheMatch;
|
let idOfIntevalCheckTerminationOfTheMatch;
|
||||||
|
|
||||||
onMount( async() => {
|
onMount( async() => {
|
||||||
user = await fetch('http://transcendance:8080/api/v2/user')
|
user = await fetch('http://{Domain}:{Port}/api/v2/user')
|
||||||
.then( x => x.json() );
|
.then( x => x.json() );
|
||||||
allUsers = await fetch('http://transcendance:8080/api/v2/user/all')
|
allUsers = await fetch('http://{Domain}:{Port}/api/v2/user/all')
|
||||||
.then( x => x.json() );
|
.then( x => x.json() );
|
||||||
options.playerOneUsername = user.username;
|
options.playerOneUsername = user.username;
|
||||||
})
|
})
|
||||||
@@ -68,7 +69,7 @@
|
|||||||
idOfIntevalCheckTerminationOfTheMatch = setInterval(matchTermitation, 1000);
|
idOfIntevalCheckTerminationOfTheMatch = setInterval(matchTermitation, 1000);
|
||||||
const matchOptions = pong.computeMatchOptions(options);
|
const matchOptions = pong.computeMatchOptions(options);
|
||||||
|
|
||||||
const responseWhenGrantToken = fetch("http://transcendance:8080/api/v2/game/ticket", {
|
const responseWhenGrantToken = fetch("http://{Domain}:{Port}/api/v2/game/ticket", {
|
||||||
method : "POST",
|
method : "POST",
|
||||||
headers : {'Content-Type': 'application/json'},
|
headers : {'Content-Type': 'application/json'},
|
||||||
body : JSON.stringify({
|
body : JSON.stringify({
|
||||||
@@ -173,13 +174,13 @@
|
|||||||
const showInvitation = async() => {
|
const showInvitation = async() => {
|
||||||
showGameOption = false;
|
showGameOption = false;
|
||||||
showInvitations = true;
|
showInvitations = true;
|
||||||
invitations = await fetch("http://transcendance:8080/api/v2/game/invitations")
|
invitations = await fetch("http://{Domain}:{Port}/api/v2/game/invitations")
|
||||||
.then(x => x.json())
|
.then(x => x.json())
|
||||||
invitations.length !== 0 ? isThereAnyInvitation = true : isThereAnyInvitation = false
|
invitations.length !== 0 ? isThereAnyInvitation = true : isThereAnyInvitation = false
|
||||||
}
|
}
|
||||||
|
|
||||||
const rejectInvitation = async(invitation) => {
|
const rejectInvitation = async(invitation) => {
|
||||||
await fetch("http://transcendance:8080/api/v2/game/decline",{
|
await fetch("http://{Domain}:{Port}/api/v2/game/decline",{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { 'Content-Type': 'application/json'},
|
headers: { 'Content-Type': 'application/json'},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
@@ -192,7 +193,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const acceptInvitation = async(invitation : any) => {
|
const acceptInvitation = async(invitation : any) => {
|
||||||
const res = await fetch("http://transcendance:8080/api/v2/game/accept",{
|
const res = await fetch("http://{Domain}:{Port}/api/v2/game/accept",{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { 'Content-Type': 'application/json'},
|
headers: { 'Content-Type': 'application/json'},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import { onMount, onDestroy } from "svelte";
|
import { onMount, onDestroy } from "svelte";
|
||||||
import Header from '../../pieces/Header.svelte';
|
import Header from '../../pieces/Header.svelte';
|
||||||
import { fade, fly } from 'svelte/transition';
|
import { fade, fly } from 'svelte/transition';
|
||||||
|
import { Domain, Port } from "../../Constantes.svelte";
|
||||||
|
|
||||||
import * as pongSpectator from "./client/pongSpectator";
|
import * as pongSpectator from "./client/pongSpectator";
|
||||||
|
|
||||||
@@ -20,9 +21,9 @@
|
|||||||
let hiddenGame = true;
|
let hiddenGame = true;
|
||||||
|
|
||||||
onMount( async() => {
|
onMount( async() => {
|
||||||
user = await fetch('http://transcendance:8080/api/v2/user')
|
user = await fetch('http://{Domain}:{Port}/api/v2/user')
|
||||||
.then( x => x.json() );
|
.then( x => x.json() );
|
||||||
allUsers = await fetch('http://transcendance:8080/api/v2/user/all')
|
allUsers = await fetch('http://{Domain}:{Port}/api/v2/user/all')
|
||||||
.then( x => x.json() );
|
.then( x => x.json() );
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,17 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount, onDestroy } from "svelte";
|
import { onMount, onDestroy } from "svelte";
|
||||||
import Header from "../../pieces/Header.svelte";
|
import Header from "../../pieces/Header.svelte";
|
||||||
|
import { Domain, Port } from "../../Constantes.svelte";
|
||||||
|
|
||||||
//user's stuff
|
//user's stuff
|
||||||
let currentUser;
|
let currentUser;
|
||||||
let allUsers = [];
|
let allUsers = [];
|
||||||
let idInterval;
|
let idInterval;
|
||||||
onMount( async() => {
|
onMount( async() => {
|
||||||
currentUser = await fetch('http://transcendance:8080/api/v2/user')
|
currentUser = await fetch('http://{Domain}:{Port}/api/v2/user')
|
||||||
.then( x => x.json() );
|
.then( x => x.json() );
|
||||||
allUsers = await fetch('http://transcendance:8080/api/v2/game/ranking')
|
allUsers = await fetch('http://{Domain}:{Port}/api/v2/game/ranking')
|
||||||
.then( x => x.json() );
|
.then( x => x.json() );
|
||||||
idInterval = setInterval(fetchScores, 10000);
|
idInterval = setInterval(fetchScores, 10000);
|
||||||
})
|
})
|
||||||
@@ -20,7 +21,7 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
function fetchScores() {
|
function fetchScores() {
|
||||||
fetch('http://transcendance:8080/api/v2/game/ranking')
|
fetch('http://{Domain}:{Port}/api/v2/game/ranking')
|
||||||
.then( x => x.json() )
|
.then( x => x.json() )
|
||||||
.then( x => allUsers = x );
|
.then( x => allUsers = x );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import GenerateUserDisplay from '../../pieces/GenerateUserDisplay.svelte';
|
import GenerateUserDisplay from '../../pieces/GenerateUserDisplay.svelte';
|
||||||
|
import { Domain, Port } from "../../Constantes.svelte";
|
||||||
|
|
||||||
import Chat from '../../pieces/chat/Chat.svelte';
|
import Chat from '../../pieces/chat/Chat.svelte';
|
||||||
|
|
||||||
@@ -9,7 +10,7 @@
|
|||||||
|
|
||||||
onMount( async() => {
|
onMount( async() => {
|
||||||
// console.log('mounting profile display')
|
// console.log('mounting profile display')
|
||||||
user = await fetch('http://transcendance:8080/api/v2/user')
|
user = await fetch('http://{Domain}:{Port}/api/v2/user')
|
||||||
.then( (x) => x.json() );
|
.then( (x) => x.json() );
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
|
||||||
import { onMount } from "svelte";
|
import { onMount } from "svelte";
|
||||||
import { binding_callbacks } from "svelte/internal";
|
import { binding_callbacks } from "svelte/internal";
|
||||||
|
import { Domain, Port } from "../../Constantes.svelte";
|
||||||
import Button from "../../pieces/Button.svelte";
|
import Button from "../../pieces/Button.svelte";
|
||||||
import DisplayAUser from "../../pieces/DisplayAUser.svelte";
|
import DisplayAUser from "../../pieces/DisplayAUser.svelte";
|
||||||
|
|
||||||
@@ -38,7 +39,7 @@ could be a list of friends and if they're active but i can't see that yet
|
|||||||
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')
|
user = await fetch('http://{Domain}:{Port}/api/v2/user')
|
||||||
.then( (x) => x.json() );
|
.then( (x) => x.json() );
|
||||||
|
|
||||||
// userBeingViewed = user;
|
// userBeingViewed = user;
|
||||||
@@ -46,26 +47,26 @@ could be a list of friends and if they're active but i can't see that yet
|
|||||||
// console.log(user)
|
// console.log(user)
|
||||||
// console.log(user.username)
|
// console.log(user.username)
|
||||||
|
|
||||||
myFriends = await fetch("http://transcendance:8080/api/v2/network/myfriends")
|
myFriends = await fetch("http://{Domain}:{Port}/api/v2/network/myfriends")
|
||||||
.then( (x) => x.json() );
|
.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')
|
requestsMade = await fetch('http://{Domain}:{Port}/api/v2/network/pending')
|
||||||
.then( x => x.json() );
|
.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')
|
requestsRecieved = await fetch('http://{Domain}:{Port}/api/v2/network/received')
|
||||||
.then( x => x.json() );
|
.then( x => x.json() );
|
||||||
|
|
||||||
// console.log('Requests received ');
|
// console.log('Requests received ');
|
||||||
// console.log(requestsRecieved);
|
// console.log(requestsRecieved);
|
||||||
|
|
||||||
allUsers = await fetch('http://transcendance:8080/api/v2/user/all')
|
allUsers = await fetch('http://{Domain}:{Port}/api/v2/user/all')
|
||||||
.then( x => x.json() );
|
.then( x => x.json() );
|
||||||
// console.log('got all users ' + allUsers)
|
// console.log('got all users ' + allUsers)
|
||||||
|
|
||||||
@@ -74,20 +75,20 @@ could be a list of friends and if they're active but i can't see that yet
|
|||||||
|
|
||||||
|
|
||||||
const displayAllUsers = async() => {
|
const displayAllUsers = async() => {
|
||||||
allUsers = await fetch('http://transcendance:8080/api/v2/user/all')
|
allUsers = await fetch('http://{Domain}:{Port}/api/v2/user/all')
|
||||||
.then( x => x.json() );
|
.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')
|
myFriends = await fetch('http://{Domain}:{Port}/api/v2/network/myfriends')
|
||||||
.then( x => x.json() );
|
.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')
|
requestsMade = await fetch('http://{Domain}:{Port}/api/v2/network/pending')
|
||||||
.then( x => x.json() );
|
.then( x => x.json() );
|
||||||
// console.log('got requests made ' + requestsMade)
|
// console.log('got requests made ' + requestsMade)
|
||||||
};
|
};
|
||||||
@@ -106,7 +107,7 @@ could be a list of friends and if they're active but i can't see that yet
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (valid) {
|
if (valid) {
|
||||||
sentFriendRequest = await fetch("http://transcendance:8080/api/v2/network/myfriends", {
|
sentFriendRequest = await fetch("http://{Domain}:{Port}/api/v2/network/myfriends", {
|
||||||
method : "POST",
|
method : "POST",
|
||||||
headers: { 'Content-Type': 'application/json'},
|
headers: { 'Content-Type': 'application/json'},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
@@ -124,7 +125,7 @@ could be a list of friends and if they're active but i can't see that yet
|
|||||||
// 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://{Domain}:{Port}/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
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import Card from '../../pieces/Card.svelte';
|
import Card from '../../pieces/Card.svelte';
|
||||||
import {onMount} from 'svelte';
|
import {onMount} from 'svelte';
|
||||||
import { push } from 'svelte-spa-router';
|
import { push } from 'svelte-spa-router';
|
||||||
|
import { Domain, Port } from "../../Constantes.svelte";
|
||||||
import Button from '../../pieces/Button.svelte';
|
import Button from '../../pieces/Button.svelte';
|
||||||
|
|
||||||
let user;
|
let user;
|
||||||
@@ -16,7 +17,7 @@
|
|||||||
let success = {username: '', avatar: '' };
|
let success = {username: '', avatar: '' };
|
||||||
|
|
||||||
onMount( async() => {
|
onMount( async() => {
|
||||||
user = await fetch('http://transcendance:8080/api/v2/user')
|
user = await fetch('http://{Domain}:{Port}/api/v2/user')
|
||||||
.then( (x) => x.json() );
|
.then( (x) => x.json() );
|
||||||
// do a .catch?
|
// do a .catch?
|
||||||
|
|
||||||
@@ -33,7 +34,7 @@
|
|||||||
// 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"})
|
await fetch("http://{Domain}:{Port}/api/v2/user/avatar", {method: "GET"})
|
||||||
.then(response => {return response.blob()})
|
.then(response => {return response.blob()})
|
||||||
.then(data => {
|
.then(data => {
|
||||||
const url = URL.createObjectURL(data);
|
const url = URL.createObjectURL(data);
|
||||||
@@ -63,7 +64,7 @@
|
|||||||
else {
|
else {
|
||||||
errors.username = '';
|
errors.username = '';
|
||||||
}
|
}
|
||||||
await fetch('http://transcendance:8080/api/v2/user',{
|
await fetch('http://{Domain}:{Port}/api/v2/user',{
|
||||||
method: 'PATCH',
|
method: 'PATCH',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
@@ -100,7 +101,7 @@
|
|||||||
// tmp
|
// tmp
|
||||||
console.log(data);
|
console.log(data);
|
||||||
|
|
||||||
await fetch("http://transcendance:8080/api/v2/user/avatar",
|
await fetch("http://{Domain}:{Port}/api/v2/user/avatar",
|
||||||
{
|
{
|
||||||
method : 'POST',
|
method : 'POST',
|
||||||
body : data,
|
body : data,
|
||||||
@@ -108,7 +109,7 @@
|
|||||||
.then(() => uploadAvatarSuccess = true ) // for some reason it needs to be a function, i think a TS thing, not a promis otherwise
|
.then(() => uploadAvatarSuccess = true ) // for some reason it needs to be a function, i think a TS thing, not a promis otherwise
|
||||||
.then(() => success.avatar = 'Your changes have been saved')
|
.then(() => success.avatar = 'Your changes have been saved')
|
||||||
.catch(() => errors.avatar = 'Sorry failed to upload your new Avatar' );
|
.catch(() => errors.avatar = 'Sorry failed to upload your new Avatar' );
|
||||||
await fetch("http://transcendance:8080/api/v2/user/avatar", {method: "GET"})
|
await fetch("http://{Domain}:{Port}/api/v2/user/avatar", {method: "GET"})
|
||||||
.then(response => {return response.blob()})
|
.then(response => {return response.blob()})
|
||||||
.then(data => {
|
.then(data => {
|
||||||
const url = URL.createObjectURL(data);
|
const url = URL.createObjectURL(data);
|
||||||
|
|||||||
@@ -45,4 +45,4 @@
|
|||||||
background: white;
|
background: white;
|
||||||
border: 2px solid #45c496;
|
border: 2px solid #45c496;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import GenerateUserDisplay from './GenerateUserDisplay.svelte';
|
import GenerateUserDisplay from './GenerateUserDisplay.svelte';
|
||||||
|
import { Domain, Port } from "../Constantes.svelte";
|
||||||
// import {updateGeneratedUser} from './GenerateUserDisplay.svelte';
|
// import {updateGeneratedUser} from './GenerateUserDisplay.svelte';
|
||||||
|
|
||||||
export let aUsername;
|
export let aUsername;
|
||||||
@@ -9,8 +10,8 @@
|
|||||||
|
|
||||||
onMount( async() => {
|
onMount( async() => {
|
||||||
console.log('Display aUser username: '+ aUsername)
|
console.log('Display aUser username: '+ aUsername)
|
||||||
// http://transcendance:8080/api/v2/user?username=NomDuUserATrouver
|
// http://{Domain}:{Port}/api/v2/user?username=NomDuUserATrouver
|
||||||
user = await fetch(`http://transcendance:8080/api/v2/user?username=${aUsername}`)
|
user = await fetch(`http://{Domain}:{Port}/api/v2/user?username=${aUsername}`)
|
||||||
.then( (x) => x.json() );
|
.then( (x) => x.json() );
|
||||||
|
|
||||||
// console.log('Display a user: ')
|
// console.log('Display a user: ')
|
||||||
@@ -26,15 +27,15 @@
|
|||||||
|
|
||||||
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=NomDuUserATrouver
|
// http://{Domain}:{Port}/api/v2/user?username=NomDuUserATrouver
|
||||||
user = await fetch(`http://transcendance:8080/api/v2/user?username=${updateUser}`)
|
user = await fetch(`http://{Domain}:{Port}/api/v2/user?username=${updateUser}`)
|
||||||
.then( (x) => x.json() );
|
.then( (x) => x.json() );
|
||||||
};
|
};
|
||||||
|
|
||||||
// export const updateUser = async(updatedUser) => {
|
// export 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=NomDuUserATrouver
|
// // http://{Domain}:{Port}/api/v2/user?username=NomDuUserATrouver
|
||||||
// user = await fetch(`http://transcendance:8080/api/v2/user?username=${updateUser}`)
|
// user = await fetch(`http://{Domain}:{Port}/api/v2/user?username=${updateUser}`)
|
||||||
// .then( (x) => x.json() );
|
// .then( (x) => x.json() );
|
||||||
// updateGeneratedUser(updateUser);
|
// updateGeneratedUser(updateUser);
|
||||||
|
|
||||||
@@ -56,4 +57,4 @@
|
|||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
|
import { Domain, Port } from "../Constantes.svelte";
|
||||||
|
|
||||||
export let user;
|
export let user;
|
||||||
export let primary;
|
export let primary;
|
||||||
@@ -11,7 +12,7 @@
|
|||||||
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"})
|
await fetch("http://{Domain}:{Port}/api/v2/user/avatar", {method: "GET"})
|
||||||
.then(response => {return response.blob()})
|
.then(response => {return response.blob()})
|
||||||
.then(data => {
|
.then(data => {
|
||||||
const url = URL.createObjectURL(data);
|
const url = URL.createObjectURL(data);
|
||||||
@@ -253,4 +254,4 @@
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { push } from "svelte-spa-router";
|
import { push } from "svelte-spa-router";
|
||||||
import { location } from 'svelte-spa-router';
|
import { location } from 'svelte-spa-router';
|
||||||
|
import { Domain, Port } from "../Constantes.svelte";
|
||||||
|
|
||||||
import active from 'svelte-spa-router/active'
|
import active from 'svelte-spa-router/active'
|
||||||
// or i could leave them all and not display if they're active?
|
// or i could leave them all and not display if they're active?
|
||||||
|
|
||||||
|
|
||||||
let handleClickLogout = async () => {
|
let handleClickLogout = async () => {
|
||||||
await fetch('http://transcendance:8080/api/v2/auth/logout', {
|
await fetch('http://{Domain}:{Port}/api/v2/auth/logout', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
})
|
})
|
||||||
// .then(resp => resp.json)
|
// .then(resp => resp.json)
|
||||||
|
|||||||
@@ -2,13 +2,14 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
|
||||||
import Layouts from './Chat_layouts.svelte';
|
import Layouts from './Chat_layouts.svelte';
|
||||||
|
import { Domain, Port } from "../Constantes.svelte";
|
||||||
export let color = "transparent";
|
export let color = "transparent";
|
||||||
|
|
||||||
/* web sockets with socket.io
|
/* web sockets with socket.io
|
||||||
*/
|
*/
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import io from 'socket.io-client';
|
import io from 'socket.io-client';
|
||||||
const socket = io('http://transcendance:8080', {
|
const socket = io('http://{Domain}:{Port}', {
|
||||||
path: '/chat'
|
path: '/chat'
|
||||||
});
|
});
|
||||||
onMount(async => {
|
onMount(async => {
|
||||||
|
|||||||
Reference in New Issue
Block a user