Browse Source

fixes

master
PhilReact 11 months ago
parent
commit
bf03a1764d
  1. 4
      core/language/us.json
  2. 33
      core/src/components/friends-view/profile.js
  3. 7
      plugins/plugins/core/qdn/browser/browser.src.js

4
core/language/us.json

@ -1226,14 +1226,14 @@
"profile5": "Bio",
"profile6": "Wallet Addresses",
"profile7": "Fill from UI",
"profile8": "Add custom data",
"profile8": "Add custom property",
"profile9": "Property name",
"profile10": "Fields",
"profile11": "Add new field",
"profile12": "Field name",
"profile13": "Fill out",
"profile14": "Activity",
"profile15": "No data",
"profile15": "No value",
"profile16": "This name has no profile",
"profile17": "Unable to fetch profile",
"profile18": "Open profile",

33
core/src/components/friends-view/profile.js

@ -326,6 +326,7 @@ class ProfileQdn extends connect(store)(LitElement) {
return ret;
}
async setValues(response, resource) {
if (response) {
let data = { ...response };
@ -336,7 +337,6 @@ class ProfileQdn extends connect(store)(LitElement) {
const decryptedData = decryptGroupData(
data.customData[key]
);
if (decryptedData && !decryptedData.error) {
const decryptedDataToBase64 =
uint8ArrayToObject(decryptedData);
@ -541,18 +541,31 @@ class ProfileQdn extends connect(store)(LitElement) {
const getArbitraryFee = await this.getArbitraryFee();
const feeAmount = getArbitraryFee.fee;
let newObject = { ...data };
let newObject = structuredClone(data)
for (const key of Object.keys(newObject.customData || {})) {
if (key.includes('-private')) {
const toBase64 = await objectToBase64(
newObject.customData[key]
);
const encryptedData = encryptDataGroup({
data64: toBase64,
publicKeys: [],
});
newObject['customData'][key] = encryptedData;
const dataKey = newObject.customData[key]
let isBase64 = false
try {
const decodedString = atob(dataKey);
isBase64 = decodedString.includes('qortalGroupEncryptedData')
} catch (e) {
console.log(e)
}
if(isBase64){
newObject['customData'][key] = newObject.customData[key];
} else {
const toBase64 = await objectToBase64(
newObject.customData[key]
);
const encryptedData = encryptDataGroup({
data64: toBase64,
publicKeys: [],
});
newObject['customData'][key] = encryptedData;
}
} else {
newObject['customData'][key] = newObject.customData[key];
}

7
plugins/plugins/core/qdn/browser/browser.src.js

@ -2206,11 +2206,12 @@ class WebBrowser extends LitElement {
// Set up an event listener to wait for the response
window.addEventListener('qortal-request-set-profile-data-response', handleResponseEvent);
});
if(!res.response) throw new Error('Failed to set property')
response = JSON.stringify(res.response);
response = JSON.stringify(res);
} catch (error) {
const obj = {};
const errorMsg = error.message || 'Failed to join the group.';
const errorMsg = error.message || 'Failed to set property.';
obj['error'] = errorMsg;
response = JSON.stringify(obj);
} finally {
@ -3792,7 +3793,7 @@ async function showModalAndWait(type, data) {
` : ''}
${type === actions.SET_PROFILE_DATA ? `
<div class="modal-subcontainer">
<p class="modal-paragraph">${get("browserpage.bchange50")}: <span style="font-weight: bold"> ${data.property}</span></p>
<p class="modal-paragraph">${get("browserpage.bchange50")} <span style="font-weight: bold"> ${data.property}</span></p>
<br>
<p style="font-size: 16px;overflow-wrap: anywhere;" class="modal-paragraph">${get('browserpage.bchange47')} <span style="font-weight: bold">${data.fee} QORT fee</span></p>
<br>

Loading…
Cancel
Save