lib/zold/node/front.rb in zold-0.14.12 vs lib/zold/node/front.rb in zold-0.14.13
- old
+ new
@@ -72,10 +72,15 @@
check_header(Http::NETWORK_HEADER) do |header|
if header != settings.network
raise "Network name mismatch, you are in '#{header}', we are in '#{settings.network}'"
end
end
+ check_header(Http::PROTOCOL_HEADER) do |header|
+ if header != settings.protocol.to_s
+ raise "Protocol mismatch, you are in '#{header}', we are in '#{settings.protocol}'"
+ end
+ end
check_header(Http::SCORE_HEADER) do |header|
if settings.remotes.all.empty?
settings.log.debug("#{request.url}: we are in standalone mode, won't update remotes")
end
s = Score.parse_text(header)
@@ -96,11 +101,11 @@
# Currently there are no tests at all that would verify the headers.
after do
headers['Cache-Control'] = 'no-cache'
headers['Connection'] = 'close'
headers['X-Zold-Version'] = settings.version
- headers['X-Zold-Protocol'] = settings.protocol.to_s
+ headers[Http::PROTOCOL_HEADER] = settings.protocol.to_s
headers['Access-Control-Allow-Origin'] = '*'
headers[Http::SCORE_HEADER] = score.reduced(16).to_s
end
get '/robots.txt' do
@@ -159,9 +164,10 @@
version: settings.version,
score: score.to_h,
wallets: settings.wallets.all.count,
mtime: wallet.mtime.utc.iso8601,
digest: wallet.digest,
+ balance: wallet.balance.to_i,
body: AtomicFile.new(wallet.path).read
}.to_json
end
get %r{/wallet/(?<id>[A-Fa-f0-9]{16})/balance} do