Issue#123: compatibility issue with zerotier 1.12.1 (#125)

* issue#123: version bump

* Fix incompatibility with ZeroTier 1.12 (#124)

Co-authored-by: Niels Martignène <niels.martignene@protonmail.com>

* issue#123: Credit to @Koromix for fix

---------

Co-authored-by: Niels Martignène <niels.martignene@protonmail.com>
This commit is contained in:
key-networks 2023-08-30 07:17:08 +08:00 committed by Key Networks
parent 42248c1359
commit 1b2284864d
3 changed files with 18 additions and 6 deletions

View File

@ -305,4 +305,5 @@ Problems with ztncui can be reported using the GitHub issue tracking system. Pl
The ztncui code is open source code, licensed under the GNU GPLv3, and is free to use on those terms. If you are interested in commercial licensing, please contact us via the contact form at [key-networks.com](https://key-networks.com) . The ztncui code is open source code, licensed under the GNU GPLv3, and is free to use on those terms. If you are interested in commercial licensing, please contact us via the contact form at [key-networks.com](https://key-networks.com) .
## Thanks ## Thanks
@lideming for a rework and improvement of the network details page, adding DNS support, peer status/address/latency and other improvements. - @lideming for a rework and improvement of the network details page, adding DNS support, peer status/address/latency and other improvements.
- @Koromix for a fix for incompatibility with ZeroTier 1.12.

View File

@ -17,15 +17,26 @@ async function get_network_with_members(nwid) {
zt.network_detail(nwid), zt.network_detail(nwid),
zt.peers(), zt.peers(),
zt.members(nwid) zt.members(nwid)
.then(member_ids => .then(member_ids => {
Promise.all( // Fix weird data returned by ZeroTier 1.12
if (Array.isArray(member_ids)) {
let obj = {};
for (let id of member_ids) {
let key = Object.keys(id)[0];
let value = Object.values(id)[0];
obj[key] = value;
}
member_ids = obj;
}
return Promise.all(
Object.keys(member_ids) Object.keys(member_ids)
.map(id => Promise.all([ .map(id => Promise.all([
zt.member_detail(nwid, id), zt.member_detail(nwid, id),
storage.getItem(id) storage.getItem(id)
])) ]))
) );
).then(results => results.map(([member, name]) => { }).then(results => results.map(([member, name]) => {
member.name = name || ''; member.name = name || '';
return member; return member;
})) }))

View File

@ -1,6 +1,6 @@
{ {
"name": "ztncui", "name": "ztncui",
"version": "0.8.13", "version": "0.8.14",
"private": true, "private": true,
"scripts": { "scripts": {
"start": "node ./bin/www", "start": "node ./bin/www",