4
1
mirror of https://github.com/Qortal/qortal-ui.git synced 2025-02-14 11:15:50 +00:00
This commit is contained in:
PhilReact 2023-11-07 15:55:01 +02:00
parent 6169da48a8
commit bf03a1764d
3 changed files with 29 additions and 15 deletions

View File

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

View File

@ -326,6 +326,7 @@ class ProfileQdn extends connect(store)(LitElement) {
return ret; return ret;
} }
async setValues(response, resource) { async setValues(response, resource) {
if (response) { if (response) {
let data = { ...response }; let data = { ...response };
@ -336,7 +337,6 @@ class ProfileQdn extends connect(store)(LitElement) {
const decryptedData = decryptGroupData( const decryptedData = decryptGroupData(
data.customData[key] data.customData[key]
); );
if (decryptedData && !decryptedData.error) { if (decryptedData && !decryptedData.error) {
const decryptedDataToBase64 = const decryptedDataToBase64 =
uint8ArrayToObject(decryptedData); uint8ArrayToObject(decryptedData);
@ -541,10 +541,21 @@ class ProfileQdn extends connect(store)(LitElement) {
const getArbitraryFee = await this.getArbitraryFee(); const getArbitraryFee = await this.getArbitraryFee();
const feeAmount = getArbitraryFee.fee; const feeAmount = getArbitraryFee.fee;
let newObject = { ...data }; let newObject = structuredClone(data)
for (const key of Object.keys(newObject.customData || {})) { for (const key of Object.keys(newObject.customData || {})) {
if (key.includes('-private')) { if (key.includes('-private')) {
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( const toBase64 = await objectToBase64(
newObject.customData[key] newObject.customData[key]
); );
@ -553,6 +564,8 @@ class ProfileQdn extends connect(store)(LitElement) {
publicKeys: [], publicKeys: [],
}); });
newObject['customData'][key] = encryptedData; newObject['customData'][key] = encryptedData;
}
} else { } else {
newObject['customData'][key] = newObject.customData[key]; newObject['customData'][key] = newObject.customData[key];
} }

View File

@ -2206,11 +2206,12 @@ class WebBrowser extends LitElement {
// Set up an event listener to wait for the response // Set up an event listener to wait for the response
window.addEventListener('qortal-request-set-profile-data-response', handleResponseEvent); 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) { } catch (error) {
const obj = {}; const obj = {};
const errorMsg = error.message || 'Failed to join the group.'; const errorMsg = error.message || 'Failed to set property.';
obj['error'] = errorMsg; obj['error'] = errorMsg;
response = JSON.stringify(obj); response = JSON.stringify(obj);
} finally { } finally {
@ -3792,7 +3793,7 @@ async function showModalAndWait(type, data) {
` : ''} ` : ''}
${type === actions.SET_PROFILE_DATA ? ` ${type === actions.SET_PROFILE_DATA ? `
<div class="modal-subcontainer"> <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> <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> <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> <br>