diff --git a/apps/identity.json b/apps/identity.json index 5558d38e..3e735005 100644 --- a/apps/identity.json +++ b/apps/identity.json @@ -1,5 +1,5 @@ { "type": "tildefriends-app", "emoji": "🪪", - "previous": "&1RskhkBW1UheJRrw7xcTjS8ELDMnBXNAuKqW5BiT72c=.sha256" + "previous": "&BOmGofChv5mvgZq61xy5mSS0fshtttcG68uL1ILu+qo=.sha256" } \ No newline at end of file diff --git a/apps/identity/app.js b/apps/identity/app.js index b5d56bb5..51d214b3 100644 --- a/apps/identity/app.js +++ b/apps/identity/app.js @@ -14,13 +14,21 @@ async function main() { import * as tfrpc from '/static/tfrpc.js'; async function export_id(event) { let id = event.srcElement.innerHTML; - document.body.insertBefore(document.createTextNode(await tfrpc.rpc.get_private_key(id)), event.srcElement.parentNode.nextSibling); - event.srcElement.disabled = true; + let element = document.createElement('textarea'); + element.value = await tfrpc.rpc.get_private_key(id); + element.style = 'width: 100%; read-only: true'; + element.readOnly = true; + document.body.insertBefore(element, event.srcElement.parentNode.nextSibling); + event.srcElement.onclick = event => hide_id(event, element); } async function add_id(event) { let id = document.getElementById('add_id').value; await tfrpc.rpc.add_id(id); } + function hide_id(event, element) { + element.parentNode.removeChild(element); + event.srcElement.onclick = export_id; + } window.addEventListener('load', function() { for (let button of document.getElementsByTagName('button')) { if (button.id == "add") { @@ -31,7 +39,10 @@ async function main() { } }); - `+ +