4
1
mirror of https://github.com/Qortal/qortal-ui.git synced 2025-02-11 17:55:51 +00:00

Add GET_API_KEY qortalRequest action

This commit is contained in:
QuickMythril 2024-11-07 11:29:18 -05:00
parent a4a5af8928
commit 287f582275
2 changed files with 31 additions and 0 deletions

View File

@ -111,3 +111,6 @@ export const GET_FRIENDS_LIST = 'GET_FRIENDS_LIST'
// OPEN_PROFILE
export const OPEN_PROFILE = 'OPEN_PROFILE'
// GET_API_KEY
export const GET_API_KEY = 'GET_API_KEY'

View File

@ -286,6 +286,26 @@ class WebBrowser extends LitElement {
}
}
case actions.GET_API_KEY: {
let res1 = await showModalAndWait(
actions.GET_API_KEY,
{
service: this.service,
name: this.name
}
);
if (res1 && res1.action === 'accept') {
let apiKey = this.getApiKey();
response = JSON.stringify({ apiKey });
break;
} else {
const data = {};
data['error'] = "User declined to share API key";
response = JSON.stringify(data);
break;
}
}
case actions.ENCRYPT_DATA: {
try {
let dataSentBack = {}
@ -3801,6 +3821,14 @@ async function showModalAndWait(type, data) {
</div>
` : ''}
${type === actions.GET_API_KEY ? `
<div class="modal-subcontainer">
<p class="modal-paragraph">${`<span class="capitalize-first">${data.service.toLowerCase()}</span> wants to access your API key.`}</p>
<p class="modal-paragraph">Allow ${data.service.toLowerCase()} to access your API key?</p>
<p class="modal-paragraph">Please confirm your approval.</p>
</div>
` : ''}
${type === actions.PUBLISH_MULTIPLE_QDN_RESOURCES ? `
<div class="modal-subcontainer">
<p class="modal-paragraph">${get("browserpage.bchange19")}</p>