Add native support for homepages
This commit is contained in:
parent
ce98fdd80f
commit
17e7f67a7c
4 changed files with 13 additions and 1 deletions
|
@ -56,11 +56,18 @@ function factory(server, config)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local mypath
|
||||||
if type(config.virtual) == "table" then
|
if type(config.virtual) == "table" then
|
||||||
for _, v in ipairs(config.virtual) do
|
for _, v in ipairs(config.virtual) do
|
||||||
|
mypath = mypath or v
|
||||||
vhost:set_handler(v, handler)
|
vhost:set_handler(v, handler)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
mypath = config.virtual
|
||||||
vhost:set_handler(config.virtual, handler)
|
vhost:set_handler(config.virtual, handler)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if config.home then
|
||||||
|
vhost.default = mypath
|
||||||
|
end
|
||||||
end
|
end
|
|
@ -198,6 +198,10 @@ function VHost.process(self, request, ...)
|
||||||
-- Call URI part
|
-- Call URI part
|
||||||
request.env.PATH_INFO = uri
|
request.env.PATH_INFO = uri
|
||||||
|
|
||||||
|
if self.default and uri == "/" then
|
||||||
|
return 302, {Location = self.default}
|
||||||
|
end
|
||||||
|
|
||||||
for k, h in pairs(self.handlers) do
|
for k, h in pairs(self.handlers) do
|
||||||
if #k > hlen then
|
if #k > hlen then
|
||||||
if uri == k or (uri:sub(1, #k) == k and uri:byte(#k+1) == sc) then
|
if uri == k or (uri:sub(1, #k) == k and uri:byte(#k+1) == sc) then
|
||||||
|
|
|
@ -19,6 +19,7 @@ config LuciWebPublisher luciweb
|
||||||
option physical ''
|
option physical ''
|
||||||
list virtual /luci
|
list virtual /luci
|
||||||
option domain ''
|
option domain ''
|
||||||
|
option home 1
|
||||||
list exec ':lo'
|
list exec ':lo'
|
||||||
list exec ':br-lan'
|
list exec ':br-lan'
|
||||||
list exec 'root'
|
list exec 'root'
|
||||||
|
@ -71,4 +72,3 @@ config 'Redirector' 'splashredir'
|
||||||
option 'virtual' '/'
|
option 'virtual' '/'
|
||||||
option 'physical' ':80/luci/splash'
|
option 'physical' ':80/luci/splash'
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ config DirectoryPublisher webroot
|
||||||
config LuciWebPublisher luciweb
|
config LuciWebPublisher luciweb
|
||||||
option name 'LuCI Webapplication'
|
option name 'LuCI Webapplication'
|
||||||
option physical ''
|
option physical ''
|
||||||
|
option home 1
|
||||||
list virtual /luci
|
list virtual /luci
|
||||||
list virtual /cgi-bin/luci
|
list virtual /cgi-bin/luci
|
||||||
option domain ''
|
option domain ''
|
||||||
|
|
Loading…
Reference in a new issue