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