Added support for index.ru.html in web.lua
This commit is contained in:
parent
7aab0b4e12
commit
b35798016e
|
@ -70,7 +70,7 @@
|
|||
<legend>Noise Reduction (expect JPEG Artifact)</legend>
|
||||
<label><input type="radio" name="noise" value="0"> None</label>
|
||||
<label><input type="radio" name="noise" value="1" checked="checked"> Medium</label>
|
||||
<label><input type="radio" name="noise" value="2"> High (not recommended)</label>
|
||||
<label><input type="radio" name="noise" value="2"> High</label>
|
||||
<div class="help">When using 2x scaling, we never recommend to use high level of noise reduction, it almost always makes image worse, it makes sense for only some rare cases when image had really bad quality from the beginning.</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
|
|
4
web.lua
4
web.lua
|
@ -178,6 +178,7 @@ function APIHandler:post()
|
|||
end
|
||||
local FormHandler = class("FormHandler", turbo.web.RequestHandler)
|
||||
local index_ja = file.read("./assets/index.ja.html")
|
||||
local index_ru = file.read("./assets/index.ru.html")
|
||||
local index_en = file.read("./assets/index.html")
|
||||
function FormHandler:get()
|
||||
local lang = self.request.headers:get("Accept-Language")
|
||||
|
@ -188,6 +189,8 @@ function FormHandler:get()
|
|||
end
|
||||
if langs[1] == "ja" then
|
||||
self:write(index_ja)
|
||||
elseif langs[1] == "ru" then
|
||||
self:write(index_ru)
|
||||
else
|
||||
self:write(index_en)
|
||||
end
|
||||
|
@ -208,6 +211,7 @@ local app = turbo.web.Application:new(
|
|||
{"^/$", FormHandler},
|
||||
{"^/index.html", turbo.web.StaticFileHandler, path.join("./assets", "index.html")},
|
||||
{"^/index.ja.html", turbo.web.StaticFileHandler, path.join("./assets", "index.ja.html")},
|
||||
{"^/index.ru.html", turbo.web.StaticFileHandler, path.join("./assets", "index.ru.html")},
|
||||
{"^/api$", APIHandler},
|
||||
}
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue