-- vim:set ft=lua:
PAGE_COUNT=50
dofile(mg.script_name:gsub('[^\\/]*$','')..'util.lua')
vtag=GetVarInt(mg.request_info.query_string,'vtag') or -1
ct=CreateContentBuilder(GZIP_THRESHOLD_BYTE)
ct:Append([=[
]=])
edcb.htmlEscape=15
a=edcb.GetReserveData()
table.sort(a, function(a,b) return os.time(a.startTime) < os.time(b.startTime) end)
page=GetVarInt(mg.request_info.query_string,'page',0,(#a-1)/PAGE_COUNT) or 0
pageNav=''
if #a>PAGE_COUNT then
for i=math.max(page-1,1),math.min(math.max(page-1,1)+6,(#a+PAGE_COUNT-1)/PAGE_COUNT) do
pageNav=pageNav..(i-1==page and ((i-1)*PAGE_COUNT+1)..'~ ' or '
'..((i-1)*PAGE_COUNT+1)..'~ ')
end
pageNav=(page==0 and '|<< ' or '
|<< ')..pageNav
..(page==math.floor((#a-1)/PAGE_COUNT) and '>>|' or '
>>|\n')
end
ct:Append(pageNav)
ct:Append([=[
view.lua]=])
for i,v in ipairs(edcb.FindFile and edcb.FindFile('\\\\.\\pipe\\SendTSTCP_*',0) or {}) do
n=v.name:match('^[^_]+_(%d+)_%d+$')
if n then
ct:Append((vtag..''==n and '
' or '
(video)'))
end
end
ct:Append([=[
-term
]=])
ct:Finish()
mg.write(ct:Pop(Response(200,'text/html','utf-8',ct.len)..(ct.gzip and 'Content-Encoding: gzip\r\n' or '')..'\r\n'))