zold 0.14.27 → 0.14.28
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/zold/node/front.rb +13 -0
- data/lib/zold/version.rb +1 -1
- data/test/node/test_front.rb +10 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e31d92a96dac32c4a2c347ea562e35176e481a4c
|
4
|
+
data.tar.gz: '0695b4884ed252ffc7d0e0bb5baf322bb9f16755'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 978a5f61ef0c5db91e7611b8d56f063b4f506387ce302d04361c49fd2f989158ccbc1bccf6379ddceb2eb16fe215cbbba0717fa57315c88e018890b347565f4b
|
7
|
+
data.tar.gz: a1a6d275a59aaf7ce4f1eb4b436738bd0832dcaaa83e1ed9f843d35dee2c878639b8752230aa9e8a394a21ac94d2107e4427ab4595e6e693f37c955e7bc93d99
|
data/lib/zold/node/front.rb
CHANGED
@@ -31,6 +31,7 @@ require 'concurrent'
|
|
31
31
|
require_relative '../backtrace'
|
32
32
|
require_relative '../version'
|
33
33
|
require_relative '../wallet'
|
34
|
+
require_relative '../copies'
|
34
35
|
require_relative '../log'
|
35
36
|
require_relative '../id'
|
36
37
|
require_relative '../http'
|
@@ -274,6 +275,18 @@ while #{settings.address} is in '#{settings.network}'"
|
|
274
275
|
AtomicFile.new(wallet.path).read
|
275
276
|
end
|
276
277
|
|
278
|
+
get %r{/wallet/(?<id>[A-Fa-f0-9]{16})/copies} do
|
279
|
+
id = Id.new(params[:id])
|
280
|
+
wallet = settings.wallets.find(id)
|
281
|
+
error 404 unless wallet.exists?
|
282
|
+
content_type 'text/plain'
|
283
|
+
Copies.new(File.join(settings.copies, id)).all.map do |c|
|
284
|
+
wallet = Wallet.new(c[:path])
|
285
|
+
"#{c[:name]}: #{c[:score]} #{wallet.balance}/#{wallet.txns.count}t/\
|
286
|
+
#{wallet.digest[0, 6]}/#{File.size(c[:path])}b/#{Age.new(File.mtime(c[:path]))}"
|
287
|
+
end.join("\n")
|
288
|
+
end
|
289
|
+
|
277
290
|
put %r{/wallet/(?<id>[A-Fa-f0-9]{16})/?} do
|
278
291
|
request.body.rewind
|
279
292
|
modified = settings.entrance.push(Id.new(params[:id]), request.body.read.to_s)
|
data/lib/zold/version.rb
CHANGED
data/test/node/test_front.rb
CHANGED
@@ -72,26 +72,27 @@ class FrontTest < Minitest::Test
|
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
-
# @todo #212:30min The test is skipped because it crashes
|
76
|
-
# sporadically. I don't know why. Let's investigate, find the
|
77
|
-
# cause and fix it properly: http://www.rultor.com/t/14887-396655530
|
78
75
|
def test_renders_wallet_pages
|
79
|
-
skip
|
80
76
|
FakeHome.new.run do |home|
|
81
|
-
FakeNode.new(log: test_log).run(['--ignore-score-weakness']) do |port|
|
77
|
+
FakeNode.new(log: test_log).run(['--ignore-score-weakness', '--standalone']) do |port|
|
82
78
|
wallet = home.create_wallet
|
83
79
|
test_log.debug("Wallet created: #{wallet.id}")
|
84
|
-
|
80
|
+
home = "http://localhost:#{port}"
|
81
|
+
response = Zold::Http.new(uri: "#{home}/wallet/#{wallet.id}?sync=true", score: nil)
|
85
82
|
.put(File.read(wallet.path))
|
86
83
|
assert_equal('200', response.code, response.body)
|
84
|
+
sleep 0.1 until Zold::Http.new(uri: "#{home}/wallet/#{wallet.id}", score: nil).get.code == '200'
|
87
85
|
[
|
88
|
-
"/wallet/#{wallet.id}",
|
89
86
|
"/wallet/#{wallet.id}.txt",
|
87
|
+
"/wallet/#{wallet.id}.json",
|
90
88
|
"/wallet/#{wallet.id}/balance",
|
91
89
|
"/wallet/#{wallet.id}/key",
|
92
|
-
"/wallet/#{wallet.id}/mtime"
|
90
|
+
"/wallet/#{wallet.id}/mtime",
|
91
|
+
"/wallet/#{wallet.id}/digest",
|
92
|
+
"/wallet/#{wallet.id}.bin",
|
93
|
+
"/wallet/#{wallet.id}/copies"
|
93
94
|
].each do |u|
|
94
|
-
res = Zold::Http.new(uri: u, score: nil).get
|
95
|
+
res = Zold::Http.new(uri: "#{home}#{u}", score: nil).get
|
95
96
|
assert_equal('200', res.code, res.body)
|
96
97
|
end
|
97
98
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zold
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.14.
|
4
|
+
version: 0.14.28
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|