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 = `${processBlah('action.open.dm')}`; + let safeName = encodeURIComponent(nameWithHost).replace(/'/g, "%27"); + actionBtnHtml = `${processBlah('action.open.dm')}`; } 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 += ` - + ${displayName} @@ -2403,7 +2416,10 @@ async function renderMessages(messages, isPrepend = false) { ? `${ICONS.image({ width: "1.5rem", height: "1.5rem", stroke: "currentColor" })}` : `${ICONS.download({ width: "1.5rem", height: "1.5rem", stroke: "currentColor" })}`; - attachmentsHtml += ` + let safeType = encodeURIComponent(att.type).replace(/'/g, "%27"); + let safeName = encodeURIComponent(att.name).replace(/'/g, "%27"); + + attachmentsHtml += ` ${iconSvg} ${escapeHtml(displayName)} @@ -2589,7 +2605,7 @@ async function renderMessages(messages, isPrepend = false) { html += ` ${showAvatar ? `` : ``} - + ${showAvatar ? ` ${authorName} ${timeStr} @@ -3261,9 +3277,12 @@ async function loadEmotes() { reactionPickerMenuHtml = ` - + - ${loadedEmotes.map(emoji => `${emoji.char}`).join('')} + ${loadedEmotes.map(emoji => { + let safeChar = encodeURIComponent(emoji.char).replace(/'/g, "%27"); + return `${emoji.char}`; + }).join('')} title.text.react diff --git a/android/app/src/main/assets/public/screens.js b/android/app/src/main/assets/public/screens.js index e7994758..7f08a3cf 100644 --- a/android/app/src/main/assets/public/screens.js +++ b/android/app/src/main/assets/public/screens.js @@ -143,10 +143,10 @@ var chatScreen = ` - + ${ICONS.plus({ width: "1.5rem", height: "1.5rem", stroke: "var(--main-bg-color)" })} - + ${ICONS.send()} @@ -236,9 +236,9 @@ var attachmentMenu = ` ${ICONS.poll()} action.attachment.poll - - - + + + `; var addSpaceMenu = ` @@ -255,7 +255,7 @@ var messageContextMenu = ` ${ICONS.replyAction()} title.reply.message - + ${ICONS.react()} title.react.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 = `${processBlah('action.open.dm')}`; + let safeName = encodeURIComponent(nameWithHost).replace(/'/g, "%27"); + actionBtnHtml = `${processBlah('action.open.dm')}`; } 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 += ` - + ${displayName} @@ -2403,7 +2416,10 @@ async function renderMessages(messages, isPrepend = false) { ? `${ICONS.image({ width: "1.5rem", height: "1.5rem", stroke: "currentColor" })}` : `${ICONS.download({ width: "1.5rem", height: "1.5rem", stroke: "currentColor" })}`; - attachmentsHtml += ` + let safeType = encodeURIComponent(att.type).replace(/'/g, "%27"); + let safeName = encodeURIComponent(att.name).replace(/'/g, "%27"); + + attachmentsHtml += ` ${iconSvg} ${escapeHtml(displayName)} @@ -2589,7 +2605,7 @@ async function renderMessages(messages, isPrepend = false) { html += ` ${showAvatar ? `` : ``} - + ${showAvatar ? ` ${authorName} ${timeStr} @@ -3261,9 +3277,12 @@ async function loadEmotes() { reactionPickerMenuHtml = ` - + - ${loadedEmotes.map(emoji => `${emoji.char}`).join('')} + ${loadedEmotes.map(emoji => { + let safeChar = encodeURIComponent(emoji.char).replace(/'/g, "%27"); + return `${emoji.char}`; + }).join('')} title.text.react diff --git a/webroot/screens.js b/webroot/screens.js index e7994758..7f08a3cf 100644 --- a/webroot/screens.js +++ b/webroot/screens.js @@ -143,10 +143,10 @@ var chatScreen = ` - + ${ICONS.plus({ width: "1.5rem", height: "1.5rem", stroke: "var(--main-bg-color)" })} - + ${ICONS.send()} @@ -236,9 +236,9 @@ var attachmentMenu = ` ${ICONS.poll()} action.attachment.poll - - - + + + `; var addSpaceMenu = ` @@ -255,7 +255,7 @@ var messageContextMenu = ` ${ICONS.replyAction()} title.reply.message - + ${ICONS.react()} title.react.message