This commit is contained in:
root 2026-03-31 20:00:02 -04:00
parent a343681321
commit 5f68544a95
3 changed files with 7 additions and 5 deletions

View File

@ -11,7 +11,7 @@ connectDB();
app.use( app.use(
cors({ cors({
origin: "http://localhost:5173", origin: "*",
allowedHeaders: ["Content-Type", "Authorization"], allowedHeaders: ["Content-Type", "Authorization"],
credentials: true, credentials: true,
}), }),

View File

@ -23,8 +23,10 @@ export const SocketProvider = ({ children }) => {
const userInfo = JSON.parse(localStorage.getItem("user")); const userInfo = JSON.parse(localStorage.getItem("user"));
const newSocket = io(url, { console.log(url.replace("game-api", "socket.io"));
auth: { token, username: userInfo?.username }, const newSocket = io(url.replace("/game-api", ""), {
path: "/socket.io/",
auth: { token, username: userInfo?.username },
transports: ["websocket"], transports: ["websocket"],
reconnectionAttempts: 5, reconnectionAttempts: 5,
}); });

View File

@ -13,7 +13,7 @@ const economyService = require("./game/EconomyService.js");
app.use( app.use(
cors({ cors({
origin: "http://localhost:5173", origin: "*",
methods: ["GET", "POST"], methods: ["GET", "POST"],
credentials: true, credentials: true,
}), }),
@ -50,7 +50,7 @@ const registerInApi = async () => {
try { try {
await axios.post(`${config.apiBaseUrl}/servers/register`, { await axios.post(`${config.apiBaseUrl}/servers/register`, {
name: config.serverName, name: config.serverName,
url: `http://localhost:${config.port}`, url: `https://dev-test.galaxystrike.online/game-api`,
secret: config.serverSecret, secret: config.serverSecret,
isModded: false, isModded: false,
description: config.serverDescription, description: config.serverDescription,