From c27ee70ae82b16d1ca8651a27e1a9400c2c460d9 Mon Sep 17 00:00:00 2001 From: Fahd Date: Mon, 15 Sep 2025 00:19:13 +0100 Subject: [PATCH] fix: disable cors and update frontend server ip --- package-lock.json | 23 ----------------------- package.json | 1 - server/index.js | 3 --- src/App.jsx | 6 +++--- 4 files changed, 3 insertions(+), 30 deletions(-) diff --git a/package-lock.json b/package-lock.json index 564c572..b9225d7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,6 @@ "dependencies": { "axios": "^1.11.0", "chart.js": "^4.5.0", - "cors": "^2.8.5", "express": "^5.1.0", "onnxruntime-node": "^1.22.0-rev", "react": "^19.1.0", @@ -2124,19 +2123,6 @@ "node": ">=6.6.0" } }, - "node_modules/cors": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", - "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", - "license": "MIT", - "dependencies": { - "object-assign": "^4", - "vary": "^1" - }, - "engines": { - "node": ">= 0.10" - } - }, "node_modules/cross-spawn": { "version": "7.0.6", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", @@ -3622,15 +3608,6 @@ "node": ">=0.10.0" } }, - "node_modules/object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/object-inspect": { "version": "1.13.4", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", diff --git a/package.json b/package.json index b62a241..1e0f8d3 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,6 @@ "dependencies": { "axios": "^1.11.0", "chart.js": "^4.5.0", - "cors": "^2.8.5", "express": "^5.1.0", "onnxruntime-node": "^1.22.0-rev", "react": "^19.1.0", diff --git a/server/index.js b/server/index.js index 858e4ea..58983fb 100644 --- a/server/index.js +++ b/server/index.js @@ -1,6 +1,5 @@ import express from 'express'; import { config } from 'dotenv'; -import cors from 'cors'; import match_history from './match_history.js'; import match_details from './match_details.js'; import match_analysis from './match_analysis.js'; @@ -10,8 +9,6 @@ config(); const app = express(); const PORT = 3000; -app.use(cors()); - app.get('/match_history/', match_history); app.get('/match_details/', match_details); app.get('/match_analysis/', match_analysis); diff --git a/src/App.jsx b/src/App.jsx index 3d871a5..dc6e042 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -29,12 +29,12 @@ function App() { try { const start = Date.now(); - let history = await fetch(`http://localhost:3000/match_history?name=${name}&tag=${tag}®ion=${region}`); + let history = await fetch(`https://lolytics.org/match_history?name=${name}&tag=${tag}®ion=${region}`); history = await history.json(); let matchDetails = []; for (const match_id of history.match_ids.slice(0, 5)) { - matchDetails.push(fetch(`http://localhost:3000/match_details?id=${match_id}&puuid=${history.puuid}®ion=${region}`)); + matchDetails.push(fetch(`https://lolytics.org/match_details?id=${match_id}&puuid=${history.puuid}®ion=${region}`)); } matchDetails = await Promise.all(matchDetails); @@ -67,7 +67,7 @@ function App() { const handleMatchClick = async (i) => { setSelectedMatch(matchImages[i]); - let response = await fetch(`http://localhost:3000/match_analysis?id=${matchImages[i].id}&puuid=${matchImages[i].puuid}®ion=${region}`); + let response = await fetch(`https://lolytics.org/match_analysis?id=${matchImages[i].id}&puuid=${matchImages[i].puuid}®ion=${region}`); response = await response.json(); setFrames(response.frames);