973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1 | <script lang="ts"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2 | import { onMount, tick } from 'svelte'; |
d4c0d65f690a | atagen | 2026-10-24 12:50 UTC | 3 | import { fade, fly } from 'svelte/transition'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 4 | import LoginPanel from './lib/LoginPanel.svelte'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 5 | import MessageRow from './lib/MessageRow.svelte'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 6 | import MxcAvatar from './lib/MxcAvatar.svelte'; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 7 | import PinButton from './lib/PinButton.svelte'; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 8 | import ContextMenu, { type MenuItem } from './lib/ContextMenu.svelte'; |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 9 | import StickerPicker from './lib/StickerPicker.svelte'; |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 10 | import PackManager from './lib/PackManager.svelte'; |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 11 | import { clonePackDestinations, editableChoices, shortcodeFor } from './lib/packs'; |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 12 | import type { CommandRequest } from './lib/transport'; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 13 | import UserCard, { type UserAction } from './lib/UserCard.svelte'; |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 14 | import { allowed, canRedact, groupMembers, isMuted, parsePowerLevels, type PowerLevels } from './lib/permissions'; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 15 | import { moveBefore, pinnedFirst, sortSpaces } from './lib/rail-order'; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 16 | import ImageLightbox from './lib/ImageLightbox.svelte'; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 17 | import { lightbox } from './lib/lightbox'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 18 | import SecurityPanel from './lib/SecurityPanel.svelte'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 19 | import { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 20 | closeRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 21 | createRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 22 | getEncryption, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 23 | getMembers, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 24 | getProfile, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 25 | getRooms, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 26 | getSession, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 27 | getSpaceChildren, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 28 | joinRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 29 | leaveRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 30 | logout, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 31 | markRead, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 32 | openRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 33 | paginateRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 34 | reactToMessage, |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 35 | runCommand, |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 36 | sendMessage, |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 37 | uploadAttachment, |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 38 | uploadAvatar, |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 39 | uploadRoomAvatar, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 40 | editMessage, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 41 | mediaUrl |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 42 | } from './lib/api'; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 43 | import EmojiText from './lib/EmojiText.svelte'; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 44 | import { loadEmoji, type EmojiEntry } from './lib/emoji'; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 45 | import { completeShortcode, customEmotes, emoteQueryAt, rankEmotes, resolveEmotes, type EmoteCandidate, type EmoteQuery } from './lib/emotes'; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 46 | import { COMMAND_USAGE, commandQueryAt, isKnownCommand, matchCommands, parseCommand, splitTarget, unescapeCommand } from './lib/commands'; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 47 | import type { CommandName } from './lib/commands'; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 48 | import type { ParsedCommand } from './lib/commands'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 49 | import { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 50 | banners, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 51 | blocked, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 52 | connectEvents, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 53 | connection, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 54 | disconnectEvents, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 55 | dismissBanner, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 56 | encryption, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 57 | membersByRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 58 | membersLoading, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 59 | pushBanner, |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 60 | imagePacks, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 61 | resetClientState, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 62 | rooms, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 63 | selectedRoomId, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 64 | sessionUser, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 65 | softLogout, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 66 | timelines, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 67 | pinnedTimelines, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 68 | verification |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 69 | } from './lib/store'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 70 | import { discardPending, pendingByRoom, queueSend, resetPending, retryPending } from './lib/pending'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 71 | import type { PendingMessage } from './lib/pending'; |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 72 | import { insideOpenFence } from './lib/markdown'; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 73 | import { markMentions } from './lib/composer-marks'; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 74 | import { mentionQueryAt, mentionsFromHtml, rankPeople, resolveMentions } from './lib/mentions'; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 75 | import type { Mention, MentionQuery } from './lib/mentions'; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 76 | import { loadQuickReactions, quickReactions, saveQuickReactions } from './lib/quick-reactions'; |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 77 | import { |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 78 | linkPreviews, |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 79 | loadUrlPreviewSettings, |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 80 | requestLinkPreview, |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 81 | saveUrlPreviewSettings, |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 82 | urlPreviewSettings |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 83 | } from './lib/link-previews'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 84 | import { notifyTyping, stopTyping } from './lib/typing'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 85 | import { formatDay } from './lib/format'; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 86 | import { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 87 | MEMBERS_WIDTH, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 88 | SIDE_WIDTH, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 89 | lastSpaceRooms, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 90 | lineHeight, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 91 | markdownEnabled, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 92 | membersWidth, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 93 | messageSpacing, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 94 | navFolded, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 95 | railFolded, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 96 | sideWidth |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 97 | } from './lib/appearance'; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 98 | import SettingsPanel from './lib/SettingsPanel.svelte'; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 99 | import { packsForRoom, parseEncryptionState, parseOwnProfile, parseVerificationState, contentPreview, senderLabel } from './lib/types'; |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 100 | import type { ImagePack, MemberSummary, OwnProfile, PackImage, Person, QuickReaction, ReplyReference, RoomSummary, SendState, TimelineEvent, TimelineItem } from './lib/types'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 101 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 102 | let roomsLoading = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 103 | let booted = false; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 104 | let wasOnline = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 105 | let search = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 106 | let sidebarOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 107 | let membersOpen = false; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 108 | let replyingTo: ReplyReference | null = null; |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 109 | let dialog: 'join' | 'create' | 'security' | 'settings' | 'packs' | null = null; |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 110 | let stickersOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 111 | let joinTarget = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 112 | let joinBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 113 | let createName = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 114 | let createTopic = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 115 | let createBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 116 | let leaveBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 117 | let paginateBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 118 | let reacting = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 119 | let composer = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 120 | let drafts: Record<string, string> = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 121 | let stickToBottom = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 122 | let timelineEl: HTMLElement | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 123 | let composerEl: HTMLTextAreaElement | null = null; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 124 | let marksEl: HTMLDivElement | null = null; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 125 | $: composerMarks = markMentions( |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 126 | composer, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 127 | ($selectedRoomId && pickedMentions[$selectedRoomId]) || [], |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 128 | resolveEmotes(composer, roomEmotes).map((e) => `:${e.shortcode}:`) |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 129 | ); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 130 | let fileInput: HTMLInputElement | null = null; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 131 | let avatarInput: HTMLInputElement | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 132 | let uploadBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 133 | let uploadName: string | null = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 134 | interface StagedAttachment { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 135 | id: number; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 136 | file: File; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 137 | previewUrl: string | null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 138 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 139 | let staged: Record<string, StagedAttachment[]> = {}; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 140 | let editing: { roomId: string; eventId: string; original: string; stash: string } | null = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 141 | /** Everyone picked from the finder per room; only those whose name is still in the text get linked on send. */ |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 142 | let pickedMentions: Record<string, Mention[]> = {}; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 143 | let mentionQuery: MentionQuery | null = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 144 | let mentionIndex = 0; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 145 | let nextStagedId = 1; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 146 | const WARM_ROOM_LIMIT = 8; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 147 | /** Rooms left open after switching away so coming back is instant, least recently viewed first. */ |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 148 | let warmRooms: string[] = []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 149 | let openReady: Record<string, boolean> = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 150 | let openFailed: Record<string, string> = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 151 | let membersFor: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 152 | let lastReadKey = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 153 | let readTimer: number | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 154 | let profile: OwnProfile | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 155 | let profileMxc: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 156 | let selectedSpaceId: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 157 | let spaceChildIds: string[] | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 158 | let spaceChildrenLoading = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 159 | let spaceChildrenError: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 160 | let avatarByUser: Record<string, string | null> = {}; |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 161 | let restoringRoute = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 162 | |
d4c0d65f690a | atagen | 2026-10-24 12:50 UTC | 163 | function motionDuration(ms: number): number { |
d4c0d65f690a | atagen | 2026-10-24 12:50 UTC | 164 | return typeof window !== 'undefined' && window.matchMedia('(prefers-reduced-motion: reduce)').matches ? 0 : ms; |
d4c0d65f690a | atagen | 2026-10-24 12:50 UTC | 165 | } |
d4c0d65f690a | atagen | 2026-10-24 12:50 UTC | 166 | |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 167 | // account data is read from the local cache, which is empty on a fresh device until the first sync lands |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 168 | $: { |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 169 | const online = $connection === 'online'; |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 170 | if (online && !wasOnline) { |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 171 | void loadQuickReactions(); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 172 | void loadUrlPreviewSettings(); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 173 | } |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 174 | wasOnline = online; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 175 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 176 | $: selectedRoom = $rooms.find((r) => r.room_id === $selectedRoomId) ?? null; |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 177 | $: roomPacks = packsForRoom($imagePacks, $selectedRoomId); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 178 | $: roomEmotes = customEmotes(roomPacks); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 179 | $: previewsAllowed = selectedRoom !== null && (!selectedRoom.encrypted || $urlPreviewSettings.encrypted_rooms); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 180 | $: loadPreview = previewsAllowed && $selectedRoomId ? previewLoader($selectedRoomId) : null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 181 | $: spaceRooms = $rooms.filter((r) => r.space); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 182 | $: spaceParents = parentSpaceMap(spaceRooms); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 183 | $: railSpaces = spaceRooms.filter((s) => !spaceParents.has(s.room_id)); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 184 | let railOverride: string[] | null = null; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 185 | $: if (railOverride && sortSpaces(railSpaces, null).map((s) => s.room_id).join() === railOverride.join()) railOverride = null; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 186 | $: orderedRail = sortSpaces(railSpaces, railOverride); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 187 | $: pinnedRail = orderedRail.filter((s) => s.favourite); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 188 | $: otherRail = orderedRail.filter((s) => !s.favourite); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 189 | $: railSelected = selectedSpaceId ? topSpaceOf(selectedSpaceId, spaceParents) : null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 190 | $: invites = $rooms.filter((r) => r.membership === 'Invited'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 191 | $: query = search.trim().toLowerCase(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 192 | $: selectedSpace = selectedSpaceId ? ($rooms.find((r) => r.room_id === selectedSpaceId) ?? null) : null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 193 | // While a space's children load (or fail), show no channels rather than the |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 194 | // full list — listing everything would falsely imply it belongs to the space. |
f12c7de2a3ab | atagen | 2026-10-23 08:10 UTC | 195 | $: baseRooms = selectedSpaceId ? (spaceChildIds ? $rooms.filter((r) => spaceChildIds?.includes(r.room_id)) : []) : $rooms; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 196 | $: visibleRooms = query |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 197 | ? baseRooms.filter( |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 198 | (r) => |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 199 | r.name.toLowerCase().includes(query) || r.room_id.toLowerCase().includes(query) |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 200 | ) |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 201 | : baseRooms; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 202 | $: directRooms = pinnedFirst(visibleRooms.filter((r) => r.direct && !r.space && r.membership !== 'Invited')); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 203 | $: groupRooms = pinnedFirst(visibleRooms.filter((r) => !r.direct && !r.space && r.membership !== 'Invited')); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 204 | $: spaceList = pinnedFirst(visibleRooms.filter((r) => r.space && r.membership !== 'Invited')); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 205 | $: channelRooms = baseRooms.filter((r) => !r.space && r.membership !== 'Invited'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 206 | $: recoveryBanner = $encryption && ($encryption.recovery === 'Disabled' || $encryption.recovery === 'Incomplete') ? $encryption : null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 207 | $: verificationBanner = $verification && $verification.kind !== 'Done' ? $verification : null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 208 | $: items = $selectedRoomId ? ($timelines[$selectedRoomId] ?? []) : []; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 209 | $: currentStaged = $selectedRoomId ? (staged[$selectedRoomId] ?? []) : []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 210 | $: members = $selectedRoomId ? ($membersByRoom[$selectedRoomId] ?? []) : []; |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 211 | $: memberGroups = groupMembers(members, roomLevels); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 212 | $: people = peopleIn(items, members); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 213 | $: mentionCandidates = mentionQuery ? rankPeople(Object.values(people), mentionQuery.query, $sessionUser ?? null) : []; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 214 | $: if (mentionIndex >= mentionCandidates.length) mentionIndex = 0; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 215 | $: hasStart = items.some((i) => i.kind === 'start'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 216 | $: grouped = buildGroups(items); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 217 | $: lastSentId = lastOwnSent(items); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 218 | $: pendingItems = $selectedRoomId ? ($pendingByRoom[$selectedRoomId] ?? []) : []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 219 | $: lastRealOwn = lastSenderIsOwn(items); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 220 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 221 | function lastSenderIsOwn(list: TimelineItem[]): boolean { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 222 | for (let i = list.length - 1; i >= 0; i -= 1) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 223 | const it = list[i]; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 224 | if (it.kind === 'event') return it.event.sender.user_id === $sessionUser; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 225 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 226 | return false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 227 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 228 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 229 | function pendingShowSender(index: number): boolean { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 230 | return index === 0 ? !lastRealOwn : false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 231 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 232 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 233 | function pendingToEvent(p: PendingMessage): TimelineEvent { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 234 | const state: SendState = p.status === 'failed' ? { kind: 'Failed', will_retry: false } : { kind: 'Sending' }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 235 | return { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 236 | item_id: `pending-${p.id}`, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 237 | event_id: null, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 238 | transaction_id: p.id, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 239 | sender: { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 240 | user_id: $sessionUser ?? '', |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 241 | display_name: profile?.display_name ?? null, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 242 | avatar: null, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 243 | name_ambiguous: false |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 244 | }, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 245 | timestamp_ms: p.createdAt, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 246 | own: true, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 247 | send_state: state, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 248 | content: { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 249 | kind: 'Message', |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 250 | message: { kind: 'Text', body: p.body, geo_uri: null, formatted_body: p.formatted, edited: false, media: null, link_previews: [] } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 251 | }, |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 252 | reply_to: p.replyTo, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 253 | thread_root: null, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 254 | thread_summary: null, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 255 | reactions: [], |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 256 | read_by: [], |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 257 | editable: false |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 258 | }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 259 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 260 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 261 | interface Group { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 262 | key: string; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 263 | item: TimelineItem; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 264 | showSender: boolean; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 265 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 266 | |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 267 | function lastOwnSent(list: TimelineItem[]): string | null { |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 268 | for (let i = list.length - 1; i >= 0; i--) { |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 269 | const item = list[i]; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 270 | if (item.kind === 'event' && item.event.own && item.event.send_state.kind === 'Sent') return item.event.item_id; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 271 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 272 | return null; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 273 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 274 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 275 | function buildGroups(list: TimelineItem[]): Group[] { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 276 | const out: Group[] = []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 277 | let prevSender: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 278 | let prevTs = 0; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 279 | list.forEach((item, index) => { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 280 | let showSender = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 281 | if (item.kind === 'event') { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 282 | const e = item.event; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 283 | showSender = |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 284 | prevSender !== e.sender.user_id || Math.abs(e.timestamp_ms - prevTs) > 5 * 60 * 1000; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 285 | prevSender = e.sender.user_id; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 286 | prevTs = e.timestamp_ms; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 287 | out.push({ key: e.item_id || e.event_id || `m-${index}`, item, showSender }); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 288 | } else { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 289 | prevSender = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 290 | out.push({ key: `${item.kind}-${index}`, item, showSender }); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 291 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 292 | }); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 293 | return out; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 294 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 295 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 296 | function roomUnread(r: RoomSummary): number { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 297 | return r.unread_messages + r.unread_mentions; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 298 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 299 | |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 300 | function recordRoute(spaceId: string | null, roomId: string | null): void { |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 301 | if (restoringRoute) return; |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 302 | const url = new URL(window.location.href); |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 303 | url.searchParams.delete('space'); |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 304 | url.searchParams.delete('room'); |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 305 | if (spaceId) url.searchParams.set('space', spaceId); |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 306 | if (roomId) url.searchParams.set('room', roomId); |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 307 | const next = `${url.pathname}${url.search}${url.hash}`; |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 308 | const current = `${window.location.pathname}${window.location.search}${window.location.hash}`; |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 309 | if (next !== current) window.history.pushState({ spaceId, roomId }, '', next); |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 310 | } |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 311 | |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 312 | async function restoreRoute(): Promise<void> { |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 313 | const url = new URL(window.location.href); |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 314 | const roomId = url.searchParams.get('room'); |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 315 | const spaceId = url.searchParams.get('space'); |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 316 | restoringRoute = true; |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 317 | try { |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 318 | if (roomId && $rooms.some((room) => room.room_id === roomId && !room.space)) { |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 319 | selectedSpaceId = spaceId && $rooms.some((room) => room.room_id === spaceId && room.space) ? spaceId : null; |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 320 | spaceChildrenError = null; |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 321 | spaceChildIds = selectedSpaceId ? (await getSpaceChildren(selectedSpaceId)).room_ids ?? [] : null; |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 322 | await selectRoom(roomId); |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 323 | } else if (spaceId && $rooms.some((room) => room.room_id === spaceId && room.space)) { |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 324 | await selectSpace(spaceId); |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 325 | } else { |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 326 | await selectHome(); |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 327 | } |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 328 | } catch (e) { |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 329 | pushBanner(e instanceof Error ? e.message : 'Could not restore navigation'); |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 330 | } finally { |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 331 | restoringRoute = false; |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 332 | } |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 333 | } |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 334 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 335 | onMount(() => { |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 336 | const onPopState = () => void restoreRoute(); |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 337 | window.addEventListener('popstate', onPopState); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 338 | void boot(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 339 | return () => { |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 340 | window.removeEventListener('popstate', onPopState); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 341 | disconnectEvents(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 342 | stopTyping(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 343 | if (readTimer !== null) window.clearTimeout(readTimer); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 344 | }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 345 | }); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 346 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 347 | async function boot(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 348 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 349 | const session = await getSession(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 350 | blocked.set(session.blocked ?? false); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 351 | sessionUser.set(session.user_id); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 352 | if (session.user_id) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 353 | softLogout.set(null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 354 | await refreshRooms(); |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 355 | await restoreRoute(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 356 | connectEvents(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 357 | void loadProfile(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 358 | void loadEncryption(); |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 359 | void loadQuickReactions(); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 360 | void loadUrlPreviewSettings(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 361 | } else { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 362 | softLogout.set(session.soft_logout ?? null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 363 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 364 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 365 | pushBanner(e instanceof Error ? `Session check failed: ${e.message}` : 'Session check failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 366 | sessionUser.set(null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 367 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 368 | booted = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 369 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 370 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 371 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 372 | async function refreshRooms(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 373 | roomsLoading = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 374 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 375 | const res = await getRooms(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 376 | rooms.set(res.rooms); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 377 | pruneSpaceFilter(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 378 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 379 | pushBanner(e instanceof Error ? e.message : 'Could not load rooms'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 380 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 381 | roomsLoading = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 382 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 383 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 384 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 385 | async function loadProfile(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 386 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 387 | const raw = await getProfile(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 388 | profile = parseOwnProfile(raw); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 389 | profileMxc = profile.avatar_url; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 390 | } catch { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 391 | profile = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 392 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 393 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 394 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 395 | async function loadEncryption(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 396 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 397 | const res = await getEncryption(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 398 | const state = parseEncryptionState(res.state); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 399 | if (state) encryption.set(state); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 400 | const verificationState = parseVerificationState(res.verification); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 401 | if (verificationState) verification.set(verificationState); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 402 | } catch { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 403 | // Encryption status also arrives over SSE; a failed first fetch is not fatal. |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 404 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 405 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 406 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 407 | function afterLogin(userId: string): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 408 | sessionUser.set(userId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 409 | softLogout.set(null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 410 | blocked.set(false); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 411 | void refreshRooms(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 412 | connectEvents(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 413 | void loadProfile(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 414 | void loadEncryption(); |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 415 | void loadQuickReactions(); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 416 | void loadUrlPreviewSettings(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 417 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 418 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 419 | async function doLogout(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 420 | stopTyping(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 421 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 422 | await logout(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 423 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 424 | pushBanner(e instanceof Error ? e.message : 'Logout failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 425 | return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 426 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 427 | disconnectEvents(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 428 | resetClientState(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 429 | softLogout.set(null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 430 | blocked.set(false); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 431 | sessionUser.set(null); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 432 | lightbox.set(null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 433 | composer = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 434 | drafts = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 435 | dialog = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 436 | membersOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 437 | sidebarOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 438 | profile = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 439 | profileMxc = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 440 | selectedSpaceId = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 441 | spaceChildIds = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 442 | spaceChildrenError = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 443 | openReady = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 444 | openFailed = {}; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 445 | warmRooms = []; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 446 | pickedMentions = {}; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 447 | mentionQuery = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 448 | clearAllStaged(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 449 | avatarByUser = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 450 | resetPending(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 451 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 452 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 453 | /** Joined spaces that sit inside another joined space, keyed to one such parent. Either side of the link counts. */ |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 454 | function parentSpaceMap(spaces: RoomSummary[]): Map<string, string> { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 455 | const ids = new Set(spaces.map((s) => s.room_id)); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 456 | const parents = new Map<string, string>(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 457 | for (const space of spaces) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 458 | for (const child of space.children) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 459 | if (child !== space.room_id && ids.has(child) && !parents.has(child)) parents.set(child, space.room_id); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 460 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 461 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 462 | for (const space of spaces) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 463 | const parent = space.parent_spaces.find((id) => id !== space.room_id && ids.has(id)); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 464 | if (parent && !parents.has(space.room_id)) parents.set(space.room_id, parent); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 465 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 466 | for (const id of [...parents.keys()]) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 467 | const seen = new Set<string>([id]); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 468 | let at = parents.get(id); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 469 | while (at && !seen.has(at)) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 470 | seen.add(at); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 471 | at = parents.get(at); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 472 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 473 | if (at) parents.delete(id); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 474 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 475 | return parents; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 476 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 477 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 478 | function topSpaceOf(id: string, parents: Map<string, string>): string { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 479 | let at = id; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 480 | while (parents.has(at)) at = parents.get(at)!; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 481 | return at; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 482 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 483 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 484 | function pruneSpaceFilter(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 485 | if (!selectedSpaceId) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 486 | if (!$rooms.some((r) => r.room_id === selectedSpaceId)) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 487 | selectedSpaceId = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 488 | spaceChildIds = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 489 | spaceChildrenError = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 490 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 491 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 492 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 493 | async function selectHome(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 494 | selectedSpaceId = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 495 | spaceChildIds = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 496 | spaceChildrenError = null; |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 497 | if (window.innerWidth > 640) navFolded.set(false); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 498 | sidebarOpen = true; |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 499 | recordRoute(null, null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 500 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 501 | |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 502 | function toggleChannelsPane(): void { |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 503 | if (window.innerWidth <= 640) sidebarOpen = !sidebarOpen; |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 504 | else navFolded.update((v) => !v); |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 505 | } |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 506 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 507 | async function selectSpace(spaceId: string): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 508 | if ($selectedRoomId && composer.trim()) drafts[$selectedRoomId] = composer; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 509 | stopTyping(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 510 | selectedSpaceId = spaceId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 511 | spaceChildIds = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 512 | spaceChildrenError = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 513 | spaceChildrenLoading = true; |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 514 | const last = $lastSpaceRooms[spaceId]; |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 515 | const resume = last && $rooms.some((r) => r.room_id === last && !r.space) ? last : null; |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 516 | if (resume) { |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 517 | void selectRoom(resume); |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 518 | } else { |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 519 | selectedRoomId.set(null); |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 520 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 521 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 522 | const res = await getSpaceChildren(spaceId); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 523 | if (selectedSpaceId === spaceId) { |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 524 | spaceChildIds = res.room_ids ?? []; |
00075327fc57 | atagen | 2026-10-24 11:54 UTC | 525 | const firstChannel = spaceChildIds |
00075327fc57 | atagen | 2026-10-24 11:54 UTC | 526 | .map((id) => $rooms.find((room) => room.room_id === id)) |
00075327fc57 | atagen | 2026-10-24 11:54 UTC | 527 | .find((room) => room && !room.space); |
00075327fc57 | atagen | 2026-10-24 11:54 UTC | 528 | if ((!resume || !spaceChildIds.includes(resume)) && firstChannel) { |
00075327fc57 | atagen | 2026-10-24 11:54 UTC | 529 | await selectRoom(firstChannel.room_id); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 530 | } |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 531 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 532 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 533 | if (selectedSpaceId === spaceId) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 534 | spaceChildrenError = e instanceof Error ? e.message : 'Could not load rooms in this space'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 535 | spaceChildIds = []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 536 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 537 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 538 | if (selectedSpaceId === spaceId) spaceChildrenLoading = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 539 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 540 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 541 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 542 | async function selectRoom(roomId: string, peek = false): Promise<void> { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 543 | peeking = peek ? roomId : null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 544 | if ($selectedRoomId && composer.trim()) drafts[$selectedRoomId] = composer; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 545 | if (roomId === $selectedRoomId && openReady[roomId]) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 546 | sidebarOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 547 | return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 548 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 549 | stopTyping(); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 550 | const spaceId = selectedSpaceId; |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 551 | if (spaceId) lastSpaceRooms.update((all) => ({ ...all, [spaceId]: roomId })); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 552 | selectedRoomId.set(roomId); |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 553 | recordRoute(selectedSpaceId, roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 554 | composer = drafts[roomId] ?? ''; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 555 | replyingTo = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 556 | editing = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 557 | mentionQuery = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 558 | stickToBottom = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 559 | lastReadKey = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 560 | sidebarOpen = false; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 561 | touchWarmRoom(roomId); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 562 | if (openReady[roomId]) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 563 | if (membersOpen) void loadMembers(roomId); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 564 | await tick(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 565 | scrollToBottom(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 566 | queueReadReceipt(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 567 | composerEl?.focus(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 568 | return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 569 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 570 | if (openFailed[roomId]) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 571 | const nextFailed = { ...openFailed }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 572 | delete nextFailed[roomId]; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 573 | openFailed = nextFailed; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 574 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 575 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 576 | await openRoom(roomId); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 577 | if (warmRooms.includes(roomId)) openReady = { ...openReady, [roomId]: true }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 578 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 579 | const message = e instanceof Error ? e.message : `Could not open room ${roomId}`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 580 | openFailed = { ...openFailed, [roomId]: message }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 581 | pushBanner(message); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 582 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 583 | if (membersOpen) void loadMembers(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 584 | await tick(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 585 | scrollToBottom(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 586 | queueReadReceipt(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 587 | composerEl?.focus(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 588 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 589 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 590 | function touchWarmRoom(roomId: string): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 591 | warmRooms = [...warmRooms.filter((id) => id !== roomId), roomId]; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 592 | while (warmRooms.length > WARM_ROOM_LIMIT) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 593 | const evicted = warmRooms[0]; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 594 | warmRooms = warmRooms.slice(1); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 595 | forgetOpenRoom(evicted); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 596 | closeRoom(evicted).catch(() => undefined); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 597 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 598 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 599 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 600 | function forgetOpenRoom(roomId: string): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 601 | warmRooms = warmRooms.filter((id) => id !== roomId); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 602 | const nextReady = { ...openReady }; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 603 | delete nextReady[roomId]; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 604 | openReady = nextReady; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 605 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 606 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 607 | function scrollToBottom(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 608 | if (timelineEl) timelineEl.scrollTop = timelineEl.scrollHeight; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 609 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 610 | |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 611 | let userScrollUntil = 0; |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 612 | let draggingScrollbar = false; |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 613 | let paginationAnchor: { roomId: string; top: number; height: number } | null = null; |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 614 | |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 615 | function noteUserScroll(): void { |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 616 | userScrollUntil = performance.now() + 300; |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 617 | } |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 618 | |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 619 | function onTimelineKey(e: KeyboardEvent): void { |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 620 | if (['ArrowUp', 'ArrowDown', 'PageUp', 'PageDown', 'Home', 'End', ' '].includes(e.key)) noteUserScroll(); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 621 | } |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 622 | |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 623 | function onTimelinePointer(e: PointerEvent): void { |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 624 | if (e.target === timelineEl) draggingScrollbar = true; |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 625 | } |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 626 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 627 | function onTimelineScroll(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 628 | if (!timelineEl) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 629 | const gap = timelineEl.scrollHeight - timelineEl.scrollTop - timelineEl.clientHeight; |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 630 | if (gap < 80) stickToBottom = true; |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 631 | else if (draggingScrollbar || performance.now() < userScrollUntil) stickToBottom = false; |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 632 | if (timelineEl.scrollTop < 80 && !hasStart && !paginateBusy) void paginate(); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 633 | } |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 634 | |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 635 | function pinTimeline(node: HTMLElement) { |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 636 | const observer = new ResizeObserver(() => { |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 637 | if (stickToBottom) scrollToBottom(); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 638 | }); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 639 | observer.observe(node); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 640 | if (node.parentElement) observer.observe(node.parentElement); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 641 | return { destroy: () => observer.disconnect() }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 642 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 643 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 644 | $: void trackTimeline($selectedRoomId, items); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 645 | async function trackTimeline(roomId: string | null, list: TimelineItem[]): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 646 | if (!roomId || list.length === 0) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 647 | if (roomId !== $selectedRoomId) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 648 | await tick(); |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 649 | if (paginationAnchor?.roomId === roomId && timelineEl && !stickToBottom) { |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 650 | timelineEl.scrollTop = paginationAnchor.top + timelineEl.scrollHeight - paginationAnchor.height; |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 651 | paginationAnchor = null; |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 652 | } else if (stickToBottom) scrollToBottom(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 653 | queueReadReceipt(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 654 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 655 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 656 | function queueReadReceipt(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 657 | if (readTimer !== null) window.clearTimeout(readTimer); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 658 | readTimer = window.setTimeout(() => { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 659 | readTimer = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 660 | void sendReadReceipt(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 661 | }, 800); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 662 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 663 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 664 | async function sendReadReceipt(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 665 | const roomId = $selectedRoomId; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 666 | if (!roomId || roomId === peeking) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 667 | const list = $timelines[roomId] ?? []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 668 | for (let i = list.length - 1; i >= 0; i -= 1) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 669 | const entry = list[i]; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 670 | if (entry.kind === 'event' && entry.event.event_id) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 671 | const key = `${roomId}:${entry.event.event_id}`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 672 | if (key === lastReadKey) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 673 | lastReadKey = key; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 674 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 675 | await markRead(roomId, entry.event.event_id); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 676 | } catch { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 677 | return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 678 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 679 | return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 680 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 681 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 682 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 683 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 684 | function send(): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 685 | if (editing) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 686 | submitEdit(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 687 | return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 688 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 689 | const roomId = $selectedRoomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 690 | const body = composer.trim(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 691 | const attachments = roomId ? (staged[roomId] ?? []) : []; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 692 | if (!roomId || (!body && attachments.length === 0)) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 693 | if (!openReady[roomId]) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 694 | pushBanner('Still opening this room — sending is disabled until the room is ready.'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 695 | return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 696 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 697 | if (attachments.length > 0 && uploadBusy) return; |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 698 | const command = parseCommand(body); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 699 | if (command && !isKnownCommand(command.name)) { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 700 | pushBanner(`Unknown command /${command.name}`); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 701 | return; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 702 | } |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 703 | if (command && attachments.length > 0) { |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 704 | if (command.name !== 'roomavatar' && command.name !== 'globalavatar') { |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 705 | pushBanner(`/${command.name} doesn't take attachments`); |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 706 | return; |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 707 | } |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 708 | if (command.args || attachments.length !== 1 || !attachments[0].file.type.startsWith('image/')) { |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 709 | pushBanner(`/${command.name} takes a single attached image`); |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 710 | return; |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 711 | } |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 712 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 713 | composer = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 714 | if (roomId in drafts) delete drafts[roomId]; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 715 | stickToBottom = true; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 716 | const reply = replyingTo; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 717 | replyingTo = null; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 718 | const text = unescapeCommand(body); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 719 | const mentions = resolveMentions(text, pickedMentions[roomId] ?? []); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 720 | pickedMentions = { ...pickedMentions, [roomId]: [] }; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 721 | mentionQuery = null; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 722 | if (command) { |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 723 | const image = attachments[0] ?? null; |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 724 | if (image) { |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 725 | const { [roomId]: _used, ...rest } = staged; |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 726 | staged = rest; |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 727 | } |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 728 | void execute(roomId, command, reply, mentions, image?.file ?? null).finally(() => { |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 729 | if (image?.previewUrl) URL.revokeObjectURL(image.previewUrl); |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 730 | }); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 731 | } else if (attachments.length === 0) { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 732 | queueSend(roomId, text, reply, mentions, $markdownEnabled, resolveEmotes(text, roomEmotes)); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 733 | } else { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 734 | const { [roomId]: _sent, ...rest } = staged; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 735 | staged = rest; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 736 | void sendAttachments(roomId, text, reply, mentions, attachments); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 737 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 738 | if (peeking === roomId) stopPeeking(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 739 | composerEl?.focus(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 740 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 741 | |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 742 | function lastOwnEventId(): string | null { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 743 | for (let i = items.length - 1; i >= 0; i -= 1) { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 744 | const entry = items[i]; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 745 | if (entry.kind === 'event' && entry.event.own && entry.event.event_id && entry.event.content.kind !== 'Redacted') { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 746 | return entry.event.event_id; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 747 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 748 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 749 | return null; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 750 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 751 | |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 752 | async function execute( |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 753 | roomId: string, |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 754 | command: ParsedCommand, |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 755 | reply: ReplyReference | null, |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 756 | mentions: Mention[], |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 757 | image: File | null |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 758 | ): Promise<void> { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 759 | const { name, args } = command; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 760 | const target = () => { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 761 | const found = splitTarget(args, Object.values(people)); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 762 | if ('error' in found) throw new Error(found.error); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 763 | return found; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 764 | }; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 765 | const required = (what: string) => { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 766 | if (!args) throw new Error(`/${name} needs ${what}`); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 767 | return args; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 768 | }; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 769 | try { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 770 | switch (name) { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 771 | case 'me': |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 772 | case 'notice': { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 773 | const said = required('something to say'); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 774 | await sendMessage(roomId, said, null, mentions, $markdownEnabled, name === 'me' ? 'emote' : 'notice', resolveEmotes(said, roomEmotes)); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 775 | break; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 776 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 777 | case 'msg': { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 778 | const { user_id, rest } = target(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 779 | const res = (await runCommand({ op: 'direct', user_id })) as { room_id: string }; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 780 | await refreshRooms(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 781 | await selectRoom(res.room_id); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 782 | if (rest) queueSend(res.room_id, rest, null, [], $markdownEnabled); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 783 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 784 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 785 | case 'join': |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 786 | await join(required('a room id or alias')); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 787 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 788 | case 'leave': |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 789 | await leave(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 790 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 791 | case 'invite': |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 792 | await runCommand({ op: 'invite', room_id: roomId, user_id: target().user_id }); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 793 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 794 | case 'disinvite': |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 795 | case 'kick': |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 796 | case 'ban': |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 797 | case 'unban': { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 798 | const { user_id, rest } = target(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 799 | const op = name === 'disinvite' ? 'kick' : name; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 800 | await runCommand({ op, room_id: roomId, user_id, reason: rest || null }); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 801 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 802 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 803 | case 'powerlevel': { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 804 | const { user_id, rest } = target(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 805 | const level = Number(rest); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 806 | if (!rest || !Number.isInteger(level)) throw new Error('/powerlevel needs a whole number after the name'); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 807 | await runCommand({ op: 'set_power_level', room_id: roomId, user_id, level }); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 808 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 809 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 810 | case 'mute': |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 811 | case 'unmute': |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 812 | await runCommand({ op: 'mute', room_id: roomId, user_id: target().user_id, muted: name === 'mute' }); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 813 | break; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 814 | case 'ignore': |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 815 | case 'unignore': |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 816 | await runCommand({ op: name, user_id: target().user_id }); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 817 | break; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 818 | case 'roomnick': |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 819 | await runCommand({ op: 'set_room_display_name', room_id: roomId, name: args || null }); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 820 | break; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 821 | case 'roomavatar': |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 822 | if (image) { |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 823 | await uploadRoomAvatar(roomId, image); |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 824 | } else if (args && !args.startsWith('mxc://')) { |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 825 | throw new Error('/roomavatar takes an mxc:// link, an attached image, or nothing to drop the override'); |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 826 | } else { |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 827 | await runCommand({ op: 'set_room_avatar', room_id: roomId, mxc: args || null }); |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 828 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 829 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 830 | case 'delete': { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 831 | const eventId = reply?.event_id ?? lastOwnEventId(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 832 | if (!eventId) throw new Error('Nothing of yours to delete here'); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 833 | await runCommand({ op: 'redact', room_id: roomId, event_id: eventId, reason: args || null }); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 834 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 835 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 836 | case 'globalnick': |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 837 | await runCommand({ op: 'set_display_name', name: required('a name') }); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 838 | await loadProfile(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 839 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 840 | case 'globalavatar': |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 841 | if (image) { |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 842 | await uploadAvatar(image); |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 843 | await loadProfile(); |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 844 | } else if (!args) { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 845 | avatarInput?.click(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 846 | } else if (args.startsWith('mxc://')) { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 847 | await runCommand({ op: 'set_avatar', mxc: args }); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 848 | await loadProfile(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 849 | } else { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 850 | throw new Error('/globalavatar takes an mxc:// link, or nothing to pick a file'); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 851 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 852 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 853 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 854 | } catch (e) { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 855 | pushBanner(e instanceof Error ? e.message : `/${name} failed`); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 856 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 857 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 858 | |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 859 | async function onAvatarChosen(): Promise<void> { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 860 | const file = avatarInput?.files?.[0]; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 861 | if (avatarInput) avatarInput.value = ''; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 862 | if (!file) return; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 863 | try { |
5e9271c9b8f1 | atagen | 2026-10-24 07:45 UTC | 864 | await uploadAvatar(file); |
5e9271c9b8f1 | atagen | 2026-10-24 07:45 UTC | 865 | await loadProfile(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 866 | } catch (e) { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 867 | pushBanner(e instanceof Error ? e.message : 'Avatar upload failed'); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 868 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 869 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 870 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 871 | async function sendAttachments( |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 872 | roomId: string, |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 873 | body: string, |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 874 | reply: ReplyReference | null, |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 875 | mentions: Mention[], |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 876 | attachments: StagedAttachment[] |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 877 | ): Promise<void> { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 878 | let first = true; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 879 | uploadBusy = true; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 880 | try { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 881 | for (const attachment of attachments) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 882 | uploadName = attachment.file.name || 'attachment'; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 883 | try { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 884 | if (first) await uploadAttachment(roomId, attachment.file, body || null, reply?.event_id ?? null, mentions, $markdownEnabled, resolveEmotes(body, roomEmotes)); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 885 | else await uploadAttachment(roomId, attachment.file); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 886 | first = false; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 887 | } catch (e) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 888 | pushBanner(e instanceof Error ? e.message : 'Upload failed'); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 889 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 890 | if (attachment.previewUrl) URL.revokeObjectURL(attachment.previewUrl); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 891 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 892 | } finally { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 893 | uploadBusy = false; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 894 | uploadName = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 895 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 896 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 897 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 898 | function stageFiles(files: File[]): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 899 | const roomId = $selectedRoomId; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 900 | if (!roomId || !openReady[roomId]) return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 901 | const accepted: StagedAttachment[] = []; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 902 | for (const file of files) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 903 | if (file.size === 0 || file.size > 20 * 1024 * 1024) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 904 | pushBanner(`${file.name || 'File'} must be between 1 byte and 20 MiB.`); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 905 | continue; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 906 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 907 | const previewUrl = file.type.startsWith('image/') ? URL.createObjectURL(file) : null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 908 | accepted.push({ id: nextStagedId++, file, previewUrl }); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 909 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 910 | if (accepted.length === 0) return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 911 | staged = { ...staged, [roomId]: [...(staged[roomId] ?? []), ...accepted] }; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 912 | composerEl?.focus(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 913 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 914 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 915 | function unstage(roomId: string, id: number): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 916 | const list = staged[roomId] ?? []; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 917 | const removed = list.find((a) => a.id === id); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 918 | if (removed?.previewUrl) URL.revokeObjectURL(removed.previewUrl); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 919 | staged = { ...staged, [roomId]: list.filter((a) => a.id !== id) }; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 920 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 921 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 922 | function clearAllStaged(): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 923 | for (const list of Object.values(staged)) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 924 | for (const attachment of list) if (attachment.previewUrl) URL.revokeObjectURL(attachment.previewUrl); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 925 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 926 | staged = {}; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 927 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 928 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 929 | function startEdit(eventId: string, body: string): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 930 | const roomId = $selectedRoomId; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 931 | if (!roomId) return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 932 | const stash = editing ? editing.stash : composer; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 933 | editing = { roomId, eventId, original: body, stash }; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 934 | const entry = items.find((i) => i.kind === 'event' && i.event.event_id === eventId); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 935 | if (entry?.kind === 'event' && entry.event.content.kind === 'Message') { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 936 | const existing = mentionsFromHtml(entry.event.content.message.formatted_body); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 937 | pickedMentions = { ...pickedMentions, [roomId]: [...(pickedMentions[roomId] ?? []), ...existing] }; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 938 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 939 | composer = body; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 940 | replyingTo = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 941 | composerEl?.focus(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 942 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 943 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 944 | function cancelEdit(): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 945 | if (!editing) return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 946 | composer = editing.stash; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 947 | editing = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 948 | composerEl?.focus(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 949 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 950 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 951 | function submitEdit(): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 952 | if (!editing) return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 953 | const { roomId, eventId, original } = editing; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 954 | const body = composer.trim(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 955 | cancelEdit(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 956 | if (!body || body === original.trim()) return; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 957 | editMessage(roomId, eventId, body, resolveMentions(body, pickedMentions[roomId] ?? []), $markdownEnabled, resolveEmotes(body, roomEmotes)).catch((e) => pushBanner(e instanceof Error ? e.message : 'Edit failed')); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 958 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 959 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 960 | function editLastOwn(): boolean { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 961 | for (let i = items.length - 1; i >= 0; i -= 1) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 962 | const entry = items[i]; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 963 | if (entry.kind !== 'event' || !entry.event.own) continue; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 964 | const ev = entry.event; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 965 | if (!ev.editable || !ev.event_id || ev.content.kind !== 'Message' || ev.content.message.kind !== 'Text') return false; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 966 | startEdit(ev.event_id, ev.content.message.body); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 967 | return true; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 968 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 969 | return false; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 970 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 971 | |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 972 | function startReply(target: ReplyReference): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 973 | if (editing) cancelEdit(); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 974 | replyingTo = target; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 975 | composerEl?.focus(); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 976 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 977 | |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 978 | let pinnedOpenFor: string | null = null; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 979 | let pinsExpanded = false; |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 980 | let pinPreview: TimelineEvent | null = null; |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 981 | let pinJumpBusy = false; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 982 | $: syncPinned(selectedRoom?.room_id ?? null, (selectedRoom?.pinned_events.length ?? 0) > 0); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 983 | function syncPinned(roomId: string | null, hasPins: boolean): void { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 984 | const want = hasPins ? roomId : null; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 985 | if (want === pinnedOpenFor) return; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 986 | if (pinnedOpenFor) runCommand({ op: 'close_pinned', room_id: pinnedOpenFor }).catch(() => undefined); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 987 | pinnedOpenFor = want; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 988 | pinsExpanded = false; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 989 | if (want) runCommand({ op: 'open_pinned', room_id: want }).catch(() => undefined); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 990 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 991 | |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 992 | $: pins = pinnedList(selectedRoom, $pinnedTimelines); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 993 | function pinnedList(room: RoomSummary | null, all: Record<string, TimelineItem[]>): TimelineEvent[] { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 994 | if (!room || !room.pinned_events.length) return []; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 995 | const order = new Map(room.pinned_events.map((id, i) => [id, i])); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 996 | return (all[room.room_id] ?? []) |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 997 | .flatMap((item) => (item.kind === 'event' && item.event.event_id && order.has(item.event.event_id) ? [item.event] : [])) |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 998 | .sort((a, b) => (order.get(b.event_id!) ?? 0) - (order.get(a.event_id!) ?? 0)); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 999 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1000 | |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1001 | function setPinned(eventId: string, pinned: boolean): void { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1002 | const roomId = $selectedRoomId; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1003 | if (!roomId) return; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1004 | runCommand({ op: 'set_pinned', room_id: roomId, event_id: eventId, pinned }).catch((e) => |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1005 | pushBanner(e instanceof Error ? e.message : 'Could not change the pin') |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1006 | ); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1007 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1008 | |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1009 | async function jumpToPin(eventId: string): Promise<void> { |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1010 | const roomId = $selectedRoomId; |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1011 | if (!roomId || !eventId || pinJumpBusy) return; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1012 | pinsExpanded = false; |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1013 | pinPreview = pins.find((event) => event.event_id === eventId) ?? null; |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1014 | pinJumpBusy = true; |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1015 | try { |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1016 | for (let attempt = 0; attempt < 24; attempt += 1) { |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1017 | if (($timelines[roomId] ?? []).some((item) => item.kind === 'event' && item.event.event_id === eventId)) { |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1018 | pinPreview = null; |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1019 | await tick(); |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1020 | jumpTo(eventId); |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1021 | return; |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1022 | } |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1023 | await paginateRoom(roomId); |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1024 | await new Promise((resolve) => window.setTimeout(resolve, 180)); |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1025 | } |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1026 | pushBanner('Could not load that pinned message'); |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1027 | } catch (e) { |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1028 | pushBanner(e instanceof Error ? e.message : 'Could not load that pinned message'); |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1029 | } finally { |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1030 | pinJumpBusy = false; |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1031 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1032 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1033 | |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1034 | function jumpTo(eventId: string): void { |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1035 | const el = timelineEl?.querySelector<HTMLElement>(`[data-event="${CSS.escape(eventId)}"]`); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1036 | if (!el) { |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1037 | pushBanner('The original message is not loaded. Scroll up to load older messages.'); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1038 | return; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1039 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1040 | stickToBottom = false; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1041 | el.scrollIntoView({ block: 'center', behavior: 'smooth' }); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1042 | el.classList.remove('flash'); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1043 | void el.offsetWidth; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1044 | el.classList.add('flash'); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1045 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1046 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1047 | let typedText = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1048 | let typedRoom: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1049 | $: trackTypingInput(composer, $selectedRoomId, openReady); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1050 | function trackTypingInput(text: string, roomId: string | null, ready: Record<string, boolean>): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1051 | const edited = roomId === typedRoom && text !== typedText; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1052 | typedText = text; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1053 | typedRoom = roomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1054 | if (!roomId || !ready[roomId] || !text.trim()) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1055 | stopTyping(); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1056 | } else if (edited && roomId !== peeking) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1057 | notifyTyping(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1058 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1059 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1060 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1061 | $: void trackPending($selectedRoomId, pendingItems); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1062 | async function trackPending(roomId: string | null, list: PendingMessage[]): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1063 | if (!roomId || list.length === 0) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1064 | if (roomId !== $selectedRoomId) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1065 | await tick(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1066 | if (stickToBottom) scrollToBottom(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1067 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1068 | |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1069 | let commandQuery: string | null = null; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1070 | let commandIndex = 0; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1071 | $: commandCandidates = commandQuery === null ? [] : matchCommands(commandQuery); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1072 | $: if (commandIndex >= commandCandidates.length) commandIndex = 0; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1073 | |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1074 | async function pickCommand(name: CommandName): Promise<void> { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1075 | if (!composerEl) return; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1076 | const caret = composerEl.selectionStart ?? composer.length; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1077 | const rest = composer.slice(caret).replace(/^\S*/, ''); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1078 | composer = `/${name}${rest.startsWith(' ') ? rest : ` ${rest}`}`; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1079 | commandQuery = null; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1080 | await tick(); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1081 | const at = name.length + 2; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1082 | composerEl.focus(); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1083 | composerEl.setSelectionRange(at, at); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1084 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1085 | |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1086 | let emoteQuery: EmoteQuery | null = null; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1087 | let emoteIndex = 0; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1088 | let emojiList: EmojiEntry[] = []; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1089 | $: emoteCandidates = emoteQuery ? rankEmotes(emoteQuery.query, roomEmotes, emojiList) : []; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1090 | $: if (emoteIndex >= emoteCandidates.length) emoteIndex = 0; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1091 | |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1092 | function ensureEmoji(): void { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1093 | if (emojiList.length) return; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1094 | loadEmoji() |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1095 | .then((groups) => (emojiList = groups.flatMap((g) => g.emojis))) |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1096 | .catch(() => undefined); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1097 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1098 | |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1099 | async function onComposerInput(): Promise<void> { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1100 | if (composerEl && composer.includes(':')) { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1101 | ensureEmoji(); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1102 | const done = completeShortcode(composerEl.value, composerEl.selectionStart ?? composerEl.value.length, emojiList); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1103 | if (done) { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1104 | composer = done.text; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1105 | await tick(); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1106 | composerEl.setSelectionRange(done.caret, done.caret); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1107 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1108 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1109 | updateMentionQuery(); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1110 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1111 | |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1112 | async function pickEmote(candidate: EmoteCandidate): Promise<void> { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1113 | if (!emoteQuery || !composerEl) return; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1114 | const caret = composerEl.selectionStart ?? composer.length; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1115 | const inserted = candidate.kind === 'emoji' ? candidate.emoji : `:${candidate.shortcode}: `; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1116 | composer = composer.slice(0, emoteQuery.start) + inserted + composer.slice(caret); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1117 | const at = emoteQuery.start + inserted.length; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1118 | emoteQuery = null; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1119 | await tick(); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1120 | composerEl.focus(); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1121 | composerEl.setSelectionRange(at, at); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1122 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1123 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1124 | function updateMentionQuery(): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1125 | const roomId = $selectedRoomId; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1126 | const nextEmote = composerEl ? emoteQueryAt(composerEl.value, composerEl.selectionStart ?? composerEl.value.length) : null; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1127 | if (nextEmote?.start !== emoteQuery?.start) emoteIndex = 0; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1128 | emoteQuery = nextEmote; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1129 | const nextCommand = composerEl ? commandQueryAt(composerEl.value, composerEl.selectionStart ?? composerEl.value.length) : null; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1130 | if (nextCommand !== commandQuery) commandIndex = 0; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1131 | commandQuery = nextCommand; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1132 | const next = composerEl && roomId ? mentionQueryAt(composerEl.value, composerEl.selectionStart ?? composerEl.value.length) : null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1133 | if (next && !mentionQuery && roomId && !$membersByRoom[roomId]) void loadMembers(roomId); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1134 | if (next?.start !== mentionQuery?.start) mentionIndex = 0; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1135 | mentionQuery = next; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1136 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1137 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1138 | async function pickMention(person: Person): Promise<void> { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1139 | const roomId = $selectedRoomId; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1140 | if (!mentionQuery || !roomId || !composerEl) return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1141 | const caret = composerEl.selectionStart ?? composer.length; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1142 | const inserted = `${person.name} `; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1143 | composer = composer.slice(0, mentionQuery.start) + inserted + composer.slice(caret); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1144 | const at = mentionQuery.start + inserted.length; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1145 | pickedMentions = { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1146 | ...pickedMentions, |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1147 | [roomId]: [...(pickedMentions[roomId] ?? []), { user_id: person.user_id, text: person.name }] |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1148 | }; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1149 | mentionQuery = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1150 | await tick(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1151 | composerEl.focus(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1152 | composerEl.setSelectionRange(at, at); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1153 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1154 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1155 | function onComposerKey(ev: KeyboardEvent): void { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1156 | if (emoteQuery && emoteCandidates.length > 0) { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1157 | if (ev.key === 'ArrowDown' || ev.key === 'ArrowUp') { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1158 | ev.preventDefault(); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1159 | const step = ev.key === 'ArrowDown' ? 1 : -1; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1160 | emoteIndex = (emoteIndex + step + emoteCandidates.length) % emoteCandidates.length; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1161 | return; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1162 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1163 | if ((ev.key === 'Enter' && !ev.shiftKey) || ev.key === 'Tab') { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1164 | ev.preventDefault(); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1165 | void pickEmote(emoteCandidates[emoteIndex]); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1166 | return; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1167 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1168 | if (ev.key === 'Escape') { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1169 | ev.stopPropagation(); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1170 | emoteQuery = null; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1171 | return; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1172 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1173 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1174 | if (commandQuery !== null && commandCandidates.length > 0) { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1175 | if (ev.key === 'ArrowDown' || ev.key === 'ArrowUp') { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1176 | ev.preventDefault(); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1177 | const step = ev.key === 'ArrowDown' ? 1 : -1; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1178 | commandIndex = (commandIndex + step + commandCandidates.length) % commandCandidates.length; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1179 | return; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1180 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1181 | const exact = commandCandidates.length === 1 && commandCandidates[0] === commandQuery; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1182 | if (ev.key === 'Tab' || (ev.key === 'Enter' && !ev.shiftKey && !exact)) { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1183 | ev.preventDefault(); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1184 | void pickCommand(commandCandidates[commandIndex]); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1185 | return; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1186 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1187 | if (ev.key === 'Escape') { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1188 | ev.stopPropagation(); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1189 | commandQuery = null; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1190 | return; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1191 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1192 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1193 | if (mentionQuery && mentionCandidates.length > 0) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1194 | if (ev.key === 'ArrowDown' || ev.key === 'ArrowUp') { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1195 | ev.preventDefault(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1196 | const step = ev.key === 'ArrowDown' ? 1 : -1; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1197 | mentionIndex = (mentionIndex + step + mentionCandidates.length) % mentionCandidates.length; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1198 | return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1199 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1200 | if ((ev.key === 'Enter' && !ev.shiftKey) || ev.key === 'Tab') { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1201 | ev.preventDefault(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1202 | void pickMention(mentionCandidates[mentionIndex]); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1203 | return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1204 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1205 | if (ev.key === 'Escape') { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1206 | ev.stopPropagation(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1207 | mentionQuery = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1208 | return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1209 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1210 | } |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 1211 | if (ev.key === 'Enter' && !ev.shiftKey && !insideOpenFence(composer, composerEl?.selectionStart ?? composer.length)) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1212 | ev.preventDefault(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1213 | send(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1214 | } else if (ev.key === 'Escape' && editing) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1215 | ev.stopPropagation(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1216 | cancelEdit(); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1217 | } else if (ev.key === 'Escape' && replyingTo) { |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1218 | ev.stopPropagation(); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1219 | replyingTo = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1220 | } else if (ev.key === 'ArrowUp' && !composer && !editing && editLastOwn()) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1221 | ev.preventDefault(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1222 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1223 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1224 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1225 | function pickFiles(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1226 | const roomId = $selectedRoomId; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1227 | if (!roomId || !openReady[roomId]) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1228 | fileInput?.click(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1229 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1230 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1231 | function onFileChosen(): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1232 | stageFiles(Array.from(fileInput?.files ?? [])); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1233 | if (fileInput) fileInput.value = ''; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1234 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1235 | |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1236 | function onComposerPaste(ev: ClipboardEvent): void { |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1237 | const data = ev.clipboardData; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1238 | // Office apps put a rendered image next to the copied text, so only take the image when there is no plain text. |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1239 | if (!data || data.types.includes('text/plain')) return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1240 | const images = Array.from(data.files).filter((f) => f.type.startsWith('image/')); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1241 | if (images.length === 0) return; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1242 | ev.preventDefault(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1243 | stageFiles(images); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1244 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1245 | |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1246 | async function react(eventId: string, key: string, shortcode?: string): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1247 | const roomId = $selectedRoomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1248 | if (!roomId || !eventId || reacting) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1249 | reacting = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1250 | try { |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1251 | await reactToMessage(roomId, eventId, key, shortcode); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1252 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1253 | pushBanner(e instanceof Error ? e.message : 'Reaction failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1254 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1255 | reacting = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1256 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1257 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1258 | |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1259 | function previewLoader(roomId: string): (url: string) => void { |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1260 | return (url) => requestLinkPreview(roomId, url); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1261 | } |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1262 | |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1263 | async function changeEncryptedPreviews(enabled: boolean): Promise<void> { |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1264 | try { |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1265 | await saveUrlPreviewSettings({ encrypted_rooms: enabled }); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1266 | } catch (e) { |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1267 | pushBanner(e instanceof Error ? e.message : 'Could not save link preview setting'); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1268 | } |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1269 | } |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1270 | |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1271 | async function changeQuickReactions(list: QuickReaction[]): Promise<void> { |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1272 | try { |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1273 | await saveQuickReactions(list); |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1274 | } catch (e) { |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1275 | pushBanner(e instanceof Error ? e.message : 'Could not save quick reactions'); |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1276 | } |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1277 | } |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1278 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1279 | async function paginate(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1280 | const roomId = $selectedRoomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1281 | if (!roomId || paginateBusy) return; |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 1282 | if (timelineEl && !stickToBottom) paginationAnchor = { roomId, top: timelineEl.scrollTop, height: timelineEl.scrollHeight }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1283 | paginateBusy = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1284 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1285 | await paginateRoom(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1286 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1287 | pushBanner(e instanceof Error ? e.message : 'Loading older messages failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1288 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1289 | paginateBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1290 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1291 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1292 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1293 | async function loadMembers(roomId: string): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1294 | if (membersFor === roomId && $membersLoading) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1295 | membersFor = roomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1296 | membersLoading.set(true); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1297 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1298 | const res = await getMembers(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1299 | membersByRoom.update((all) => ({ ...all, [roomId]: res.members })); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1300 | avatarByUser = { ...avatarByUser, ...avatarMap(res.members) }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1301 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1302 | pushBanner(e instanceof Error ? e.message : 'Could not load members'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1303 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1304 | if (membersFor === roomId) membersLoading.set(false); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1305 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1306 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1307 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1308 | function avatarMap(list: MemberSummary[]): Record<string, string | null> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1309 | const next: Record<string, string | null> = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1310 | for (const member of list) next[member.user_id] = member.avatar; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1311 | return next; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1312 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1313 | |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1314 | function peopleIn(list: TimelineItem[], roster: MemberSummary[]): Record<string, Person> { |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1315 | const out: Record<string, Person> = {}; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1316 | for (const item of list) { |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1317 | if (item.kind !== 'event') continue; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1318 | const s = item.event.sender; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1319 | out[s.user_id] = { user_id: s.user_id, name: senderLabel(s), avatar: s.avatar }; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1320 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1321 | for (const m of roster) out[m.user_id] = { user_id: m.user_id, name: m.name, avatar: m.avatar }; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1322 | return out; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1323 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1324 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1325 | function senderAvatarFor(userId: string): string | null { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1326 | return avatarByUser[userId] ?? null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1327 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1328 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1329 | function toggleMembers(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1330 | membersOpen = !membersOpen; |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 1331 | if (membersOpen && $selectedRoomId) { |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 1332 | void loadMembers($selectedRoomId); |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 1333 | void loadLevels($selectedRoomId); |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 1334 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1335 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1336 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1337 | async function join(target: string): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1338 | const room = target.trim(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1339 | if (!room || joinBusy) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1340 | joinBusy = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1341 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1342 | const res = await joinRoom(room); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1343 | joinTarget = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1344 | dialog = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1345 | await refreshRooms(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1346 | await selectRoom(res.room_id); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1347 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1348 | pushBanner(e instanceof Error ? e.message : 'Join failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1349 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1350 | joinBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1351 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1352 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1353 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1354 | async function create(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1355 | const name = createName.trim(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1356 | if (!name || createBusy) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1357 | createBusy = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1358 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1359 | const res = await createRoom(name, createTopic.trim() || undefined); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1360 | createName = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1361 | createTopic = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1362 | dialog = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1363 | await refreshRooms(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1364 | await selectRoom(res.room_id); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1365 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1366 | pushBanner(e instanceof Error ? e.message : 'Create room failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1367 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1368 | createBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1369 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1370 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1371 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1372 | async function leave(roomId: string | null = $selectedRoomId): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1373 | if (!roomId || leaveBusy) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1374 | leaveBusy = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1375 | stopTyping(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1376 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1377 | await leaveRoom(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1378 | if ($selectedRoomId === roomId) selectedRoomId.set(null); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1379 | if (warmRooms.includes(roomId)) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1380 | forgetOpenRoom(roomId); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1381 | closeRoom(roomId).catch(() => undefined); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1382 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1383 | await refreshRooms(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1384 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1385 | pushBanner(e instanceof Error ? e.message : 'Leave failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1386 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1387 | leaveBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1388 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1389 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1390 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1391 | function connectionClass(state: string): string { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1392 | if (state === 'online') return 'dot-online'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1393 | if (state === 'connecting' || state === 'reconnecting') return 'dot-busy'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1394 | return 'dot-off'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1395 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1396 | |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1397 | let dragSpaceId: string | null = null; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1398 | let dropTarget: { id: string; after: boolean } | null = null; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1399 | let menu: { items: MenuItem[]; x: number; y: number; above?: boolean } | null = null; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1400 | let userCard: { userId: string; x: number; y: number; confirm: 'kick' | 'ban' | null } | null = null; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1401 | let levelsByRoom: Record<string, PowerLevels | null> = {}; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1402 | let peeking: string | null = null; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1403 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1404 | $: roomLevels = $selectedRoomId ? (levelsByRoom[$selectedRoomId] ?? null) : null; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1405 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1406 | function personFor(userId: string): Person { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1407 | return people[userId] ?? { user_id: userId, name: userId, avatar: avatarByUser[userId] ?? null }; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1408 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1409 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1410 | function memberFor(userId: string): MemberSummary | null { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1411 | return members.find((m) => m.user_id === userId) ?? null; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1412 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1413 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1414 | async function loadLevels(roomId: string): Promise<void> { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1415 | try { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1416 | const levels = parsePowerLevels(await runCommand({ op: 'power_levels', room_id: roomId })); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1417 | levelsByRoom = { ...levelsByRoom, [roomId]: levels }; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1418 | } catch { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1419 | levelsByRoom = { ...levelsByRoom, [roomId]: levelsByRoom[roomId] ?? null }; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1420 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1421 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1422 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1423 | async function openUser(userId: string, x: number, y: number, asMenu: boolean): Promise<void> { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1424 | const roomId = $selectedRoomId; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1425 | if (roomId && !(roomId in levelsByRoom)) await loadLevels(roomId); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1426 | else if (roomId) void loadLevels(roomId); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1427 | if (asMenu) menu = { items: userMenuItems(userId, x, y), x, y }; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1428 | else userCard = { userId, x, y, confirm: null }; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1429 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1430 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1431 | function copyText(text: string): void { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1432 | navigator.clipboard.writeText(text).catch(() => pushBanner('Could not copy to the clipboard')); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1433 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1434 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1435 | function userMenuItems(userId: string, x: number, y: number): MenuItem[] { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1436 | const own = userId === $sessionUser; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1437 | const member = memberFor(userId); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1438 | const items: MenuItem[] = []; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1439 | if (!own) items.push({ label: 'Message', action: () => void userAction(userId, { kind: 'message' }) }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1440 | items.push({ label: 'Mention', action: () => void userAction(userId, { kind: 'mention' }) }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1441 | items.push({ label: 'Copy user ID', action: () => copyText(userId) }); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1442 | const firstModeration = items.length; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1443 | if (roomLevels && $sessionUser) { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1444 | const can = allowed(roomLevels, $sessionUser, userId); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1445 | const banned = member?.membership === 'Ban'; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1446 | if (can.setLevel && !own) { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1447 | const muted = isMuted(roomLevels, userId); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1448 | items.push({ label: muted ? 'Unmute' : 'Mute', action: () => void userAction(userId, { kind: muted ? 'unmute' : 'mute' }) }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1449 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1450 | if (can.kick && !banned) items.push({ label: 'Kick…', danger: true, action: () => (userCard = { userId, x, y, confirm: 'kick' }) }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1451 | if (can.ban && banned) items.push({ label: 'Unban', action: () => void userAction(userId, { kind: 'unban' }) }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1452 | if (can.ban && !banned) items.push({ label: 'Ban…', danger: true, action: () => (userCard = { userId, x, y, confirm: 'ban' }) }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1453 | if (can.setLevel) items.push({ label: 'Power level…', action: () => (userCard = { userId, x, y, confirm: null }) }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1454 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1455 | if (items[firstModeration]) items[firstModeration] = { ...items[firstModeration], divider: true }; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1456 | if (!own) { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1457 | const kind = member?.ignored ? 'unignore' : 'ignore'; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1458 | items.push({ label: member?.ignored ? 'Unignore' : 'Ignore', divider: true, action: () => void userAction(userId, { kind }) }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1459 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1460 | return items; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1461 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1462 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1463 | async function insertMention(person: Person): Promise<void> { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1464 | const roomId = $selectedRoomId; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1465 | if (!roomId) return; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1466 | const lead = composer && !/\s$/.test(composer) ? ' ' : ''; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1467 | composer = `${composer}${lead}${person.name} `; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1468 | pickedMentions = { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1469 | ...pickedMentions, |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1470 | [roomId]: [...(pickedMentions[roomId] ?? []), { user_id: person.user_id, text: person.name }] |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1471 | }; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1472 | await tick(); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1473 | composerEl?.focus(); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1474 | composerEl?.setSelectionRange(composer.length, composer.length); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1475 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1476 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1477 | async function userAction(userId: string, action: UserAction): Promise<void> { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1478 | const roomId = $selectedRoomId; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1479 | try { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1480 | switch (action.kind) { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1481 | case 'message': { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1482 | const res = (await runCommand({ op: 'direct', user_id: userId })) as { room_id: string }; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1483 | await refreshRooms(); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1484 | await selectRoom(res.room_id); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1485 | return; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1486 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1487 | case 'mention': |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1488 | await insertMention(personFor(userId)); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1489 | return; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1490 | case 'ignore': |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1491 | case 'unignore': |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1492 | await runCommand({ op: action.kind, user_id: userId }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1493 | if (roomId) void loadMembers(roomId); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1494 | return; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1495 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1496 | if (!roomId) return; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1497 | switch (action.kind) { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1498 | case 'kick': |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1499 | case 'ban': |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1500 | await runCommand({ op: action.kind, room_id: roomId, user_id: userId, reason: action.reason }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1501 | break; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1502 | case 'unban': |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1503 | await runCommand({ op: 'unban', room_id: roomId, user_id: userId, reason: null }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1504 | break; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1505 | case 'mute': |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1506 | case 'unmute': |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1507 | await runCommand({ op: 'mute', room_id: roomId, user_id: userId, muted: action.kind === 'mute' }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1508 | break; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1509 | case 'power': |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1510 | await runCommand({ op: 'set_power_level', room_id: roomId, user_id: userId, level: action.level }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1511 | break; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1512 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1513 | void loadLevels(roomId); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1514 | void loadMembers(roomId); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1515 | } catch (e) { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1516 | pushBanner(e instanceof Error ? e.message : 'That action failed'); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1517 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1518 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1519 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1520 | function roomMenuItems(room: RoomSummary): MenuItem[] { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1521 | const items: MenuItem[] = room.space |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1522 | ? [{ label: 'Open', action: () => void selectSpace(room.room_id) }] |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1523 | : [ |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1524 | { label: 'Open', action: () => void selectRoom(room.room_id) }, |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1525 | { label: 'Peek', action: () => void selectRoom(room.room_id, true) } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1526 | ]; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1527 | items.push({ label: room.favourite ? 'Unpin' : room.space ? 'Pin to top' : 'Pin', action: () => void togglePin(room) }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1528 | items.push({ label: 'Copy link', action: () => copyText(`https://matrix.to/#/${room.canonical_alias ?? room.room_id}`) }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1529 | items.push({ label: 'Copy room ID', action: () => copyText(room.room_id) }); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1530 | if (room.membership === 'Joined') items.push({ label: 'Leave', danger: true, divider: true, action: () => void leave(room.room_id) }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1531 | return items; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1532 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1533 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1534 | function openRoomMenu(ev: MouseEvent, room: RoomSummary): void { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1535 | menu = { items: roomMenuItems(room), x: ev.clientX, y: ev.clientY }; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1536 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1537 | |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1538 | function roomName(roomId: string): string { |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1539 | return $rooms.find((r) => r.room_id === roomId)?.name ?? roomId; |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1540 | } |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1541 | |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1542 | async function sendSticker(roomId: string, pack: ImagePack, image: PackImage): Promise<void> { |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1543 | stickersOpen = false; |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1544 | stickToBottom = true; |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1545 | try { |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1546 | await runCommand({ op: 'send_sticker', room_id: roomId, pack_id: pack.id, shortcode: image.shortcode }); |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1547 | if (peeking === roomId) stopPeeking(); |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1548 | } catch (e) { |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1549 | pushBanner(e instanceof Error ? e.message : 'Could not send the sticker'); |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1550 | } |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1551 | } |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1552 | |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1553 | async function runClone(request: CommandRequest, failure: string): Promise<void> { |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1554 | try { |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1555 | const res = (await runCommand(request)) as { skipped?: string[] } | undefined; |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1556 | if (res?.skipped?.length) pushBanner(`Couldn't copy ${res.skipped.map((s) => `:${s}:`).join(', ')}`); |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1557 | } catch (e) { |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1558 | pushBanner(e instanceof Error ? e.message : failure); |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1559 | } |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1560 | } |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1561 | |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1562 | function openCloneImageMenu(pack: ImagePack, image: PackImage, x: number, y: number): void { |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1563 | const items = editableChoices($imagePacks, roomName) |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1564 | .filter((c) => c.pack?.id !== pack.id) |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1565 | .map((choice) => ({ |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1566 | label: `Clone to ${choice.label}`, |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1567 | action: () => |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1568 | void runClone({ op: 'clone_pack_image', from_pack: pack.id, shortcode: image.shortcode, to: choice.target }, 'Could not clone the sticker') |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1569 | })); |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1570 | menu = { items, x, y }; |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1571 | } |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1572 | |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1573 | function openClonePackMenu(pack: ImagePack, x: number, y: number): void { |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1574 | const packRooms = $rooms.filter((r) => r.can_edit_packs && r.membership === 'Joined'); |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1575 | const items = clonePackDestinations(pack, packRooms, roomName).map((d) => ({ |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1576 | label: d.label, |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1577 | action: () => void runClone({ op: 'clone_pack', from_pack: pack.id, to: d.target, display_name: d.display_name }, 'Could not clone the pack') |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1578 | })); |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1579 | menu = { items, x, y }; |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1580 | } |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1581 | |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1582 | function openCloneStickerMenu(eventId: string, body: string, x: number, y: number): void { |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1583 | const roomId = $selectedRoomId; |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1584 | if (!roomId) return; |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1585 | const items = editableChoices($imagePacks, roomName).map((choice) => ({ |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1586 | label: `Clone to ${choice.label}`, |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1587 | action: () => { |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1588 | const taken = new Set(choice.pack?.images.map((i) => i.shortcode) ?? []); |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1589 | void runClone( |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1590 | { op: 'clone_sticker', room_id: roomId, event_id: eventId, to: choice.target, shortcode: shortcodeFor(body || 'sticker', taken) }, |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1591 | 'Could not clone the sticker' |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1592 | ); |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1593 | } |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1594 | })); |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1595 | menu = { items, x, y }; |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1596 | } |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1597 | |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1598 | async function openMessageMenu(event: TimelineEvent, x: number, y: number): Promise<void> { |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1599 | const roomId = $selectedRoomId; |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1600 | const eventId = event.event_id; |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1601 | if (!roomId || !eventId) return; |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1602 | if (!(roomId in levelsByRoom)) await loadLevels(roomId); |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1603 | const joined = selectedRoom?.membership === 'Joined'; |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1604 | const content = event.content; |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1605 | const items: MenuItem[] = []; |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1606 | if (joined) { |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1607 | items.push({ |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1608 | label: 'Reply', |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1609 | action: () => |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1610 | startReply({ |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1611 | event_id: eventId, |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1612 | details: { kind: 'Ready', sender: event.sender, content, timestamp_ms: event.timestamp_ms } |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1613 | }) |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1614 | }); |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1615 | } |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1616 | if (joined && event.own && event.editable && content.kind === 'Message' && content.message.kind === 'Text') { |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1617 | const body = content.message.body; |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1618 | items.push({ label: 'Edit', action: () => startEdit(eventId, body) }); |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1619 | } |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1620 | if (content.kind === 'Message' && content.message.body) { |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1621 | const body = content.message.body; |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1622 | items.push({ label: 'Copy text', action: () => copyText(body) }); |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1623 | } |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1624 | items.push({ label: 'Copy link', action: () => copyText(`https://matrix.to/#/${roomId}/${eventId}`) }); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1625 | if (joined && selectedRoom?.can_pin && content.kind !== 'Redacted') { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1626 | const pinned = selectedRoom.pinned_events.includes(eventId); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1627 | items.push({ label: pinned ? 'Unpin' : 'Pin', action: () => setPinned(eventId, !pinned) }); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1628 | } |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1629 | if (content.kind === 'Sticker') { |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1630 | const body = content.body; |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1631 | items.push({ label: 'Clone sticker…', action: () => openCloneStickerMenu(eventId, body, x, y) }); |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1632 | } |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1633 | const me = $sessionUser; |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1634 | if (joined && me && roomLevels && canRedact(roomLevels, me, event.sender.user_id) && content.kind !== 'Redacted') { |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1635 | items.push({ |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1636 | label: 'Delete message…', |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1637 | danger: true, |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1638 | action: () => |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1639 | (menu = { |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1640 | x, |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1641 | y, |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1642 | items: [ |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1643 | { label: 'Delete', danger: true, action: () => void runClone({ op: 'redact', room_id: roomId, event_id: eventId, reason: null }, 'Could not delete the message') }, |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1644 | { label: 'Cancel', action: () => undefined } |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1645 | ] |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1646 | }) |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1647 | }); |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1648 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1649 | if (!event.own) { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1650 | const person = userMenuItems(event.sender.user_id, x, y); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1651 | if (person[0]) person[0] = { ...person[0], divider: true }; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1652 | items.push(...person); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1653 | } |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1654 | menu = { items, x, y }; |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1655 | } |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1656 | |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1657 | function openAccountMenu(ev: MouseEvent): void { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1658 | const rect = (ev.currentTarget as HTMLElement).getBoundingClientRect(); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1659 | menu = { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1660 | x: rect.left, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1661 | y: rect.top - 6, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1662 | above: true, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1663 | items: [ |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1664 | { label: 'Security', action: () => (dialog = 'security') }, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1665 | { label: 'Settings', action: () => (dialog = 'settings') }, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1666 | { label: 'Sticker and emoji packs', action: () => (dialog = 'packs') }, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1667 | { label: 'Log out', danger: true, divider: true, action: () => void doLogout() } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1668 | ] |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1669 | }; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1670 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1671 | |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1672 | let resizing = false; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1673 | |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1674 | function startResize(ev: PointerEvent, pane: 'side' | 'members'): void { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1675 | if (ev.button !== 0) return; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1676 | ev.preventDefault(); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1677 | const handle = ev.currentTarget as HTMLElement; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1678 | handle.setPointerCapture(ev.pointerId); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1679 | const store = pane === 'side' ? sideWidth : membersWidth; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1680 | const range = pane === 'side' ? SIDE_WIDTH : MEMBERS_WIDTH; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1681 | const startX = ev.clientX; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1682 | const startWidth = pane === 'side' ? $sideWidth : $membersWidth; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1683 | resizing = true; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1684 | const move = (e: PointerEvent) => { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1685 | const delta = pane === 'side' ? e.clientX - startX : startX - e.clientX; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1686 | store.set(Math.round(Math.min(range.max, Math.max(range.min, startWidth + delta)))); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1687 | }; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1688 | const end = () => { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1689 | resizing = false; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1690 | handle.removeEventListener('pointermove', move); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1691 | handle.removeEventListener('pointerup', end); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1692 | handle.removeEventListener('pointercancel', end); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1693 | }; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1694 | handle.addEventListener('pointermove', move); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1695 | handle.addEventListener('pointerup', end); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1696 | handle.addEventListener('pointercancel', end); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1697 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1698 | |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1699 | function resetWidth(pane: 'side' | 'members'): void { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1700 | if (pane === 'side') sideWidth.set(SIDE_WIDTH.default); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1701 | else membersWidth.set(MEMBERS_WIDTH.default); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1702 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1703 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1704 | function stopPeeking(): void { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1705 | peeking = null; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1706 | queueReadReceipt(); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1707 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1708 | |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1709 | async function togglePin(room: RoomSummary): Promise<void> { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1710 | try { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1711 | await runCommand({ op: 'set_favourite', room_id: room.room_id, favourite: !room.favourite }); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1712 | } catch (e) { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1713 | pushBanner(e instanceof Error ? e.message : 'Could not change the pin'); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1714 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1715 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1716 | |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1717 | function startRailDrag(ev: DragEvent, id: string): void { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1718 | dragSpaceId = id; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1719 | if (ev.dataTransfer) { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1720 | ev.dataTransfer.effectAllowed = 'move'; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1721 | ev.dataTransfer.setData('text/plain', id); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1722 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1723 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1724 | |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1725 | function overRailSpace(ev: DragEvent, space: RoomSummary): void { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1726 | const dragged = orderedRail.find((s) => s.room_id === dragSpaceId); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1727 | if (!dragged || dragged.room_id === space.room_id || dragged.favourite !== space.favourite) return; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1728 | ev.preventDefault(); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1729 | const rect = (ev.currentTarget as HTMLElement).getBoundingClientRect(); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1730 | dropTarget = { id: space.room_id, after: ev.clientY > rect.top + rect.height / 2 }; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1731 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1732 | |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1733 | async function dropRailSpace(): Promise<void> { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1734 | const moved = dragSpaceId; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1735 | const target = dropTarget; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1736 | dragSpaceId = null; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1737 | dropTarget = null; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1738 | if (!moved || !target) return; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1739 | const ids = orderedRail.map((s) => s.room_id); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1740 | const before = target.after ? (ids[ids.indexOf(target.id) + 1] ?? null) : target.id; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1741 | const order = moveBefore(ids, moved, before === moved ? null : before); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1742 | if (order.join() === ids.join()) return; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1743 | railOverride = order; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1744 | try { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1745 | await runCommand({ op: 'reorder_spaces', order }); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1746 | } catch (e) { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1747 | railOverride = null; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1748 | pushBanner(e instanceof Error ? e.message : 'Could not reorder spaces'); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1749 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1750 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1751 | |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1752 | let roomMenuOpen = false; |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1753 | let roomMenuEl: HTMLDivElement | null = null; |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1754 | |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1755 | function roomMenuAction(action: () => void): void { |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1756 | roomMenuOpen = false; |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1757 | action(); |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1758 | } |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1759 | |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1760 | function closeRoomMenuOutside(ev: PointerEvent): void { |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1761 | if (roomMenuOpen && !roomMenuEl?.contains(ev.target as Node)) roomMenuOpen = false; |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1762 | } |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1763 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1764 | function onKeydown(ev: KeyboardEvent): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1765 | if (ev.key === 'Escape') { |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1766 | if (roomMenuOpen) roomMenuOpen = false; |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1767 | else if (dialog) dialog = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1768 | else if (membersOpen && window.innerWidth < 1100) membersOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1769 | else if (sidebarOpen) sidebarOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1770 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1771 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1772 | </script> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1773 | |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1774 | <svelte:window |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1775 | on:keydown={onKeydown} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1776 | on:pointerdown={closeRoomMenuOutside} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1777 | on:pointerup={() => (draggingScrollbar = false)} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1778 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1779 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1780 | {#if !booted} |
d4c0d65f690a | atagen | 2026-10-24 12:50 UTC | 1781 | <div class="splash" role="status" aria-label="Loading Malice" out:fade={{ duration: motionDuration(260) }}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1782 | <div class="splash-mark" aria-hidden="true">M</div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1783 | <p>Loading Malice…</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1784 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1785 | {:else if $blocked} |
d4c0d65f690a | atagen | 2026-10-24 12:50 UTC | 1786 | <div class="splash" role="status" aria-label="Malice is open in another tab" in:fade={{ duration: motionDuration(220) }}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1787 | <div class="splash-mark" aria-hidden="true">M</div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1788 | <p>Malice is open in another tab. Close this tab or use that one instead.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1789 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1790 | {:else if $sessionUser == null} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1791 | <LoginPanel softLogout={$softLogout} on:done={(ev) => afterLogin(ev.detail)} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1792 | {:else} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1793 | <div |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1794 | class="app" |
d4c0d65f690a | atagen | 2026-10-24 12:50 UTC | 1795 | in:fade={{ duration: motionDuration(220) }} |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1796 | class:nav-folded={$navFolded} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1797 | class:rail-folded={$railFolded && selectedRoom} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1798 | class:members-open={selectedRoom && membersOpen} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1799 | class:resizing |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1800 | style:--side-open={`${$sideWidth}px`} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1801 | style:--members-open={`${$membersWidth}px`} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1802 | style:--msg-gap={`${$messageSpacing}px`} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1803 | style:--msg-line-height={$lineHeight} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1804 | > |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1805 | <header class="chat-head"> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1806 | <button |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1807 | type="button" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1808 | class="icon-btn only-mobile" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1809 | aria-label="Open room list" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1810 | on:click={() => (sidebarOpen = true)} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1811 | > |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1812 | <span aria-hidden="true">☰</span> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1813 | </button> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1814 | <button |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1815 | type="button" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1816 | class="icon-btn only-desktop pane-toggle" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1817 | aria-pressed={!$railFolded} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1818 | aria-label={$railFolded ? 'Show spaces' : 'Hide spaces'} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1819 | title={$railFolded ? 'Show spaces' : 'Hide spaces'} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1820 | on:click={() => railFolded.update((v) => !v)} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1821 | > |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1822 | <svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true"> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1823 | <rect x="3" y="4" width="18" height="16" rx="2" fill="none" stroke="currentColor" stroke-width="2" /> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1824 | <circle cx="7" cy="9" r="1.4" fill="currentColor" /> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1825 | <circle cx="7" cy="13" r="1.4" fill="currentColor" /> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1826 | <circle cx="7" cy="17" r="1.4" fill="currentColor" /> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1827 | </svg> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1828 | </button> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1829 | <button |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1830 | type="button" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1831 | class="icon-btn only-desktop pane-toggle" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1832 | aria-pressed={!$navFolded} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1833 | aria-label={$navFolded ? 'Show channels' : 'Hide channels'} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1834 | title={$navFolded ? 'Show channels' : 'Hide channels'} |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 1835 | on:click={toggleChannelsPane} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1836 | > |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1837 | <svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true"> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1838 | <rect x="3" y="4" width="18" height="16" rx="2" fill="none" stroke="currentColor" stroke-width="2" /> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1839 | <path d="M10 4v16" stroke="currentColor" stroke-width="2" /> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1840 | </svg> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1841 | </button> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1842 | {#if selectedRoom} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1843 | <div class="head-title"> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1844 | <div class="head-room"> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 1845 | <MxcAvatar mxc={selectedRoom.avatar} label={selectedRoom.name} size={36} shape="rounded" /> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1846 | <div class="head-room-text"> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1847 | <h1>{selectedRoom.name}</h1> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1848 | <div class="head-meta"> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1849 | {#if selectedRoom.space} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1850 | <span class="pill">space</span> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1851 | {/if} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1852 | {#if selectedRoom.encrypted} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1853 | <span class="pill" title="End-to-end encrypted">🔒 encrypted</span> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1854 | {/if} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1855 | {#if selectedRoom.direct} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1856 | <span class="pill">direct</span> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1857 | {/if} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 1858 | {#if $connection !== 'online'} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 1859 | <span class="conn" title={`Sync state: ${$connection}`}> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 1860 | <span class="dot {connectionClass($connection)}" aria-hidden="true"></span> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 1861 | {$connection} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 1862 | </span> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 1863 | {/if} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1864 | </div> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1865 | </div> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1866 | </div> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1867 | </div> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1868 | {:else} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1869 | <div class="head-title"> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1870 | <div class="head-room"> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1871 | {#if selectedSpace} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1872 | <MxcAvatar mxc={selectedSpace.avatar} label={selectedSpace.name} size={36} shape="rounded" /> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1873 | {/if} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1874 | <div class="head-room-text"> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1875 | <h1>{selectedSpace?.name ?? 'Home'}</h1> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1876 | </div> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1877 | </div> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1878 | </div> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1879 | {/if} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1880 | <div class="head-actions"> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1881 | {#if selectedRoom} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1882 | {#if peeking === selectedRoom.room_id} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1883 | <button type="button" class="icon-btn" aria-pressed="true" aria-label="Stop peeking" title="Stop peeking" on:click={stopPeeking}> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1884 | <svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true"> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1885 | <path d="M2 12s3.5-6 10-6 10 6 10 6-3.5 6-10 6S2 12 2 12z" fill="none" stroke="currentColor" stroke-width="2" /> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1886 | <circle cx="12" cy="12" r="3" fill="currentColor" /> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1887 | </svg> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1888 | </button> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1889 | {/if} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1890 | {#if selectedRoom.membership !== 'Joined'} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1891 | <button |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1892 | type="button" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1893 | class="primary-btn" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1894 | disabled={joinBusy} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1895 | on:click={() => void join(selectedRoom.room_id)} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1896 | > |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1897 | {joinBusy ? 'Joining…' : 'Join'} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1898 | </button> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1899 | {/if} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1900 | <button |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1901 | type="button" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1902 | class="icon-btn" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1903 | aria-pressed={membersOpen} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1904 | aria-label={membersOpen ? 'Hide members' : 'Show members'} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1905 | title="Members" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1906 | on:click={toggleMembers} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1907 | > |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1908 | <svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true"> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1909 | <circle cx="12" cy="8" r="4" fill="none" stroke="currentColor" stroke-width="2" /> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1910 | <path d="M4 20c0-4 3.6-6 8-6s8 2 8 6" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" /> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1911 | </svg> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1912 | </button> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1913 | <div class="room-menu-wrap" bind:this={roomMenuEl}> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1914 | <button |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1915 | type="button" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1916 | class="icon-btn" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1917 | aria-haspopup="menu" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1918 | aria-expanded={roomMenuOpen} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1919 | aria-label="Room options" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1920 | title="Room options" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1921 | on:click={() => (roomMenuOpen = !roomMenuOpen)} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1922 | > |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1923 | <span aria-hidden="true">⋯</span> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1924 | </button> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1925 | {#if roomMenuOpen} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1926 | <div class="room-menu" role="menu"> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1927 | {#if selectedRoom.membership === 'Joined'} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1928 | <button |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1929 | type="button" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1930 | role="menuitem" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1931 | class="danger" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1932 | disabled={leaveBusy} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1933 | on:click={() => roomMenuAction(() => void leave())} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1934 | > |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1935 | {leaveBusy ? 'Leaving…' : 'Leave room'} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1936 | </button> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1937 | {/if} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1938 | </div> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1939 | {/if} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1940 | </div> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1941 | {/if} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1942 | </div> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1943 | </header> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1944 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1945 | <nav class="rail" aria-label="Servers and spaces"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1946 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1947 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1948 | class="rail-btn" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1949 | class:active={selectedSpaceId === null} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1950 | title="Home — all channels" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1951 | aria-label="Home — all channels" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1952 | aria-pressed={selectedSpaceId === null} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1953 | on:click={() => void selectHome()} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1954 | > |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1955 | <svg viewBox="0 0 24 24" width="19" height="19" aria-hidden="true"><path d="M4 11l8-7 8 7v8a1 1 0 0 1-1 1h-4v-6H9v6H5a1 1 0 0 1-1-1z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round" /></svg> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1956 | </button> |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1957 | {#each [pinnedRail, otherRail] as group} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1958 | {#if group.length > 0} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1959 | <div class="rail-sep" aria-hidden="true"></div> |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1960 | {/if} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1961 | {#each group as space (space.room_id)} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1962 | <button |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1963 | type="button" |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1964 | class="rail-btn rail-space" |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1965 | class:active={railSelected === space.room_id} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1966 | class:drop-before={dropTarget?.id === space.room_id && !dropTarget.after} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1967 | class:drop-after={dropTarget?.id === space.room_id && dropTarget.after} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1968 | class:pinned={space.favourite} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1969 | title={space.name} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1970 | aria-label={`Show channels in space ${space.name}`} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1971 | aria-pressed={selectedSpaceId === space.room_id} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1972 | draggable="true" |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1973 | on:click={() => void selectSpace(space.room_id)} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1974 | on:contextmenu|preventDefault={(ev) => openRoomMenu(ev, space)} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1975 | on:dragstart={(ev) => startRailDrag(ev, space.room_id)} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1976 | on:dragover={(ev) => overRailSpace(ev, space)} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1977 | on:dragleave={() => dropTarget?.id === space.room_id && (dropTarget = null)} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1978 | on:drop|preventDefault={() => void dropRailSpace()} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1979 | on:dragend={() => ((dragSpaceId = null), (dropTarget = null))} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1980 | > |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1981 | <MxcAvatar mxc={space.avatar} label={space.name} size={44} shape="rounded" /> |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1982 | </button> |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1983 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1984 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1985 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1986 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1987 | class="rail-btn rail-add" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1988 | aria-label="Join or create a room" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1989 | on:click={() => { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1990 | dialog = 'join'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1991 | }} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1992 | > |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1993 | <svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true"><path d="M12 5v14M5 12h14" stroke="currentColor" stroke-width="2" stroke-linecap="round" /></svg> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1994 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1995 | </nav> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1996 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1997 | {#if menu} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1998 | <ContextMenu items={menu.items} x={menu.x} y={menu.y} above={menu.above ?? false} onClose={() => (menu = null)} /> |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1999 | {/if} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2000 | {#if userCard} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2001 | {#key userCard} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2002 | {@const cardUser = userCard.userId} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2003 | <UserCard |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2004 | person={personFor(cardUser)} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2005 | member={memberFor(cardUser)} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2006 | levels={roomLevels} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2007 | self={$sessionUser ?? null} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2008 | x={userCard.x} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2009 | y={userCard.y} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2010 | confirm={userCard.confirm} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2011 | onAction={(action) => void userAction(cardUser, action)} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2012 | onClose={() => (userCard = null)} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2013 | /> |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2014 | {/key} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2015 | {/if} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2016 | |
c04b1e46303f | atagen | 2026-10-24 12:08 UTC | 2017 | <aside class="sidebar" class:open={sidebarOpen} aria-label="Rooms"> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2018 | <!-- svelte-ignore a11y_no_static_element_interactions --> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2019 | <div class="pane-resize right" title="Drag to resize" on:pointerdown={(e) => startResize(e, 'side')} on:dblclick={() => resetWidth('side')}></div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2020 | <div class="side-search"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2021 | <label class="visually-hidden" for="room-search">Search rooms</label> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2022 | <input |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2023 | id="room-search" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2024 | type="search" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2025 | placeholder="Search rooms" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2026 | bind:value={search} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2027 | autocomplete="off" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2028 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2029 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2030 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2031 | class="icon-btn" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2032 | title="Refresh rooms" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2033 | aria-label="Refresh rooms" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2034 | disabled={roomsLoading} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2035 | on:click={() => void refreshRooms()} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2036 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2037 | <span aria-hidden="true">⟳</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2038 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2039 | </div> |
d4c0d65f690a | atagen | 2026-10-24 12:50 UTC | 2040 | {#key selectedSpaceId ?? 'home'} |
d4c0d65f690a | atagen | 2026-10-24 12:50 UTC | 2041 | <div class="side-scroll" in:fly={{ y: 5, duration: motionDuration(180) }} out:fade={{ duration: motionDuration(120) }}> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2042 | {#if selectedSpace && spaceParents.has(selectedSpace.room_id)} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2043 | {@const parentId = spaceParents.get(selectedSpace.room_id) ?? ''} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2044 | <button type="button" class="room-row up-row" on:click={() => void selectSpace(parentId)}> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2045 | <span aria-hidden="true">↑</span> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2046 | <span class="room-name">{$rooms.find((r) => r.room_id === parentId)?.name ?? 'Parent space'}</span> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2047 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2048 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2049 | {#if roomsLoading && $rooms.length === 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2050 | <p class="side-note">Loading rooms…</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2051 | {:else if $rooms.length === 0} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2052 | <p class="side-note">No rooms yet</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2053 | <div class="side-cta"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2054 | <button type="button" on:click={() => (dialog = 'join')}>Join a room</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2055 | <button type="button" on:click={() => (dialog = 'create')}>Create one</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2056 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2057 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2058 | {#if selectedSpaceId && spaceChildrenLoading} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2059 | <p class="side-note">Loading channels…</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2060 | {:else if selectedSpaceId && spaceChildrenError} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2061 | <p class="side-note" role="alert">{spaceChildrenError}</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2062 | <div class="side-cta"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2063 | <button type="button" on:click={() => selectedSpaceId && void selectSpace(selectedSpaceId)}>Retry</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2064 | <button type="button" on:click={() => void selectHome()}>Back to Home</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2065 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2066 | {:else if selectedSpaceId && spaceChildIds && channelRooms.length === 0} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2067 | <p class="side-note">No channels</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2068 | <div class="side-cta"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2069 | <button type="button" on:click={() => void selectHome()}>Back to Home</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2070 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2071 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2072 | {#if invites.length > 0 && !selectedSpaceId} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2073 | <h2 class="side-h">Invites</h2> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2074 | <ul class="room-list"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2075 | {#each invites as room (room.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2076 | <li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2077 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2078 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2079 | class="room-row" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2080 | class:active={$selectedRoomId === room.room_id} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2081 | on:click={() => void selectRoom(room.room_id)} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2082 | on:contextmenu|preventDefault={(ev) => openRoomMenu(ev, room)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2083 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2084 | <MxcAvatar mxc={room.avatar} label={room.name} size={26} shape="rounded" /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2085 | <span class="room-name">{room.name}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2086 | <span |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2087 | class="invite-join" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2088 | role="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2089 | tabindex="0" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2090 | aria-label={`Join ${room.name}`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2091 | on:click|stopPropagation={() => void join(room.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2092 | on:keydown|stopPropagation={(ev) => { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2093 | if (ev.key === 'Enter' || ev.key === ' ') { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2094 | ev.preventDefault(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2095 | void join(room.room_id); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2096 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2097 | }} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2098 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2099 | Join |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2100 | </span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2101 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2102 | </li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2103 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2104 | </ul> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2105 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2106 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2107 | {#if directRooms.length > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2108 | <h2 class="side-h">Direct messages</h2> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2109 | <ul class="room-list"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2110 | {#each directRooms as room (room.room_id)} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2111 | <li class="room-item"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2112 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2113 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2114 | class="room-row" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2115 | class:active={$selectedRoomId === room.room_id} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2116 | aria-current={$selectedRoomId === room.room_id ? 'true' : undefined} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2117 | on:click={() => void selectRoom(room.room_id)} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2118 | on:contextmenu|preventDefault={(ev) => openRoomMenu(ev, room)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2119 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2120 | <MxcAvatar mxc={room.avatar} label={room.name} size={26} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2121 | <span class="room-name">{room.name}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2122 | {#if roomUnread(room) > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2123 | <span |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2124 | class="badge" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2125 | class:mention={room.unread_mentions > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2126 | aria-label={`${roomUnread(room)} unread`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2127 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2128 | {roomUnread(room) > 99 ? '99+' : roomUnread(room)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2129 | </span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2130 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2131 | </button> |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2132 | <PinButton pinned={room.favourite} label={room.name} onToggle={() => void togglePin(room)} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2133 | </li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2134 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2135 | </ul> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2136 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2137 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2138 | {#if groupRooms.length > 0} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2139 | <h2 class="side-h">{selectedSpace ? 'Channels' : 'Rooms'}</h2> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2140 | <ul class="room-list"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2141 | {#each groupRooms as room (room.room_id)} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2142 | <li class="room-item"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2143 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2144 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2145 | class="room-row" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2146 | class:active={$selectedRoomId === room.room_id} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2147 | aria-current={$selectedRoomId === room.room_id ? 'true' : undefined} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2148 | on:click={() => void selectRoom(room.room_id)} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2149 | on:contextmenu|preventDefault={(ev) => openRoomMenu(ev, room)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2150 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2151 | <MxcAvatar mxc={room.avatar} label={room.name} size={26} shape="rounded" /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2152 | <span class="room-name">{room.name}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2153 | {#if roomUnread(room) > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2154 | <span |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2155 | class="badge" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2156 | class:mention={room.unread_mentions > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2157 | aria-label={`${roomUnread(room)} unread`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2158 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2159 | {roomUnread(room) > 99 ? '99+' : roomUnread(room)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2160 | </span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2161 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2162 | </button> |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2163 | <PinButton pinned={room.favourite} label={room.name} onToggle={() => void togglePin(room)} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2164 | </li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2165 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2166 | </ul> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2167 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2168 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2169 | {#if spaceList.length > 0} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2170 | <h2 class="side-h">{selectedSpace ? 'Subspaces' : 'Spaces'}</h2> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2171 | <ul class="room-list"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2172 | {#each spaceList as room (room.room_id)} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2173 | <li class="room-item"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2174 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2175 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2176 | class="room-row" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2177 | class:active={selectedSpaceId === room.room_id} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2178 | aria-label={`Show channels in space ${room.name}`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2179 | on:click={() => void selectSpace(room.room_id)} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2180 | on:contextmenu|preventDefault={(ev) => openRoomMenu(ev, room)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2181 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2182 | <MxcAvatar mxc={room.avatar} label={room.name} size={26} shape="rounded" /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2183 | <span class="room-name">{room.name}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2184 | </button> |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2185 | <PinButton pinned={room.favourite} label={room.name} onToggle={() => void togglePin(room)} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2186 | </li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2187 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2188 | </ul> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2189 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2190 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2191 | {#if query && visibleRooms.length === 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2192 | <p class="side-note">No rooms match “{search.trim()}”.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2193 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2194 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2195 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2196 | </div> |
d4c0d65f690a | atagen | 2026-10-24 12:50 UTC | 2197 | {/key} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2198 | |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2199 | </aside> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2200 | <div class="account"> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2201 | <button type="button" class="me-btn" title={$sessionUser} aria-haspopup="menu" on:click={openAccountMenu}> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2202 | {#if profileMxc} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2203 | <MxcAvatar mxc={profileMxc} label={profile?.display_name ?? $sessionUser} size={32} /> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2204 | {:else} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2205 | <span class="me-avatar" aria-hidden="true">{$sessionUser.slice(1, 2).toUpperCase()}</span> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2206 | {/if} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2207 | <span class="me-names"> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2208 | <span class="me-name">{profile?.display_name || $sessionUser}</span> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2209 | {#if profile?.display_name && profile.display_name !== $sessionUser}<span class="me-id">{$sessionUser}</span>{/if} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2210 | </span> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2211 | </button> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2212 | <div class="account-actions"> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2213 | <button type="button" class="icon-btn" title="Encryption and verification" aria-label="Encryption and verification" on:click={() => (dialog = 'security')}> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2214 | <svg viewBox="0 0 24 24" width="17" height="17" aria-hidden="true"><path d="M12 3l8 3v6c0 4.5-3.4 8.2-8 9-4.6-.8-8-4.5-8-9V6z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round" /></svg> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2215 | </button> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2216 | <button type="button" class="icon-btn" title="Settings" aria-label="Settings" on:click={() => (dialog = 'settings')}> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2217 | <svg viewBox="0 0 24 24" width="17" height="17" aria-hidden="true"><circle cx="12" cy="12" r="3" fill="none" stroke="currentColor" stroke-width="1.8" /><path d="M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9l2.1 2.1M17 17l2.1 2.1M4.9 19.1L7 17M17 7l2.1-2.1" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" /></svg> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2218 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2219 | <button type="button" class="icon-btn" title="Log out" aria-label="Log out" on:click={() => void doLogout()}> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2220 | <svg viewBox="0 0 24 24" width="17" height="17" aria-hidden="true"><path d="M12 3v8M6.3 6.3a8 8 0 1 0 11.4 0" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" /></svg> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2221 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2222 | </div> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2223 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2224 | {#if sidebarOpen} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2225 | <button type="button" class="scrim" aria-label="Close room list" on:click={() => (sidebarOpen = false)}></button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2226 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2227 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2228 | <main class="chat"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2229 | {#if $banners.length > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2230 | <div class="banners" aria-live="polite"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2231 | {#each $banners as banner (banner.id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2232 | <div class="banner" role="alert"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2233 | <span>{banner.message}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2234 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2235 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2236 | aria-label="Dismiss error" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2237 | on:click={() => dismissBanner(banner.id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2238 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2239 | ✕ |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2240 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2241 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2242 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2243 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2244 | {/if} |
d4c0d65f690a | atagen | 2026-10-24 12:50 UTC | 2245 | {#key $selectedRoomId ?? 'home'} |
d4c0d65f690a | atagen | 2026-10-24 12:50 UTC | 2246 | <div class="chat-view" in:fly={{ y: 8, duration: motionDuration(220) }} out:fade={{ duration: motionDuration(140) }}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2247 | {#if !selectedRoom} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2248 | <div class="empty"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2249 | <div class="empty-mark" aria-hidden="true">◈</div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2250 | {#if selectedSpace} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2251 | <h1>{selectedSpace.name}</h1> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2252 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2253 | <h1>Welcome to Malice</h1> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2254 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2255 | <div class="empty-cta"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2256 | <button type="button" class="primary-btn" on:click={() => (dialog = 'join')}>Join a room</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2257 | <button type="button" class="ghost-btn" on:click={() => (dialog = 'create')}>Create a room</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2258 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2259 | <p class="conn-line"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2260 | <span class="dot {connectionClass($connection)}" aria-hidden="true"></span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2261 | {$connection} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2262 | </p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2263 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2264 | {:else} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2265 | {#if pins.length} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2266 | <div class="pinned-strip" class:open={pinsExpanded}> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2267 | <div class="pinned-head"> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2268 | <svg viewBox="0 0 24 24" width="14" height="14" aria-hidden="true"><path d="M9 3h6l-1 6 4 4v2h-5v6l-1 1-1-1v-6H6v-2l4-4z" fill="currentColor" /></svg> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2269 | <button type="button" class="pinned-latest" title="Jump to pinned message" on:click={() => jumpToPin(pins[0].event_id ?? '')}> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2270 | <strong>{people[pins[0].sender.user_id]?.name ?? senderLabel(pins[0].sender)}</strong> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2271 | <span>{contentPreview(pins[0].content)}</span> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2272 | </button> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2273 | {#if pins.length > 1} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2274 | <button type="button" class="pinned-count" aria-expanded={pinsExpanded} on:click={() => (pinsExpanded = !pinsExpanded)}> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2275 | {pins.length} pinned |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2276 | <svg viewBox="0 0 24 24" width="12" height="12" aria-hidden="true"><path d="m6 9 6 6 6-6" fill="none" stroke="currentColor" stroke-width="2" /></svg> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2277 | </button> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2278 | {/if} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2279 | {#if pinsExpanded && selectedRoom.can_pin} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2280 | <button type="button" class="icon-btn" aria-label="Unpin" title="Unpin" on:click={() => setPinned(pins[0].event_id ?? '', false)}> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2281 | <svg viewBox="0 0 24 24" width="14" height="14" aria-hidden="true"><path d="M6 6l12 12M18 6 6 18" stroke="currentColor" stroke-width="2" /></svg> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2282 | </button> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2283 | {/if} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2284 | </div> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2285 | {#if pinsExpanded} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2286 | <ul class="pinned-list"> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2287 | {#each pins.slice(1) as pin (pin.event_id)} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2288 | <li> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2289 | <button type="button" on:click={() => jumpToPin(pin.event_id ?? '')}> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2290 | <strong>{people[pin.sender.user_id]?.name ?? senderLabel(pin.sender)}</strong> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2291 | <span>{contentPreview(pin.content)}</span> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2292 | </button> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2293 | {#if selectedRoom.can_pin} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2294 | <button type="button" class="icon-btn" aria-label="Unpin" title="Unpin" on:click={() => setPinned(pin.event_id ?? '', false)}> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2295 | <svg viewBox="0 0 24 24" width="14" height="14" aria-hidden="true"><path d="M6 6l12 12M18 6 6 18" stroke="currentColor" stroke-width="2" /></svg> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2296 | </button> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2297 | {/if} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2298 | </li> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2299 | {/each} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2300 | </ul> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2301 | {/if} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2302 | </div> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2303 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2304 | {#if recoveryBanner} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2305 | <div class="sec-banner warn" role="status"> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2306 | <span>Message history is locked</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2307 | <button type="button" on:click={() => (dialog = 'security')}>Recover</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2308 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2309 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2310 | {#if verificationBanner} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2311 | <div class="sec-banner" role="status"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2312 | {#if verificationBanner.kind === 'Incoming'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2313 | <span>A device wants to verify this session</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2314 | <button type="button" on:click={() => (dialog = 'security')}>Review request</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2315 | {:else if verificationBanner.kind === 'Comparison'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2316 | <span>Verification codes ready</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2317 | <button type="button" on:click={() => (dialog = 'security')}>Compare codes</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2318 | {:else if verificationBanner.kind === 'Waiting'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2319 | <span>Verification started</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2320 | <button type="button" on:click={() => (dialog = 'security')}>Open verification</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2321 | {:else if verificationBanner.kind === 'Failed'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2322 | <span>Verification failed: {verificationBanner.message}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2323 | <button type="button" on:click={() => (dialog = 'security')}>Try again</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2324 | {:else if verificationBanner.kind === 'Cancelled'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2325 | <span>Verification cancelled: {verificationBanner.reason}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2326 | <button type="button" on:click={() => (dialog = 'security')}>Open security</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2327 | {:else} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2328 | <span>Verification in progress</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2329 | <button type="button" on:click={() => (dialog = 'security')}>Open security</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2330 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2331 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2332 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2333 | {#if $selectedRoomId && openFailed[$selectedRoomId]} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2334 | <p class="conn-banner error" role="alert">{openFailed[$selectedRoomId]}</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2335 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2336 | |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 2337 | {#if pinPreview} |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 2338 | <div class="pin-preview" role="dialog" aria-label="Pinned message preview"> |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 2339 | <div class="pin-preview-head"> |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 2340 | <strong>{people[pinPreview.sender.user_id]?.name ?? senderLabel(pinPreview.sender)}</strong> |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 2341 | <button type="button" class="icon-btn" aria-label="Close pinned message preview" on:click={() => (pinPreview = null)}>✕</button> |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 2342 | </div> |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 2343 | <p>{contentPreview(pinPreview.content)}</p> |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 2344 | <button type="button" class="primary-btn" disabled={pinJumpBusy} on:click={() => void jumpToPin(pinPreview?.event_id ?? '')}> |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 2345 | {pinJumpBusy ? 'Loading message…' : 'Jump to message'} |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 2346 | </button> |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 2347 | </div> |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 2348 | {/if} |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 2349 | |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2350 | <!-- svelte-ignore a11y_no_static_element_interactions --> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2351 | <div |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2352 | class="timeline" |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2353 | bind:this={timelineEl} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2354 | on:scroll={onTimelineScroll} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2355 | on:wheel={noteUserScroll} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2356 | on:touchmove={noteUserScroll} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2357 | on:keydown={onTimelineKey} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2358 | on:pointerdown={onTimelinePointer} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2359 | aria-label={`Messages in ${selectedRoom.name}`} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2360 | > |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2361 | <div class="timeline-inner" use:pinTimeline> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2362 | <div class="timeline-top"> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2363 | {#if hasStart} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2364 | <p class="start-note">Beginning of history</p> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2365 | {:else} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2366 | <button type="button" class="ghost-btn" disabled={paginateBusy} on:click={() => void paginate()}> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2367 | {paginateBusy ? 'Loading…' : 'Load older messages'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2368 | </button> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2369 | {/if} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2370 | </div> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2371 | {#if grouped.length === 0} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2372 | <p class="side-note timeline-empty">No messages yet</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2373 | {:else} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2374 | {#each grouped as g (g.key)} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2375 | {#if g.item.kind === 'day'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2376 | <div class="day-row"><span>{formatDay(g.item.timestamp_ms)}</span></div> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2377 | {:else if g.item.kind === 'readMarker'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2378 | <div class="new-row"><span>New</span></div> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2379 | {:else if g.item.kind === 'start'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2380 | <p class="start-note">Beginning of history</p> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2381 | {:else if g.item.kind === 'unknown'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2382 | <p class="unknown-note">Unsupported event ({g.item.label})</p> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2383 | {:else} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2384 | <MessageRow |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2385 | itemId={g.key} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2386 | event={g.item.event} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2387 | showSender={g.showSender} |
787cdbbf0721 | atagen | 2026-10-24 06:50 UTC | 2388 | senderAvatar={senderAvatarFor(g.item.event.sender.user_id) ?? g.item.event.sender.avatar} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2389 | {reacting} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2390 | onReact={(eventId, key, shortcode) => void react(eventId, key, shortcode)} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2391 | quickReactions={$quickReactions} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2392 | packs={roomPacks} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2393 | linkPreviews={$linkPreviews} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2394 | {loadPreview} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2395 | onQuickChange={(list) => void changeQuickReactions(list)} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2396 | {people} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2397 | self={$sessionUser ?? null} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2398 | onUser={(userId, x, y, asMenu) => void openUser(userId, x, y, asMenu)} |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2399 | onCloneSticker={openCloneStickerMenu} |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 2400 | onMore={(ev, x, y) => void openMessageMenu(ev, x, y)} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2401 | onReply={selectedRoom.membership === 'Joined' ? startReply : null} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2402 | onJump={jumpTo} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2403 | onEdit={selectedRoom.membership === 'Joined' ? startEdit : null} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2404 | editing={editing !== null && editing.eventId === g.item.event.event_id} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2405 | showSent={g.item.event.item_id === lastSentId && pendingItems.length === 0} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2406 | /> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2407 | {/if} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2408 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2409 | {/if} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2410 | {#each pendingItems as p, i (p.id)} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2411 | <MessageRow |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2412 | itemId={`pending-${p.id}`} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2413 | event={pendingToEvent(p)} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2414 | onJump={jumpTo} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2415 | showSender={pendingShowSender(i)} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2416 | senderAvatar={senderAvatarFor($sessionUser ?? '')} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2417 | {reacting} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2418 | onReact={(eventId, key, shortcode) => void react(eventId, key, shortcode)} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2419 | quickReactions={$quickReactions} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2420 | packs={roomPacks} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2421 | linkPreviews={$linkPreviews} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2422 | {loadPreview} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2423 | onQuickChange={(list) => void changeQuickReactions(list)} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2424 | /> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2425 | {#if p.status === 'failed'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2426 | <div class="pending-actions"> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2427 | <span class="pending-error" role="alert">{p.error}</span> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2428 | <button type="button" class="ghost-btn" on:click={() => retryPending(p.id)}>Retry</button> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2429 | <button type="button" class="ghost-btn danger" on:click={() => discardPending(p.id)}>Discard</button> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2430 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2431 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2432 | {/each} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2433 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2434 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2435 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2436 | {#if selectedRoom.membership === 'Joined'} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2437 | {#if editing} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2438 | <div class="reply-bar" role="status"> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2439 | <span class="reply-bar-label"> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2440 | Editing message |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2441 | <span class="reply-bar-text">{editing.original}</span> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2442 | </span> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2443 | <button type="button" class="icon-btn" aria-label="Cancel edit" title="Cancel edit (Esc)" on:click={cancelEdit}> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2444 | <span aria-hidden="true">✕</span> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2445 | </button> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2446 | </div> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2447 | {:else if replyingTo && replyingTo.details.kind === 'Ready'} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2448 | <div class="reply-bar" role="status"> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2449 | <span class="reply-bar-label"> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2450 | Replying to <strong>{people[replyingTo.details.sender.user_id]?.name ?? senderLabel(replyingTo.details.sender)}</strong> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2451 | <span class="reply-bar-text">{contentPreview(replyingTo.details.content)}</span> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2452 | </span> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2453 | <button type="button" class="icon-btn" aria-label="Cancel reply" title="Cancel reply (Esc)" on:click={() => (replyingTo = null)}> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2454 | <span aria-hidden="true">✕</span> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2455 | </button> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2456 | </div> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2457 | {/if} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2458 | {#if $selectedRoomId && currentStaged.length > 0} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2459 | {@const stagedRoom = $selectedRoomId} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2460 | <ul class="staged" aria-label="Attachments to send"> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2461 | {#each currentStaged as attachment (attachment.id)} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2462 | <li class="staged-item"> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2463 | {#if attachment.previewUrl} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2464 | <img src={attachment.previewUrl} alt={attachment.file.name || 'Pasted image'} /> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2465 | {:else} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2466 | <span class="staged-name">{attachment.file.name || 'attachment'}</span> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2467 | {/if} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2468 | <button |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2469 | type="button" |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2470 | class="icon-btn staged-remove" |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2471 | aria-label={`Remove ${attachment.file.name || 'attachment'}`} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2472 | title="Remove" |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2473 | on:click={() => unstage(stagedRoom, attachment.id)} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2474 | > |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2475 | <span aria-hidden="true">✕</span> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2476 | </button> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2477 | </li> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2478 | {/each} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2479 | </ul> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2480 | {/if} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2481 | <form class="composer" class:replying={replyingTo || editing} class:staging={currentStaged.length > 0} on:submit|preventDefault={() => send()}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2482 | <label class="visually-hidden" for="composer">Message {selectedRoom.name}</label> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2483 | <input |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2484 | type="file" |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2485 | multiple |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2486 | bind:this={fileInput} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2487 | class="visually-hidden" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2488 | aria-label="Attach a file" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2489 | on:change={() => void onFileChosen()} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2490 | /> |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 2491 | <input |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 2492 | type="file" |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 2493 | accept="image/*" |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 2494 | bind:this={avatarInput} |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 2495 | class="visually-hidden" |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 2496 | aria-label="Choose a new avatar" |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 2497 | on:change={() => void onAvatarChosen()} |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 2498 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2499 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2500 | type="button" |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2501 | class="icon-btn" |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2502 | class:busy={uploadBusy} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2503 | title={uploadBusy ? `Uploading ${uploadName ?? 'file'}…` : 'Attach an image or file'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2504 | aria-label="Attach an image or file" |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2505 | aria-busy={uploadBusy} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2506 | disabled={!($selectedRoomId && openReady[$selectedRoomId])} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2507 | on:click={pickFiles} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2508 | > |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2509 | <svg viewBox="0 0 24 24" width="19" height="19" aria-hidden="true"> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2510 | <path d="M20 11.5l-8.2 8.2a5 5 0 0 1-7-7L13 4.4a3.3 3.3 0 0 1 4.7 4.7l-8.2 8.2a1.7 1.7 0 0 1-2.4-2.4l7.5-7.5" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" /> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2511 | </svg> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2512 | </button> |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2513 | <button |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2514 | type="button" |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2515 | class="icon-btn sticker-btn" |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2516 | title="Stickers" |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2517 | aria-label="Stickers" |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2518 | aria-expanded={stickersOpen} |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2519 | disabled={!($selectedRoomId && openReady[$selectedRoomId])} |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2520 | on:click={() => (stickersOpen = !stickersOpen)} |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2521 | > |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2522 | <svg viewBox="0 0 24 24" width="19" height="19" aria-hidden="true"> |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2523 | <path d="M4 6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v7l-7 7H6a2 2 0 0 1-2-2z" fill="none" stroke="currentColor" stroke-width="1.8" /> |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2524 | <path d="M13 20v-5a2 2 0 0 1 2-2h5" fill="none" stroke="currentColor" stroke-width="1.8" /> |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2525 | </svg> |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2526 | </button> |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2527 | {#if stickersOpen && $selectedRoomId} |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2528 | {@const stickerRoom = $selectedRoomId} |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2529 | <div class="sticker-pop"> |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2530 | <StickerPicker |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2531 | packs={roomPacks} |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2532 | {roomName} |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2533 | onSend={(pack, image) => void sendSticker(stickerRoom, pack, image)} |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2534 | onClone={(pack, image, x, y) => openCloneImageMenu(pack, image, x, y)} |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2535 | onClonePack={(pack, x, y) => openClonePackMenu(pack, x, y)} |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2536 | onManage={() => ((stickersOpen = false), (dialog = 'packs'))} |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2537 | onClose={() => (stickersOpen = false)} |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2538 | /> |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2539 | </div> |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2540 | {/if} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2541 | <div class="composer-field"> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2542 | {#if commandQuery !== null && commandCandidates.length > 0} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2543 | <ul class="mention-finder" role="listbox" aria-label="Commands"> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2544 | {#each commandCandidates as name, i (name)} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2545 | <li |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2546 | role="option" |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2547 | aria-selected={i === commandIndex} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2548 | class:active={i === commandIndex} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2549 | on:pointerdown|preventDefault={() => void pickCommand(name)} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2550 | on:pointerenter={() => (commandIndex = i)} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2551 | > |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2552 | <span class="mention-name">/{name}</span> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2553 | <span class="mention-id">{COMMAND_USAGE[name]}</span> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2554 | </li> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2555 | {/each} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2556 | </ul> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2557 | {/if} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2558 | {#if emoteQuery && emoteCandidates.length > 0} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2559 | <ul class="mention-finder" role="listbox" aria-label="Emotes"> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2560 | {#each emoteCandidates as candidate, i (candidate.kind + candidate.shortcode)} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2561 | <li |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2562 | role="option" |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2563 | aria-selected={i === emoteIndex} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2564 | class:active={i === emoteIndex} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2565 | on:pointerdown|preventDefault={() => void pickEmote(candidate)} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2566 | on:pointerenter={() => (emoteIndex = i)} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2567 | > |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2568 | {#if candidate.kind === 'custom'} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2569 | <img class="finder-emote" src={mediaUrl(candidate.mxc) ?? ''} alt="" /> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2570 | {:else} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2571 | <span class="finder-emote"><EmojiText text={candidate.emoji} /></span> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2572 | {/if} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2573 | <span class="mention-name">:{candidate.shortcode}:</span> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2574 | </li> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2575 | {/each} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2576 | </ul> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2577 | {/if} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2578 | {#if mentionQuery && mentionCandidates.length > 0} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2579 | <ul class="mention-finder" role="listbox" aria-label="Mention someone"> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2580 | {#each mentionCandidates as person, i (person.user_id)} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2581 | <li |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2582 | role="option" |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2583 | aria-selected={i === mentionIndex} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2584 | class:active={i === mentionIndex} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2585 | on:pointerdown|preventDefault={() => void pickMention(person)} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2586 | on:pointerenter={() => (mentionIndex = i)} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2587 | > |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2588 | <MxcAvatar mxc={person.avatar} label={person.name} size={22} /> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2589 | <span class="mention-name">{person.name}</span> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2590 | <span class="mention-id">{person.user_id}</span> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2591 | </li> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2592 | {/each} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2593 | </ul> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2594 | {/if} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2595 | <div class="composer-marks" aria-hidden="true" bind:this={marksEl}>{#each composerMarks as part}{#if part.mark}<mark>{part.text}</mark>{:else}{part.text}{/if}{/each}​</div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2596 | <textarea |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2597 | id="composer" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2598 | bind:this={composerEl} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2599 | bind:value={composer} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2600 | rows="1" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2601 | placeholder={`Message ${selectedRoom.name}`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2602 | aria-label={`Message ${selectedRoom.name}. Enter to send, Shift Enter for a new line.`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2603 | on:keydown={onComposerKey} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2604 | on:input={() => void onComposerInput()} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2605 | on:click={updateMentionQuery} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2606 | on:focus={ensureEmoji} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2607 | on:keyup={(e) => (e.key.startsWith('Arrow') && e.key !== 'ArrowUp' && e.key !== 'ArrowDown') || e.key === 'Home' || e.key === 'End' ? updateMentionQuery() : undefined} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2608 | on:blur={() => ((mentionQuery = null), (commandQuery = null), (emoteQuery = null))} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2609 | on:paste={onComposerPaste} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2610 | on:scroll={() => marksEl && composerEl && (marksEl.scrollTop = composerEl.scrollTop)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2611 | disabled={!($selectedRoomId && openReady[$selectedRoomId])} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2612 | ></textarea> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2613 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2614 | <button |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 2615 | type="button" |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2616 | class="icon-btn" |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 2617 | aria-pressed={$markdownEnabled} |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 2618 | aria-label={$markdownEnabled ? 'Turn markdown off' : 'Turn markdown on'} |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 2619 | title={$markdownEnabled ? 'Markdown on' : 'Markdown off'} |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 2620 | on:click={() => markdownEnabled.update((v) => !v)} |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 2621 | > |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2622 | <svg viewBox="0 0 24 16" width="21" height="14" aria-hidden="true"> |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 2623 | <rect x="1" y="1" width="22" height="14" rx="2" fill="none" stroke="currentColor" stroke-width="1.6" /> |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 2624 | <path d="M4.5 11.5v-7l2.75 3 2.75-3v7M15.5 4.5v6.5M13 8.5l2.5 2.75L18 8.5" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round" /> |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 2625 | </svg> |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 2626 | </button> |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 2627 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2628 | type="submit" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2629 | class="primary-btn" |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2630 | disabled={(!composer.trim() && currentStaged.length === 0) || |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2631 | !($selectedRoomId && openReady[$selectedRoomId]) || |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2632 | (currentStaged.length > 0 && uploadBusy)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2633 | title={!($selectedRoomId && openReady[$selectedRoomId]) ? 'Waiting for the room to open' : 'Send message'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2634 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2635 | Send |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2636 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2637 | </form> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2638 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2639 | <div class="join-bar"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2640 | <p>You are not a member of this room.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2641 | <button type="button" class="primary-btn" disabled={joinBusy} on:click={() => void join(selectedRoom.room_id)}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2642 | {joinBusy ? 'Joining…' : `Join ${selectedRoom.name}`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2643 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2644 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2645 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2646 | {/if} |
d4c0d65f690a | atagen | 2026-10-24 12:50 UTC | 2647 | </div> |
d4c0d65f690a | atagen | 2026-10-24 12:50 UTC | 2648 | {/key} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2649 | </main> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2650 | |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 2651 | {#if selectedRoom} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 2652 | <aside class="members" aria-hidden={!membersOpen} aria-label={`Members of ${selectedRoom.name}`}> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2653 | <!-- svelte-ignore a11y_no_static_element_interactions --> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2654 | <div class="pane-resize left" title="Drag to resize" on:pointerdown={(e) => startResize(e, 'members')} on:dblclick={() => resetWidth('members')}></div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2655 | <div class="members-head"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2656 | <h2>Members</h2> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2657 | <button type="button" class="icon-btn" aria-label="Close members" on:click={() => (membersOpen = false)}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2658 | <span aria-hidden="true">✕</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2659 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2660 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2661 | {#if $membersLoading && members.length === 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2662 | <p class="side-note">Loading members…</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2663 | {:else if members.length === 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2664 | <p class="side-note">No members loaded.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2665 | {#if $selectedRoomId} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2666 | <button type="button" class="ghost-btn" on:click={() => $selectedRoomId && void loadMembers($selectedRoomId)}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2667 | Retry |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2668 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2669 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2670 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2671 | <ul class="member-list"> |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2672 | {#each memberGroups as group (group.label)} |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2673 | <li class="member-group"> |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2674 | <h3 class="member-group-label">{group.label}<span>{group.members.length}</span></h3> |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2675 | <ul class="member-group-list"> |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2676 | {#each group.members as member (member.user_id)} |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2677 | <li> |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2678 | <button |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2679 | type="button" |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2680 | class="member" |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2681 | on:click={(ev) => { |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2682 | const rect = ev.currentTarget.getBoundingClientRect(); |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2683 | void openUser(member.user_id, rect.left - 308, rect.top, false); |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2684 | }} |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2685 | on:contextmenu|preventDefault={(ev) => void openUser(member.user_id, ev.clientX, ev.clientY, true)} |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2686 | > |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2687 | <MxcAvatar mxc={member.avatar} label={member.display_name || member.name || member.user_id} seed={member.user_id} size={28} /> |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2688 | <span class="member-names"> |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2689 | <span class="member-name">{member.display_name || member.name}</span> |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2690 | <span class="member-id">{member.user_id}</span> |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2691 | </span> |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2692 | </button> |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2693 | </li> |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2694 | {/each} |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2695 | </ul> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2696 | </li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2697 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2698 | </ul> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2699 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2700 | </aside> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2701 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2702 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2703 | {#if dialog} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2704 | <div class="modal-wrap" role="presentation" on:click|self={() => (dialog = null)}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2705 | {#if dialog === 'security'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2706 | <SecurityPanel |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2707 | encryptionState={$encryption} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2708 | verificationState={$verification} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2709 | onAction={() => void loadEncryption()} |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 2710 | encryptedPreviews={$urlPreviewSettings.encrypted_rooms} |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 2711 | onEncryptedPreviews={(enabled) => void changeEncryptedPreviews(enabled)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2712 | on:close={() => (dialog = null)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2713 | /> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2714 | {:else if dialog === 'settings'} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2715 | <SettingsPanel |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2716 | quick={$quickReactions} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2717 | packs={roomPacks} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2718 | onQuickChange={(list) => void changeQuickReactions(list)} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2719 | on:close={() => (dialog = null)} |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2720 | on:packs={() => (dialog = 'packs')} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2721 | /> |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2722 | {:else if dialog === 'packs'} |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2723 | <PackManager packs={$imagePacks} rooms={$rooms} onError={pushBanner} on:close={() => (dialog = null)} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2724 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2725 | <div class="modal" role="dialog" aria-modal="true" aria-label={dialog === 'join' ? 'Join a room' : 'Create a room'}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2726 | <div class="modal-tabs" role="tablist" aria-label="Room actions"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2727 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2728 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2729 | role="tab" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2730 | aria-selected={dialog === 'join'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2731 | class:active={dialog === 'join'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2732 | on:click={() => (dialog = 'join')} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2733 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2734 | Join |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2735 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2736 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2737 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2738 | role="tab" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2739 | aria-selected={dialog === 'create'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2740 | class:active={dialog === 'create'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2741 | on:click={() => (dialog = 'create')} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2742 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2743 | Create |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2744 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2745 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2746 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2747 | class="icon-btn modal-x" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2748 | aria-label="Close dialog" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2749 | on:click={() => (dialog = null)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2750 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2751 | <span aria-hidden="true">✕</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2752 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2753 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2754 | {#if dialog === 'join'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2755 | <form on:submit|preventDefault={() => void join(joinTarget)}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2756 | <label class="field"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2757 | <span>Room ID or alias</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2758 | <input |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2759 | type="text" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2760 | placeholder="!room:example.org or #alias:example.org" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2761 | bind:value={joinTarget} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2762 | required |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2763 | disabled={joinBusy} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2764 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2765 | </label> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2766 | <button type="submit" class="primary-btn wide" disabled={joinBusy || !joinTarget.trim()}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2767 | {joinBusy ? 'Joining…' : 'Join room'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2768 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2769 | </form> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2770 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2771 | <form on:submit|preventDefault={() => void create()}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2772 | <label class="field"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2773 | <span>Room name</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2774 | <input |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2775 | type="text" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2776 | placeholder="Weekend plans" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2777 | bind:value={createName} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2778 | required |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2779 | disabled={createBusy} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2780 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2781 | </label> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2782 | <label class="field"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2783 | <span>Topic (optional)</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2784 | <input |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2785 | type="text" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2786 | placeholder="What should this room be about?" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2787 | bind:value={createTopic} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2788 | disabled={createBusy} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2789 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2790 | </label> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2791 | <button type="submit" class="primary-btn wide" disabled={createBusy || !createName.trim()}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2792 | {createBusy ? 'Creating…' : 'Create room'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2793 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2794 | </form> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2795 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2796 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2797 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2798 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2799 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2800 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2801 | {/if} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2802 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2803 | <ImageLightbox /> |