fix big courses upload part 1

This commit is contained in:
Jonny_Bro (Nikita) 2024-04-01 18:23:06 +05:00
parent 19d056bcd7
commit 9fdfbecc7a
No known key found for this signature in database
GPG key ID: 3F1ECC04147E9BD8
2 changed files with 5 additions and 3 deletions

View file

@ -82,7 +82,7 @@ function UploadCourse()
local url = domain:GetString() .. "/api/upload" local url = domain:GetString() .. "/api/upload"
local data = file.Open("beatrun/courses/" .. currentMap .. "/" .. Course_ID .. ".txt", "rb", "DATA") local data = file.Open("beatrun/courses/" .. currentMap .. "/" .. Course_ID .. ".txt", "rb", "DATA")
local filedata = util.Decompress(data:Read(data:Size())) or data:Read(data:Size()) local filedata = data:Read()
http.Post(url, NULL, function(body, length, headers, code) http.Post(url, NULL, function(body, length, headers, code)
local response = util.JSONToTable(body) local response = util.JSONToTable(body)
@ -118,7 +118,7 @@ function UpdateCourse(course_code)
local url = domain:GetString() .. "/api/update" local url = domain:GetString() .. "/api/update"
local data = file.Open("beatrun/courses/" .. currentMap .. "/" .. Course_ID .. ".txt", "rb", "DATA") local data = file.Open("beatrun/courses/" .. currentMap .. "/" .. Course_ID .. ".txt", "rb", "DATA")
local filedata = util.Decompress(data:Read(data:Size())) or data:Read(data:Size()) local filedata = data:Read()
http.Post(url, NULL, function(body, length, headers, code) http.Post(url, NULL, function(body, length, headers, code)
local response = util.JSONToTable(body) local response = util.JSONToTable(body)

View file

@ -1009,6 +1009,7 @@ if CLIENT then
Course_ID = id Course_ID = id
end end
--[[
concommand.Add("Beatrun_PrintCourse", function(ply, cmd, args, argstr) concommand.Add("Beatrun_PrintCourse", function(ply, cmd, args, argstr)
local dir = "beatrun/courses/" .. game.GetMap() .. "/" local dir = "beatrun/courses/" .. game.GetMap() .. "/"
local save = file.Read(dir .. args[1] .. ".txt", "DATA") local save = file.Read(dir .. args[1] .. ".txt", "DATA")
@ -1019,8 +1020,9 @@ if CLIENT then
return return
end end
PrintTable(save) print(save)
end) end)
--]]
net.Receive("BuildMode_Sync", function() net.Receive("BuildMode_Sync", function()
local x = net.ReadFloat() local x = net.ReadFloat()