4 Dumps all the published links
6 function dump_files(t, r, dir)
7 for _, f in ipairs(r:get_direntries(dir)) do
8 if f ~= "." and f ~= ".." then
9 local filepath = dir .. "/" .. f
10 local info = r:stat(filepath)
12 -- if this is a file, then add it to the table!
13 if info.filetype == 1 then
17 -- if this is a dir, then descend into it
18 if info.filetype == 2 then
19 dump_files(t, r, filepath)
27 r.content_type = "text/plain"
29 if r.method == 'GET' then
30 -- get all local symlinks
32 dump_files(links, r, r.document_root)
34 -- if FQDN override is set,
35 -- use override instead of my own server name and port number
36 local fqdn = os.getenv('PUBLIC_FQDN_OVERRIDE')
37 fqdn = fqdn or r.server_name .. ":" ..r.port
40 for filepath, info in pairs(links) do
41 r:puts( ("%s\n"):format(
42 filepath:gsub(r.document_root, fqdn)