refactor: organize lua dependencies

This commit is contained in:
Eugene Prodan
2021-06-12 00:55:15 +03:00
parent 55ad0713bb
commit ff669a9e64
4 changed files with 19 additions and 1563 deletions

14
dependencies-0-0.rockspec Normal file
View File

@ -0,0 +1,14 @@
rockspec_format = "3.0"
package = "dependencies"
version = "0-0"
source = {
url = "https://github.com/mora9715/haproxy_ddos_protector"
}
dependencies = {
"lua > 5.1",
"md5 >= 1.3",
"net-url >= 0.9",
"luasec >= 1.0",
"luasocket >= 2",
"rapidjson >= 0.7"
}

View File

@ -97,7 +97,7 @@ ADD haproxy/docker-entrypoint.sh /usr/local/bin/
RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat
# This is terrible mess but we need it for simple testing purposes of our POC
RUN apt-get update && apt-get install libssl-dev make nano wget gcc libreadline-dev unzip git socat -y
RUN apt-get update && apt-get install libssl-dev make nano wget gcc libreadline-dev unzip git socat cmake g++ -y
RUN wget http://www.lua.org/ftp/lua-5.3.5.tar.gz &&\
tar -zxf lua-5.3.5.tar.gz &&\
cd lua-5.3.5 &&\
@ -114,7 +114,8 @@ RUN wget "https://luarocks.org/releases/luarocks-3.3.1.tar.gz" &&\
RUN /usr/local/bin/luarocks install luasocket &&\
/usr/local/bin/luarocks install luasec &&\
/usr/local/bin/luarocks install net-url &&\
/usr/local/bin/luarocks install md5
/usr/local/bin/luarocks install md5 &&\
/usr/local/bin/luarocks install rapidjson
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@ _M = {}
local url = require("net.url")
local https = require("ssl.https")
local json = require("json")
local json = require("rapidjson")
local utils = require("utils")
local cookie = require("cookie")
@ -55,7 +55,7 @@ function _M.view(applet)
parsed_body["h-captcha-response"]
)
local body, _, _, _ = https.request(url)
local api_response = json:decode(body)
local api_response = json.decode(body)
if api_response.success == true then
core.Debug("HCAPTCHA SUCCESSFULLY PASSED")