add dev url on debug

This commit is contained in:
Linventif 2024-01-16 04:17:55 +01:00
parent 32e3310f65
commit f3aae78525
2 changed files with 18 additions and 2 deletions

View File

@ -29,7 +29,15 @@ if (!GWSockets) then
return
end
local socket = GWSockets.createWebSocket("wss://ws.gmod-integration.com")
local function getWebSocketURL()
local url = "wss://ws.gmod-integration.com"
if (gmInte.config.debug && gmInte.config.wssDebug) then
url = gmInte.config.wssDebug
end
return url
end
local socket = GWSockets.createWebSocket(getWebSocketURL())
// Authentication
socket:setHeader("id", gmInte.config.id)

View File

@ -25,6 +25,14 @@ local function errorMessage(body, code)
end
end
local function getAPIURL()
local url = "https://api.gmod-integration.com"
if (gmInte.config.debug && gmInte.config.apiDebug) then
url = gmInte.config.apiDebug
end
return url
end
local function sendHTTP(params)
// Log the HTTP request
gmInte.log("HTTP Request: " .. params.method .. " " .. params.endpoint, true)
@ -32,7 +40,7 @@ local function sendHTTP(params)
// Send the HTTP request
HTTP({
url = "https://api.gmod-integration.com" .. params.endpoint,
url = getAPIURL() .. params.endpoint,
method = params.method,
headers = {
["Content-Type"] = "application/json",