diff --git a/webui-src/app/channels/channel_view.js b/webui-src/app/channels/channel_view.js index d7b5ea8..6610181 100644 --- a/webui-src/app/channels/channel_view.js +++ b/webui-src/app/channels/channel_view.js @@ -520,7 +520,7 @@ function displaycomment() { util.GXS_VOTE_UP, comment.mMeta.mGroupId, comment.mMeta.mThreadId, - identity, + identity[0], //not correct way. Give options comment.mMeta.mMsgId ), }, @@ -535,7 +535,7 @@ function displaycomment() { util.GXS_VOTE_DOWN, comment.mMeta.mGroupId, comment.mMeta.mThreadId, - identity, + identity[0], //not correct way. Give options comment.mMeta.mMsgId ), }, diff --git a/webui-src/app/home.js b/webui-src/app/home.js index cbda0ef..b6675f8 100644 --- a/webui-src/app/home.js +++ b/webui-src/app/home.js @@ -203,7 +203,7 @@ function invalidCertPrompt() { widget.popupMessage([m('h3', 'Error'), m('hr'), m('p', 'Not a valid Retroshare certificate.')]); } -function confirmAddPrompt(details, cert) { +function confirmAddPrompt(details, cert, long) { widget.popupMessage([ m('i.fas.fa-user-plus'), m('h3', 'Make friend'), @@ -214,39 +214,73 @@ function confirmAddPrompt(details, cert) { m('li', 'Location: ' + details.location + '(' + details.id + ')'), m('li', details.isHiddenNode ? details.hiddenNodeAddress : details.extAddr), ]), - m( - 'button', - { - onclick: () => - rs.rsJsonApiRequest('/rsPeers/loadCertificateFromString', { cert }, (data) => { - if (data.retval) { - widget.popupMessage([ - m('h3', 'Successful'), - m('hr'), - m('p', 'Successfully added friend.'), - ]); - } else { - widget.popupMessage([ - m('h3', 'Error'), - m('hr'), - m('p', 'An error occoured during adding. Friend not added.'), - ]); - } - }), - }, - 'Finish' - ), + + long + ? m( + 'button', + { + onclick: async () =>{ + const res = await rs.rsJsonApiRequest('/rsPeers/loadCertificateFromString', { cert }); + if (res.body.retval) { + widget.popupMessage([ + m('h3', 'Successful'), + m('hr'), + m('p', 'Successfully added friend.'), + ]); + } else { + widget.popupMessage([ + m('h3', 'Error'), + m('hr'), + m('p', 'An error occoured during adding. Friend not added.'), + ]); + } + }, + }, + 'Finish' + ) + : m( + 'button', + { + onclick: async () => { + const res = await rs.rsJsonApiRequest('/rsPeers/addSslOnlyFriend', { + sslId: details.id, + pgpId: details.gpg_id, + }); + if (res.body.retval) { + widget.popupMessage([ + m('h3', 'Successful'), + m('hr'), + m('p', 'Successfully added friend.'), + ]); + } else { + widget.popupMessage([ + m('h3', 'Error'), + m('hr'), + m('p', 'An error occoured during adding. Friend not added.'), + ]); + } + }, + }, + 'Finish' + ), ]); } -function addFriendFromCert(cert) { - rs.rsJsonApiRequest('/rsPeers/loadDetailsFromStringCert', { cert }, (data) => { - if (!data.retval) { - invalidCertPrompt(); - return null; - } - confirmAddPrompt(data.certDetails, cert); - }); +async function addFriendFromCert(cert) { + const res = await rs.rsJsonApiRequest('/rsPeers/parseShortInvite', { invite: cert }); + + if (res.body.retval) { + console.log(res.body); + confirmAddPrompt(res.body.details, cert, false); + } else { + rs.rsJsonApiRequest('/rsPeers/loadDetailsFromStringCert', { cert }, (data) => { + if (!data.retval) { + invalidCertPrompt(); + return null; + } + confirmAddPrompt(data.certDetails, cert, true); + }); + } } const AddFriend = () => {