ssb: Fiddling with render of encrypted messages.

This commit is contained in:
Cory McWilliams 2025-01-02 16:11:04 -05:00
parent 7d9e0f4080
commit b8e19040b5
2 changed files with 14 additions and 16 deletions

View File

@ -1,5 +1,5 @@
{
"type": "tildefriends-app",
"emoji": "🦀",
"previous": "&mZcElHJkLDuyk+ITEdBh8cCtCVq8XgdohH5OWLmEom4=.sha256"
"previous": "&RltKappiEl1sZ1CJpZus2OwLLUWcyJN/wFkOJOd9n7w=.sha256"
}

View File

@ -436,7 +436,9 @@ class TfMessageElement extends LitElement {
render_header() {
let is_encrypted = this.message?.decrypted
? html`<span class="w3-bar-item" style="align-self: center">🔓</span>`
? html`<span class="w3-bar-item">🔓</span>`
: typeof(this.message?.content) == 'string'
? html`<span class="w3-bar-item">🔒</span>`
: undefined;
return html`
<header class="w3-bar">
@ -486,7 +488,7 @@ class TfMessageElement extends LitElement {
let self = this;
return this.render_frame(html`
${self.render_header()}
${self.format == 'raw' ? self.render_raw() : inner}
${self.format == 'raw' ? html`<div class="w3-container">${self.render_raw()}</div>` : inner}
${self.render_votes()}
${(self.message.child_messages || []).map(
(x) => html`
@ -576,7 +578,7 @@ class TfMessageElement extends LitElement {
></tf-message>
`
)}`);
} else if (typeof (content?.type === 'string')) {
} else if (typeof(content?.type) === 'string') {
if (content.type == 'about') {
let name;
let image;
@ -665,9 +667,6 @@ class TfMessageElement extends LitElement {
? html` ${content_warning} ${content_html} `
: content_warning
: content_html;
let is_encrypted = this.message?.decrypted
? html`<span style="align-self: center">🔓</span>`
: undefined;
return this.render_frame(html`
${this.render_header()}
<div class="w3-container">${payload}</div>
@ -675,9 +674,6 @@ class TfMessageElement extends LitElement {
</div>
`);
} else if (content.type === 'issue') {
let is_encrypted = this.message?.decrypted
? html`<span style="align-self: center">🔓</span>`
: undefined;
return this.render_frame(html`
${this.render_header()}
${content.text} ${this.render_votes()}
@ -756,26 +752,28 @@ class TfMessageElement extends LitElement {
>
</div>
`);
} else if (typeof this.message.content == 'string') {
} else if (typeof(this.message.content) == 'string') {
if (this.message?.decrypted) {
if (this.format == 'decrypted') {
return this.render_small_frame(
html`<span>🔓</span> ${this.render_json(this.message.decrypted)}`
html`<span class="w3-container">🔓</span> ${this.render_json(this.message.decrypted)}`
);
} else {
return this.render_small_frame(
html`<span>🔓</span>
<div>${this.message.decrypted.type}</div>`
html`<span class="w3-container">🔓</span>
<div class="w3-container">${this.message.decrypted.type}</div>`
);
}
} else {
return this.render_small_frame(html`<span>🔒</span>`);
return this.render_small_frame();
}
} else {
return this.render_small_frame(
html`<div><b>type</b>: ${content.type}</div>`
html`<div class="w3-container"><b>type</b>: ${content.type}</div>`
);
}
} else if (typeof(this.message.content) == 'string') {
return this.render_small_frame();
} else {
return this.render_small_frame(this.render_raw());
}