1
0
mirror of https://github.com/lxsang/antd-web-apps synced 2024-12-28 02:08:22 +01:00
antd-web-apps/blog/index.ls
Xuan Sang LE e88b5470cc add blog
2018-02-23 19:52:10 +01:00

28 lines
743 B
Plaintext

<?lua
BLOG_ROOT = __ROOT__.."/blog"
-- if a file request, just respond it
local action = REQUEST.query.action
if not action or action == "" then
return require("blog.router")("top:10")
end
local path = BLOG_ROOT.."/"..action
if unix.exists(path) then
local mime = std.mime(path)
if mime == "application/octet-stream" then
std.html()
echo("Acess denied to: "..path)
else
std.header(mime)
if std.is_bin(path) then
std.fb(path)
else
std.f(path)
end
end
else
print("Perform action.."..action)
return require("blog.router")(action)
end
?>