Compare commits

...

3 commits

Author SHA1 Message Date
Christopher (Cris) Fuhrman
62df610d62
Merge pull request #313 from ets-cfuhrman-pfe/fuhrmanator/issue312
Some checks failed
CI/CD Pipeline for Backend / build_and_push_backend (push) Failing after 18s
CI/CD Pipeline for Nginx Router / build_and_push_nginx (push) Failing after 17s
CI/CD Pipeline for Frontend / build_and_push_frontend (push) Failing after 18s
Tests / lint-and-tests (client) (push) Failing after 1m5s
Tests / lint-and-tests (server) (push) Failing after 54s
Corrige problème avec l'URL générée pour les images dans la galerie
2025-04-07 22:07:04 -04:00
C. Fuhrman
f13b58d89b Use BACKEND_URL instead of IMG_URL
Fixes #312
2025-04-07 22:00:28 -04:00
C. Fuhrman
a66631c60b IMG_URL not needed finally (default to running server with relative URL) 2025-04-07 21:10:53 -04:00
9 changed files with 423 additions and 511 deletions

View file

@ -1,3 +1,2 @@
VITE_BACKEND_URL=http://localhost:4400 VITE_BACKEND_URL=http://localhost:4400
VITE_BACKEND_SOCKET_URL=http://localhost:4400 VITE_BACKEND_SOCKET_URL=http://localhost:4400
VITE_IMG_URL=http://localhost:4400

View file

@ -1,3 +1,2 @@
VITE_BACKEND_URL=http://localhost:4400 VITE_BACKEND_URL=http://localhost:4400
VITE_AZURE_BACKEND_URL=http://localhost:4400 VITE_AZURE_BACKEND_URL=http://localhost:4400
VITE_IMG_URL=http://localhost:4400

870
client/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -8,7 +8,7 @@
"build": "tsc && vite build", "build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview", "preview": "vite preview",
"test": "jest --colors", "test": "jest --colors --silent",
"test:watch": "jest --watch" "test:watch": "jest --watch"
}, },
"dependencies": { "dependencies": {
@ -18,19 +18,19 @@
"@fortawesome/fontawesome-svg-core": "^6.7.2", "@fortawesome/fontawesome-svg-core": "^6.7.2",
"@fortawesome/free-solid-svg-icons": "^6.7.2", "@fortawesome/free-solid-svg-icons": "^6.7.2",
"@fortawesome/react-fontawesome": "^0.2.0", "@fortawesome/react-fontawesome": "^0.2.0",
"@mui/icons-material": "^6.4.6", "@mui/icons-material": "^7.0.1",
"@mui/lab": "^5.0.0-alpha.153", "@mui/lab": "^5.0.0-alpha.153",
"@mui/material": "^6.4.6", "@mui/material": "^7.0.1",
"@types/uuid": "^9.0.7", "@types/uuid": "^9.0.7",
"axios": "^1.8.1", "axios": "^1.8.1",
"dompurify": "^3.2.3", "dompurify": "^3.2.5",
"esbuild": "^0.25.0", "esbuild": "^0.25.2",
"gift-pegjs": "^2.0.0-beta.1", "gift-pegjs": "^2.0.0-beta.1",
"jest-environment-jsdom": "^29.7.0", "jest-environment-jsdom": "^29.7.0",
"jwt-decode": "^4.0.0", "jwt-decode": "^4.0.0",
"katex": "^0.16.11", "katex": "^0.16.11",
"marked": "^14.1.2", "marked": "^15.0.8",
"nanoid": "^5.1.2", "nanoid": "^5.1.5",
"qrcode.react": "^4.2.0", "qrcode.react": "^4.2.0",
"react": "^18.3.1", "react": "^18.3.1",
"react-dom": "^18.3.1", "react-dom": "^18.3.1",
@ -39,40 +39,40 @@
"remark-math": "^6.0.0", "remark-math": "^6.0.0",
"socket.io-client": "^4.7.2", "socket.io-client": "^4.7.2",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"uuid": "^9.0.1", "uuid": "^11.1.0",
"vite-plugin-checker": "^0.9.0" "vite-plugin-checker": "^0.9.1"
}, },
"devDependencies": { "devDependencies": {
"@babel/preset-env": "^7.26.9", "@babel/preset-env": "^7.26.9",
"@babel/preset-react": "^7.26.3", "@babel/preset-react": "^7.26.3",
"@babel/preset-typescript": "^7.23.3", "@babel/preset-typescript": "^7.27.0",
"@eslint/js": "^9.21.0", "@eslint/js": "^9.24.0",
"@testing-library/dom": "^10.4.0", "@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.3", "@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.2.0", "@testing-library/react": "^16.3.0",
"@testing-library/user-event": "^14.6.1", "@testing-library/user-event": "^14.6.1",
"@types/jest": "^29.5.13", "@types/jest": "^29.5.13",
"@types/node": "^22.13.5", "@types/node": "^22.14.0",
"@types/react": "^18.2.15", "@types/react": "^18.2.15",
"@types/react-dom": "^18.2.7", "@types/react-dom": "^18.2.7",
"@types/react-latex": "^2.0.3", "@types/react-latex": "^2.0.3",
"@typescript-eslint/eslint-plugin": "^8.25.0", "@typescript-eslint/eslint-plugin": "^8.29.1",
"@typescript-eslint/parser": "^8.25.0", "@typescript-eslint/parser": "^8.29.1",
"@vitejs/plugin-react-swc": "^3.8.0", "@vitejs/plugin-react-swc": "^3.8.1",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"eslint": "^9.21.0", "eslint": "^9.24.0",
"eslint-plugin-eslint-comments": "^3.2.0", "eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-jest": "^28.11.0", "eslint-plugin-jest": "^28.11.0",
"eslint-plugin-react": "^7.37.3", "eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^5.1.0-rc-206df66e-20240912", "eslint-plugin-react-hooks": "^5.1.0-rc-206df66e-20240912",
"eslint-plugin-react-refresh": "^0.4.19", "eslint-plugin-react-refresh": "^0.4.19",
"eslint-plugin-unused-imports": "^4.1.4", "eslint-plugin-unused-imports": "^4.1.4",
"globals": "^15.14.0", "globals": "^15.14.0",
"identity-obj-proxy": "^3.0.0", "identity-obj-proxy": "^3.0.0",
"jest": "^29.7.0", "jest": "^29.7.0",
"ts-jest": "^29.2.6", "ts-jest": "^29.3.1",
"typescript": "^5.7.3", "typescript": "^5.8.3",
"typescript-eslint": "^8.25.0", "typescript-eslint": "^8.29.1",
"vite": "^6.2.0", "vite": "^6.2.0",
"vite-plugin-environment": "^1.1.3" "vite-plugin-environment": "^1.1.3"
} }

View file

@ -22,8 +22,8 @@ import CloseIcon from "@mui/icons-material/Close";
import { ImageType } from "../../Types/ImageType"; import { ImageType } from "../../Types/ImageType";
import ApiService from "../../services/ApiService"; import ApiService from "../../services/ApiService";
import { Upload } from "@mui/icons-material"; import { Upload } from "@mui/icons-material";
import { ENV_VARIABLES } from '../../constants';
import { escapeForGIFT } from "src/utils/giftUtils"; import { escapeForGIFT } from "src/utils/giftUtils";
import { ENV_VARIABLES } from "src/constants";
interface ImagesProps { interface ImagesProps {
handleCopy?: (id: string) => void; handleCopy?: (id: string) => void;
@ -83,9 +83,9 @@ const ImageGallery: React.FC<ImagesProps> = ({ handleCopy, handleDelete }) => {
const defaultHandleCopy = (id: string) => { const defaultHandleCopy = (id: string) => {
if (navigator.clipboard) { if (navigator.clipboard) {
const link = `${ENV_VARIABLES.IMG_URL}/api/image/get/${id}`; const link = `${ENV_VARIABLES.BACKEND_URL}/api/image/get/${id}`;
const imgTag = `[markdown]![alt_text](${escapeForGIFT(link)} "texte de l'infobulle") {T}`; const imgTag = `[markdown] ![texte alternatif d'écrivant l'image pour les personnes qui ne peuvent pas voir l'image](${escapeForGIFT(link)} "texte de l'infobulle (ne fonctionne pas sur écran tactile généralement)") `;
setSnackbarMessage("Le lien Markdown de limage a été copié dans le presse-papiers"); setSnackbarMessage("Le lien Markdown de l'image a été copié dans le presse-papiers");
setSnackbarSeverity("success"); setSnackbarSeverity("success");
setSnackbarOpen(true); setSnackbarOpen(true);
navigator.clipboard.writeText(imgTag); navigator.clipboard.writeText(imgTag);

View file

@ -2,7 +2,6 @@
const ENV_VARIABLES = { const ENV_VARIABLES = {
MODE: process.env.MODE || "production", MODE: process.env.MODE || "production",
VITE_BACKEND_URL: process.env.VITE_BACKEND_URL || "", VITE_BACKEND_URL: process.env.VITE_BACKEND_URL || "",
IMG_URL: process.env.MODE == "development" ? process.env.VITE_BACKEND_URL : process.env.VITE_IMG_URL,
BACKEND_URL: process.env.SITE_URL != undefined ? `${process.env.SITE_URL}${process.env.USE_PORTS ? `:${process.env.BACKEND_PORT}` : ''}` : process.env.VITE_BACKEND_URL || '', BACKEND_URL: process.env.SITE_URL != undefined ? `${process.env.SITE_URL}${process.env.USE_PORTS ? `:${process.env.BACKEND_PORT}` : ''}` : process.env.VITE_BACKEND_URL || '',
FRONTEND_URL: process.env.SITE_URL != undefined ? `${process.env.SITE_URL}${process.env.USE_PORTS ? `:${process.env.PORT}` : ''}` : '' FRONTEND_URL: process.env.SITE_URL != undefined ? `${process.env.SITE_URL}${process.env.USE_PORTS ? `:${process.env.PORT}` : ''}` : ''
}; };

View file

@ -17,7 +17,7 @@ import ImageGalleryModal from 'src/components/ImageGallery/ImageGalleryModal/Ima
import ApiService from '../../../services/ApiService'; import ApiService from '../../../services/ApiService';
import { escapeForGIFT } from '../../../utils/giftUtils'; import { escapeForGIFT } from '../../../utils/giftUtils';
import { ENV_VARIABLES } from '../../../constants'; import { ENV_VARIABLES } from 'src/constants';
interface EditQuizParams { interface EditQuizParams {
id: string; id: string;
@ -170,7 +170,7 @@ const QuizForm: React.FC = () => {
} }
const handleCopyImage = (id: string) => { const handleCopyImage = (id: string) => {
const escLink = `${ENV_VARIABLES.IMG_URL}/api/image/get/${id}`; const escLink = `${ENV_VARIABLES.BACKEND_URL}/api/image/get/${id}`;
setImageLinks(prevLinks => [...prevLinks, escLink]); setImageLinks(prevLinks => [...prevLinks, escLink]);
} }

View file

@ -7,8 +7,6 @@ services:
context: ./client context: ./client
dockerfile: Dockerfile dockerfile: Dockerfile
container_name: frontend container_name: frontend
environment:
VITE_IMG_URL: http://localhost
ports: ports:
- "5173:5173" - "5173:5173"
restart: always restart: always

View file

@ -10,7 +10,6 @@ services:
- VITE_BACKEND_URL= - VITE_BACKEND_URL=
# Define empty VITE_BACKEND_SOCKET_URL so it will default to window.location.host # Define empty VITE_BACKEND_SOCKET_URL so it will default to window.location.host
- VITE_BACKEND_SOCKET_URL= - VITE_BACKEND_SOCKET_URL=
- VITE_IMG_URL=https://evalsa.etsmtl.ca
ports: ports:
- "5173:5173" - "5173:5173"
restart: always restart: always