lib/zold/node/front.rb in zold-0.26.16 vs lib/zold/node/front.rb in zold-0.26.17
- old
+ new
@@ -317,11 +317,11 @@
].join("\n")
end
end
get %r{/wallet/(?<id>[A-Fa-f0-9]{16})\.html} do
- fetch do |wallet|
+ fetch('text/html') do |wallet|
[
'<!DOCTYPE html><html><head>',
'<title>' + wallet.id.to_s + '</title>',
'<link href="https://cdn.jsdelivr.net/gh/yegor256/tacit@gh-pages/tacit-css-1.4.2.min.css" rel="stylesheet"/>',
'<style>table { width: 100%; } td, th { padding: 0.2em .4em }</style>',
@@ -336,23 +336,23 @@
[
'<tr>',
'<td style="color:' + (t.amount.negative? ? 'red' : 'green') + "\">#{t.id}</td>",
"<td>#{t.date.utc.iso8601}</td>",
'<td style="text-align:right">' + t.amount.to_zld(4) + '</td>',
- "<td><a href='/wallet/#{t.bnf}.html'>#{t.bnf}</td>",
- "<td>#{t.details}</td>",
+ "<td><a href='/wallet/#{t.bnf}.html'><code>#{t.bnf}</code></a></td>",
+ "<td>#{CGI.escapeHTML(t.details)}</td>",
'</tr>'
].join
end.join,
'<p>—<br/>',
"Balance: #{wallet.balance.to_zld(8)} ZLD (#{wallet.balance.to_i} zents)<br/>",
"Transactions: #{wallet.txns.count}<br/>",
"Taxes: #{Tax.new(wallet).paid} paid, the debt is #{Tax.new(wallet).debt}<br/>",
"File size: #{Size.new(wallet.size)}/#{wallet.size}, \
#{Copies.new(File.join(settings.copies, wallet.id)).all.count} copies<br/>",
"Modified: #{wallet.mtime.utc.iso8601} (#{Age.new(wallet.mtime.utc.iso8601)} ago)<br/>",
- "Digest: #{wallet.digest}</p></section></body></html>"
+ "Digest: <code>#{wallet.digest}</code></p></section></body></html>"
].join
end
end
get %r{/wallet/(?<id>[A-Fa-f0-9]{16})\.bin} do
@@ -486,10 +486,11 @@
'<!DOCTYPE html><html><head>',
'<title>/journal</title>',
'<link href="https://cdn.jsdelivr.net/gh/yegor256/tacit@gh-pages/tacit-css-1.4.2.min.css" rel="stylesheet"/>',
'</head><body><section>',
DirItems.new(settings.journal_dir).fetch.sort.map do |f|
- "<p><a href='/journal/item?id=#{f}'>#{f}</a></p>"
+ file = File.join(settings.journal_dir, f)
+ "<p><a href='/journal/item?id=#{f}'>#{f}</a>: #{File.size(file)} #{Age.new(File.mtime(file))} ago</p>"
end.join,
'</section></body></html>'
].join
end