From a193dc570304976e7bc348b1d78b9d1e2ee6c244 Mon Sep 17 00:00:00 2001 From: Kim Yongbeom Date: Mon, 11 Nov 2024 20:25:21 +0800 Subject: [PATCH 01/16] feat: Fix yarn build --- peerprep/frontend/src/api/assesscodeApi.ts | 29 ++++------ peerprep/frontend/src/api/matchingApi.ts | 11 +--- .../CollabServiceMainView.tsx | 8 +-- .../CollabServiceViews/components/Chat.tsx | 11 ++-- .../MatchingServiceMainView.tsx | 55 ------------------- peerprep/frontend/tsconfig.app.tsbuildinfo | 2 +- 6 files changed, 24 insertions(+), 92 deletions(-) diff --git a/peerprep/frontend/src/api/assesscodeApi.ts b/peerprep/frontend/src/api/assesscodeApi.ts index a7333726cf..f689f4a88c 100644 --- a/peerprep/frontend/src/api/assesscodeApi.ts +++ b/peerprep/frontend/src/api/assesscodeApi.ts @@ -10,21 +10,6 @@ export class ApiError extends Error { } } -const handleApiError = (error: unknown): never => { - if (axios.isAxiosError(error)) { - const axiosError = error as AxiosError; - if (axiosError.response) { - throw new ApiError(`API error: ${axiosError.response.statusText}`, axiosError.response.status); - } else if (axiosError.request) { - throw new ApiError('API error: No response received from the server'); - } else { - throw new ApiError(`API error: ${axiosError.message}`); - } - } else { - throw new ApiError(`API error: An unexpected error occurred ${error}`); - } -}; - export const assessCode = async (currentCode: string): Promise => { try { console.log('Submitting code to backend API:'); @@ -38,6 +23,16 @@ export const assessCode = async (currentCode: string): Promise => { return feedback; } catch (error) { console.error('Error executing backend API call:', error); - return "Failed to process code assessment on backend"; + if (axios.isAxiosError(error)) { + const axiosError = error as AxiosError; + if (axiosError.response) { + throw new ApiError(`API error: ${axiosError.response.statusText}`, axiosError.response.status); + } else if (axiosError.request) { + throw new ApiError('API error: No response received from the server'); + } else { + throw new ApiError(`API error: ${axiosError.message}`); + } + } + throw new ApiError(`API error: An unexpected error occurred ${error}`); } -}; \ No newline at end of file +}; diff --git a/peerprep/frontend/src/api/matchingApi.ts b/peerprep/frontend/src/api/matchingApi.ts index afeaff72a2..74449a8172 100644 --- a/peerprep/frontend/src/api/matchingApi.ts +++ b/peerprep/frontend/src/api/matchingApi.ts @@ -1,5 +1,4 @@ import axios, { AxiosError } from 'axios'; -import { Request } from '../models/Request'; // Set up axios instance with base URL const API_URL = "http://localhost:3000/matchingrequest"; @@ -11,10 +10,6 @@ export class ApiError extends Error { } } -interface ErrorResponseData { - message: string; -} - const handleApiError = (error: unknown): never => { if (axios.isAxiosError(error)) { const axiosError = error as AxiosError; @@ -88,7 +83,7 @@ export const getMatchStatus = async (userId: string): Promise void, onError: (error: any) => void) => { +export const listenToMatchStatus = (userId: string, onUpdate: (data: MatchingRequestResponse) => void, onError: (error: Error | Event) => void) => { const eventSource = new EventSource(`${API_URL}/${userId}`); // Listen for incoming events from the server @@ -98,7 +93,7 @@ export const listenToMatchStatus = (userId: string, onUpdate: (data: MatchingReq onUpdate(data); // Call the update handler with the received data } catch (error) { console.error("Error parsing SSE data:", error); - onError(error); + onError(error instanceof Error ? error : new Error("Failed to parse SSE data")); } }; @@ -192,4 +187,4 @@ export const getAllMatchedSessionsByTopicAndDifficulty = async (topic: string, d } catch (error) { return handleApiError(error); } -} \ No newline at end of file +} diff --git a/peerprep/frontend/src/views/CollabServiceViews/CollabServiceMainView.tsx b/peerprep/frontend/src/views/CollabServiceViews/CollabServiceMainView.tsx index e25177c102..cf19a07cff 100644 --- a/peerprep/frontend/src/views/CollabServiceViews/CollabServiceMainView.tsx +++ b/peerprep/frontend/src/views/CollabServiceViews/CollabServiceMainView.tsx @@ -1,6 +1,6 @@ import React, { useState, useEffect } from 'react'; import { Controlled as CodeMirror } from 'react-codemirror2'; // CodeMirror component -import { useParams, useNavigate } from 'react-router-dom'; // For routing and session handling +import { useNavigate } from 'react-router-dom'; // For routing and session handling import 'codemirror/lib/codemirror.css'; // Default CodeMirror styles import 'codemirror/theme/material.css'; // CodeMirror theme import 'codemirror/mode/javascript/javascript'; // Support for JavaScript mode @@ -13,7 +13,6 @@ interface CollaborationServiceViewProps { const CollaborationServiceView: React.FC = ({ topic, difficulty, sessionId }) => { const [code, setCode] = useState('// Start coding here...\n'); - const [users, setUsers] = useState([]); // Placeholder for active users const navigate = useNavigate(); // For navigation useEffect(() => { @@ -21,7 +20,6 @@ const CollaborationServiceView: React.FC = ({ top console.log(`Session ID: ${sessionId}, Topic: ${topic}, Difficulty: ${difficulty}`); }, [sessionId, topic, difficulty]); - useEffect(() => { // Lock scroll when this component mounts document.body.style.overflow = 'hidden'; @@ -32,7 +30,7 @@ const CollaborationServiceView: React.FC = ({ top }; }, []); - const handleCodeChange = (editor: any, data: any, value: string) => { + const handleCodeChange = (_editor: unknown, _data: unknown, value: string) => { setCode(value); // Update local code state // TODO: Later sync this code change with the backend using WebSocket/Socket.io }; @@ -67,4 +65,4 @@ const CollaborationServiceView: React.FC = ({ top ); }; -export default CollaborationServiceView; \ No newline at end of file +export default CollaborationServiceView; diff --git a/peerprep/frontend/src/views/CollabServiceViews/components/Chat.tsx b/peerprep/frontend/src/views/CollabServiceViews/components/Chat.tsx index 28452bd9ba..839db8c705 100644 --- a/peerprep/frontend/src/views/CollabServiceViews/components/Chat.tsx +++ b/peerprep/frontend/src/views/CollabServiceViews/components/Chat.tsx @@ -11,21 +11,20 @@ interface ChatProps { } const Chat: React.FC = ({ sessionId }) => { - const [room, setRoom] = useState(sessionId); const [message, setMessage] = useState(''); const [messages, setMessages] = useState<{ text: string; sender: boolean }[]>([]); const [connectionError, setConnectionError] = useState(null); const joinRoom = () => { - if (room !== '') { - socket.emit('join_room', room); + if (sessionId !== '') { + socket.emit('join_room', sessionId); } }; const sendMessage = () => { if (!message) return; // Checking if there's a message to send - const messageData = { message, room, senderId: socket.id }; + const messageData = { message, room: sessionId, senderId: socket.id }; setMessages((prevMessages) => [...prevMessages, { text: message, sender: true }]); setMessage(''); @@ -42,7 +41,7 @@ const Chat: React.FC = ({ sessionId }) => { useEffect(() => { joinRoom(); // Automatically join the room based on sessionId - socket.on('connect_error', (err) => { + socket.on('connect_error', () => { setConnectionError('Connection error. Please try again.'); }); @@ -66,7 +65,7 @@ const Chat: React.FC = ({ sessionId }) => { socket.off('connect_timeout'); socket.off('reconnect_failed'); }; - }, [room]); + }, [sessionId]); return (
diff --git a/peerprep/frontend/src/views/MatchingServiceViews/MatchingServiceMainView.tsx b/peerprep/frontend/src/views/MatchingServiceViews/MatchingServiceMainView.tsx index 176dff723a..e7006dbb83 100644 --- a/peerprep/frontend/src/views/MatchingServiceViews/MatchingServiceMainView.tsx +++ b/peerprep/frontend/src/views/MatchingServiceViews/MatchingServiceMainView.tsx @@ -8,7 +8,6 @@ const MatchingServiceMainView: React.FC = () => { const [difficulty, setDifficulty] = useState(''); const [statusMessage, setStatusMessage] = useState(null); const [sessionId, setSessionId] = useState(null); - const [questionId, setQuestionId] = useState('Q'); const [loading, setLoading] = useState(false); const [progress, setProgress] = useState(0); const [matchFound, setMatchFound] = useState(false); @@ -42,26 +41,6 @@ const MatchingServiceMainView: React.FC = () => { setProgress(0); }; - const getValueAfterDelimiter = (input: string): string | null => { - // Split the input string using "-Q" as the delimiter - const parts = input.split("-Q"); - - // Check if there is a part after the delimiter - if (parts.length > 1) { - return parts[1].replace(/_/g, " "); // Return the part after "-Q" - } else { - return "Empty Q" - } - return null; -}; - - const handleSetQuestionId = (fullSessionId: string) => { - const parsedQuestionId = getValueAfterDelimiter(fullSessionId); - if (parsedQuestionId != null) { - setQuestionId(parsedQuestionId); - } - } - // Function to listen to match status, declared outside handleSubmit const startListeningToMatchStatus = () => { const stopListening = listenToMatchStatus( @@ -71,11 +50,9 @@ const MatchingServiceMainView: React.FC = () => { if (data.message.includes("Session")) { setStatusMessage(data.message); setSessionId(data.message); - handleSetQuestionId(data.message); console.log(data.message); setMatchFound(true); // Set match status to true stopProgressBar(); - //setStatusMessage(`Match found for ${topic} and ${difficulty}!`); setStatusMessage(`Match found! Join the session to start coding.`); setLoading(false); stopListening(); @@ -123,7 +100,6 @@ const MatchingServiceMainView: React.FC = () => { useEffect(() => { if (progress >= 100) { setLoading(false); - //setStatusMessage("Match timed out. Please try again."); stopProgressBar(); } }, [progress]); @@ -133,19 +109,6 @@ const MatchingServiceMainView: React.FC = () => { deleteMatchingRequest(userId!); // Fire-and-forget API request }; - // Handle navigation to session stub - const goToSession = () => { - navigate('/sessionStub', { - state: { - sessionId: userId, - topic, - difficulty, - userId1: userId, - userId2: 'OtherUserId', // Replace with actual matched user ID from the data - }, - }); - }; - return (
Go to Login @@ -223,21 +186,3 @@ const MatchingServiceMainView: React.FC = () => { }; export default MatchingServiceMainView; - -/* - - Go to Session - - -*/ \ No newline at end of file diff --git a/peerprep/frontend/tsconfig.app.tsbuildinfo b/peerprep/frontend/tsconfig.app.tsbuildinfo index cf79f902f5..455c7bce52 100644 --- a/peerprep/frontend/tsconfig.app.tsbuildinfo +++ b/peerprep/frontend/tsconfig.app.tsbuildinfo @@ -1 +1 @@ -{"root":["./src/admindashboard.tsx","./src/app.tsx","./src/login.tsx","./src/privateroute.tsx","./src/profile.tsx","./src/signup.tsx","./src/jest.setup.ts","./src/main.tsx","./src/setuptests.ts","./src/vite-env.d.ts","./src/__test__/api/questionapi.test.ts","./src/__test__/controllers/questioncontroller.test.tsx","./src/__test__/models/questionmodel.test.tsx","./src/__test__/views/questionform.test.tsx","./src/__test__/views/questionlist.test.tsx","./src/__test__/views/questionmanagement.test.tsx","./src/api/authapi.ts","./src/api/questionapi.ts","./src/api/userapi.ts","./src/api/usersapi.ts","./src/controllers/questioncontroller.tsx","./src/models/question.tsx","./src/models/user.tsx","./src/views/questionform.tsx","./src/views/questionlist.tsx","./src/views/questionmanagement.tsx"],"errors":true,"version":"5.6.2"} \ No newline at end of file +{"root":["./src/App.tsx","./src/jest.setup.ts","./src/main.tsx","./src/setupTests.ts","./src/vite-env.d.ts","./src/y-codemirror.d.ts","./src/api/assesscodeApi.ts","./src/api/authApi.ts","./src/api/matchingApi.ts","./src/api/questionApi.ts","./src/api/testcaseApi.ts","./src/api/userApi.ts","./src/api/usersApi.ts","./src/components/Footer.tsx","./src/components/Navbar.tsx","./src/controllers/QuestionController.tsx","./src/models/Question.tsx","./src/models/Request.tsx","./src/models/User.tsx","./src/views/CollabServiceViews/CollabServiceIntegratedView.tsx","./src/views/CollabServiceViews/CollabServiceMainView.tsx","./src/views/CollabServiceViews/components/Chat.tsx","./src/views/MatchingServiceViews/MatchingServiceMainView.tsx","./src/views/MatchingServiceViews/SessionStubView.tsx","./src/views/QuestionServiceViews/QuestionForm.tsx","./src/views/QuestionServiceViews/QuestionList.tsx","./src/views/QuestionServiceViews/QuestionManagement.tsx","./src/views/UserServiceViews/AdminDashBoard.tsx","./src/views/UserServiceViews/Login.tsx","./src/views/UserServiceViews/PrivateRoute.tsx","./src/views/UserServiceViews/Profile.tsx","./src/views/UserServiceViews/SignUp.tsx"],"errors":true,"version":"5.6.2"} \ No newline at end of file From 3c0478c913ddf3f6b3fd55e821b5f01c95192a95 Mon Sep 17 00:00:00 2001 From: Kim Yongbeom Date: Mon, 11 Nov 2024 20:30:31 +0800 Subject: [PATCH 02/16] feat: Container always restarts --- peerprep/backend/docker-compose.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/peerprep/backend/docker-compose.yaml b/peerprep/backend/docker-compose.yaml index b06974b98a..a279270c3e 100644 --- a/peerprep/backend/docker-compose.yaml +++ b/peerprep/backend/docker-compose.yaml @@ -7,6 +7,7 @@ services: - "3001:3001" env_file: - ./user-service/.env + restart: always question-service: build: @@ -16,6 +17,7 @@ services: - "8080:8080" env_file: - ./question-service/.env + restart: always matching-service: build: @@ -25,6 +27,7 @@ services: - "3000:3000" env_file: - ./matching-service/.env + restart: always collab-service: build: @@ -35,6 +38,7 @@ services: - "3003:3003" env_file: - ./collab-service/.env + restart: always networks: my-network: From 429f08359a81081c4acce97a897eebbd33258613 Mon Sep 17 00:00:00 2001 From: Kim Yongbeom Date: Mon, 11 Nov 2024 20:43:47 +0800 Subject: [PATCH 03/16] feat: Fix yarn build frontend --- peerprep/frontend/src/views/UserServiceViews/AdminDashBoard.tsx | 2 +- peerprep/frontend/src/views/UserServiceViews/Login.tsx | 2 +- peerprep/frontend/src/views/UserServiceViews/Profile.tsx | 2 +- peerprep/frontend/src/views/UserServiceViews/SignUp.tsx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/peerprep/frontend/src/views/UserServiceViews/AdminDashBoard.tsx b/peerprep/frontend/src/views/UserServiceViews/AdminDashBoard.tsx index dada3a8c21..5109db3eec 100644 --- a/peerprep/frontend/src/views/UserServiceViews/AdminDashBoard.tsx +++ b/peerprep/frontend/src/views/UserServiceViews/AdminDashBoard.tsx @@ -1,5 +1,5 @@ // src/AdminDashboard.tsx -import React, { useEffect, useState } from 'react'; +import { useEffect, useState } from 'react'; import { Link } from 'react-router-dom'; // Import Link from react-router-dom for navigation import { getAllUsers } from '../../api/usersApi'; // API function to fetch users import { User } from '../../models/User'; // Import the User model diff --git a/peerprep/frontend/src/views/UserServiceViews/Login.tsx b/peerprep/frontend/src/views/UserServiceViews/Login.tsx index 672dd8e97e..6dbf340c7e 100644 --- a/peerprep/frontend/src/views/UserServiceViews/Login.tsx +++ b/peerprep/frontend/src/views/UserServiceViews/Login.tsx @@ -1,5 +1,5 @@ // src/Login.tsx -import React, { useState } from "react"; +import { useState } from "react"; import { loginUser } from "../../api/authApi"; import { useNavigate, Link } from "react-router-dom"; // Import Link to navigate to signup diff --git a/peerprep/frontend/src/views/UserServiceViews/Profile.tsx b/peerprep/frontend/src/views/UserServiceViews/Profile.tsx index a695fe24ea..cbcd9dad74 100644 --- a/peerprep/frontend/src/views/UserServiceViews/Profile.tsx +++ b/peerprep/frontend/src/views/UserServiceViews/Profile.tsx @@ -1,5 +1,5 @@ // src/Profile.tsx -import React, { useEffect, useState } from 'react'; +import { useEffect, useState } from 'react'; import { getUserProfile } from '../../api/usersApi'; // Import the getUserProfile function import { useParams, Link } from 'react-router-dom'; // Import useParams to get userId from the URL import { User } from '../../models/User'; // Import the User model diff --git a/peerprep/frontend/src/views/UserServiceViews/SignUp.tsx b/peerprep/frontend/src/views/UserServiceViews/SignUp.tsx index 08b469bf39..881017ad02 100644 --- a/peerprep/frontend/src/views/UserServiceViews/SignUp.tsx +++ b/peerprep/frontend/src/views/UserServiceViews/SignUp.tsx @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import { useState } from "react"; import { useNavigate, Link } from "react-router-dom"; // Import Link and useNavigate for navigation import { createUser } from "../../api/usersApi"; // Import the createUser API import { AxiosError } from "axios"; // Import AxiosError for error handling From 2622d25bece9f66791800e4704520480046e658a Mon Sep 17 00:00:00 2001 From: Kim Yongbeom Date: Mon, 11 Nov 2024 20:57:02 +0800 Subject: [PATCH 04/16] feat: Frontend setup --- peerprep/frontend/.env.development | 9 + peerprep/frontend/.env.production | 9 + peerprep/frontend/src/api/assesscodeApi.ts | 2 +- peerprep/frontend/src/api/authApi.ts | 2 +- peerprep/frontend/src/api/matchingApi.ts | 2 +- peerprep/frontend/src/api/questionApi.ts | 2 +- peerprep/frontend/src/api/testcaseApi.ts | 2 +- peerprep/frontend/src/api/userApi.ts | 2 +- peerprep/frontend/src/api/usersApi.ts | 2 +- .../CollabServiceIntegratedView.tsx | 2 +- .../CollabServiceViews/components/Chat.tsx | 2 +- peerprep/frontend/tsconfig.app.tsbuildinfo | 2 +- peerprep/frontend/yarn.lock | 317 ++++++++++++++---- 13 files changed, 281 insertions(+), 74 deletions(-) create mode 100644 peerprep/frontend/.env.development create mode 100644 peerprep/frontend/.env.production diff --git a/peerprep/frontend/.env.development b/peerprep/frontend/.env.development new file mode 100644 index 0000000000..794be3a003 --- /dev/null +++ b/peerprep/frontend/.env.development @@ -0,0 +1,9 @@ +VITE_AUTH_API_URL=http://localhost:3001/auth +VITE_MATCHING_API_URL=http://localhost:3000/matchingrequest +VITE_USER_API_URL=http://localhost:3001/api/users +VITE_USERS_API_URL=http://localhost:3001/users +VITE_ASSESSCODE_API_URL=http://localhost:1234/api/gpt/assess +VITE_QUESTION_API_URL=http://localhost:8080/api/questions +VITE_TESTCASE_API_URL=http://localhost:8080/api/testcases +VITE_WS_PROVIDER_URL=ws://localhost:1234/ +VITE_SOCKET_IO_URL=http://localhost:1234 diff --git a/peerprep/frontend/.env.production b/peerprep/frontend/.env.production new file mode 100644 index 0000000000..8c815c60a4 --- /dev/null +++ b/peerprep/frontend/.env.production @@ -0,0 +1,9 @@ +VITE_AUTH_API_URL=http://user.peerprep.app/auth +VITE_MATCHING_API_URL=http://matching.peerprep.app/matchingrequest +VITE_USER_API_URL=http://user.peerprep.app/api/users +VITE_USERS_API_URL=http://user.peerprep.app/users +VITE_QUESTION_API_URL=http://question.peerperp.app/api/questions +VITE_TESTCASE_API_URL=http://question.peerperp.app/api/testcases +VITE_ASSESSCODE_API_URL=http://collab.peerprep.app/api/gpt/assess +VITE_WS_PROVIDER_URL=ws://collab.peerprep.app/ +VITE_SOCKET_IO_URL=http://collab.peerprep.app/ diff --git a/peerprep/frontend/src/api/assesscodeApi.ts b/peerprep/frontend/src/api/assesscodeApi.ts index f689f4a88c..f4157fea86 100644 --- a/peerprep/frontend/src/api/assesscodeApi.ts +++ b/peerprep/frontend/src/api/assesscodeApi.ts @@ -1,6 +1,6 @@ import axios, { AxiosError } from 'axios'; -const API_URL = 'http://localhost:1234/api/gpt/assess'; +const API_URL = import.meta.env.VITE_ASSESSCODE_API_URL; // Define a custom error class for API errors export class ApiError extends Error { diff --git a/peerprep/frontend/src/api/authApi.ts b/peerprep/frontend/src/api/authApi.ts index 154c5fd71a..8efb521158 100644 --- a/peerprep/frontend/src/api/authApi.ts +++ b/peerprep/frontend/src/api/authApi.ts @@ -3,7 +3,7 @@ import axios, { AxiosError } from 'axios'; import { User } from '../models/User'; // Base URL for authentication APIs -const API_URL = 'http://localhost:3001/auth'; +const API_URL = import.meta.env.VITE_AUTH_API_URL; class ApiError extends Error { constructor(message: string, public statusCode?: number) { diff --git a/peerprep/frontend/src/api/matchingApi.ts b/peerprep/frontend/src/api/matchingApi.ts index 74449a8172..aa9ac811c5 100644 --- a/peerprep/frontend/src/api/matchingApi.ts +++ b/peerprep/frontend/src/api/matchingApi.ts @@ -1,7 +1,7 @@ import axios, { AxiosError } from 'axios'; // Set up axios instance with base URL -const API_URL = "http://localhost:3000/matchingrequest"; +const API_URL = import.meta.env.VITE_MATCHING_API_URL; export class ApiError extends Error { constructor(message: string, public statusCode?: number) { diff --git a/peerprep/frontend/src/api/questionApi.ts b/peerprep/frontend/src/api/questionApi.ts index 21cdb88e76..a82372bbc7 100644 --- a/peerprep/frontend/src/api/questionApi.ts +++ b/peerprep/frontend/src/api/questionApi.ts @@ -1,7 +1,7 @@ import axios, { AxiosError } from 'axios'; import { Question } from '../models/Question'; -const API_URL = 'http://localhost:8080/api/questions'; +const API_URL = import.meta.env.VITE_QUESTION_API_URL; export class ApiError extends Error { constructor(message: string, public statusCode?: number) { diff --git a/peerprep/frontend/src/api/testcaseApi.ts b/peerprep/frontend/src/api/testcaseApi.ts index 6a60381d06..6f299270f6 100644 --- a/peerprep/frontend/src/api/testcaseApi.ts +++ b/peerprep/frontend/src/api/testcaseApi.ts @@ -1,6 +1,6 @@ import axios from 'axios'; -const API_URL = 'http://localhost:8080/api/testcases'; +const API_URL = import.meta.env.VITE_TESTCASE_API_URL; export interface Testcase { questionId: number; diff --git a/peerprep/frontend/src/api/userApi.ts b/peerprep/frontend/src/api/userApi.ts index a5fc39df6a..2ee076d431 100644 --- a/peerprep/frontend/src/api/userApi.ts +++ b/peerprep/frontend/src/api/userApi.ts @@ -3,7 +3,7 @@ import axios, { AxiosError } from 'axios'; import { User } from '../models/User'; // Set up axios instance with base URL -const API_URL = "http://localhost:3001/api/users"; +const API_URL = import.meta.env.VITE_USER_API_URL; class ApiError extends Error { constructor(message: string, public statusCode?: number) { diff --git a/peerprep/frontend/src/api/usersApi.ts b/peerprep/frontend/src/api/usersApi.ts index 5647cbace7..58c7272033 100644 --- a/peerprep/frontend/src/api/usersApi.ts +++ b/peerprep/frontend/src/api/usersApi.ts @@ -3,7 +3,7 @@ import axios, { AxiosError } from 'axios'; import { User } from '../models/User'; // Base URL for user APIs -const API_URL = 'http://localhost:3001/users'; +const API_URL = import.meta.env.VITE_USERS_API_URL; class ApiError extends Error { constructor(message: string, public statusCode?: number) { diff --git a/peerprep/frontend/src/views/CollabServiceViews/CollabServiceIntegratedView.tsx b/peerprep/frontend/src/views/CollabServiceViews/CollabServiceIntegratedView.tsx index b61129ff0e..4a00509b20 100644 --- a/peerprep/frontend/src/views/CollabServiceViews/CollabServiceIntegratedView.tsx +++ b/peerprep/frontend/src/views/CollabServiceViews/CollabServiceIntegratedView.tsx @@ -94,7 +94,7 @@ const CollaborationServiceIntegratedView: React.FC = () => { useEffect(() => { const ydoc = new Y.Doc(); - const provider = new WebsocketProvider('ws://localhost:1234/' + sessionId, 'collaborative-doc', ydoc); + const provider = new WebsocketProvider(import.meta.env.VITE_WS_PROVIDER_URL + sessionId, 'collaborative-doc', ydoc); const newYText = ydoc.getText('codemirror'); setYText(newYText); diff --git a/peerprep/frontend/src/views/CollabServiceViews/components/Chat.tsx b/peerprep/frontend/src/views/CollabServiceViews/components/Chat.tsx index 839db8c705..2b0d4451e3 100644 --- a/peerprep/frontend/src/views/CollabServiceViews/components/Chat.tsx +++ b/peerprep/frontend/src/views/CollabServiceViews/components/Chat.tsx @@ -1,7 +1,7 @@ import React, { useState, useEffect } from 'react'; import io from 'socket.io-client'; -const socket = io('http://localhost:1234', { +const socket = io(import.meta.env.VITE_SOCKET_IO_URL, { reconnectionAttempts: 3, // attempt reconnection 3 times timeout: 5000, // connection timeout }); diff --git a/peerprep/frontend/tsconfig.app.tsbuildinfo b/peerprep/frontend/tsconfig.app.tsbuildinfo index 455c7bce52..18f6bd794c 100644 --- a/peerprep/frontend/tsconfig.app.tsbuildinfo +++ b/peerprep/frontend/tsconfig.app.tsbuildinfo @@ -1 +1 @@ -{"root":["./src/App.tsx","./src/jest.setup.ts","./src/main.tsx","./src/setupTests.ts","./src/vite-env.d.ts","./src/y-codemirror.d.ts","./src/api/assesscodeApi.ts","./src/api/authApi.ts","./src/api/matchingApi.ts","./src/api/questionApi.ts","./src/api/testcaseApi.ts","./src/api/userApi.ts","./src/api/usersApi.ts","./src/components/Footer.tsx","./src/components/Navbar.tsx","./src/controllers/QuestionController.tsx","./src/models/Question.tsx","./src/models/Request.tsx","./src/models/User.tsx","./src/views/CollabServiceViews/CollabServiceIntegratedView.tsx","./src/views/CollabServiceViews/CollabServiceMainView.tsx","./src/views/CollabServiceViews/components/Chat.tsx","./src/views/MatchingServiceViews/MatchingServiceMainView.tsx","./src/views/MatchingServiceViews/SessionStubView.tsx","./src/views/QuestionServiceViews/QuestionForm.tsx","./src/views/QuestionServiceViews/QuestionList.tsx","./src/views/QuestionServiceViews/QuestionManagement.tsx","./src/views/UserServiceViews/AdminDashBoard.tsx","./src/views/UserServiceViews/Login.tsx","./src/views/UserServiceViews/PrivateRoute.tsx","./src/views/UserServiceViews/Profile.tsx","./src/views/UserServiceViews/SignUp.tsx"],"errors":true,"version":"5.6.2"} \ No newline at end of file +{"root":["./src/App.tsx","./src/jest.setup.ts","./src/main.tsx","./src/setupTests.ts","./src/vite-env.d.ts","./src/y-codemirror.d.ts","./src/api/assesscodeApi.ts","./src/api/authApi.ts","./src/api/matchingApi.ts","./src/api/questionApi.ts","./src/api/testcaseApi.ts","./src/api/userApi.ts","./src/api/usersApi.ts","./src/components/Footer.tsx","./src/components/Navbar.tsx","./src/controllers/QuestionController.tsx","./src/models/Question.tsx","./src/models/Request.tsx","./src/models/User.tsx","./src/views/CollabServiceViews/CollabServiceIntegratedView.tsx","./src/views/CollabServiceViews/CollabServiceMainView.tsx","./src/views/CollabServiceViews/components/Chat.tsx","./src/views/MatchingServiceViews/MatchingServiceMainView.tsx","./src/views/MatchingServiceViews/SessionStubView.tsx","./src/views/QuestionServiceViews/QuestionForm.tsx","./src/views/QuestionServiceViews/QuestionList.tsx","./src/views/QuestionServiceViews/QuestionManagement.tsx","./src/views/UserServiceViews/AdminDashBoard.tsx","./src/views/UserServiceViews/Login.tsx","./src/views/UserServiceViews/PrivateRoute.tsx","./src/views/UserServiceViews/Profile.tsx","./src/views/UserServiceViews/SignUp.tsx"],"version":"5.6.2"} \ No newline at end of file diff --git a/peerprep/frontend/yarn.lock b/peerprep/frontend/yarn.lock index f34c413100..f295a90f87 100644 --- a/peerprep/frontend/yarn.lock +++ b/peerprep/frontend/yarn.lock @@ -33,7 +33,7 @@ resolved "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.25.4.tgz" integrity sha512-+LGRog6RAsCJrrrg/IO6LGmpphNe5DiK30dGjCoxxeGv49B10/3XYGxPsAwrDlMFcFEvdAUavDT8r9k/hSyQqQ== -"@babel/core@^7.0.0", "@babel/core@^7.0.0-0", "@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.23.9", "@babel/core@^7.24.5", "@babel/core@^7.8.0", "@babel/core@>=7.0.0-beta.0 <8": +"@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.23.9", "@babel/core@^7.24.5": version "7.25.2" resolved "https://registry.npmjs.org/@babel/core/-/core-7.25.2.tgz" integrity sha512-BBt3opiCOxUr9euZ5/ro/Xv8/V7yJ5bjYMqG/C1YAo8MIKAnumZalCN+msbci3Pigy4lIQfPUpfMM27HMGaYEA== @@ -329,8 +329,120 @@ dependencies: "@jridgewell/trace-mapping" "0.3.9" +"@esbuild/aix-ppc64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz#c7184a326533fcdf1b8ee0733e21c713b975575f" + integrity sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ== + +"@esbuild/android-arm64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz#09d9b4357780da9ea3a7dfb833a1f1ff439b4052" + integrity sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A== + +"@esbuild/android-arm@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.21.5.tgz#9b04384fb771926dfa6d7ad04324ecb2ab9b2e28" + integrity sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg== + +"@esbuild/android-x64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.21.5.tgz#29918ec2db754cedcb6c1b04de8cd6547af6461e" + integrity sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA== + "@esbuild/darwin-arm64@0.21.5": version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz#e495b539660e51690f3928af50a76fb0a6ccff2a" + integrity sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ== + +"@esbuild/darwin-x64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz#c13838fa57372839abdddc91d71542ceea2e1e22" + integrity sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw== + +"@esbuild/freebsd-arm64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz#646b989aa20bf89fd071dd5dbfad69a3542e550e" + integrity sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g== + +"@esbuild/freebsd-x64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz#aa615cfc80af954d3458906e38ca22c18cf5c261" + integrity sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ== + +"@esbuild/linux-arm64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz#70ac6fa14f5cb7e1f7f887bcffb680ad09922b5b" + integrity sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q== + +"@esbuild/linux-arm@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz#fc6fd11a8aca56c1f6f3894f2bea0479f8f626b9" + integrity sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA== + +"@esbuild/linux-ia32@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz#3271f53b3f93e3d093d518d1649d6d68d346ede2" + integrity sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg== + +"@esbuild/linux-loong64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz#ed62e04238c57026aea831c5a130b73c0f9f26df" + integrity sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg== + +"@esbuild/linux-mips64el@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz#e79b8eb48bf3b106fadec1ac8240fb97b4e64cbe" + integrity sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg== + +"@esbuild/linux-ppc64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz#5f2203860a143b9919d383ef7573521fb154c3e4" + integrity sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w== + +"@esbuild/linux-riscv64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz#07bcafd99322d5af62f618cb9e6a9b7f4bb825dc" + integrity sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA== + +"@esbuild/linux-s390x@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz#b7ccf686751d6a3e44b8627ababc8be3ef62d8de" + integrity sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A== + +"@esbuild/linux-x64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz#6d8f0c768e070e64309af8004bb94e68ab2bb3b0" + integrity sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ== + +"@esbuild/netbsd-x64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz#bbe430f60d378ecb88decb219c602667387a6047" + integrity sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg== + +"@esbuild/openbsd-x64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz#99d1cf2937279560d2104821f5ccce220cb2af70" + integrity sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow== + +"@esbuild/sunos-x64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz#08741512c10d529566baba837b4fe052c8f3487b" + integrity sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg== + +"@esbuild/win32-arm64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz#675b7385398411240735016144ab2e99a60fc75d" + integrity sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A== + +"@esbuild/win32-ia32@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz#1bfc3ce98aa6ca9a0969e4d2af72144c59c1193b" + integrity sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA== + +"@esbuild/win32-x64@0.21.5": + version "0.21.5" + resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz#acad351d582d157bb145535db2a6ff53dd514b5c" + integrity sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw== "@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0": version "4.4.0" @@ -368,7 +480,7 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@eslint/js@^9.9.0", "@eslint/js@9.10.0": +"@eslint/js@9.10.0", "@eslint/js@^9.9.0": version "9.10.0" resolved "https://registry.npmjs.org/@eslint/js/-/js-9.10.0.tgz" integrity sha512-fuXtbiP5GWIn8Fz+LWoOMVf/Jxm+aajZYkhi6CuEm4SxymFM+eUWzbO9qXT+L0iCkL5+KGYMCSGxo686H19S1g== @@ -582,7 +694,7 @@ jest-haste-map "^29.7.0" slash "^3.0.0" -"@jest/transform@^29.0.0", "@jest/transform@^29.7.0": +"@jest/transform@^29.7.0": version "29.7.0" resolved "https://registry.npmjs.org/@jest/transform/-/transform-29.7.0.tgz" integrity sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw== @@ -603,7 +715,7 @@ slash "^3.0.0" write-file-atomic "^4.0.2" -"@jest/types@^29.0.0", "@jest/types@^29.6.3": +"@jest/types@^29.6.3": version "29.6.3" resolved "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz" integrity sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw== @@ -639,14 +751,6 @@ resolved "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz" integrity sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ== -"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.18", "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25": - version "0.3.25" - resolved "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz" - integrity sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ== - dependencies: - "@jridgewell/resolve-uri" "^3.1.0" - "@jridgewell/sourcemap-codec" "^1.4.14" - "@jridgewell/trace-mapping@0.3.9": version "0.3.9" resolved "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz" @@ -655,6 +759,14 @@ "@jridgewell/resolve-uri" "^3.0.3" "@jridgewell/sourcemap-codec" "^1.4.10" +"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.18", "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25": + version "0.3.25" + resolved "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz" + integrity sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ== + dependencies: + "@jridgewell/resolve-uri" "^3.1.0" + "@jridgewell/sourcemap-codec" "^1.4.14" + "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz" @@ -663,7 +775,7 @@ "@nodelib/fs.stat" "2.0.5" run-parallel "^1.1.9" -"@nodelib/fs.stat@^2.0.2", "@nodelib/fs.stat@2.0.5": +"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": version "2.0.5" resolved "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz" integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== @@ -686,11 +798,96 @@ resolved "https://registry.npmjs.org/@remix-run/router/-/router-1.19.2.tgz" integrity sha512-baiMx18+IMuD1yyvOGaHM9QrVUPGGG0jC+z+IPHnRJWUAUvaKuWKyE8gjDj2rzv3sz9zOGoRSPgeBVHRhZnBlA== +"@rollup/rollup-android-arm-eabi@4.25.0": + version "4.25.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.25.0.tgz#3e7eda4c0c1de6d2415343002d742ff95e38dca7" + integrity sha512-CC/ZqFZwlAIbU1wUPisHyV/XRc5RydFrNLtgl3dGYskdwPZdt4HERtKm50a/+DtTlKeCq9IXFEWR+P6blwjqBA== + +"@rollup/rollup-android-arm64@4.25.0": + version "4.25.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.25.0.tgz#04f679231acf7284f1f8a1f7250d0e0944865ba8" + integrity sha512-/Y76tmLGUJqVBXXCfVS8Q8FJqYGhgH4wl4qTA24E9v/IJM0XvJCGQVSW1QZ4J+VURO9h8YCa28sTFacZXwK7Rg== + "@rollup/rollup-darwin-arm64@4.25.0": version "4.25.0" resolved "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.25.0.tgz" integrity sha512-YVT6L3UrKTlC0FpCZd0MGA7NVdp7YNaEqkENbWQ7AOVOqd/7VzyHpgIpc1mIaxRAo1ZsJRH45fq8j4N63I/vvg== +"@rollup/rollup-darwin-x64@4.25.0": + version "4.25.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.25.0.tgz#28e6e0687092f31e20982fc104779d48c643fc21" + integrity sha512-ZRL+gexs3+ZmmWmGKEU43Bdn67kWnMeWXLFhcVv5Un8FQcx38yulHBA7XR2+KQdYIOtD0yZDWBCudmfj6lQJoA== + +"@rollup/rollup-freebsd-arm64@4.25.0": + version "4.25.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.25.0.tgz#99e9173b8aef3d1ef086983da70413988206e530" + integrity sha512-xpEIXhiP27EAylEpreCozozsxWQ2TJbOLSivGfXhU4G1TBVEYtUPi2pOZBnvGXHyOdLAUUhPnJzH3ah5cqF01g== + +"@rollup/rollup-freebsd-x64@4.25.0": + version "4.25.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.25.0.tgz#f3a1ef941f8d3c6b2b036484c69a7b2d3d9ebbd7" + integrity sha512-sC5FsmZGlJv5dOcURrsnIK7ngc3Kirnx3as2XU9uER+zjfyqIjdcMVgzy4cOawhsssqzoAX19qmxgJ8a14Qrqw== + +"@rollup/rollup-linux-arm-gnueabihf@4.25.0": + version "4.25.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.25.0.tgz#9ba6adcc33f26f2a0c6ee658f0bbda4de8da2f75" + integrity sha512-uD/dbLSs1BEPzg564TpRAQ/YvTnCds2XxyOndAO8nJhaQcqQGFgv/DAVko/ZHap3boCvxnzYMa3mTkV/B/3SWA== + +"@rollup/rollup-linux-arm-musleabihf@4.25.0": + version "4.25.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.25.0.tgz#62f2426fa9016ec884f4fa779d7b62d5ba02a41a" + integrity sha512-ZVt/XkrDlQWegDWrwyC3l0OfAF7yeJUF4fq5RMS07YM72BlSfn2fQQ6lPyBNjt+YbczMguPiJoCfaQC2dnflpQ== + +"@rollup/rollup-linux-arm64-gnu@4.25.0": + version "4.25.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.25.0.tgz#f98ec111a231d35e0c6d3404e3d80f67f9d5b9f8" + integrity sha512-qboZ+T0gHAW2kkSDPHxu7quaFaaBlynODXpBVnPxUgvWYaE84xgCKAPEYE+fSMd3Zv5PyFZR+L0tCdYCMAtG0A== + +"@rollup/rollup-linux-arm64-musl@4.25.0": + version "4.25.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.25.0.tgz#4b36ffb8359f959f2c29afd187603c53368b6723" + integrity sha512-ndWTSEmAaKr88dBuogGH2NZaxe7u2rDoArsejNslugHZ+r44NfWiwjzizVS1nUOHo+n1Z6qV3X60rqE/HlISgw== + +"@rollup/rollup-linux-powerpc64le-gnu@4.25.0": + version "4.25.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.25.0.tgz#52f4b39e6783505d168a745b79d86474fde71680" + integrity sha512-BVSQvVa2v5hKwJSy6X7W1fjDex6yZnNKy3Kx1JGimccHft6HV0THTwNtC2zawtNXKUu+S5CjXslilYdKBAadzA== + +"@rollup/rollup-linux-riscv64-gnu@4.25.0": + version "4.25.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.25.0.tgz#49195be7e6a7d68d482b12461e2ea914e31ff977" + integrity sha512-G4hTREQrIdeV0PE2JruzI+vXdRnaK1pg64hemHq2v5fhv8C7WjVaeXc9P5i4Q5UC06d/L+zA0mszYIKl+wY8oA== + +"@rollup/rollup-linux-s390x-gnu@4.25.0": + version "4.25.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.25.0.tgz#4b8d50a205eac7b46cdcb9c50d4a6ae5994c02e0" + integrity sha512-9T/w0kQ+upxdkFL9zPVB6zy9vWW1deA3g8IauJxojN4bnz5FwSsUAD034KpXIVX5j5p/rn6XqumBMxfRkcHapQ== + +"@rollup/rollup-linux-x64-gnu@4.25.0": + version "4.25.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.25.0.tgz#dfcceebc5ccac7fc2db19471996026258c81b55f" + integrity sha512-ThcnU0EcMDn+J4B9LD++OgBYxZusuA7iemIIiz5yzEcFg04VZFzdFjuwPdlURmYPZw+fgVrFzj4CA64jSTG4Ig== + +"@rollup/rollup-linux-x64-musl@4.25.0": + version "4.25.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.25.0.tgz#192f78bad8429711d63a31dc0a7d3312e2df850e" + integrity sha512-zx71aY2oQxGxAT1JShfhNG79PnjYhMC6voAjzpu/xmMjDnKNf6Nl/xv7YaB/9SIa9jDYf8RBPWEnjcdlhlv1rQ== + +"@rollup/rollup-win32-arm64-msvc@4.25.0": + version "4.25.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.25.0.tgz#f4ec076579634f780b4e5896ae7f59f3e38e0c60" + integrity sha512-JT8tcjNocMs4CylWY/CxVLnv8e1lE7ff1fi6kbGocWwxDq9pj30IJ28Peb+Y8yiPNSF28oad42ApJB8oUkwGww== + +"@rollup/rollup-win32-ia32-msvc@4.25.0": + version "4.25.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.25.0.tgz#5458eab1929827e4f805cefb90bd09ecf7eeed2b" + integrity sha512-dRLjLsO3dNOfSN6tjyVlG+Msm4IiZnGkuZ7G5NmpzwF9oOc582FZG05+UdfTbz5Jd4buK/wMb6UeHFhG18+OEg== + +"@rollup/rollup-win32-x64-msvc@4.25.0": + version "4.25.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.25.0.tgz#93415e7e707e4b156d77c5950b983b58f4bc33f3" + integrity sha512-/RqrIFtLB926frMhZD0a5oDa4eFIbyNEwLLloMTEjmqfwZWXywwVVOVmwTsuyhC9HKkVEZcOOi+KV4U9wmOdlg== + "@sinclair/typebox@^0.27.8": version "0.27.8" resolved "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz" @@ -715,7 +912,7 @@ resolved "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.2.tgz" integrity sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA== -"@testing-library/dom@^10.0.0", "@testing-library/dom@^10.4.0": +"@testing-library/dom@^10.4.0": version "10.4.0" resolved "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.0.tgz" integrity sha512-pemlzrSESWbdAloYml3bAJMEfNh1Z7EduzqPKprCH5S341frlpYnUEW0H72dLxa6IsYr+mPno20GiSm+h9dEdQ== @@ -854,7 +1051,7 @@ "@types/node" "*" form-data "^4.0.0" -"@types/node@*", "@types/node@^18.0.0 || >=20.0.0": +"@types/node@*": version "22.7.4" resolved "https://registry.npmjs.org/@types/node/-/node-22.7.4.tgz" integrity sha512-y+NPi1rFzDs1NdQHHToqeiX2TIS79SWEAw9GYhkkx8bD0ChpfqC+n2j5OXOCpzfojBEBt6DnEnnG9MY0zk1XLg== @@ -873,14 +1070,14 @@ resolved "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.13.tgz" integrity sha512-hCZTSvwbzWGvhqxp/RqVqwU999pBf2vp7hzIjiYOsl8wqOmUxkQ6ddw1cV3l8811+kdUFus/q4d1Y3E3SyEifA== -"@types/react-dom@^18.0.0", "@types/react-dom@^18.3.0": +"@types/react-dom@^18.3.0": version "18.3.0" resolved "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.0.tgz" integrity sha512-EhwApuTmMBmXuFOikhQLIBUn6uFg81SwLMOAUgodJF14SOBOCMdU04gDoYi0WOJJHD144TL32z4yDqCW3dnkQg== dependencies: "@types/react" "*" -"@types/react@*", "@types/react@^18.0.0", "@types/react@^18.3.3": +"@types/react@*", "@types/react@^18.3.3": version "18.3.7" resolved "https://registry.npmjs.org/@types/react/-/react-18.3.7.tgz" integrity sha512-KUnDCJF5+AiZd8owLIeVHqmW9yM4sqmDVf2JRJiBMFkGvkoZ4/WyV2lL4zVsoinmRS/W3FeEdZLEWFRofnT2FQ== @@ -927,7 +1124,7 @@ natural-compare "^1.4.0" ts-api-utils "^1.3.0" -"@typescript-eslint/parser@^8.0.0 || ^8.0.0-alpha.0", "@typescript-eslint/parser@8.6.0": +"@typescript-eslint/parser@8.6.0": version "8.6.0" resolved "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.6.0.tgz" integrity sha512-eQcbCuA2Vmw45iGfcyG4y6rS7BhWfz9MQuk409WD47qMM+bKCGQWXxvoOs1DUp+T7UBMTtRTVT+kXr7Sh4O9Ow== @@ -1034,7 +1231,7 @@ acorn-walk@^8.1.1: dependencies: acorn "^8.11.0" -"acorn@^6.0.0 || ^7.0.0 || ^8.0.0", acorn@^8.11.0, acorn@^8.12.0, acorn@^8.4.1: +acorn@^8.11.0, acorn@^8.12.0, acorn@^8.4.1: version "8.12.1" resolved "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz" integrity sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg== @@ -1132,9 +1329,6 @@ argparse@^2.0.1: resolved "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz" integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== -aria-query@^5.0.0: - version "5.3.2" - aria-query@5.3.0: version "5.3.0" resolved "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz" @@ -1142,6 +1336,11 @@ aria-query@5.3.0: dependencies: dequal "^2.0.3" +aria-query@^5.0.0: + version "5.3.2" + resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-5.3.2.tgz#93f81a43480e33a338f19163a3d10a50c01dcd59" + integrity sha512-COROpnaoap1E2F000S62r6A60uHZnmlvomhfyT2DlTcrY1OrBKn2UhH7qn5wTC9zMvD0AY7csdPSNwKP+7WiQw== + async-limiter@~1.0.0: version "1.0.1" resolved "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz" @@ -1178,7 +1377,7 @@ axios@^1.7.7: form-data "^4.0.0" proxy-from-env "^1.1.0" -babel-jest@^29.0.0, babel-jest@^29.7.0: +babel-jest@^29.7.0: version "29.7.0" resolved "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz" integrity sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg== @@ -1278,7 +1477,7 @@ braces@^3.0.3, braces@~3.0.2: dependencies: fill-range "^7.1.1" -browserslist@^4.23.1, browserslist@^4.23.3, "browserslist@>= 4.21.0": +browserslist@^4.23.1, browserslist@^4.23.3: version "4.23.3" resolved "https://registry.npmjs.org/browserslist/-/browserslist-4.23.3.tgz" integrity sha512-btwCFJVjI4YWDNfau8RhZ+B1Q/VLoUITrm3RlP6y1tYGWIOa+InuYiRGXUBXo8nA1qKmHMyLB/iVQg5TT4eFoA== @@ -1409,7 +1608,7 @@ co@^4.6.0: resolved "https://registry.npmjs.org/co/-/co-4.6.0.tgz" integrity sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ== -codemirror@^5.52.2, codemirror@^5.65.18, codemirror@5.x: +codemirror@^5.65.18: version "5.65.18" resolved "https://registry.npmjs.org/codemirror/-/codemirror-5.65.18.tgz" integrity sha512-Gaz4gHnkbHMGgahNt3CA5HBk5lLQBqmD/pBgeB4kQU6OedZmqMBjlRF0LSrp2tJ4wlLNPm2FfaUd1pDy0mdlpA== @@ -1433,16 +1632,16 @@ color-convert@^2.0.1: dependencies: color-name "~1.1.4" -color-name@~1.1.4: - version "1.1.4" - resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz" - integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== - color-name@1.1.3: version "1.1.3" resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz" integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + combined-stream@^1.0.8: version "1.0.8" resolved "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz" @@ -1731,7 +1930,7 @@ eslint-visitor-keys@^4.0.0: resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.0.0.tgz" integrity sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw== -"eslint@^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0", "eslint@^6.0.0 || ^7.0.0 || >=8.0.0", "eslint@^8.57.0 || ^9.0.0", eslint@^9.9.0, eslint@>=7: +eslint@^9.9.0: version "9.10.0" resolved "https://registry.npmjs.org/eslint/-/eslint-9.10.0.tgz" integrity sha512-Y4D0IgtBZfOcOUAIQTSXBKoNGfY0REGqHJG6+Q81vNippW5YlKjHFj4soMxamKK1NXHUWuBZTLdU3Km+L/pcHw== @@ -1861,7 +2060,7 @@ fast-glob@^3.3.0, fast-glob@^3.3.2: merge2 "^1.3.0" micromatch "^4.0.4" -fast-json-stable-stringify@^2.0.0, fast-json-stable-stringify@^2.1.0, fast-json-stable-stringify@2.x: +fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0, fast-json-stable-stringify@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz" integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== @@ -1982,6 +2181,8 @@ fs.realpath@^1.0.0: fsevents@^2.3.2, fsevents@~2.3.2, fsevents@~2.3.3: version "2.3.3" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" + integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== function-bind@^1.1.2: version "1.1.2" @@ -2008,7 +2209,7 @@ get-stream@^6.0.0: resolved "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz" integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== -glob-parent@^5.1.2: +glob-parent@^5.1.2, glob-parent@~5.1.2: version "5.1.2" resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz" integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== @@ -2022,13 +2223,6 @@ glob-parent@^6.0.2: dependencies: is-glob "^4.0.3" -glob-parent@~5.1.2: - version "5.1.2" - resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz" - integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== - dependencies: - is-glob "^4.0.1" - glob@^10.3.10: version "10.4.5" resolved "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz" @@ -2161,7 +2355,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@^2.0.3, inherits@^2.0.4, inherits@2: +inherits@2, inherits@^2.0.3, inherits@^2.0.4: version "2.0.4" resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -2508,7 +2702,7 @@ jest-resolve-dependencies@^29.7.0: jest-regex-util "^29.6.3" jest-snapshot "^29.7.0" -jest-resolve@*, jest-resolve@^29.7.0: +jest-resolve@^29.7.0: version "29.7.0" resolved "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.7.0.tgz" integrity sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA== @@ -2652,7 +2846,7 @@ jest-worker@^29.7.0: merge-stream "^2.0.0" supports-color "^8.0.0" -jest@^29.0.0, jest@^29.7.0: +jest@^29.7.0: version "29.7.0" resolved "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz" integrity sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw== @@ -2662,7 +2856,7 @@ jest@^29.0.0, jest@^29.7.0: import-local "^3.0.2" jest-cli "^29.7.0" -jiti@*, jiti@^1.21.0: +jiti@^1.21.0: version "1.21.6" resolved "https://registry.npmjs.org/jiti/-/jiti-1.21.6.tgz" integrity sha512-2yTgeWTWzMWkHu6Jp9NKgePDaYHbntiwvYuuJLbbN9vl7DC9DvXKOB2BC3ZZ92D3cvV/aflH0osDfwpHepQ53w== @@ -3270,7 +3464,7 @@ postcss-value-parser@^4.0.0, postcss-value-parser@^4.2.0: resolved "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz" integrity sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ== -postcss@^8.0.0, postcss@^8.1.0, postcss@^8.2.14, postcss@^8.4.21, postcss@^8.4.23, postcss@^8.4.43, postcss@^8.4.47, postcss@>=8.0.9: +postcss@^8.4.23, postcss@^8.4.43, postcss@^8.4.47: version "8.4.47" resolved "https://registry.npmjs.org/postcss/-/postcss-8.4.47.tgz" integrity sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ== @@ -3345,7 +3539,7 @@ react-codemirror2@^8.0.0: resolved "https://registry.npmjs.org/react-codemirror2/-/react-codemirror2-8.0.0.tgz" integrity sha512-JIbhXoghvX0BrasIoCQvRxBPIU78plfjF1Buz0gaMFvZXwEDjkCYBkQhucoOtudQ7ikbB1jJUnmCsutElti7yA== -react-dom@^18.0.0, react-dom@^18.3.1, "react-dom@>=16.14.0 <20.0.0 || ^19.0.0-0", react-dom@>=16.8: +react-dom@^18.3.1: version "18.3.1" resolved "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz" integrity sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw== @@ -3383,7 +3577,7 @@ react-router@6.26.2: dependencies: "@remix-run/router" "1.19.2" -react@^18.0.0, react@^18.3.1, "react@>=15.5 <=18.x", "react@>=16.14.0 <20.0.0 || ^19.0.0-0", react@>=16.8: +react@^18.3.1: version "18.3.1" resolved "https://registry.npmjs.org/react/-/react-18.3.1.tgz" integrity sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ== @@ -3513,12 +3707,7 @@ scheduler@^0.23.2: dependencies: loose-envify "^1.1.0" -semver@^6.3.0: - version "6.3.1" - resolved "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz" - integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== - -semver@^6.3.1: +semver@^6.3.0, semver@^6.3.1: version "6.3.1" resolved "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== @@ -3608,13 +3797,6 @@ stack-utils@^2.0.3: dependencies: escape-string-regexp "^2.0.0" -string_decoder@^1.1.1: - version "1.3.0" - resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz" - integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== - dependencies: - safe-buffer "~5.2.0" - string-length@^4.0.1: version "4.0.2" resolved "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz" @@ -3650,6 +3832,13 @@ string-width@^5.0.1, string-width@^5.1.2: emoji-regex "^9.2.2" strip-ansi "^7.0.1" +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + "strip-ansi-cjs@npm:strip-ansi@^6.0.1": version "6.0.1" resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz" @@ -3835,7 +4024,7 @@ ts-jest@^29.2.5: semver "^7.6.3" yargs-parser "^21.1.1" -ts-node@^10.9.2, ts-node@>=9.0.0: +ts-node@^10.9.2: version "10.9.2" resolved "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz" integrity sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ== @@ -3880,7 +4069,7 @@ typescript-eslint@^8.0.1: "@typescript-eslint/parser" "8.6.0" "@typescript-eslint/utils" "8.6.0" -typescript@^5.5.3, typescript@>=2.7, typescript@>=4.2.0, "typescript@>=4.3 <6": +typescript@^5.5.3: version "5.6.2" resolved "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz" integrity sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw== @@ -3929,7 +4118,7 @@ v8-to-istanbul@^9.0.1: "@types/istanbul-lib-coverage" "^2.0.1" convert-source-map "^2.0.0" -"vite@^4.2.0 || ^5.0.0", vite@^5.4.1: +vite@^5.4.1: version "5.4.6" resolved "https://registry.npmjs.org/vite/-/vite-5.4.6.tgz" integrity sha512-IeL5f8OO5nylsgzd9tq4qD2QqI0k2CQLGrWD0rCN0EQJZpBK5vJAx0I+GDkMOXxQX/OfFHMuLIx6ddAxGX/k+Q== @@ -4106,7 +4295,7 @@ yargs@^17.3.1: y18n "^5.0.5" yargs-parser "^21.1.1" -yjs@^13.0.0, yjs@^13.5.17, yjs@^13.5.6, yjs@^13.6.20: +yjs@^13.6.20: version "13.6.20" resolved "https://registry.npmjs.org/yjs/-/yjs-13.6.20.tgz" integrity sha512-Z2YZI+SYqK7XdWlloI3lhMiKnCdFCVC4PchpdO+mCYwtiTwncjUbnRK9R1JmkNfdmHyDXuWN3ibJAt0wsqTbLQ== From 14b83cdfd73d47f96381c969c43487cf8da4782e Mon Sep 17 00:00:00 2001 From: Kim Yongbeom Date: Mon, 11 Nov 2024 20:58:48 +0800 Subject: [PATCH 05/16] feat: https --- peerprep/frontend/.env.production | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/peerprep/frontend/.env.production b/peerprep/frontend/.env.production index 8c815c60a4..89de4e1d10 100644 --- a/peerprep/frontend/.env.production +++ b/peerprep/frontend/.env.production @@ -1,9 +1,9 @@ -VITE_AUTH_API_URL=http://user.peerprep.app/auth -VITE_MATCHING_API_URL=http://matching.peerprep.app/matchingrequest -VITE_USER_API_URL=http://user.peerprep.app/api/users -VITE_USERS_API_URL=http://user.peerprep.app/users -VITE_QUESTION_API_URL=http://question.peerperp.app/api/questions -VITE_TESTCASE_API_URL=http://question.peerperp.app/api/testcases -VITE_ASSESSCODE_API_URL=http://collab.peerprep.app/api/gpt/assess +VITE_AUTH_API_URL=https://user.peerprep.app/auth +VITE_MATCHING_API_URL=https://matching.peerprep.app/matchingrequest +VITE_USER_API_URL=https://user.peerprep.app/api/users +VITE_USERS_API_URL=https://user.peerprep.app/users +VITE_QUESTION_API_URL=https://question.peerperp.app/api/questions +VITE_TESTCASE_API_URL=https://question.peerperp.app/api/testcases +VITE_ASSESSCODE_API_URL=https://collab.peerprep.app/api/gpt/assess VITE_WS_PROVIDER_URL=ws://collab.peerprep.app/ -VITE_SOCKET_IO_URL=http://collab.peerprep.app/ +VITE_SOCKET_IO_URL=https://collab.peerprep.app/ From 74c94156781fca1162596609cd35985ce78b288e Mon Sep 17 00:00:00 2001 From: Kim Yongbeom Date: Mon, 11 Nov 2024 21:01:15 +0800 Subject: [PATCH 06/16] fix (collab): CORS --- peerprep/backend/collab-service/src/server.js | 108 +++++++++--------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/peerprep/backend/collab-service/src/server.js b/peerprep/backend/collab-service/src/server.js index 76f03ab3e1..48a63d4262 100644 --- a/peerprep/backend/collab-service/src/server.js +++ b/peerprep/backend/collab-service/src/server.js @@ -25,80 +25,80 @@ connectDB(); app.use('/api', gptRoutes); // Endpoint to save a document to MongoDB -app.post('/api/saveDocument', async (req, res) => { - try { - const { name, data } = req.body; - await storeDocument(name, Buffer.from(data)); - res.status(200).json({ message: 'Document saved successfully' }); - } catch (error) { - res.status(500).json({ error: error.message }); - } +app.post('/api/saveDocument', async(req, res) => { + try { + const { name, data } = req.body; + await storeDocument(name, Buffer.from(data)); + res.status(200).json({ message: 'Document saved successfully' }); + } catch (error) { + res.status(500).json({ error: error.message }); + } }); // Endpoint to retrieve a document from MongoDB -app.get('/api/getDocument/:name', async (req, res) => { - try { - const name = req.params.name; - const documentData = await getDocument(name); - res.status(200).json({ data: Array.from(documentData) }); - } catch (error) { - res.status(500).json({ error: error.message }); - } +app.get('/api/getDocument/:name', async(req, res) => { + try { + const name = req.params.name; + const documentData = await getDocument(name); + res.status(200).json({ data: Array.from(documentData) }); + } catch (error) { + res.status(500).json({ error: error.message }); + } }); // Serve static files and set up WebSocket connections for y-websocket const staticServer = new StaticServer('../', { cache: false, gzip: true }); app.get('*', (req, res) => { - staticServer.serve(req, res); + staticServer.serve(req, res); }); wss.on('connection', (conn, req) => { - setupWSConnection(conn, req, { gc: req.url.slice(1) !== 'ws/prosemirror-versions' }); + setupWSConnection(conn, req, { gc: req.url.slice(1) !== 'ws/prosemirror-versions' }); }); const io = new Server(server, { - cors: { - origin: "http://localhost:5173", - methods: ["GET", "POST"], - }, + cors: { + origin: "*", + methods: ["GET", "POST"], + }, }); io.on("connection", (socket) => { - console.log(`User Connected: ${socket.id}`); - - socket.on("join_room", (room) => { - try { - socket.join(room); - console.log(`User ${socket.id} joined room ${room}`); - } catch (error) { - console.error(`Error joining room: ${error.message}`); - socket.emit("error_message", { message: "Failed to join room. Try again later." }); - } - }); - - socket.on("send_message", (data) => { - try { - socket.in(data.room).emit("receive_message", data); - } catch (error) { - console.error(`Error sending message: ${error.message}`); - socket.emit("error_message", { message: "Failed to send message. Try again later." }); - } - }); - - socket.on("disconnect", (reason) => { - console.log(`User Disconnected: ${socket.id} - Reason: ${reason}`); - if (reason === "io server disconnect") { - socket.connect(); // Reconnect on server-side disconnect - } - }); - - socket.on("error", (error) => { - console.error(`Socket error: ${error.message}`); - }); + console.log(`User Connected: ${socket.id}`); + + socket.on("join_room", (room) => { + try { + socket.join(room); + console.log(`User ${socket.id} joined room ${room}`); + } catch (error) { + console.error(`Error joining room: ${error.message}`); + socket.emit("error_message", { message: "Failed to join room. Try again later." }); + } + }); + + socket.on("send_message", (data) => { + try { + socket.in(data.room).emit("receive_message", data); + } catch (error) { + console.error(`Error sending message: ${error.message}`); + socket.emit("error_message", { message: "Failed to send message. Try again later." }); + } + }); + + socket.on("disconnect", (reason) => { + console.log(`User Disconnected: ${socket.id} - Reason: ${reason}`); + if (reason === "io server disconnect") { + socket.connect(); // Reconnect on server-side disconnect + } + }); + + socket.on("error", (error) => { + console.error(`Socket error: ${error.message}`); + }); }); const PORT = process.env.PORT || 1234; server.listen(PORT, () => { - console.log(`Server is running at http://localhost:${PORT}`); + console.log(`Server is running at http://localhost:${PORT}`); }); \ No newline at end of file From 90a81a7fd5d8926044d17563e2cfbf6695d224d2 Mon Sep 17 00:00:00 2001 From: Kim Yongbeom Date: Mon, 11 Nov 2024 21:08:52 +0800 Subject: [PATCH 07/16] feat: wss instead of ws --- peerprep/frontend/.env.production | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/peerprep/frontend/.env.production b/peerprep/frontend/.env.production index 89de4e1d10..3ed77a28a7 100644 --- a/peerprep/frontend/.env.production +++ b/peerprep/frontend/.env.production @@ -5,5 +5,5 @@ VITE_USERS_API_URL=https://user.peerprep.app/users VITE_QUESTION_API_URL=https://question.peerperp.app/api/questions VITE_TESTCASE_API_URL=https://question.peerperp.app/api/testcases VITE_ASSESSCODE_API_URL=https://collab.peerprep.app/api/gpt/assess -VITE_WS_PROVIDER_URL=ws://collab.peerprep.app/ +VITE_WS_PROVIDER_URL=wss://collab.peerprep.app/ VITE_SOCKET_IO_URL=https://collab.peerprep.app/ From e3407990f5a620a94cc2f707ca50cd18597896e9 Mon Sep 17 00:00:00 2001 From: Kim Yongbeom Date: Mon, 11 Nov 2024 21:34:55 +0800 Subject: [PATCH 08/16] feat: Allow CORS all --- peerprep/backend/collab-service/src/server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/peerprep/backend/collab-service/src/server.js b/peerprep/backend/collab-service/src/server.js index 48a63d4262..b862800a7c 100644 --- a/peerprep/backend/collab-service/src/server.js +++ b/peerprep/backend/collab-service/src/server.js @@ -58,7 +58,7 @@ wss.on('connection', (conn, req) => { const io = new Server(server, { cors: { - origin: "*", + origin: true, methods: ["GET", "POST"], }, }); From 17f49b33d90b4d72859a052a3151c65777a86df9 Mon Sep 17 00:00:00 2001 From: Kim Yongbeom Date: Mon, 11 Nov 2024 21:59:17 +0800 Subject: [PATCH 09/16] feat: Fix typo in url --- peerprep/frontend/.env.production | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/peerprep/frontend/.env.production b/peerprep/frontend/.env.production index 3ed77a28a7..2c4acdab99 100644 --- a/peerprep/frontend/.env.production +++ b/peerprep/frontend/.env.production @@ -2,8 +2,8 @@ VITE_AUTH_API_URL=https://user.peerprep.app/auth VITE_MATCHING_API_URL=https://matching.peerprep.app/matchingrequest VITE_USER_API_URL=https://user.peerprep.app/api/users VITE_USERS_API_URL=https://user.peerprep.app/users -VITE_QUESTION_API_URL=https://question.peerperp.app/api/questions -VITE_TESTCASE_API_URL=https://question.peerperp.app/api/testcases +VITE_QUESTION_API_URL=https://question.peerprep.app/api/questions +VITE_TESTCASE_API_URL=https://question.peerprep.app/api/testcases VITE_ASSESSCODE_API_URL=https://collab.peerprep.app/api/gpt/assess VITE_WS_PROVIDER_URL=wss://collab.peerprep.app/ VITE_SOCKET_IO_URL=https://collab.peerprep.app/ From 34b0a288a34f8e13c218704a0517004cc5d8193b Mon Sep 17 00:00:00 2001 From: Kim Yongbeom Date: Tue, 12 Nov 2024 00:40:55 +0800 Subject: [PATCH 10/16] feat: SSL/TLS for wss connections --- peerprep/backend/collab-service/src/server.js | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/peerprep/backend/collab-service/src/server.js b/peerprep/backend/collab-service/src/server.js index b862800a7c..b6c9e53c2e 100644 --- a/peerprep/backend/collab-service/src/server.js +++ b/peerprep/backend/collab-service/src/server.js @@ -1,6 +1,8 @@ const express = require('express'); const WebSocket = require('ws'); const http = require('http'); +const https = require('https'); +const fs = require('fs'); const StaticServer = require('node-static').Server; const ywsUtils = require('y-websocket/bin/utils'); const setupWSConnection = ywsUtils.setupWSConnection; @@ -11,10 +13,29 @@ const { Server } = require("socket.io"); const cors = require("cors"); const gptRoutes = require('./routes/gptRoutes'); const dotenv = require('dotenv'); - +dotenv.config(); const app = express(); -const server = http.createServer(app); -const wss = new WebSocket.Server({ noServer: true }); + +let server; +if (process.env.SSL_KEY_PATH && process.env.SSL_CERT_PATH && process.env.SSL_CA_PATH) { + // Load SSL/TLS certificates from environment variables + const options = { + key: fs.readFileSync(process.env.SSL_KEY_PATH), + cert: fs.readFileSync(process.env.SSL_CERT_PATH), + ca: fs.readFileSync(process.env.SSL_CA_PATH) + }; + + // Create an HTTPS server + server = https.createServer(options, app); + console.log('HTTPS server created with SSL/TLS certificates.'); +} else { + // Fallback to HTTP server if SSL/TLS environment variables are not set + const http = require('http'); + server = http.createServer(app); + console.log('HTTP server created as SSL/TLS certificates are not provided.'); +} + +const wss = new WebSocket.Server({ server }); app.use(cors()); app.use(express.json()); From dc28346d32813826d128512abaa271f168d98698 Mon Sep 17 00:00:00 2001 From: Kim Yongbeom Date: Tue, 12 Nov 2024 00:49:51 +0800 Subject: [PATCH 11/16] feat: Mount letsencrypt certs for matching service --- peerprep/backend/docker-compose.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/peerprep/backend/docker-compose.yaml b/peerprep/backend/docker-compose.yaml index a279270c3e..080bc4c870 100644 --- a/peerprep/backend/docker-compose.yaml +++ b/peerprep/backend/docker-compose.yaml @@ -28,6 +28,8 @@ services: env_file: - ./matching-service/.env restart: always + volumes: + - /etc/letsencrypt:/etc/letsencrypt collab-service: build: From 91e0eb897e2a0b436763dbfd02db9e17e8f368a0 Mon Sep 17 00:00:00 2001 From: Kim Yongbeom Date: Wed, 13 Nov 2024 21:25:32 +0800 Subject: [PATCH 12/16] feat: Sanity endpoint for collab + change port from 3000 to 3333 --- peerprep/backend/collab-service/src/server.js | 11 +++++++++-- peerprep/backend/docker-compose.yaml | 6 +++--- peerprep/backend/matching-service/.env | 2 +- .../src/controllers/requestController.ts | 2 +- .../matching-service/src/controllers/sseController.ts | 2 +- peerprep/backend/matching-service/src/server.ts | 2 +- peerprep/frontend/.env.development | 2 +- 7 files changed, 17 insertions(+), 10 deletions(-) diff --git a/peerprep/backend/collab-service/src/server.js b/peerprep/backend/collab-service/src/server.js index b6c9e53c2e..08842368fd 100644 --- a/peerprep/backend/collab-service/src/server.js +++ b/peerprep/backend/collab-service/src/server.js @@ -17,7 +17,10 @@ dotenv.config(); const app = express(); let server; -if (process.env.SSL_KEY_PATH && process.env.SSL_CERT_PATH && process.env.SSL_CA_PATH) { +if (process.env.SSL_KEY_PATH && process.env.SSL_CERT_PATH && process.env.SSL_CA_PATH && + fs.existsSync(process.env.SSL_KEY_PATH) && + fs.existsSync(process.env.SSL_CERT_PATH) && + fs.existsSync(process.env.SSL_CA_PATH)) { // Load SSL/TLS certificates from environment variables const options = { key: fs.readFileSync(process.env.SSL_KEY_PATH), @@ -45,6 +48,11 @@ connectDB(); app.use('/api', gptRoutes); +// Sanity testing endpoint +app.get('/hello', (req, res) => { + res.status(200).json({ message: 'Hello, world!' }); +}); + // Endpoint to save a document to MongoDB app.post('/api/saveDocument', async(req, res) => { try { @@ -118,7 +126,6 @@ io.on("connection", (socket) => { }); }); - const PORT = process.env.PORT || 1234; server.listen(PORT, () => { console.log(`Server is running at http://localhost:${PORT}`); diff --git a/peerprep/backend/docker-compose.yaml b/peerprep/backend/docker-compose.yaml index 080bc4c870..4a28b9ba1d 100644 --- a/peerprep/backend/docker-compose.yaml +++ b/peerprep/backend/docker-compose.yaml @@ -24,12 +24,10 @@ services: context: ./matching-service dockerfile: Dockerfile ports: - - "3000:3000" + - "3333:3333" env_file: - ./matching-service/.env restart: always - volumes: - - /etc/letsencrypt:/etc/letsencrypt collab-service: build: @@ -41,6 +39,8 @@ services: env_file: - ./collab-service/.env restart: always + volumes: + - "/etc/letsencrypt:/etc/letsencrypt" networks: my-network: diff --git a/peerprep/backend/matching-service/.env b/peerprep/backend/matching-service/.env index f0b7a2596f..0495a88ec3 100644 --- a/peerprep/backend/matching-service/.env +++ b/peerprep/backend/matching-service/.env @@ -1,3 +1,3 @@ REDIS_CLOUD_URI=redis://default:TRXhRgutyzRMWWE8Mpl0RAYTECWRuxFH@redis-14179.c295.ap-southeast-1-1.ec2.redns.redis-cloud.com:14179/0 NODE_ENV=development -PORT=3000 +PORT=3333 diff --git a/peerprep/backend/matching-service/src/controllers/requestController.ts b/peerprep/backend/matching-service/src/controllers/requestController.ts index 5da340b530..bbb4908d4d 100644 --- a/peerprep/backend/matching-service/src/controllers/requestController.ts +++ b/peerprep/backend/matching-service/src/controllers/requestController.ts @@ -20,7 +20,7 @@ export const createRequest = async (req: Request, res: Response): Promise // find within 30 seconds let matchedUser = null; - const timeout = 30000; + const timeout = 33330; const startTime = Date.now(); while (!matchedUser && Date.now() - startTime < timeout) { diff --git a/peerprep/backend/matching-service/src/controllers/sseController.ts b/peerprep/backend/matching-service/src/controllers/sseController.ts index 435fb826ad..3580ebf49e 100644 --- a/peerprep/backend/matching-service/src/controllers/sseController.ts +++ b/peerprep/backend/matching-service/src/controllers/sseController.ts @@ -10,7 +10,7 @@ export const matchStatusStream = (req: Request, res: Response) => { res.flushHeaders(); // Ensure headers are sent immediately const userId = req.params.userId as string; // Get userId from URL parameters - const timeout = 30000; // 30-second timeout for example + const timeout = 33330; // 30-second timeout for example const startTime = Date.now(); // Function to send data to client diff --git a/peerprep/backend/matching-service/src/server.ts b/peerprep/backend/matching-service/src/server.ts index bd1c8efd3a..64003fb506 100644 --- a/peerprep/backend/matching-service/src/server.ts +++ b/peerprep/backend/matching-service/src/server.ts @@ -8,7 +8,7 @@ import apiRoutes from './routes/apiRoutes'; // Import your routes dotenv.config(); -const PORT = process.env.PORT ?? 3000; +const PORT = process.env.PORT ?? 3333; const app = express(); diff --git a/peerprep/frontend/.env.development b/peerprep/frontend/.env.development index 794be3a003..1b21ad7875 100644 --- a/peerprep/frontend/.env.development +++ b/peerprep/frontend/.env.development @@ -1,5 +1,5 @@ VITE_AUTH_API_URL=http://localhost:3001/auth -VITE_MATCHING_API_URL=http://localhost:3000/matchingrequest +VITE_MATCHING_API_URL=http://localhost:3333/matchingrequest VITE_USER_API_URL=http://localhost:3001/api/users VITE_USERS_API_URL=http://localhost:3001/users VITE_ASSESSCODE_API_URL=http://localhost:1234/api/gpt/assess From 0458da2717581590d0c8eb6b384ca1d34d013288 Mon Sep 17 00:00:00 2001 From: Kim Yongbeom Date: Wed, 13 Nov 2024 22:25:53 +0800 Subject: [PATCH 13/16] feat: Set up CORS for wss server --- peerprep/backend/collab-service/src/server.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/peerprep/backend/collab-service/src/server.js b/peerprep/backend/collab-service/src/server.js index 08842368fd..1584995528 100644 --- a/peerprep/backend/collab-service/src/server.js +++ b/peerprep/backend/collab-service/src/server.js @@ -38,7 +38,13 @@ if (process.env.SSL_KEY_PATH && process.env.SSL_CERT_PATH && process.env.SSL_CA_ console.log('HTTP server created as SSL/TLS certificates are not provided.'); } -const wss = new WebSocket.Server({ server }); +const wss = new WebSocket.Server({ + server, + verifyClient: (info, done) => { + // Allow connections from any origin + done(true); + } +}); app.use(cors()); app.use(express.json()); From d3a05ca27f158583f7ef82cd90caae0237a07743 Mon Sep 17 00:00:00 2001 From: Kim Yongbeom Date: Thu, 14 Nov 2024 01:19:18 +0800 Subject: [PATCH 14/16] feat: collab_service: Remove https --- peerprep/backend/collab-service/src/server.js | 22 +------------------ 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/peerprep/backend/collab-service/src/server.js b/peerprep/backend/collab-service/src/server.js index 1584995528..4cf6b82ae0 100644 --- a/peerprep/backend/collab-service/src/server.js +++ b/peerprep/backend/collab-service/src/server.js @@ -16,27 +16,7 @@ const dotenv = require('dotenv'); dotenv.config(); const app = express(); -let server; -if (process.env.SSL_KEY_PATH && process.env.SSL_CERT_PATH && process.env.SSL_CA_PATH && - fs.existsSync(process.env.SSL_KEY_PATH) && - fs.existsSync(process.env.SSL_CERT_PATH) && - fs.existsSync(process.env.SSL_CA_PATH)) { - // Load SSL/TLS certificates from environment variables - const options = { - key: fs.readFileSync(process.env.SSL_KEY_PATH), - cert: fs.readFileSync(process.env.SSL_CERT_PATH), - ca: fs.readFileSync(process.env.SSL_CA_PATH) - }; - - // Create an HTTPS server - server = https.createServer(options, app); - console.log('HTTPS server created with SSL/TLS certificates.'); -} else { - // Fallback to HTTP server if SSL/TLS environment variables are not set - const http = require('http'); - server = http.createServer(app); - console.log('HTTP server created as SSL/TLS certificates are not provided.'); -} +const server = http.createServer(app); const wss = new WebSocket.Server({ server, From fd0a2fac706a31d3094ebb48fa7d89e43609e753 Mon Sep 17 00:00:00 2001 From: Kim Yongbeom Date: Thu, 14 Nov 2024 01:21:30 +0800 Subject: [PATCH 15/16] feat: Replace ports 3333 with 3000 --- peerprep/backend/docker-compose.yaml | 2 +- peerprep/backend/matching-service/.env | 2 +- .../matching-service/src/controllers/requestController.ts | 2 +- .../backend/matching-service/src/controllers/sseController.ts | 2 +- peerprep/backend/matching-service/src/server.ts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/peerprep/backend/docker-compose.yaml b/peerprep/backend/docker-compose.yaml index 4a28b9ba1d..f0de2433d9 100644 --- a/peerprep/backend/docker-compose.yaml +++ b/peerprep/backend/docker-compose.yaml @@ -24,7 +24,7 @@ services: context: ./matching-service dockerfile: Dockerfile ports: - - "3333:3333" + - "3000:3000" env_file: - ./matching-service/.env restart: always diff --git a/peerprep/backend/matching-service/.env b/peerprep/backend/matching-service/.env index 0495a88ec3..f0b7a2596f 100644 --- a/peerprep/backend/matching-service/.env +++ b/peerprep/backend/matching-service/.env @@ -1,3 +1,3 @@ REDIS_CLOUD_URI=redis://default:TRXhRgutyzRMWWE8Mpl0RAYTECWRuxFH@redis-14179.c295.ap-southeast-1-1.ec2.redns.redis-cloud.com:14179/0 NODE_ENV=development -PORT=3333 +PORT=3000 diff --git a/peerprep/backend/matching-service/src/controllers/requestController.ts b/peerprep/backend/matching-service/src/controllers/requestController.ts index bbb4908d4d..5da340b530 100644 --- a/peerprep/backend/matching-service/src/controllers/requestController.ts +++ b/peerprep/backend/matching-service/src/controllers/requestController.ts @@ -20,7 +20,7 @@ export const createRequest = async (req: Request, res: Response): Promise // find within 30 seconds let matchedUser = null; - const timeout = 33330; + const timeout = 30000; const startTime = Date.now(); while (!matchedUser && Date.now() - startTime < timeout) { diff --git a/peerprep/backend/matching-service/src/controllers/sseController.ts b/peerprep/backend/matching-service/src/controllers/sseController.ts index 3580ebf49e..435fb826ad 100644 --- a/peerprep/backend/matching-service/src/controllers/sseController.ts +++ b/peerprep/backend/matching-service/src/controllers/sseController.ts @@ -10,7 +10,7 @@ export const matchStatusStream = (req: Request, res: Response) => { res.flushHeaders(); // Ensure headers are sent immediately const userId = req.params.userId as string; // Get userId from URL parameters - const timeout = 33330; // 30-second timeout for example + const timeout = 30000; // 30-second timeout for example const startTime = Date.now(); // Function to send data to client diff --git a/peerprep/backend/matching-service/src/server.ts b/peerprep/backend/matching-service/src/server.ts index 64003fb506..bd1c8efd3a 100644 --- a/peerprep/backend/matching-service/src/server.ts +++ b/peerprep/backend/matching-service/src/server.ts @@ -8,7 +8,7 @@ import apiRoutes from './routes/apiRoutes'; // Import your routes dotenv.config(); -const PORT = process.env.PORT ?? 3333; +const PORT = process.env.PORT ?? 3000; const app = express(); From 4640b87f2704d3c54261e91a24a81ab8f8d53b9a Mon Sep 17 00:00:00 2001 From: Kim Yongbeom Date: Thu, 14 Nov 2024 01:27:16 +0800 Subject: [PATCH 16/16] feat: Commit out unused variables --- .../frontend/src/views/UserServiceViews/Login.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/peerprep/frontend/src/views/UserServiceViews/Login.tsx b/peerprep/frontend/src/views/UserServiceViews/Login.tsx index 9f21e0dcfa..c7379ca697 100644 --- a/peerprep/frontend/src/views/UserServiceViews/Login.tsx +++ b/peerprep/frontend/src/views/UserServiceViews/Login.tsx @@ -9,11 +9,12 @@ const Login = () => { const [error, setError] = useState(""); // State to store error messages const navigate = useNavigate(); - // Temp stubs needed to move into Collab stub - const topic = "algorithms"; - const difficulty = "easy"; - const sessionId ="session1"; - const questionId="Q-42: Write an algorithm for Radix Sort"; + // YB: please coment out variables that you don't use because they get in the way of bundling the code. + // // Temp stubs needed to move into Collab stub + // const topic = "algorithms"; + // const difficulty = "easy"; + // const sessionId ="session1"; + // const questionId="Q-42: Write an algorithm for Radix Sort"; const handleLogin = async () => { try {