3 function publish(dir, pattern)
4 local cmd = ("%s/publish.sh %s"):format(dir, pattern)
5 local handle = io.popen(cmd)
6 local output = handle:read('*a')
12 function get_form(dir)
13 local handle = io.open(dir .. '/submit.html')
14 local output = handle:read('*a')
21 r.content_type = "text/html"
23 local args = r:parseargs()
24 local pattern = args.pattern
27 local nonce = publish(r.context_document_root, pattern)
29 -- if FQDN override is set,
30 -- use override instead of my own server name and port number
31 local fqdn = os.getenv('PUBLIC_FQDN_OVERRIDE')
32 fqdn = fqdn or (r.is_https and "https" or "http") .. "://" .. r.server_name .. ":" ..r.port
34 local uri = ("%s/%s/"):format(fqdn, nonce)
35 r:puts( ([[<a href="%s">%s</a>]]):format(uri, uri) )
37 local template = get_form(r.context_document_root)