Show more information about encrypted messages.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4618 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2023-11-08 01:43:58 +00:00
parent 367c489fc3
commit 607e9ef71b
2 changed files with 14 additions and 3 deletions

View File

@ -1,5 +1,5 @@
{ {
"type": "tildefriends-app", "type": "tildefriends-app",
"emoji": "🐌", "emoji": "🐌",
"previous": "&rMCwJnENRN/cYxMPF06+r0dlKVyFFuL3fziFjG14oN4=.sha256" "previous": "&eHrt88ylDUCaDFIj3DTdUaHPYQRe81K//O80CHp+pyk=.sha256"
} }

View File

@ -258,9 +258,16 @@ class TfMessageElement extends LitElement {
case 'md': case 'md':
raw_button = html`<input type="button" value="Message" @click=${() => self.format = 'message'}></input>`; raw_button = html`<input type="button" value="Message" @click=${() => self.format = 'message'}></input>`;
break; break;
default: case 'decrypted':
raw_button = html`<input type="button" value="Raw" @click=${() => self.format = 'raw'}></input>`; raw_button = html`<input type="button" value="Raw" @click=${() => self.format = 'raw'}></input>`;
break; break;
default:
if (this.message.decrypted) {
raw_button = html`<input type="button" value="Decrypted" @click=${() => self.format = 'decrypted'}></input>`;
} else {
raw_button = html`<input type="button" value="Raw" @click=${() => self.format = 'raw'}></input>`;
}
break;
} }
function small_frame(inner) { function small_frame(inner) {
let body; let body;
@ -526,7 +533,11 @@ class TfMessageElement extends LitElement {
`); `);
} else if (typeof(this.message.content) == 'string') { } else if (typeof(this.message.content) == 'string') {
if (this.message?.decrypted) { if (this.message?.decrypted) {
return small_frame(html`<span>🔓</span><pre>${JSON.stringify(this.decrypted, null, 2)}</pre>`); if (this.format == 'decrypted') {
return small_frame(html`<span>🔓</span><pre>${JSON.stringify(this.message.decrypted, null, 2)}</pre>`);
} else {
return small_frame(html`<span>🔓</span><div>${this.message.decrypted.type}</div>`);
}
} else { } else {
return small_frame(html`<span>🔒</span>`); return small_frame(html`<span>🔒</span>`);
} }