Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nodesfinder
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tools
nodesfinder
Commits
a212fe6b
Commit
a212fe6b
authored
2 years ago
by
matograine
Browse files
Options
Downloads
Plain Diff
Merge branch 'hugo-version'
parents
47ab0086
c7c4be22
No related branches found
No related tags found
1 merge request
!1
Draft: add version column
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
endpoint.js
+23
-2
23 additions, 2 deletions
endpoint.js
index.html
+2
-0
2 additions, 0 deletions
index.html
node.js
+14
-3
14 additions, 3 deletions
node.js
with
39 additions
and
5 deletions
endpoint.js
+
23
−
2
View file @
a212fe6b
...
@@ -14,7 +14,8 @@ let is_path = function (to_test, endpoint) {
...
@@ -14,7 +14,8 @@ let is_path = function (to_test, endpoint) {
class
BMAEndpoint
{
class
BMAEndpoint
{
constructor
(
raw_endpoint
)
{
constructor
(
raw_endpoint
,
pubkey
)
{
this
.
pubkey
=
pubkey
let
infos
=
raw_endpoint
.
split
(
"
"
);
let
infos
=
raw_endpoint
.
split
(
"
"
);
this
.
type
=
this
.
get_endpoint_type
(
infos
);
this
.
type
=
this
.
get_endpoint_type
(
infos
);
...
@@ -33,6 +34,7 @@ class BMAEndpoint{
...
@@ -33,6 +34,7 @@ class BMAEndpoint{
// TODO manage IPv4/v6
// TODO manage IPv4/v6
this
.
has_url
=
this
.
create_root_url
();
this
.
has_url
=
this
.
create_root_url
();
this
.
is_member
();
}
}
get_endpoint_type
(
raw_endpoint_array
)
{
get_endpoint_type
(
raw_endpoint_array
)
{
...
@@ -162,8 +164,27 @@ class BMAEndpoint{
...
@@ -162,8 +164,27 @@ class BMAEndpoint{
this
.
row
=
document
.
createElement
(
'
tr
'
)
this
.
row
=
document
.
createElement
(
'
tr
'
)
fields
.
forEach
(
field
=>
{
fields
.
forEach
(
field
=>
{
let
cell
=
document
.
createElement
(
'
td
'
)
let
cell
=
document
.
createElement
(
'
td
'
)
cell
.
innerText
=
(
this
[
field
]
==
undefined
)
?
''
:
this
[
field
]
cell
.
innerText
=
(
this
[
field
]
==
undefined
)
?
'
ø
'
:
this
[
field
]
this
.
row
.
appendChild
(
cell
)
this
.
row
.
appendChild
(
cell
)
});
});
}
}
get_version
=
async
function
()
{
return
fetch
(
this
.
url_protocol
+
this
.
url_root
+
'
/node/summary/
'
)
.
then
(
response
=>
response
.
json
())
.
then
(
data
=>
this
.
version
=
data
.
duniter
.
version
)
.
catch
(
error
=>
{
this
.
version
=
"
ø
"
})
}
is_member
=
async
function
()
{
let
url
=
this
.
url_protocol
+
this
.
url_root
+
'
/wot/identity-of/
'
+
this
.
pubkey
console
.
log
(
url
)
return
fetch
(
url
)
.
then
(
response
=>
response
.
json
())
.
then
(
data
=>
{
this
.
member
=
(
data
.
pubkey
?
'
Oui
'
:
'
Non
'
)
})
.
catch
(
error
=>
{
this
.
member
=
"
ø
"
})
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
index.html
+
2
−
0
View file @
a212fe6b
...
@@ -45,6 +45,8 @@
...
@@ -45,6 +45,8 @@
<th>
Bloc
</th>
<th>
Bloc
</th>
<th>
Type
</th>
<th>
Type
</th>
<th>
Rapidité (ms)
</th>
<th>
Rapidité (ms)
</th>
<th>
version
</th>
<th>
Membre
</th>
</tr>
</tr>
</thead>
</thead>
</table>
</table>
...
...
This diff is collapsed.
Click to expand it.
node.js
+
14
−
3
View file @
a212fe6b
class
DuniterNodes
class
DuniterNodes
{
{
constructor
(
peers
)
{
constructor
(
peers
)
{
this
.
fields
=
[
'
url_root
'
,
'
head_block
'
,
'
type
'
,
'
speed
'
]
this
.
fields
=
[
'
url_root
'
,
'
head_block
'
,
'
type
'
,
'
speed
'
,
'
version
'
,
'
member
'
]
this
.
ep_body
=
document
.
createElement
(
'
tbody
'
)
this
.
ep_body
=
document
.
createElement
(
'
tbody
'
)
this
.
draw
()
this
.
draw
()
...
@@ -21,7 +21,7 @@ class DuniterNodes
...
@@ -21,7 +21,7 @@ class DuniterNodes
peers
.
forEach
(
peer
=>
{
peers
.
forEach
(
peer
=>
{
let
endpoints
=
peer
.
endpoints
;
let
endpoints
=
peer
.
endpoints
;
endpoints
.
forEach
(
endpoint
=>
{
endpoints
.
forEach
(
endpoint
=>
{
let
ep
=
new
BMAEndpoint
(
endpoint
)
let
ep
=
new
BMAEndpoint
(
endpoint
,
peer
.
pubkey
)
if
(
ep
.
has_url
)
{
if
(
ep
.
has_url
)
{
this
.
endpoints
.
push
(
ep
)
this
.
endpoints
.
push
(
ep
)
}
}
...
@@ -38,6 +38,7 @@ class DuniterNodes
...
@@ -38,6 +38,7 @@ class DuniterNodes
ep
.
draw_row
(
fields
)
ep
.
draw_row
(
fields
)
this
.
insert
(
ep
)
this
.
insert
(
ep
)
})
})
ep
.
get_version
()
})
})
}
}
...
@@ -100,6 +101,7 @@ class DuniterNodes
...
@@ -100,6 +101,7 @@ class DuniterNodes
let
rows
=
this
.
ep_body
.
childNodes
let
rows
=
this
.
ep_body
.
childNodes
rows
.
forEach
(
row
=>
{
rows
.
forEach
(
row
=>
{
let
cells
=
row
.
childNodes
let
cells
=
row
.
childNodes
switch
(
cells
[
1
].
innerText
)
{
switch
(
cells
[
1
].
innerText
)
{
case
consensus_block
:
case
consensus_block
:
cells
[
1
].
setAttribute
(
'
class
'
,
'
consensus
'
)
cells
[
1
].
setAttribute
(
'
class
'
,
'
consensus
'
)
...
@@ -107,13 +109,22 @@ class DuniterNodes
...
@@ -107,13 +109,22 @@ class DuniterNodes
case
'
undefined
'
:
case
'
undefined
'
:
cells
[
1
].
setAttribute
(
'
class
'
,
'
unreachable
'
)
cells
[
1
].
setAttribute
(
'
class
'
,
'
unreachable
'
)
break
break
case
''
:
case
'
ø
'
:
cells
[
1
].
setAttribute
(
'
class
'
,
'
unreachable
'
)
cells
[
1
].
setAttribute
(
'
class
'
,
'
unreachable
'
)
break
break
default
:
default
:
cells
[
1
].
setAttribute
(
'
class
'
,
'
desynchronized
'
)
cells
[
1
].
setAttribute
(
'
class
'
,
'
desynchronized
'
)
break
break
}
}
switch
(
cells
[
5
].
innerText
)
{
case
'
Oui
'
:
cells
[
5
].
setAttribute
(
'
class
'
,
'
consensus
'
)
break
case
'
Non
'
:
cells
[
5
].
setAttribute
(
'
class
'
,
'
desynchronized
'
)
break
}
})
})
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment