fix relative paths
This commit is contained in:
parent
f6cf84e310
commit
3c2de65806
@ -1,19 +1,17 @@
|
||||
local to_json = require("lapis.util").to_json
|
||||
local autoload = require("lapis.util").autoload
|
||||
local config = require("lapis.config")
|
||||
|
||||
-- print(to_json(config.get()))
|
||||
|
||||
local hotmixes = autoload("hotmixes")
|
||||
|
||||
local function Roothandler(self)
|
||||
local stuff = hotmixes.utils.these_files( hotmixes.utils.data_path )
|
||||
|
||||
local latest_path, latest_name = hotmixes.utils.these_latest()
|
||||
local path = config.get().mount .. self.titles.url
|
||||
local stuff = hotmixes.utils.these_files( path .. hotmixes.utils.request_path )
|
||||
local latest_path, latest_name = hotmixes.utils.these_latest( path )
|
||||
|
||||
self.total = hotmixes.utils.total_files_dir( config.get().mount )
|
||||
self.total = hotmixes.utils.total_files_dir( path )
|
||||
self.uri = hotmixes.utils.request_path
|
||||
self.path = '/data' .. hotmixes.utils.request_path
|
||||
self.path = '/data/' .. self.titles.url .. hotmixes.utils.request_path
|
||||
self.dirs = stuff.dirs
|
||||
self.files = stuff.files
|
||||
self.images = stuff.images
|
||||
|
||||
@ -80,17 +80,14 @@ utils['these_files'] = function( path )
|
||||
return stuff
|
||||
end
|
||||
|
||||
utils['these_latest'] = function()
|
||||
utils['these_latest'] = function( path )
|
||||
-- list last 10 modified files in our directory
|
||||
local latest_path, latest_name = {}, {}
|
||||
|
||||
for i, file_path in ipairs( utils.latest_files( data_dir ) ) do
|
||||
file_path = file_path:gsub( data_dir, "/" )
|
||||
for i, file_path in ipairs( utils.latest_files( path ) ) do
|
||||
file_path = file_path:gsub( path, "/" )
|
||||
table.insert( latest_path, file_path)
|
||||
|
||||
-- local to_json = require("lapis.util").to_json
|
||||
-- print( to_json(latest_path) )
|
||||
|
||||
local temp = ""
|
||||
local result = ""
|
||||
for i = file_path:len(), 1, -1 do
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
<br>
|
||||
<h1 class="h1">Latest uploads:</h1>
|
||||
<% for i, file in ipairs(latestpath) do %>
|
||||
<a class="amixlink" href="<%= '/data' .. file %>">
|
||||
<a class="amixlink" href="<%= '/data/' .. titles.url .. '/' .. file %>">
|
||||
<span class="mixlink"><%= latestname[i] %></span>
|
||||
</a>
|
||||
</br>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user