diff --git a/.env b/.env index ac67a9f..de02d31 100644 --- a/.env +++ b/.env @@ -1,4 +1,4 @@ -API_URL=https://api-dev.firehosting.com.br -NEXT_PUBLIC_API_URL=https://api-dev.firehosting.com.br -NEXT_PUBLIC_SOCKET_URL=https://firehosting-socket.squareweb.app +API_URL=https://system-api.firehosting.com.br +NEXT_PUBLIC_API_URL=https://system-api.firehosting.com.br +NEXT_PUBLIC_SOCKET_URL=https://socket.firehosting.com.br NEXT_PUBLIC_CENTRAL_URL=https://central.firehosting.com.br \ No newline at end of file diff --git a/config.json b/config.json index 50772b9..a1d5d09 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,6 @@ { "api": { - "baseUrl": "https://api-dev.firehosting.com.br", + "baseUrl": "https://system-api.firehosting.com.br", "authKey": "CjYYooDNiVgzWBJPNlYyIUfoxJRtLozDFiTAoHdQuPAnxFEAuK" } } diff --git a/src/components/dashboard/minecraft/CustomizationContent.tsx b/src/components/dashboard/minecraft/CustomizationContent.tsx index 34576ab..cb4564f 100644 --- a/src/components/dashboard/minecraft/CustomizationContent.tsx +++ b/src/components/dashboard/minecraft/CustomizationContent.tsx @@ -170,7 +170,7 @@ export default function CustomizationContent({ server }: CustomizationContentPro if (uploadUrlResponse.success && uploadUrlResponse.data) { // Upload the file const formData = new FormData(); - formData.append('file', pngFile); + formData.append('files', pngFile); // Changed from 'file' to 'files' to match API expectations const uploadResponse = await fetch(uploadUrlResponse.data.url, { method: 'POST', diff --git a/src/components/dashboard/minecraft/FilesContent.tsx b/src/components/dashboard/minecraft/FilesContent.tsx index e3f30f5..9ca9f60 100644 --- a/src/components/dashboard/minecraft/FilesContent.tsx +++ b/src/components/dashboard/minecraft/FilesContent.tsx @@ -244,7 +244,8 @@ export default function FilesContent({ if (uploadUrl.success && uploadUrl.data) { const formData = new FormData(); - formData.append('file', file); + // Important: Use "files" as the key name, not "file" + formData.append('files', file); const uploadResponse = await fetch(uploadUrl.data.url, { method: 'POST', @@ -252,7 +253,9 @@ export default function FilesContent({ }); if (!uploadResponse.ok) { - throw new Error(`Failed to upload ${file.name}`); + const errorText = await uploadResponse.text(); + console.error("Upload error:", errorText); + throw new Error(`Failed to upload ${file.name}: ${uploadResponse.status} ${errorText}`); } } @@ -261,6 +264,7 @@ export default function FilesContent({ fetchFiles(currentPath); } catch (err: any) { + console.error("Upload error:", err); setFilesError(err.message || "An error occurred during upload"); } finally { setUploadProgress(null); @@ -309,8 +313,9 @@ export default function FilesContent({ e.stopPropagation(); setDragActive(false); - if (e.dataTransfer.files && e.dataTransfer.files.length > 0 && fileInputRef.current) { - fileInputRef.current.files = e.dataTransfer.files; + if (e.dataTransfer.files && e.dataTransfer.files.length > 0) { + // We don't need to assign to fileInputRef.current.files anymore + // Just directly handle the files from dataTransfer handleFileUpload({ target: { files: e.dataTransfer.files } } as any); } }} diff --git a/src/components/dashboard/minecraft/MinecraftSettingsContent.tsx b/src/components/dashboard/minecraft/MinecraftSettingsContent.tsx index 7f16f64..d7bbdec 100644 --- a/src/components/dashboard/minecraft/MinecraftSettingsContent.tsx +++ b/src/components/dashboard/minecraft/MinecraftSettingsContent.tsx @@ -214,9 +214,9 @@ export default function MinecraftSettingsContent({ server }: MinecraftSettingsCo try { const response = await fetch( - `${config.api.baseUrl}/client/servers/${server.identifier}/settings/rename`, + `${config.api.baseUrl}/v1/users/me/servers/games/${server.identifier}/settings?action=rename`, { - method: "POST", + method: "PATCH", headers: { Authorization: `Bearer ${accessKey}`, "Content-Type": "application/json", diff --git a/src/services/ServerConsoleWebSocket.ts b/src/services/ServerConsoleWebSocket.ts index f731691..e7c41ea 100644 --- a/src/services/ServerConsoleWebSocket.ts +++ b/src/services/ServerConsoleWebSocket.ts @@ -26,7 +26,7 @@ export class ServerConsoleWebSocket { private onErrorCallback?: (error: string) => void; constructor(provider: CredentialProvider) { - this.socketUrl = process.env.NEXT_PUBLIC_SOCKET_URL || 'wss://firehosting-socket.squareweb.app'; + this.socketUrl = process.env.NEXT_PUBLIC_SOCKET_URL || 'wss://socket.firehosting.com.br'; this.credentialProvider = provider; }