short cert fixed(needs testing)

This commit is contained in:
Sukhamjot Singh 2022-08-05 15:15:46 +05:30
parent d81e835459
commit ff3259baba
2 changed files with 67 additions and 33 deletions

View File

@ -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
),
},

View File

@ -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 = () => {