LiquidProxy Lua Edition
at master 44 lines 1.4 kB view raw
1-- Fixes GravityBox activation. Likely legal as GravityBox Unlocker on Play Store is completely free now. 2local lu = require "ext.lua-url" 3local json = require "json" 4 5---@param req luvit.http.IncomingMessage 6---@param res luvit.http.ServerResponse 7return nil, {["gravitybox.ceco.sk.eu.org"] = function(req, res) 8 if req.url == "/service.php" then 9 local body = "" 10 req:on('data', function (chunk) 11 body = body .. chunk 12 end) 13 req:on("end", function() 14 if not (body and body ~= "") then 15 res.statusCode = 400 16 end 17 local q = lu.parseArgs(body) 18 -- Has to be caps for some reason. 19 if q and q.transactionId and string.upper(q.transactionId) == "YES" then 20 res.statusCode = 200 21 res:setHeader("Content-Type", "application/json") 22 ---@diagnostic disable-next-line: param-type-mismatch 23 res:finish(json.encode({ 24 message = "henlo :3", 25 status = "OK", 26 -- TRANSACTION_VALID, TRANSACTION_INVALID, TRANSACTION_VIOLATION, TRANSACTION_BLOCKED 27 trans_status = "TRANSACTION_VALID" 28 })) 29 else 30 res.statusCode = 400 31 res:setHeader("Content-Type", "application/json") 32 ---@diagnostic disable-next-line: param-type-mismatch 33 res:finish(json.encode({ 34 message = "henlo :3", 35 status = "OK", 36 trans_status = "TRANSACTION_INVALID" 37 })) 38 end 39 end) 40 else 41 res.statusCode = 404 42 end 43 return true 44end}