</html>]]
end
-function dirlisting(url,listing,acl_)
+function dirlisting(url,listing)
local list = {}
for _,f in ipairs(listing) do
if not string.match(f,"^%.") then
</body>
</html>]]
end
- return h:file(url,"text/html",nil,password,acl_,callback,nil)
+ return h:file(url,"text/html",nil,password,nil,callback,nil)
end
-- FIXME: Experimental art support. Needs some cleaning up.
return content
end
-function file(h,path,url,acl_,mime)
+function file(h,path,url,mime)
local generate_page = process(path)
local callback = function(data,request)
-- FIXME: I'm sure that we could define a real sandbox
end
return table.concat(page)
end
- return h:file(url or path,mime,nil,password,acl_,callback,nil)
+ return h:file(url or path,mime,nil,password,nil,callback,nil)
end
-function rawfile(h,path,url,acl_)
+function rawfile(h,path,url)
local filename = path
local mtime = 0 -- vlc.net.stat(filename).modification_time
local page = false -- io.open(filename):read("*a")
end
return page
end
- return h:file(url or path,nil,nil,password,acl_,callback,nil)
+ return h:file(url or path,nil,nil,password,nil,callback,nil)
end
function parse_url_request(request)
package.path = oldpath
end
local files = {}
-local function load_dir(dir,root,parent_acl)
+local function load_dir(dir,root)
local root = root or "/"
local has_index = false
- local my_acl = parent_acl
- do
- local af = dir.."/.hosts"
- local s = vlc.net.stat(af)
- if s and s.type == "file" then
- -- We found an acl
- my_acl = vlc.acl(false)
- my_acl:load_file(af)
- end
- end
local d = vlc.net.opendir(dir)
for _,f in ipairs(d) do
if not string.match(f,"^%.") then
local mime = mimes[ext]
-- print(url,mime)
if mime and string.match(mime,"^text/") then
- table.insert(files,file(h,dir.."/"..f,url,my_acl,mime))
+ table.insert(files,file(h,dir.."/"..f,url,mime))
else
- table.insert(files,rawfile(h,dir.."/"..f,url,my_acl))
+ table.insert(files,rawfile(h,dir.."/"..f,url))
end
elseif s.type == "dir" then
- load_dir(dir.."/"..f,root..f.."/",my_acl)
+ load_dir(dir.."/"..f,root..f.."/")
end
end
end
if not has_index and not config.no_index then
-- print("Adding index for", root)
- table.insert(files,dirlisting(root,d,my_acl))
+ table.insert(files,dirlisting(root,d))
end
- return my_acl
end
if config.host then
password = vlc.var.inherit(nil,"http-password")
h = vlc.httpd()
-local root_acl = load_dir( http_dir )
-local a = h:handler("/art",nil,password,root_acl,callback_art,nil)
+local a = h:handler("/art",nil,password,nil,callback_art,nil)