/g) ?? []).length).toBeLessThanOrEqual(100);
});
});
diff --git a/src/app/utils/sanitize.ts b/src/app/utils/sanitize.ts
index 0a599c0ba..301b942c5 100644
--- a/src/app/utils/sanitize.ts
+++ b/src/app/utils/sanitize.ts
@@ -1,9 +1,10 @@
-import sanitizeHtml, { Transformer } from 'sanitize-html';
+import DOMPurify from 'dompurify';
+import { isMatrixHexColor } from './matrixHtml';
const MAX_TAG_NESTING = 100;
+const INTERNAL_IMG_SRC_ATTR = 'data-sable-img-src';
const permittedHtmlTags = [
- 'font',
'del',
'h1',
'h2',
@@ -24,7 +25,6 @@ const permittedHtmlTags = [
'u',
'strong',
'em',
- 'strike',
's',
'code',
'hr',
@@ -42,22 +42,16 @@ const permittedHtmlTags = [
'img',
'details',
'summary',
-];
-
-const urlSchemes = ['https', 'http', 'ftp', 'mailto', 'magnet'];
+] as const;
const permittedTagToAttributes = {
- font: ['style', 'data-mx-bg-color', 'data-mx-color', 'color'],
- span: [
- 'style',
- 'data-mx-bg-color',
- 'data-mx-color',
- 'data-mx-spoiler',
- 'data-mx-maths',
- 'data-mx-pill',
- 'data-mx-ping',
- 'data-md',
- ],
+ span: ['data-mx-bg-color', 'data-mx-color', 'data-mx-spoiler', 'data-mx-maths', 'data-md'],
+ a: ['target', 'href', 'data-md'],
+ img: ['width', 'height', 'alt', 'title', 'src', 'data-mx-emoticon'], // data-mx-emoticon is for MSC2545
+ ol: ['start', 'data-md'],
+ ul: ['data-md'],
+ code: ['class', 'data-md', 'data-lang'],
+ pre: ['class', 'data-md', 'data-lang'],
div: ['data-mx-maths'],
blockquote: ['data-md'],
h1: ['data-md'],
@@ -66,12 +60,6 @@ const permittedTagToAttributes = {
h4: ['data-md'],
h5: ['data-md'],
h6: ['data-md'],
- pre: ['data-md', 'class', 'data-lang'],
- ol: ['start', 'type', 'data-md'],
- ul: ['data-md'],
- a: ['name', 'target', 'href', 'rel', 'data-md'],
- img: ['width', 'height', 'alt', 'title', 'src', 'data-mx-emoticon'],
- code: ['class', 'data-md', 'data-lang'],
strong: ['data-md'],
i: ['data-md'],
em: ['data-md'],
@@ -80,85 +68,18 @@ const permittedTagToAttributes = {
del: ['data-md'],
sub: ['data-md'],
hr: ['data-md'],
-};
+} as const satisfies Record
;
-const transformFontTag: Transformer = (tagName, attribs) => ({
- tagName,
- attribs: {
- ...attribs,
- style: `background-color: ${attribs['data-mx-bg-color']}; color: ${attribs['data-mx-color']}`,
- },
-});
+const permittedHtmlAttributes = Array.from(new Set(Object.values(permittedTagToAttributes).flat()));
-const transformSpanTag: Transformer = (tagName, attribs) => ({
- tagName,
- attribs: {
- ...attribs,
- style: `background-color: ${attribs['data-mx-bg-color']}; color: ${attribs['data-mx-color']}`,
- },
-});
+const allowedLinkSchemes = new Set(['https', 'http', 'ftp', 'mailto', 'magnet']);
+const forbiddenContentTags = ['mx-reply', 'script', 'style', 'textarea', 'option', 'noscript'];
-const transformATag: Transformer = (tagName, attribs) => ({
- tagName,
- attribs: {
- ...attribs,
- rel: 'noreferrer noopener',
- target: '_blank',
- },
-});
+const codeLanguageClassRegex = /^language-[A-Za-z0-9_-]+$/;
+const orderedListStartRegex = /^-?\d+$/;
+const allowedUriRegex = /^(?:https?|ftp|mailto|magnet|mxc):/i;
-const transformImgTag: Transformer = (tagName, attribs) => {
- const { src } = attribs;
- if (typeof src === 'string' && src.startsWith('mxc://') === false) {
- return {
- tagName: 'a',
- attribs: {
- href: src,
- rel: 'noreferrer noopener',
- target: '_blank',
- },
- text: attribs.alt || src,
- };
- }
- return {
- tagName,
- attribs: {
- ...attribs,
- },
- };
-};
-
-export const sanitizeCustomHtml = (customHtml: string): string =>
- sanitizeHtml(customHtml, {
- allowedTags: permittedHtmlTags,
- allowedAttributes: permittedTagToAttributes,
- disallowedTagsMode: 'discard',
- allowedSchemes: urlSchemes,
- allowedSchemesByTag: {
- a: urlSchemes,
- },
- allowedSchemesAppliedToAttributes: ['href'],
- allowProtocolRelative: false,
- allowedClasses: {
- code: ['language-*'],
- },
- allowedStyles: {
- '*': {
- color: [/^#(?:[0-9a-fA-F]{3}){1,2}$/],
- 'background-color': [/^#(?:[0-9a-fA-F]{3}){1,2}$/],
- },
- },
- transformTags: {
- font: transformFontTag,
- span: transformSpanTag,
- a: transformATag,
- img: transformImgTag,
- },
- nonTextTags: ['style', 'script', 'textarea', 'option', 'noscript', 'mx-reply'],
- nestingLimit: MAX_TAG_NESTING,
- });
-
-export const sanitizeText = (body: string) => {
+export function sanitizeText(body: string): string {
const tagsToReplace: Record = {
'&': '&',
'<': '<',
@@ -166,5 +87,259 @@ export const sanitizeText = (body: string) => {
'"': '"',
"'": ''',
};
+
return body.replace(/[&<>'"]/g, (tag) => tagsToReplace[tag] || tag);
+}
+
+function tagAllowsAttribute(tagName: string, attrName: string): boolean {
+ const allowedAttributes =
+ permittedTagToAttributes[tagName as keyof typeof permittedTagToAttributes];
+
+ return allowedAttributes ? (allowedAttributes as readonly string[]).includes(attrName) : false;
+}
+
+function isAllowedAbsoluteLink(value: string): boolean {
+ try {
+ const parsed = new URL(value);
+ return allowedLinkSchemes.has(parsed.protocol.slice(0, -1));
+ } catch {
+ return false;
+ }
+}
+
+function isAllowedMxcUri(value: string): boolean {
+ try {
+ const parsed = new URL(value);
+ return (
+ parsed.protocol === 'mxc:' &&
+ parsed.host.length > 0 &&
+ parsed.pathname.length > 1 &&
+ parsed.username === '' &&
+ parsed.password === '' &&
+ parsed.search === '' &&
+ parsed.hash === ''
+ );
+ } catch {
+ return false;
+ }
+}
+
+function normalizeCodeClasses(attrValue: string): string | undefined {
+ const classes = attrValue.split(/\s+/).filter(Boolean);
+ if (
+ classes.length === 0 ||
+ classes.some((className) => !codeLanguageClassRegex.test(className))
+ ) {
+ return undefined;
+ }
+
+ return classes.join(' ');
+}
+
+function getValidatedAttributeValue(
+ tagName: string,
+ attrName: string,
+ attrValue: string
+): string | undefined {
+ if (attrName === 'style') {
+ return undefined;
+ }
+
+ if (
+ (attrName === 'data-mx-color' || attrName === 'data-mx-bg-color') &&
+ !isMatrixHexColor(attrValue)
+ ) {
+ return undefined;
+ }
+
+ if (tagName === 'a' && attrName === 'href' && !isAllowedAbsoluteLink(attrValue)) {
+ return undefined;
+ }
+
+ if (tagName === 'img' && attrName === 'src' && !isAllowedMxcUri(attrValue)) {
+ return undefined;
+ }
+
+ if (tagName === 'ol' && attrName === 'start' && !orderedListStartRegex.test(attrValue)) {
+ return undefined;
+ }
+
+ if ((tagName === 'code' || tagName === 'pre') && attrName === 'class') {
+ return normalizeCodeClasses(attrValue);
+ }
+
+ return attrValue;
+}
+
+function getValidatedProtectedImageSource(
+ sourceId: string | null,
+ protectedSources?: Map
+): string | undefined {
+ const rawSrc = sourceId ? protectedSources?.get(sourceId) : undefined;
+
+ return typeof rawSrc === 'string' ? getValidatedAttributeValue('img', 'src', rawSrc) : undefined;
+}
+
+function protectImageSources(customHtml: string): {
+ protectedHtml: string;
+ protectedSources: Map;
+} {
+ const protectedSources = new Map();
+ const protectedHtml = customHtml.replace(/
]*>/gi, (imgTag) => {
+ let protectedSourceId: string | undefined;
+
+ const strippedTag = imgTag.replace(
+ /\s(src|srcset)\s*=\s*("([^"]*)"|'([^']*)'|([^\s"'=<>`]+))/gi,
+ (_match, attrName: string, _value, doubleQuoted, singleQuoted, bareValue) => {
+ if (attrName.toLowerCase() !== 'src') {
+ return '';
+ }
+
+ if (protectedSourceId !== undefined) {
+ return '';
+ }
+
+ const rawSrc = doubleQuoted ?? singleQuoted ?? bareValue ?? '';
+ protectedSourceId = `${protectedSources.size}`;
+ protectedSources.set(protectedSourceId, rawSrc);
+
+ return ` ${INTERNAL_IMG_SRC_ATTR}="${protectedSourceId}"`;
+ }
+ );
+
+ return strippedTag;
+ });
+
+ return {
+ protectedHtml,
+ protectedSources,
+ };
+}
+
+function restoreProtectedImageSources(
+ sanitizedHtml: string,
+ protectedSources: Map
+): string {
+ return sanitizedHtml.replace(
+ new RegExp(`\\s${INTERNAL_IMG_SRC_ATTR}="([^"]+)"`, 'g'),
+ (_match, sourceId: string) => {
+ const validatedSrc = getValidatedProtectedImageSource(sourceId, protectedSources);
+ if (!validatedSrc) return '';
+
+ return ` src="${sanitizeText(validatedSrc)}"`;
+ }
+ );
+}
+
+const enforceNestingLimit = (fragment: DocumentFragment): void => {
+ const overlyNestedElements: Array<{ depth: number; element: Element }> = [];
+
+ const collect = (node: ParentNode, depth: number) => {
+ Array.from(node.childNodes).forEach((child) => {
+ if (!(child instanceof Element)) return;
+
+ const childDepth = depth + 1;
+ if (childDepth > MAX_TAG_NESTING) {
+ overlyNestedElements.push({ depth: childDepth, element: child });
+ }
+
+ collect(child, childDepth);
+ });
+ };
+
+ collect(fragment, 0);
+
+ overlyNestedElements
+ .sort((a, b) => b.depth - a.depth)
+ .forEach(({ element }) => {
+ if (!element.parentNode) return;
+ element.replaceWith(...Array.from(element.childNodes));
+ });
+};
+
+const pruneInvalidEmptyElements = (
+ fragment: DocumentFragment,
+ protectedSources?: Map
+): void => {
+ fragment.querySelectorAll('img').forEach((img) => {
+ const validatedProtectedSource = getValidatedProtectedImageSource(
+ img.getAttribute(INTERNAL_IMG_SRC_ATTR),
+ protectedSources
+ );
+
+ if (!img.getAttribute('src') && !validatedProtectedSource) {
+ img.remove();
+ }
+ });
+};
+
+export const sanitizeCustomHtml = (customHtml: string): string => {
+ if (typeof window === 'undefined') {
+ return sanitizeText(customHtml);
+ }
+
+ const { protectedHtml, protectedSources } = protectImageSources(customHtml);
+ const purify = DOMPurify(window);
+ const allowedHtmlAttributes = [...permittedHtmlAttributes, INTERNAL_IMG_SRC_ATTR];
+
+ purify.addHook('uponSanitizeAttribute', (currentNode, hookEvent) => {
+ const tagName = currentNode.tagName.toLowerCase();
+ const attrName = hookEvent.attrName.toLowerCase();
+
+ if (tagName === 'img' && attrName === INTERNAL_IMG_SRC_ATTR) {
+ if (!protectedSources.has(hookEvent.attrValue)) {
+ // eslint-disable-next-line no-param-reassign
+ hookEvent.keepAttr = false;
+ return;
+ }
+
+ // eslint-disable-next-line no-param-reassign
+ hookEvent.forceKeepAttr = true;
+ return;
+ }
+
+ if (!tagAllowsAttribute(tagName, attrName)) {
+ // DOMPurify exposes attribute decisions by mutating the hook event.
+ // eslint-disable-next-line no-param-reassign
+ hookEvent.keepAttr = false;
+ return;
+ }
+
+ const validatedAttrValue = getValidatedAttributeValue(tagName, attrName, hookEvent.attrValue);
+ if (validatedAttrValue === undefined) {
+ // eslint-disable-next-line no-param-reassign
+ hookEvent.keepAttr = false;
+ return;
+ }
+
+ // eslint-disable-next-line no-param-reassign
+ hookEvent.attrValue = validatedAttrValue;
+ // eslint-disable-next-line no-param-reassign
+ hookEvent.forceKeepAttr = true;
+ });
+
+ const sanitizedNode = purify.sanitize(protectedHtml, {
+ ALLOWED_TAGS: [...permittedHtmlTags],
+ ALLOWED_ATTR: allowedHtmlAttributes,
+ ALLOW_ARIA_ATTR: false,
+ ALLOW_DATA_ATTR: true,
+ FORBID_ATTR: ['style'],
+ FORBID_TAGS: ['mx-reply'],
+ FORBID_CONTENTS: forbiddenContentTags,
+ KEEP_CONTENT: true,
+ ALLOWED_URI_REGEXP: allowedUriRegex,
+ RETURN_DOM_FRAGMENT: true,
+ });
+
+ if (!(sanitizedNode instanceof window.DocumentFragment)) {
+ return sanitizeText(customHtml);
+ }
+
+ const fragment = sanitizedNode;
+ enforceNestingLimit(fragment);
+ pruneInvalidEmptyElements(fragment, protectedSources);
+
+ const container = document.createElement('div');
+ container.append(fragment);
+ return restoreProtectedImageSources(container.innerHTML, protectedSources);
};
diff --git a/src/app/utils/shortIdGen.ts b/src/app/utils/shortIdGen.ts
new file mode 100644
index 000000000..c9e108f71
--- /dev/null
+++ b/src/app/utils/shortIdGen.ts
@@ -0,0 +1,4 @@
+export function generateShortId(length: number): string {
+ const uuid = crypto.randomUUID();
+ return uuid.replaceAll('-', '').substring(0, length);
+}
diff --git a/src/app/utils/timeline.ts b/src/app/utils/timeline.ts
index 4ed92ab16..0934e5b02 100644
--- a/src/app/utils/timeline.ts
+++ b/src/app/utils/timeline.ts
@@ -22,18 +22,14 @@ export const getFirstLinkedTimeline = (
return current;
};
-const collectTimelines = (
- tl: EventTimeline | null,
- dir: Direction,
- acc: EventTimeline[] = []
-): EventTimeline[] => {
- if (!tl) return acc;
- return collectTimelines(tl.getNeighbouringTimeline(dir), dir, [...acc, tl]);
-};
-
export const getLinkedTimelines = (timeline: EventTimeline): EventTimeline[] => {
- const firstTimeline = getFirstLinkedTimeline(timeline, Direction.Backward);
- return collectTimelines(firstTimeline, Direction.Forward);
+ const result: EventTimeline[] = [];
+ let current: EventTimeline | null = getFirstLinkedTimeline(timeline, Direction.Backward);
+ while (current) {
+ result.push(current);
+ current = current.getNeighbouringTimeline(Direction.Forward);
+ }
+ return result;
};
export const timelineToEventsCount = (t: EventTimeline) => {
diff --git a/src/client/initMatrix.ts b/src/client/initMatrix.ts
index 18809c5d2..093093ba2 100644
--- a/src/client/initMatrix.ts
+++ b/src/client/initMatrix.ts
@@ -563,9 +563,6 @@ export const startClient = async (mx: MatrixClient, config?: StartClientConfig):
pollTimeoutMs: slidingConfig?.pollTimeoutMs ?? SLIDING_SYNC_POLL_TIMEOUT_MS,
});
manager.attach();
- // Begin background spidering so all rooms are eventually indexed.
- // Not awaited â this runs incrementally in the background.
- manager.startSpidering(100, 50);
slidingSyncByClient.set(mx, manager);
syncTransportByClient.set(mx, {
transport: 'sliding',
diff --git a/src/client/slidingSync.ts b/src/client/slidingSync.ts
index 096f77f43..43fdf39ea 100644
--- a/src/client/slidingSync.ts
+++ b/src/client/slidingSync.ts
@@ -8,6 +8,7 @@ import {
MSC3575List,
MSC3575RoomData,
MSC3575RoomSubscription,
+ MSC3575SlidingSyncResponse,
MSC3575_WILDCARD,
RoomMemberEvent,
SlidingSync,
@@ -351,6 +352,27 @@ export class SlidingSyncManager {
return;
}
+ // Before room data is processed, reset live timelines for active rooms that
+ // are receiving a full refresh (initial: true) or a post-gap update
+ // (limited: true). The SDK deliberately does not call resetLiveTimeline() for
+ // sliding sync, so events from previous visits accumulate in the live
+ // timeline alongside new events. Resetting here â before the SDK's
+ // onRoomData listener runs â ensures the fresh batch lands on a clean
+ // timeline with a correct backward pagination token.
+ if (state === SlidingSyncState.RequestFinished && resp && !err) {
+ const rooms = (resp as MSC3575SlidingSyncResponse).rooms ?? {};
+ Object.entries(rooms)
+ .filter(([, roomData]) => roomData.initial || roomData.limited)
+ .filter(([roomId]) => this.activeRoomSubscriptions.has(roomId))
+ .forEach(([roomId]) => {
+ const room = this.mx.getRoom(roomId);
+ if (!room) return;
+ const timelineSet = room.getUnfilteredTimelineSet();
+ if (timelineSet.getLiveTimeline().getEvents().length === 0) return;
+ timelineSet.resetLiveTimeline();
+ });
+ }
+
if (err || !resp || state !== SlidingSyncState.Complete) return;
// Track what changed in this sync cycle
diff --git a/src/sw.ts b/src/sw.ts
index 230a87646..bd09cd8d3 100644
--- a/src/sw.ts
+++ b/src/sw.ts
@@ -277,28 +277,73 @@ async function fetchRoomName(
}
}
+type MemberInfo = {
+ displayname: string | undefined;
+ avatarUrl: string | undefined;
+};
+
/**
- * Fetch a room member's displayname from homeserver member state.
- * Returns undefined if the member has no displayname or the request fails.
+ * Fetch a room member's state from the homeserver.
+ * Returns displayname and avatar_url (both may be undefined).
*/
-async function fetchMemberDisplayName(
+async function fetchMemberInfo(
baseUrl: string,
accessToken: string,
roomId: string,
userId: string
-): Promise {
+): Promise {
try {
const url = `${baseUrl}/_matrix/client/v3/rooms/${encodeURIComponent(roomId)}/state/m.room.member/${encodeURIComponent(userId)}`;
const res = await fetch(url, { headers: { Authorization: `Bearer ${accessToken}` } });
+ if (!res.ok) return { displayname: undefined, avatarUrl: undefined };
+ const data = (await res.json()) as Record;
+ const displayname =
+ typeof data.displayname === 'string' && data.displayname.trim()
+ ? data.displayname.trim()
+ : undefined;
+ const avatarUrl =
+ typeof data.avatar_url === 'string' && data.avatar_url.trim()
+ ? data.avatar_url.trim()
+ : undefined;
+ return { displayname, avatarUrl };
+ } catch {
+ return { displayname: undefined, avatarUrl: undefined };
+ }
+}
+
+/**
+ * Fetch the m.room.avatar state event URL from the homeserver.
+ * Returns undefined when the room has no avatar or the request fails.
+ */
+async function fetchRoomAvatar(
+ baseUrl: string,
+ accessToken: string,
+ roomId: string
+): Promise {
+ try {
+ const url = `${baseUrl}/_matrix/client/v3/rooms/${encodeURIComponent(roomId)}/state/m.room.avatar`;
+ const res = await fetch(url, { headers: { Authorization: `Bearer ${accessToken}` } });
if (!res.ok) return undefined;
const data = (await res.json()) as Record;
- const name = data.displayname;
- return typeof name === 'string' && name.trim() ? name.trim() : undefined;
+ const avatarUrl = data.url;
+ return typeof avatarUrl === 'string' && avatarUrl.trim() ? avatarUrl.trim() : undefined;
} catch {
return undefined;
}
}
+/**
+ * Convert an mxc:// URL to a legacy unauthenticated thumbnail URL.
+ * Notification icons are fetched by the OS without auth headers, so we use
+ * the pre-MSC3916 media endpoint which most homeservers still serve publicly.
+ */
+function mxcToNotificationUrl(mxcUrl: string, baseUrl: string): string | undefined {
+ const match = mxcUrl.match(/^mxc:\/\/([^/]+)\/([^?#]+)/);
+ if (!match) return undefined;
+ const [, server, mediaId] = match;
+ return `${baseUrl}/_matrix/media/v3/thumbnail/${encodeURIComponent(server)}/${encodeURIComponent(mediaId)}?width=96&height=96&method=crop`;
+}
+
/**
* Return the first any-session we have stored (used for push fetches where we
* don't have a client ID, e.g. when the app is backgrounded but still loaded).
@@ -386,10 +431,11 @@ async function handleMinimalPushPayload(
return;
}
- // Fetch the raw event and room name state in parallel â both need only roomId.
- const [rawEvent, roomNameFromState] = await Promise.all([
+ // Fetch the raw event, room name, and room avatar in parallel â all need only roomId.
+ const [rawEvent, roomNameFromState, roomAvatarMxc] = await Promise.all([
fetchRawEvent(session.baseUrl, session.accessToken, roomId, eventId),
fetchRoomName(session.baseUrl, session.accessToken, roomId),
+ fetchRoomAvatar(session.baseUrl, session.accessToken, roomId),
]);
if (!rawEvent) {
@@ -406,13 +452,20 @@ async function handleMinimalPushPayload(
const eventType = rawEvent.type as string | undefined;
const sender = rawEvent.sender as string | undefined;
- // Fetch sender's display name from room member state; fall back to MXID localpart.
- const senderDisplay =
- (sender
- ? await fetchMemberDisplayName(session.baseUrl, session.accessToken, roomId, sender)
- : undefined) ?? (sender ? mxidLocalpart(sender) : 'Someone');
+ // Fetch sender's member state â gives us both display name and avatar URL.
+ const memberInfo = sender
+ ? await fetchMemberInfo(session.baseUrl, session.accessToken, roomId, sender)
+ : { displayname: undefined, avatarUrl: undefined };
+ // Fall back to MXID localpart when the server returns no displayname.
+ const senderDisplay = memberInfo.displayname ?? (sender ? mxidLocalpart(sender) : 'Someone');
// For DMs (no m.room.name state), use the sender's display name as the room name.
const resolvedRoomName = roomNameFromState ?? senderDisplay;
+ // Room avatar takes priority (group rooms); for DMs fall back to sender's member avatar.
+ // Convert mxc:// to a legacy unauthenticated thumbnail URL so the OS can fetch it.
+ const notificationAvatarUrl =
+ (roomAvatarMxc ?? memberInfo.avatarUrl) !== undefined
+ ? mxcToNotificationUrl((roomAvatarMxc ?? memberInfo.avatarUrl)!, session.baseUrl)
+ : undefined;
const baseData = {
room_id: roomId,
event_id: eventId,
@@ -432,13 +485,16 @@ async function handleMinimalPushPayload(
if (result?.success) {
// App was backgrounded but not frozen â decryption succeeded.
+ // Prefer the server-fetched display name (authoritative) over the relay's SDK cache
+ // value, which may be stale or missing if the SDK hasn't fully synced yet.
await handlePushNotificationPushData({
...baseData,
type: result.eventType,
content: result.content,
- sender_display_name: result.sender_display_name ?? senderDisplay,
+ sender_display_name: senderDisplay,
// Prefer relay's room name (has m.direct / computed SDK name); fall back to state fetch.
room_name: result.room_name || resolvedRoomName,
+ room_avatar_url: notificationAvatarUrl,
});
} else {
// App is frozen or fully closed â show "Encrypted message" fallback.
@@ -448,6 +504,7 @@ async function handleMinimalPushPayload(
content: {},
sender_display_name: senderDisplay,
room_name: resolvedRoomName,
+ room_avatar_url: notificationAvatarUrl,
});
}
} else {
@@ -458,6 +515,7 @@ async function handleMinimalPushPayload(
content: rawEvent.content,
sender_display_name: senderDisplay,
room_name: resolvedRoomName,
+ room_avatar_url: notificationAvatarUrl,
});
}
}
diff --git a/src/types/matrix/accountData.ts b/src/types/matrix/accountData.ts
index 56edd8779..25b13cbc4 100644
--- a/src/types/matrix/accountData.ts
+++ b/src/types/matrix/accountData.ts
@@ -21,6 +21,9 @@ export enum AccountDataEvent {
// Sable account data
SableNicknames = 'moe.sable.app.nicknames',
SablePinStatus = 'moe.sable.app.pins_read_marker',
+
+ // because of a mistake hasn't been renamed in time
+ SablePerProfileMessageProfiles = 'fyi.cisnt.permessageprofile',
SableSettings = 'moe.sable.app.settings',
}
@@ -51,6 +54,24 @@ export type SecretContent = {
mac: string;
};
+/**
+ * type to save compatibility information
+ */
+export type AccountDataCompatVersion = {
+ /**
+ * a simple version number, for example 1
+ */
+ version: number;
+ /**
+ * the date where it was added
+ */
+ compatDate: string;
+ /**
+ * version number which is the oldest compatible, this attribute is optional
+ */
+ incompatBefore?: number;
+};
+
export type SecretAccountData = {
encrypted: Record;
};
diff --git a/src/types/matrix/common.ts b/src/types/matrix/common.ts
index 8cc96d7d6..e91993578 100644
--- a/src/types/matrix/common.ts
+++ b/src/types/matrix/common.ts
@@ -14,6 +14,11 @@ export type IImageInfo = {
[MATRIX_BLUR_HASH_PROPERTY_NAME]?: string;
};
+export type MSC1767Text = {
+ body: string;
+ mimetype?: string;
+};
+
export type IVideoInfo = {
w?: number;
h?: number;