Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 64b07ad34d | |||
| 6fbc87a465 | |||
| c88c43fd8e | |||
| 807e124570 | |||
| 0493632932 | |||
| ce4f7f54da | |||
| 9df7ed5be8 | |||
| 82035ea239 |
@@ -1,5 +1,6 @@
|
|||||||
local to_json = require("lapis.util").to_json
|
local to_json = require("lapis.util").to_json
|
||||||
local autoload = require("lapis.util").autoload
|
local autoload = require("lapis.util").autoload
|
||||||
|
local escape = require("lapis.util").escape
|
||||||
local config = require("lapis.config")
|
local config = require("lapis.config")
|
||||||
local hotmixes = autoload("hotmixes")
|
local hotmixes = autoload("hotmixes")
|
||||||
|
|
||||||
@@ -10,13 +11,14 @@ local function Roothandler(self)
|
|||||||
local latest_path, latest_name = hotmixes.utils.these_latest( path )
|
local latest_path, latest_name = hotmixes.utils.these_latest( path )
|
||||||
|
|
||||||
self.total = hotmixes.utils.total_files_dir( path )
|
self.total = hotmixes.utils.total_files_dir( path )
|
||||||
self.uri = hotmixes.utils.request_path
|
self.uri = hotmixes.utils.request_path:sub(2) -- remove leading slash
|
||||||
self.path = '/data/' .. self.titles.url .. hotmixes.utils.request_path
|
self.path = '/data/' .. self.titles.url .. hotmixes.utils.request_path
|
||||||
self.dirs = stuff.dirs
|
self.dirs = stuff.dirs
|
||||||
self.files = stuff.files
|
self.files = stuff.files
|
||||||
self.images = stuff.images
|
self.images = stuff.images
|
||||||
self.latestpath = latest_path
|
self.latestpath = latest_path
|
||||||
self.latestname = latest_name
|
self.latestname = latest_name
|
||||||
|
self.functions = { escape = escape }
|
||||||
|
|
||||||
if self.titles['url'] == "panamaracing.club" then
|
if self.titles['url'] == "panamaracing.club" then
|
||||||
return { render = "root", layout = require "views.prc_layout" }
|
return { render = "root", layout = require "views.prc_layout" }
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ end
|
|||||||
|
|
||||||
local request_path
|
local request_path
|
||||||
if request_uri ~= '/' then
|
if request_uri ~= '/' then
|
||||||
request_path = request_uri .. '/'
|
request_path = request_uri .. '/'
|
||||||
else
|
else
|
||||||
request_path = request_uri
|
request_path = request_uri
|
||||||
end
|
end
|
||||||
@@ -64,17 +64,17 @@ utils['these_files'] = function( path )
|
|||||||
if utils.match_ext( file, type_image ) then
|
if utils.match_ext( file, type_image ) then
|
||||||
table.insert( images, file )
|
table.insert( images, file )
|
||||||
elseif utils.match_ext( file, type_media ) then
|
elseif utils.match_ext( file, type_media ) then
|
||||||
table.insert( files, {sane=escape(file), file=file} )
|
table.insert( files, file )
|
||||||
end
|
end
|
||||||
elseif lfs.attributes( path .. file, "mode" ) == "directory" then
|
elseif lfs.attributes( path .. file, "mode" ) == "directory" then
|
||||||
table.insert( dirs, {sane=escape(file), dir=file} )
|
table.insert( dirs, file )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
table.sort( images )
|
table.sort( images )
|
||||||
-- table.sort( files )
|
table.sort( files )
|
||||||
-- table.sort( dirs )
|
table.sort( dirs )
|
||||||
|
|
||||||
local stuff = {
|
local stuff = {
|
||||||
files = files,
|
files = files,
|
||||||
|
|||||||
@@ -10,14 +10,14 @@
|
|||||||
|
|
||||||
<% for i, dir in ipairs(dirs) do %>
|
<% for i, dir in ipairs(dirs) do %>
|
||||||
<br>
|
<br>
|
||||||
<a href="<%= uri .. dir["sane"] %>" class="djsection"><span><%= dir["dir"] %></span></a>
|
<a href="<%- functions.escape(uri .. dir) %>" class="djsection"><span><%= dir %></span></a>
|
||||||
<br>
|
<br>
|
||||||
<% end %>
|
<% end %>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<% for i, file in ipairs(files) do %>
|
<% for i, file in ipairs(files) do %>
|
||||||
<a class="amixlink" href="<%= path .. file["sane"] %>">
|
<a class="amixlink" href="<%- functions.escape(path .. file):gsub("%%2f", "/") %>">
|
||||||
<span class="mixlink"><%= file["file"] %></span>
|
<span class="mixlink"><%= file %></span>
|
||||||
</a>
|
</a>
|
||||||
<br>
|
<br>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
Reference in New Issue
Block a user