mirror of
https://github.com/RetroShare/RSNewWebUI.git
synced 2026-09-14 02:55:47 +05:00
* fix checkout alignmnet * fixed create identity issue * added logic for edit identity as well as create identity * final changes * UX changes * minor fixes * Signed Create identity is working now * minor changes * friend node profile pic is aligned now * People->Edit && create identity popup responsive * updated & refactor code * changes added * Update people_ownids.js * Update people_util.js * feat: people Web page UI * minor-fix * fix prettier & eslint issue * updated changes * updated changes * minor fix * update changes
61 lines
1.5 KiB
JavaScript
61 lines
1.5 KiB
JavaScript
const rs = require('rswebui');
|
|
|
|
async function refreshIds() {
|
|
let sslIds = [];
|
|
await rs.rsJsonApiRequest('/rsPeers/getFriendList', {}, (data) => (sslIds = data.sslIds));
|
|
return sslIds;
|
|
}
|
|
|
|
async function loadSslDetails() {
|
|
const sslDetails = [];
|
|
const sslIds = await refreshIds();
|
|
await Promise.all(
|
|
sslIds.map((sslId) =>
|
|
rs.rsJsonApiRequest('/rsPeers/getPeerDetails', { sslId }, (data) => sslDetails.push(data.det))
|
|
)
|
|
);
|
|
return sslDetails;
|
|
}
|
|
|
|
const Data = {
|
|
gpgDetails: {},
|
|
};
|
|
Data.refreshGpgDetails = async function () {
|
|
const details = {};
|
|
const sslDetails = await loadSslDetails();
|
|
await Promise.all(
|
|
sslDetails.map((data) => {
|
|
let isOnline = false;
|
|
return rs
|
|
.rsJsonApiRequest(
|
|
'/rsPeers/isOnline',
|
|
{ sslId: data.id },
|
|
(stat) => (isOnline = stat.retval)
|
|
)
|
|
.then(() => {
|
|
const loc = {
|
|
name: data.location,
|
|
id: data.id,
|
|
lastSeen: data.lastConnect,
|
|
isOnline,
|
|
gpg_id: data.gpg_id,
|
|
};
|
|
|
|
if (details[data.gpg_id] === undefined) {
|
|
details[data.gpg_id] = {
|
|
name: data.name,
|
|
isSearched: true,
|
|
isOnline,
|
|
locations: [loc],
|
|
};
|
|
} else {
|
|
details[data.gpg_id].locations.push(loc);
|
|
}
|
|
details[data.gpg_id].isOnline = details[data.gpg_id].isOnline || isOnline;
|
|
});
|
|
})
|
|
);
|
|
Data.gpgDetails = details;
|
|
};
|
|
module.exports = Data;
|