diff --git a/site/game/main.js b/site/game/main.js index abca12d..c6c7b36 100644 --- a/site/game/main.js +++ b/site/game/main.js @@ -6,10 +6,11 @@ /* By: edbernar +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/07/30 13:50:49 by edbernar #+# #+# */ -/* Updated: 2024/07/30 13:50:49 by edbernar ### ########.fr */ +/* Updated: 2024/08/07 15:29:04 by edbernar ### ########.fr */ /* */ /* ************************************************************************** */ +import { sendRequest } from './websocket.js'; import * as THREE from 'three'; import Stats from 'stats.js'; import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js'; @@ -41,7 +42,6 @@ camera.position.z = 4; camera.position.y = 3; camera.rotation.x = -(Math.PI / 4); - // ------------------- Ball ------------------- // const geometryBall = new THREE.SphereGeometry(0.1, 32, 32); const materialBall = new THREE.MeshLambertMaterial({ color: 0xffffff }); diff --git a/site/game/space.jpg b/site/game/space.jpg deleted file mode 100644 index aa4acd7..0000000 Binary files a/site/game/space.jpg and /dev/null differ diff --git a/site/game/space.tif b/site/game/space.tif deleted file mode 100644 index dbe0c13..0000000 Binary files a/site/game/space.tif and /dev/null differ diff --git a/site/game/typeResponse/typeLogin.js b/site/game/typeResponse/typeLogin.js new file mode 100644 index 0000000..bebe714 --- /dev/null +++ b/site/game/typeResponse/typeLogin.js @@ -0,0 +1,25 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* typeLogin.js :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: edbernar +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2024/07/31 22:17:24 by edbernar #+# #+# */ +/* Updated: 2024/08/07 15:29:26 by edbernar ### ########.fr */ +/* */ +/* ************************************************************************** */ + +import { typeLogin } from "./typeResponse/typeLogin.js"; + +/* + Todo (Eddy) : + - Request to connect by email and password. Waiting for the front to do it (already functional on the back side) + sendRequest("login", {type: "byPass", mail: "aa@aa.fr", password: "ABC123"}); + - Information: the 'token' variable is only used until the connection is fully implemented +*/ + +const socket = new WebSocket('ws://localhost:8000/'); +const token = "IDSNCSDAd465sd13215421"; + +const typeResponse = ["login"]; +const functionResponse = [typeLogin]; + +let status = 0; + +socket.onopen = () => { + status = 1; + console.log('Connected'); + if (token) + sendRequest("login", {"type": "byToken", "token": token}); +}; + +socket.onmessage = (event) => { + let response; + + try { + response = JSON.parse(event.data); + } catch { + return ; + } + if (response.code >= 9000 && response.code <= 9999) + console.warn(response); + else + { + try { + functionResponse[typeResponse.indexOf(response.type)](response.content); + } catch { + console.warn(response); + } + } +}; + +socket.onclose = () => { + status = 0; + console.log('Disconnected'); +}; + +function sendRequest(type, content) { + let coc = null; + + if (status === 0) + return ; + if (content instanceof Object) + coc = JSON.stringify(content); + else + coc = content; + socket.send(JSON.stringify({ + type: type, + token: token, + content: content + })); +} + +export { socket, token, sendRequest }; \ No newline at end of file diff --git a/site/interface/site/index.html b/site/interface/site/index.html index 12dee80..aa6eb53 100644 --- a/site/interface/site/index.html +++ b/site/interface/site/index.html @@ -5,7 +5,8 @@ Chat - + + @@ -15,6 +16,12 @@
+
+

PTME

+
+

Login

+
+

CHAT

diff --git a/site/interface/site/style/home.css b/site/interface/site/style/home.css new file mode 100644 index 0000000..d3eb36c --- /dev/null +++ b/site/interface/site/style/home.css @@ -0,0 +1,49 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* home.css :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: edbernar +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2024/08/07 12:00:55 by edbernar #+# #+# */ +/* Updated: 2024/08/07 12:10:04 by edbernar ### ########.fr */ +/* */ +/* ************************************************************************** */ + +* { + margin: 0; + padding: 0; +} + +body { + border: 0; + padding: 0; + width: 100%; + height: 100%; + background-color: #616161; + user-select: none; +} + +#topBar { + margin: 0; + padding: 0; + width: 100%; + display: flex; + flex-direction: row; +} + +#topBar h1 { + margin: 0; + padding: 0; + font-size: 40px; + color: white; + font-family: 'Poppins'; +} + +#topBar p { + margin: 0; + padding: 0; + font-size: 20px; + color: white; + font-family: 'Poppins'; +} \ No newline at end of file diff --git a/site/interface/site/style/style.css b/site/interface/site/style/liveChat.css similarity index 91% rename from site/interface/site/style/style.css rename to site/interface/site/style/liveChat.css index 5954269..3ebd748 100644 --- a/site/interface/site/style/style.css +++ b/site/interface/site/style/liveChat.css @@ -1,23 +1,15 @@ /* ************************************************************************** */ /* */ /* ::: :::::::: */ -/* style.css :+: :+: :+: */ +/* liveChat.css :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: edbernar +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/07/30 13:53:39 by edbernar #+# #+# */ -/* Updated: 2024/08/04 23:44:06 by edbernar ### ########.fr */ +/* Updated: 2024/08/07 12:02:11 by edbernar ### ########.fr */ /* */ /* ************************************************************************** */ -body { - border: 0; - padding: 0; - width: 100%; - height: 100%; - background-color: #616161; - user-select: none; -} #chatButton { position: absolute; @@ -236,9 +228,9 @@ body { } @supports not selector(::-webkit-scrollbar) { -#messageListChatHome { - scrollbar-color: var(--sb-thumb-color) - var(--sb-track-color); -} + #messageListChatHome { + scrollbar-color: var(--sb-thumb-color) + var(--sb-track-color); + } } diff --git a/websocket-server/Class/__pycache__/User.cpython-310.pyc b/websocket-server/Class/__pycache__/User.cpython-310.pyc new file mode 100644 index 0000000..3d2c99d Binary files /dev/null and b/websocket-server/Class/__pycache__/User.cpython-310.pyc differ diff --git a/websocket-server/typeRequets/__pycache__/getPrivateListMessage.cpython-310.pyc b/websocket-server/typeRequets/__pycache__/getPrivateListMessage.cpython-310.pyc new file mode 100644 index 0000000..b5de488 Binary files /dev/null and b/websocket-server/typeRequets/__pycache__/getPrivateListMessage.cpython-310.pyc differ diff --git a/websocket-server/typeRequets/__pycache__/getPrivateListUser.cpython-310.pyc b/websocket-server/typeRequets/__pycache__/getPrivateListUser.cpython-310.pyc new file mode 100644 index 0000000..9f73101 Binary files /dev/null and b/websocket-server/typeRequets/__pycache__/getPrivateListUser.cpython-310.pyc differ diff --git a/websocket-server/typeRequets/__pycache__/login.cpython-310.pyc b/websocket-server/typeRequets/__pycache__/login.cpython-310.pyc new file mode 100644 index 0000000..479b869 Binary files /dev/null and b/websocket-server/typeRequets/__pycache__/login.cpython-310.pyc differ diff --git a/websocket-server/typeRequets/__pycache__/sendPrivateMessage.cpython-310.pyc b/websocket-server/typeRequets/__pycache__/sendPrivateMessage.cpython-310.pyc new file mode 100644 index 0000000..c696138 Binary files /dev/null and b/websocket-server/typeRequets/__pycache__/sendPrivateMessage.cpython-310.pyc differ