project Websites / videos.bentasker.co.uk avatar

Websites / videos.bentasker.co.uk: e28a2dbc




VID-11 Only send debug information when {{debug}} is present in querystring

VID-11 Only send debug information when {{debug}} is present in querystring

Commit e28a2dbc.

Authored 2019-04-18T14:00:29.000+01:00 by B Tasker in project Websites / videos.bentasker.co.uk

+7 lines -2 lines

Changes

diff --git a/resources/tokenisation/minter/token_gen.lua b/resources/tokenisation/minter/token_gen.lua
--- a/resources/tokenisation/minter/token_gen.lua
+++ b/resources/tokenisation/minter/token_gen.lua
# @@ -83,7 +83,7 @@ end
# local function sendSuccessful(tok,expires,debug)
# -- response format should be
# -- {"status": true, "token": "OqBvCvqg49QJgGKDHFbdNccB", "exp": 0}
# - local r = {status = true, token = tok, exp = expires, d = debug}
# + local r = {status = true, token = tok, exp = expires, debug = debug}
# return json.encode(r)
# end
#
# @@ -160,6 +160,7 @@ local function check_referrer(referrer,httpref,permitted)
# end
#
# -- Function main
# +local debug = nil
#
# -- get some details from the request
# local referer = unescape(ngx.var.arg_ref)
# @@ -202,6 +203,10 @@ local tok = mint_token(vidpath,expires,ip,secret)
# -- print(expires)
# -- print(tok)
#
# +if ngx.var.arg_debug ~= nil
# +then
# + debug = {vidpath = vidpath, IP = ip, Expires = expires}
# +end
#
# -ngx.print(sendSuccessful(tok,expires,{vidpath,ip,expires}))
# +ngx.print(sendSuccessful(tok,expires,debug))
# -- print(sendSuccessful(tok,expires,{vidpath,ip,expires})) -- offline testing only
#