mirror of
https://github.com/lxsang/antd-web-apps
synced 2024-11-20 02:18:20 +01:00
fix
This commit is contained in:
parent
9acc7966a8
commit
8550dab61c
@ -28,6 +28,7 @@ local REGISTRY = {}
|
|||||||
REGISTRY.logger = Logger:new{ levels = {INFO = true, ERROR = true, DEBUG = true}}
|
REGISTRY.logger = Logger:new{ levels = {INFO = true, ERROR = true, DEBUG = true}}
|
||||||
REGISTRY.db = DBHelper:new{db="mrsang"}
|
REGISTRY.db = DBHelper:new{db="mrsang"}
|
||||||
REGISTRY.layout = 'default'
|
REGISTRY.layout = 'default'
|
||||||
|
REGISTRY.fileaccess = true
|
||||||
|
|
||||||
REGISTRY.db:open()
|
REGISTRY.db:open()
|
||||||
local router = Router:new{registry = REGISTRY}
|
local router = Router:new{registry = REGISTRY}
|
||||||
|
3
index.ls
3
index.ls
@ -1,5 +1,6 @@
|
|||||||
<?lua
|
<?lua
|
||||||
std.html()
|
std.html()
|
||||||
|
require("sqlite")
|
||||||
local user = "mrsang"
|
local user = "mrsang"
|
||||||
local die = function(m)
|
local die = function(m)
|
||||||
echo(m)
|
echo(m)
|
||||||
@ -8,7 +9,7 @@
|
|||||||
end
|
end
|
||||||
local mobilecls = ""
|
local mobilecls = ""
|
||||||
if HEADER.mobile then mobilecls = "mobile" end
|
if HEADER.mobile then mobilecls = "mobile" end
|
||||||
local db = require("db.model").get(user,"user",nil)
|
local db = require("os.libs.dbmodel").get(user,"user",nil)
|
||||||
if db == nil then die("cannot get db data") end
|
if db == nil then die("cannot get db data") end
|
||||||
local data, a = db:getAll()
|
local data, a = db:getAll()
|
||||||
db:close()
|
db:close()
|
||||||
|
@ -24,6 +24,7 @@ local REGISTRY = {}
|
|||||||
REGISTRY.logger = Logger:new{ levels = {INFO = true, ERROR = true, DEBUG = true}}
|
REGISTRY.logger = Logger:new{ levels = {INFO = true, ERROR = true, DEBUG = true}}
|
||||||
REGISTRY.db = DBHelper:new{db="mrsang"}
|
REGISTRY.db = DBHelper:new{db="mrsang"}
|
||||||
REGISTRY.layout = 'default'
|
REGISTRY.layout = 'default'
|
||||||
|
REGISTRY.fileaccess = true
|
||||||
|
|
||||||
REGISTRY.db:open()
|
REGISTRY.db:open()
|
||||||
local router = Router:new{registry = REGISTRY}
|
local router = Router:new{registry = REGISTRY}
|
||||||
|
@ -93,9 +93,9 @@ end
|
|||||||
|
|
||||||
function AssetController:get(...)
|
function AssetController:get(...)
|
||||||
local path = WWW_ROOT..DIR_SEP..implode({...}, DIR_SEP)
|
local path = WWW_ROOT..DIR_SEP..implode({...}, DIR_SEP)
|
||||||
local mime = std.mimeOf(path)
|
|
||||||
|
|
||||||
if ulib.exists(path) then
|
if self.registry.fileaccess and ulib.exists(path) then
|
||||||
|
local mime = std.mimeOf(path)
|
||||||
if POLICY.mimes[mime] then
|
if POLICY.mimes[mime] then
|
||||||
std.header(mime)
|
std.header(mime)
|
||||||
if std.isBinary(path) then
|
if std.isBinary(path) then
|
||||||
@ -107,7 +107,7 @@ function AssetController:get(...)
|
|||||||
self:error("Access forbidden: "..path)
|
self:error("Access forbidden: "..path)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
self:error("Asset file not found: "..path)
|
self:error("Asset file not found or access forbidden: "..path)
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
Loading…
Reference in New Issue
Block a user