Oups dernier fix
continuous-integration/drone/push Build is passing Details

demo-IREM
Thomas Chazot 1 year ago
parent dde816f6da
commit b4184eb221

@ -25,8 +25,8 @@ fi
npm start & npm start &
node $SCRIPT_DIR/../server/server.js & node $SCRIPT_DIR/../server/socket_io/server.js &
node $SCRIPT_DIR/../src/server/server.js node $SCRIPT_DIR/../server/api/server.js

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -14,7 +14,7 @@ const port = 3003;
// Middleware // Middleware
app.use(cors( app.use(cors(
{ {
origin: ["http://localhost:3000", "http://localhost:3000"], origin: ["http://172.20.10.4:3000", "http://172.20.10.4:3000"],
credentials: true credentials: true
} }
)); // Autoriser les requêtes cross-origin )); // Autoriser les requêtes cross-origin

@ -7,7 +7,7 @@ const app = express();
const server = http.createServer(app); const server = http.createServer(app);
const io = socketIO(server, { const io = socketIO(server, {
cors: { cors: {
origin: ["http://localhost:3000", "http://localhost:3000"], // Remplacez par l'URL de votre application React origin: ["http://172.20.10.4:3000", "http://172.20.10.4:3000"], // Remplacez par l'URL de votre application React
methods: ["GET", "POST"], methods: ["GET", "POST"],
credentials: true credentials: true
} }

@ -1,11 +1,15 @@
const ADRESSE_WEBSERVER = "http://localhost:3002" const ADRESSE_WEBSERVER = "http://172.20.10.4:3002"
const ADRESSE_DBSERVER = "http://localhost:3003" const ADRESSE_DBSERVER = "http://172.20.10.4:3003"
const tmp = ADRESSE_DBSERVER const tmp = ADRESSE_DBSERVER
const tmp2 = ADRESSE_WEBSERVER const tmp2 = ADRESSE_WEBSERVER
const ADRESSE_WEBSITE = "" const ADRESSE_WEBSITE = ""
const basePath = process.env.REACT_APP_BASE_PATH || '/containers/Crypteam-website';
export {ADRESSE_DBSERVER, ADRESSE_WEBSERVER, ADRESSE_WEBSITE} const tmp3 = basePath
export {ADRESSE_DBSERVER, ADRESSE_WEBSERVER, ADRESSE_WEBSITE, basePath}

@ -42,8 +42,9 @@ import messagesEn from './Translations/en.json';
import ErrorBoundary from './Error/ErrorBoundary'; import ErrorBoundary from './Error/ErrorBoundary';
import ErrorPage from './Error/ErrorPage'; import ErrorPage from './Error/ErrorPage';
import DeducCheck from './Pages/DeducCheck'; import DeducCheck from './Pages/DeducCheck';
import {basePath} from "./AdressSetup"
const basePath = process.env.REACT_APP_BASE_PATH || '/containers/Crypteam-website';
const messages = { const messages = {
fr: messagesFr, fr: messagesFr,
@ -65,7 +66,7 @@ function App() {
//const location = useLocation(); //const location = useLocation();
const hasNavbarVisible = [basePath + "/", basePath + "/login", basePath + "/signup", basePath + "/play", basePath + "/lobby", basePath + "/endgame", basePath + "/deduc"]//.includes(window.location.pathname); const hasNavbarVisible = [basePath + "/", basePath + "/login", basePath + "/signup", basePath + "/lobby", basePath + "/endgame", basePath + "/deduc"]//.includes(window.location.pathname);
return ( return (

@ -5,6 +5,8 @@ import { FormattedMessage } from 'react-intl';
import { useTheme } from '../Style/ThemeContext'; import { useTheme } from '../Style/ThemeContext';
import COLORS from '../Style/Color'; import COLORS from '../Style/Color';
import {basePath} from "../AdressSetup"
//@ts-ignore //@ts-ignore
function BigButtonNav({ dest, img}) { function BigButtonNav({ dest, img}) {
@ -15,7 +17,7 @@ function BigButtonNav({ dest, img}) {
// }; // };
return ( return (
<Link to={dest} className="link-without-underline"> <Link to={`${basePath}/${dest}`} className="link-without-underline">
<button className='bigbuttonNabImg' style={{ backgroundColor: theme.colors.primary }}> <button className='bigbuttonNabImg' style={{ backgroundColor: theme.colors.primary }}>
<img src={img} alt="Button Image" height="100" width="100"/> <img src={img} alt="Button Image" height="100" width="100"/>
</button> </button>

@ -4,12 +4,14 @@ import './ButtonImgNav.css';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import { useTheme } from '../Style/ThemeContext'; import { useTheme } from '../Style/ThemeContext';
import {basePath} from "../AdressSetup"
//@ts-ignore //@ts-ignore
function ButtonImgNav({ dest, img, text = "" }) { function ButtonImgNav({ dest, img, text = "" }) {
const theme = useTheme(); const theme = useTheme();
return ( return (
<Link to={dest} className="link-without-underline"> {/*target='_blank' ==> ouvre un nouvelle onglet*/ } <Link to={`${basePath}/${dest}`} className="link-without-underline"> {/*target='_blank' ==> ouvre un nouvelle onglet*/ }
<button className='buttonNabImg' style={{ backgroundColor: theme.colors.primary, color: theme.colors.secondary}}> <button className='buttonNabImg' style={{ backgroundColor: theme.colors.primary, color: theme.colors.secondary}}>
<img src={img} alt="Button Image" height="50" width="50"/> <img src={img} alt="Button Image" height="50" width="50"/>
<p>{text}</p> <p>{text}</p>

@ -20,6 +20,7 @@ import User from "../model/User";
import { json } from "body-parser"; import { json } from "body-parser";
import html2canvas from 'html2canvas'; import html2canvas from 'html2canvas';
import jsPDF from 'jspdf'; import jsPDF from 'jspdf';
import {basePath} from "../AdressSetup"
interface MyGraphComponentProps { interface MyGraphComponentProps {
onNodeClick: (shouldShowChoiceBar: boolean) => void; onNodeClick: (shouldShowChoiceBar: boolean) => void;
@ -67,7 +68,7 @@ let cptBug = 0
let cptUseEffect = 0 let cptUseEffect = 0
let testPlayers: Player[] = [] let testPlayers: Player[] = []
const basePath = process.env.REACT_APP_BASE_PATH || '/containers/Crypteam-website';
const MyGraphComponent: React.FC<MyGraphComponentProps> = ({onNodeClick, handleShowTurnBar, handleTurnBarTextChange, playerTouched, setPlayerTouched, changecptTour, solo, isDaily, isEasy, addToHistory, showLast, setNetwork, setNetworkEnigme, setPlayerIndex, askedWrong, setAskedWrong, importToPdf, setImportToPdf}) => { const MyGraphComponent: React.FC<MyGraphComponentProps> = ({onNodeClick, handleShowTurnBar, handleTurnBarTextChange, playerTouched, setPlayerTouched, changecptTour, solo, isDaily, isEasy, addToHistory, showLast, setNetwork, setNetworkEnigme, setPlayerIndex, askedWrong, setAskedWrong, importToPdf, setImportToPdf}) => {
let cptTour: number = 0 let cptTour: number = 0

@ -10,6 +10,8 @@ import Button from 'react-bootstrap/Button';
import { socket } from '../SocketConfig'; import { socket } from '../SocketConfig';
import Tooltip from 'react-bootstrap/esm/Tooltip'; import Tooltip from 'react-bootstrap/esm/Tooltip';
import OverlayTrigger from 'react-bootstrap/esm/OverlayTrigger'; import OverlayTrigger from 'react-bootstrap/esm/OverlayTrigger';
import {basePath} from "../AdressSetup"
interface LobbyContainerProps { interface LobbyContainerProps {
roomNum : string roomNum : string
@ -20,7 +22,6 @@ interface LobbyContainerProps {
//? mettre un "nbplayermax" si le nombre de joueur max peut etre fixé ? //? mettre un "nbplayermax" si le nombre de joueur max peut etre fixé ?
} }
const basePath = process.env.REACT_APP_BASE_PATH || '/containers/Crypteam-website';
const LobbyContainer: React.FC<LobbyContainerProps> = ({roomNum, HeadPlayer, nbPlayer, setFirst, started}) => { const LobbyContainer: React.FC<LobbyContainerProps> = ({roomNum, HeadPlayer, nbPlayer, setFirst, started}) => {
const theme=useTheme(); const theme=useTheme();

@ -25,7 +25,7 @@ import { useTheme } from '../Style/ThemeContext';
import { useAuth } from '../Contexts/AuthContext'; import { useAuth } from '../Contexts/AuthContext';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
const basePath = process.env.REACT_APP_BASE_PATH || '/containers/Crypteam-website'; import {basePath} from "../AdressSetup"
// @ts-ignore // @ts-ignore
function AppNavbar({changeLocale}) { function AppNavbar({changeLocale}) {
@ -87,11 +87,11 @@ function AppNavbar({changeLocale}) {
</NavDropdown> </NavDropdown>
) : ( ) : (
<> <>
<Nav.Link href="/login" className='navbar-title-dd' style={{ backgroundColor: theme.colors.secondary }}> <Nav.Link href={`${basePath}/login`} className='navbar-title-dd' style={{ backgroundColor: theme.colors.secondary }}>
<BiLogInCircle /> <BiLogInCircle />
<FormattedMessage id="log_in" /> <FormattedMessage id="log_in" />
</Nav.Link> </Nav.Link>
<Nav.Link href="/signup" className='navbar-title-dd' style={{ backgroundColor: theme.colors.secondary }}> <Nav.Link href={`${basePath}/signup`} className='navbar-title-dd' style={{ backgroundColor: theme.colors.secondary }}>
<BsFillPersonPlusFill /> <BsFillPersonPlusFill />
<FormattedMessage id="sign_up" /> <FormattedMessage id="sign_up" />
</Nav.Link> </Nav.Link>

@ -28,7 +28,7 @@ function ErrorPage({ code = "", msg = "Something is wrong"}) {
</div> </div>
<div className='centerDivH' style={{margin: "20px"}}> <div className='centerDivH' style={{margin: "20px"}}>
<Button href={`${basePath}/join`} variant='danger'>Retour à l'accueil</Button> <Button href={`${basePath}/`} variant='danger'>Retour à l'accueil</Button>
</div> </div>
</div> </div>
); );

@ -34,6 +34,8 @@ import { useGame } from '../Contexts/GameContext';
/* Boostrap */ /* Boostrap */
import { Button } from 'react-bootstrap'; import { Button } from 'react-bootstrap';
import Bot from '../model/Bot'; import Bot from '../model/Bot';
import {basePath} from "../AdressSetup"
function EndGame() { function EndGame() {
@ -194,7 +196,7 @@ function EndGame() {
<div id="vis-graph"/> <div id="vis-graph"/>
<div className='centerDivH' onClick={resetAll} style={{margin: "20px"}}> <div className='centerDivH' onClick={resetAll} style={{margin: "20px"}}>
<Button href='/'>Retour à l'accueil</Button> <Button href={`${basePath}/`}>Retour à l'accueil</Button>
</div> </div>
</div> </div>

@ -12,8 +12,7 @@ import {loadImageAsync} from "../ImageHelper"
import { socket } from '../SocketConfig'; import { socket } from '../SocketConfig';
import JSONParser from '../JSONParser'; import JSONParser from '../JSONParser';
import {basePath} from "../AdressSetup"
const basePath = process.env.REACT_APP_BASE_PATH || '/containers/Crypteam-website';
// @ts-ignore // @ts-ignore
@ -68,7 +67,7 @@ function Home() {
Si un joueur place un jeton carré, le questionneur doit également jouer son jeu en plaçant un jeton carré de sa couleur sur un nœud du graphique. La contre-manipulation devient ainsi une arme redoutable pour détourner l'accusation et semer la confusion. Pour en savoir plus, plongez-vous dans les détails de ce passionnant récit sur une autre page. Si un joueur place un jeton carré, le questionneur doit également jouer son jeu en plaçant un jeton carré de sa couleur sur un nœud du graphique. La contre-manipulation devient ainsi une arme redoutable pour détourner l'accusation et semer la confusion. Pour en savoir plus, plongez-vous dans les détails de ce passionnant récit sur une autre page.
</p> </p>
<br/> <br/>
<p>Pour des informations plus détaillées, consulter les <Link to="/info">règles</Link>.</p> <p>Pour des informations plus détaillées, consulter les <Link to={`${basePath}/info`}>règles</Link>.</p>
<br/> <br/>
</div> </div>
<div> <div>

@ -49,10 +49,10 @@ import { Network } from 'vis-network';
import {generateLatexCode, generateLatexCodeEnigme} from '../Script/LatexScript'; import {generateLatexCode, generateLatexCodeEnigme} from '../Script/LatexScript';
import Pair from '../model/Pair'; import Pair from '../model/Pair';
import Indice from '../model/Indices/Indice'; import Indice from '../model/Indices/Indice';
import {basePath} from "../AdressSetup"
let cptNavigation = 0
const basePath = process.env.REACT_APP_BASE_PATH || '/containers/Crypteam-website'; let cptNavigation = 0
//@ts-ignore //@ts-ignore
const InGame = ({locale, changeLocale}) => { const InGame = ({locale, changeLocale}) => {
@ -68,7 +68,7 @@ const InGame = ({locale, changeLocale}) => {
if (cptNavigation % 2 == 0){ if (cptNavigation % 2 == 0){
if (navigationType.toString() == "POP"){ if (navigationType.toString() == "POP"){
socket.emit("player quit") socket.emit("player quit")
navigate(`/${basePath}/play`) navigate(`${basePath}/`)
} }
} }
@ -283,7 +283,7 @@ const InGame = ({locale, changeLocale}) => {
const { indice, players, actualPlayerIndex} = useGame(); const { indice, players, actualPlayerIndex} = useGame();
const nbPlayer = players.length; const nbPlayer = players.length;
const navdeduc = '/deduc?actualId=' + actualPlayerIndex + '&nbPlayer=' + nbPlayer; const navdeduc = 'deduc?actualId=' + actualPlayerIndex + '&nbPlayer=' + nbPlayer;
return ( return (
<div id="mainDiv"> <div id="mainDiv">
@ -368,7 +368,7 @@ const InGame = ({locale, changeLocale}) => {
{/* <Link to='/info#indice-possible' target='_blank'> {/* <Link to='/info#indice-possible' target='_blank'>
//? redirection impossible apparament (securité des navigateur //? redirection impossible apparament (securité des navigateur
*/} */}
<Link to='/info' target='_blank'> <Link to={`${basePath}/info`} target='_blank'>
<button className='button' <button className='button'
style={{ style={{
backgroundColor: theme.colors.tertiary, backgroundColor: theme.colors.tertiary,
@ -379,7 +379,7 @@ const InGame = ({locale, changeLocale}) => {
</Link> </Link>
{!IsSolo && {!IsSolo &&
<Link to={navdeduc} target='_blank'> <Link to={`${basePath}/${navdeduc}`} target='_blank'>
<button className='button' <button className='button'
style={{ style={{
backgroundColor: theme.colors.tertiary, backgroundColor: theme.colors.tertiary,

@ -140,7 +140,7 @@ function Lobbies() {
{filteredLobbiesToShow.length === 0 ? ( {filteredLobbiesToShow.length === 0 ? (
<div style={{border:'solid 2px blue', borderRadius:'15px', boxShadow:'5px 5px 5px rgb(246, 246, 246)', padding:'20px', margin:'20px'}}> <div style={{border:'solid 2px blue', borderRadius:'15px', boxShadow:'5px 5px 5px rgb(246, 246, 246)', padding:'20px', margin:'20px'}}>
<h3><b>Il n'y a aucun lobby disponible</b></h3> <h3><b>Il n'y a aucun lobby disponible</b></h3>
<button onClick={createLobby} className='ButtonNav' style={{backgroundColor: theme.colors.primary, borderColor: theme.colors.secondary}}>Créé en un !</button> <button onClick={createLobby} className='ButtonNav' style={{backgroundColor: theme.colors.primary, borderColor: theme.colors.secondary}}>Créez en un !</button>
</div> </div>
) : ( ) : (
<div className="lobbyList"> <div className="lobbyList">

@ -46,11 +46,12 @@ import { useRef } from 'react';
import Button from 'react-bootstrap/Button'; import Button from 'react-bootstrap/Button';
import Overlay from 'react-bootstrap/Overlay'; import Overlay from 'react-bootstrap/Overlay';
import { DataSet } from 'vis-network'; import { DataSet } from 'vis-network';
import {basePath} from "../AdressSetup"
let gameStarted = false let gameStarted = false
let firstLaunch = true let firstLaunch = true
const basePath = process.env.REACT_APP_BASE_PATH || '/containers/Crypteam-website';
function Lobby() { function Lobby() {
const theme=useTheme(); const theme=useTheme();
@ -186,17 +187,17 @@ function Lobby() {
socket.on("room full", () => { socket.on("room full", () => {
//TODO POP UP pour quand la room est pleine //TODO POP UP pour quand la room est pleine
navigate(`${basePath}/play`) navigate(`${basePath}/`)
}) })
socket.on("game started", () => { socket.on("game started", () => {
//TODO POP UP pour quand la room est pleine //TODO POP UP pour quand la room est pleine
navigate(`${basePath}/play`) navigate(`${basePath}/`)
}) })
socket.on("game already started", () => { socket.on("game already started", () => {
//TODO POP UP pour quand la room est pleine //TODO POP UP pour quand la room est pleine
navigate(`${basePath}/play`) navigate(`${basePath}/`)
}) })
socket.on("player left", (tab, i) => { socket.on("player left", (tab, i) => {
@ -228,7 +229,7 @@ function Lobby() {
const copyGameLink = () => { const copyGameLink = () => {
setShow(!show) setShow(!show)
const gameLink = "http://localhost:3000/lobby?room="+ room; const gameLink = "http://172.20.10.4:3000/lobby?room="+ room;
navigator.clipboard.writeText(gameLink) navigator.clipboard.writeText(gameLink)
.then(() => { .then(() => {
console.log('Lien copié avec succès !'); console.log('Lien copié avec succès !');
@ -239,7 +240,7 @@ function Lobby() {
}; };
const textAreaRef = useRef<HTMLTextAreaElement>(null); const textAreaRef = useRef<HTMLTextAreaElement>(null);
const linkToCopy = "http://localhost:3000/lobby?room="+ room const linkToCopy = "http://172.20.10.4:3000/lobby?room="+ room
const handleCopyClick = () => { const handleCopyClick = () => {
setShow(!show) setShow(!show)
if(textAreaRef.current != null){ if(textAreaRef.current != null){

@ -4,8 +4,8 @@ import { useNavigate } from 'react-router-dom';
import { useAuth } from '../Contexts/AuthContext'; import { useAuth } from '../Contexts/AuthContext';
import AuthService from '../services/AuthService'; import AuthService from '../services/AuthService';
import '../Style/Global.css'; import '../Style/Global.css';
import {basePath} from "../AdressSetup"
const basePath = process.env.REACT_APP_BASE_PATH || '/containers/Crypteam-website';
const SignIn = () => { const SignIn = () => {
const navigate = useNavigate(); const navigate = useNavigate();

@ -30,11 +30,11 @@ import { Overlay, ToggleButton, ToggleButtonGroup } from 'react-bootstrap';
import Button from 'react-bootstrap/Button'; import Button from 'react-bootstrap/Button';
import ButtonGroup from 'react-bootstrap/ButtonGroup'; import ButtonGroup from 'react-bootstrap/ButtonGroup';
import Lobbies from './Lobbies'; import Lobbies from './Lobbies';
import {basePath} from "../AdressSetup"
let cptNavigation = 0
const basePath = process.env.REACT_APP_BASE_PATH || '/containers/Crypteam-website'; let cptNavigation = 0
function NewPlay() { function NewPlay() {

@ -30,9 +30,10 @@ import Button from 'react-bootstrap/Button';
import ButtonGroup from 'react-bootstrap/ButtonGroup'; import ButtonGroup from 'react-bootstrap/ButtonGroup';
import Info from '../res/icon/infoGreen.png'; import Info from '../res/icon/infoGreen.png';
import {basePath} from "../AdressSetup"
let cptNavigation = 0 let cptNavigation = 0
const basePath = process.env.REACT_APP_BASE_PATH || '/containers/Crypteam-website';
function Play() { function Play() {
let first = true let first = true

@ -25,7 +25,7 @@ import Form from 'react-bootstrap/Form';
import ProgressBar from 'react-bootstrap/ProgressBar'; import ProgressBar from 'react-bootstrap/ProgressBar';
const basePath = process.env.REACT_APP_BASE_PATH || '/containers/Crypteam-website'; import {basePath} from "../AdressSetup"
//@ts-ignore //@ts-ignore
const Profile = () => { const Profile = () => {

@ -4,7 +4,7 @@ import { useNavigate } from 'react-router-dom';
import AuthService from '../services/AuthService'; import AuthService from '../services/AuthService';
import '../Style/Global.css'; import '../Style/Global.css';
const basePath = process.env.REACT_APP_BASE_PATH || '/containers/Crypteam-website'; import {basePath} from "../AdressSetup"
const SignUp = () => { const SignUp = () => {
@ -92,7 +92,7 @@ const SignUp = () => {
</button> </button>
</div> </div>
<p className="forgot-password text-right"> <p className="forgot-password text-right">
Vous avez déjà un <a href="/login">compte</a> ? Vous avez déjà un <a href={`${basePath}/login`}>compte</a> ?
</p> </p>
</form> </form>

Loading…
Cancel
Save