From 91d293ee05eebf1269e4eb4e1953e47c1f8681ee Mon Sep 17 00:00:00 2001 From: olcxja Date: Fri, 24 Jul 2026 23:04:57 +0200 Subject: [PATCH] remove depracated code & fix attachment name handling --- android/app/src/main/assets/public/main.js | 33 +++++++++++++++---- android/app/src/main/assets/public/screens.js | 12 +++---- webroot/main.js | 33 +++++++++++++++---- webroot/screens.js | 12 +++---- 4 files changed, 64 insertions(+), 26 deletions(-) diff --git a/android/app/src/main/assets/public/main.js b/android/app/src/main/assets/public/main.js index ef533d35..6217d060 100644 --- a/android/app/src/main/assets/public/main.js +++ b/android/app/src/main/assets/public/main.js @@ -1597,7 +1597,17 @@ async function openProfile(accountId) { let bannerUrl = `${url}/user/storage/public/getentry?id=${accountId}&e=larp.profile.banner`; if (accountId === window.id && window.profileUpdateTimestamp) bannerUrl += `&t=${window.profileUpdateTimestamp}`; - let bannerHtml = ``; + let bannerHtml = ``; + setTimeout(() => { + let bannerImg = document.querySelector("#profile-popup-inner .profile-banner"); + if (bannerImg) { + bannerImg.addEventListener("error", function() { + let div = document.createElement("div"); + div.className = "profile-banner"; + this.parentNode.replaceChild(div, this); + }); + } + }, 50); let bio = await fetchAsync(`${url}/user/storage/public/getentry?id=${accountId}&e=larp.profile.bio`); if (bio.startsWith("error:")) bio = ""; @@ -1639,7 +1649,8 @@ async function openProfile(accountId) { } if (hasDm) { - actionBtnHtml = ``; + let safeName = encodeURIComponent(nameWithHost).replace(/'/g, "%27"); + actionBtnHtml = ``; } else { let sentInvite = false; let receivedInvite = false; @@ -2156,8 +2167,10 @@ async function renderDms(res) { let isRead = dmData.string3 === "true"; let nameStyle = isRead ? "opacity: 0.8;" : "opacity: 1;"; + let safeTargetUsername = encodeURIComponent(targetUsername).replace(/'/g, "%27"); + html += ` - `).join('')} + ${loadedEmotes.map(emoji => { + let safeChar = encodeURIComponent(emoji.char).replace(/'/g, "%27"); + return ``; + }).join('')} - + @@ -236,9 +236,9 @@ var attachmentMenu = ` ${ICONS.poll()} action.attachment.poll - - - + + + `; var addSpaceMenu = ` @@ -255,7 +255,7 @@ var messageContextMenu = ` ${ICONS.replyAction()} title.reply.message - diff --git a/webroot/main.js b/webroot/main.js index ef533d35..6217d060 100644 --- a/webroot/main.js +++ b/webroot/main.js @@ -1597,7 +1597,17 @@ async function openProfile(accountId) { let bannerUrl = `${url}/user/storage/public/getentry?id=${accountId}&e=larp.profile.banner`; if (accountId === window.id && window.profileUpdateTimestamp) bannerUrl += `&t=${window.profileUpdateTimestamp}`; - let bannerHtml = ``; + let bannerHtml = ``; + setTimeout(() => { + let bannerImg = document.querySelector("#profile-popup-inner .profile-banner"); + if (bannerImg) { + bannerImg.addEventListener("error", function() { + let div = document.createElement("div"); + div.className = "profile-banner"; + this.parentNode.replaceChild(div, this); + }); + } + }, 50); let bio = await fetchAsync(`${url}/user/storage/public/getentry?id=${accountId}&e=larp.profile.bio`); if (bio.startsWith("error:")) bio = ""; @@ -1639,7 +1649,8 @@ async function openProfile(accountId) { } if (hasDm) { - actionBtnHtml = ``; + let safeName = encodeURIComponent(nameWithHost).replace(/'/g, "%27"); + actionBtnHtml = ``; } else { let sentInvite = false; let receivedInvite = false; @@ -2156,8 +2167,10 @@ async function renderDms(res) { let isRead = dmData.string3 === "true"; let nameStyle = isRead ? "opacity: 0.8;" : "opacity: 1;"; + let safeTargetUsername = encodeURIComponent(targetUsername).replace(/'/g, "%27"); + html += ` - `).join('')} + ${loadedEmotes.map(emoji => { + let safeChar = encodeURIComponent(emoji.char).replace(/'/g, "%27"); + return ``; + }).join('')} - + @@ -236,9 +236,9 @@ var attachmentMenu = ` ${ICONS.poll()} action.attachment.poll - - - + + + `; var addSpaceMenu = ` @@ -255,7 +255,7 @@ var messageContextMenu = ` ${ICONS.replyAction()} title.reply.message -