Skip to content

Commit

Permalink
Избавление от hash библиотеки
Browse files Browse the repository at this point in the history
Использование встроенной в гмод util.SHA256
  • Loading branch information
AMD-NICK committed May 19, 2023
1 parent 3ed2763 commit 0537134
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 415 deletions.
6 changes: 3 additions & 3 deletions addons/igs-core/lua/igs/apinator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@ function IGS.GetSign(tParams, secret)
s = s .. tostring(v):Trim() .. DELIMITER
end

return hash.SHA256(s .. (secret or IGS.C.ProjectKey))
return util.SHA256(s .. (secret or IGS.C.ProjectKey))
end

function IGS.DoRequest(project_id, secret, sMethod, tParams, fSucc, fErr)
tParams = map(tParams, tostring)

-- prt({"Sign: %s" .. IGS.GetSign(tParams), tParams})
local api_url = IGS_API_ENDPOINT or "https://gm-donate.net/api"
http.Post(api_url .. sMethod, tParams, fSucc, fErr, {
sign = IGS.GetSign(tParams, secret),
Expand Down Expand Up @@ -61,7 +60,8 @@ local function wrapResponse(sMethod, tParams, fOnSuccess, fOnError)
else
fOnSuccess(d)
end
end, function()
end, function(err)
IGS.print(Color(255,0,0), "HTTP Error: " .. err)
fOnError("http_error")
end)
end
Expand Down
Loading

0 comments on commit 0537134

Please sign in to comment.