Skip to content

Commit

Permalink
Fix incompatibility with ZeroTier 1.12 (#124)
Browse files Browse the repository at this point in the history
Co-authored-by: Niels Martignène <niels.martignene@protonmail.com>
  • Loading branch information
key-networks and Koromix authored Aug 28, 2023
1 parent 8cfb2ca commit 3f041d1
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/controllers/networkController.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,26 @@ async function get_network_with_members(nwid) {
zt.network_detail(nwid),
zt.peers(),
zt.members(nwid)
.then(member_ids =>
Promise.all(
.then(member_ids => {
// 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)
.map(id => Promise.all([
zt.member_detail(nwid, id),
storage.getItem(id)
]))
)
).then(results => results.map(([member, name]) => {
);
}).then(results => results.map(([member, name]) => {
member.name = name || '';
return member;
}))
Expand Down

0 comments on commit 3f041d1

Please sign in to comment.