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 = string.gsub(args.pattern, '+', ' ')
27 local nonce = publish(r.context_document_root, pattern)
29 r:puts( "No links created" )
31 -- if FQDN override is set,
32 -- use override instead of my own server name and port number
33 local fqdn = os.getenv('PUBLIC_FQDN_OVERRIDE')
35 (r.is_https and "https" or "http") ..
36 "://" .. r.server_name .. ":" ..r.port
38 local uri = ("%s/%s/"):format(fqdn, nonce)
39 r:puts( ([[<a href="%s">%s</a>]]):format(uri, uri) )
42 local template = get_form(r.context_document_root)