mirror of
https://github.com/Blah-IM/blahrs.git
synced 2025-07-08 15:15:33 +00:00
Simplify rich text on-wire format
This commit is contained in:
parent
c492bb2537
commit
370722731b
5 changed files with 49 additions and 73 deletions
|
@ -122,8 +122,8 @@ async function showChatMsg(chat) {
|
|||
|
||||
function richTextToHtml(richText) {
|
||||
let ret = ''
|
||||
for (let [text, attrs] of richText) {
|
||||
if (attrs === undefined) attrs = {};
|
||||
for (let e of richText) {
|
||||
const [text, attrs] = typeof e === 'string' ? [e, {}] : e;
|
||||
// Incomplete cases.
|
||||
const tags = [
|
||||
[attrs.b, 'b'],
|
||||
|
@ -241,7 +241,7 @@ async function postChat(text) {
|
|||
if (text.startsWith('[')) {
|
||||
richText = JSON.parse(text);
|
||||
} else {
|
||||
richText = [[text]];
|
||||
richText = [text];
|
||||
}
|
||||
const signedPayload = await signData({
|
||||
typ: 'chat',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue