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'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 3 | import LoginPanel from './lib/LoginPanel.svelte'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 4 | import MessageRow from './lib/MessageRow.svelte'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 5 | import MxcAvatar from './lib/MxcAvatar.svelte'; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 6 | import PinButton from './lib/PinButton.svelte'; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 7 | import ContextMenu, { type MenuItem } from './lib/ContextMenu.svelte'; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 8 | import UserCard, { type UserAction } from './lib/UserCard.svelte'; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 9 | import { allowed, isMuted, parsePowerLevels, type PowerLevels } from './lib/permissions'; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 10 | import { moveBefore, pinnedFirst, sortSpaces } from './lib/rail-order'; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 11 | import ImageLightbox from './lib/ImageLightbox.svelte'; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 12 | import { lightbox } from './lib/lightbox'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 13 | import SecurityPanel from './lib/SecurityPanel.svelte'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 14 | import { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 15 | closeRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 16 | createRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 17 | getEncryption, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 18 | getMembers, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 19 | getProfile, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 20 | getRooms, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 21 | getSession, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 22 | getSpaceChildren, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 23 | joinRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 24 | leaveRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 25 | logout, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 26 | markRead, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 27 | openRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 28 | paginateRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 29 | reactToMessage, |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 30 | runCommand, |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 31 | sendMessage, |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 32 | uploadAttachment, |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 33 | uploadAvatar, |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 34 | uploadRoomAvatar, |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 35 | editMessage |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 36 | } from './lib/api'; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 37 | import { isKnownCommand, parseCommand, splitTarget, unescapeCommand } from './lib/commands'; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 38 | import type { ParsedCommand } from './lib/commands'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 39 | import { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 40 | banners, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 41 | blocked, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 42 | connectEvents, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 43 | connection, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 44 | disconnectEvents, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 45 | dismissBanner, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 46 | encryption, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 47 | membersByRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 48 | membersLoading, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 49 | pushBanner, |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 50 | imagePacks, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 51 | resetClientState, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 52 | rooms, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 53 | selectedRoomId, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 54 | sessionUser, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 55 | softLogout, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 56 | timelines, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 57 | verification |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 58 | } from './lib/store'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 59 | import { discardPending, pendingByRoom, queueSend, resetPending, retryPending } from './lib/pending'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 60 | import type { PendingMessage } from './lib/pending'; |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 61 | import { insideOpenFence } from './lib/markdown'; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 62 | import { mentionQueryAt, mentionsFromHtml, rankPeople, resolveMentions } from './lib/mentions'; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 63 | import type { Mention, MentionQuery } from './lib/mentions'; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 64 | import { loadQuickReactions, quickReactions, saveQuickReactions } from './lib/quick-reactions'; |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 65 | import { |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 66 | linkPreviews, |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 67 | loadUrlPreviewSettings, |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 68 | requestLinkPreview, |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 69 | saveUrlPreviewSettings, |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 70 | urlPreviewSettings |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 71 | } from './lib/link-previews'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 72 | import { notifyTyping, stopTyping } from './lib/typing'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 73 | import { formatDay } from './lib/format'; |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 74 | import { lastSpaceRooms, lineHeight, markdownEnabled, messageSpacing, navFolded, railFolded } from './lib/appearance'; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 75 | import SettingsPanel from './lib/SettingsPanel.svelte'; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 76 | import { packsForRoom, parseEncryptionState, parseOwnProfile, parseVerificationState, contentPreview, senderLabel } from './lib/types'; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 77 | import type { MemberSummary, OwnProfile, Person, QuickReaction, ReplyReference, RoomSummary, SendState, TimelineEvent, TimelineItem } from './lib/types'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 78 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 79 | let roomsLoading = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 80 | let booted = false; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 81 | let wasOnline = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 82 | let search = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 83 | let sidebarOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 84 | let membersOpen = false; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 85 | let replyingTo: ReplyReference | null = null; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 86 | let dialog: 'join' | 'create' | 'security' | 'settings' | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 87 | let joinTarget = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 88 | let joinBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 89 | let createName = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 90 | let createTopic = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 91 | let createBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 92 | let leaveBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 93 | let paginateBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 94 | let reacting = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 95 | let composer = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 96 | let drafts: Record<string, string> = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 97 | let stickToBottom = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 98 | let timelineEl: HTMLElement | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 99 | let composerEl: HTMLTextAreaElement | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 100 | let fileInput: HTMLInputElement | null = null; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 101 | let avatarInput: HTMLInputElement | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 102 | let uploadBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 103 | let uploadName: string | null = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 104 | interface StagedAttachment { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 105 | id: number; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 106 | file: File; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 107 | previewUrl: string | null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 108 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 109 | let staged: Record<string, StagedAttachment[]> = {}; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 110 | let editing: { roomId: string; eventId: string; original: string; stash: string } | null = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 111 | /** 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 | 112 | let pickedMentions: Record<string, Mention[]> = {}; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 113 | let mentionQuery: MentionQuery | null = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 114 | let mentionIndex = 0; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 115 | let nextStagedId = 1; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 116 | const WARM_ROOM_LIMIT = 8; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 117 | /** Rooms left open after switching away so coming back is instant, least recently viewed first. */ |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 118 | let warmRooms: string[] = []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 119 | let openReady: Record<string, boolean> = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 120 | let openFailed: Record<string, string> = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 121 | let membersFor: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 122 | let lastReadKey = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 123 | let readTimer: number | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 124 | let profile: OwnProfile | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 125 | let profileMxc: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 126 | let selectedSpaceId: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 127 | let spaceChildIds: string[] | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 128 | let spaceChildrenLoading = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 129 | let spaceChildrenError: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 130 | let avatarByUser: Record<string, string | null> = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 131 | |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 132 | // 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 | 133 | $: { |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 134 | const online = $connection === 'online'; |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 135 | if (online && !wasOnline) { |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 136 | void loadQuickReactions(); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 137 | void loadUrlPreviewSettings(); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 138 | } |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 139 | wasOnline = online; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 140 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 141 | $: selectedRoom = $rooms.find((r) => r.room_id === $selectedRoomId) ?? null; |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 142 | $: roomPacks = packsForRoom($imagePacks, $selectedRoomId); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 143 | $: previewsAllowed = selectedRoom !== null && (!selectedRoom.encrypted || $urlPreviewSettings.encrypted_rooms); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 144 | $: loadPreview = previewsAllowed && $selectedRoomId ? previewLoader($selectedRoomId) : null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 145 | $: spaceRooms = $rooms.filter((r) => r.space); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 146 | $: spaceParents = parentSpaceMap(spaceRooms); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 147 | $: railSpaces = spaceRooms.filter((s) => !spaceParents.has(s.room_id)); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 148 | let railOverride: string[] | null = null; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 149 | $: if (railOverride && sortSpaces(railSpaces, null).map((s) => s.room_id).join() === railOverride.join()) railOverride = null; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 150 | $: orderedRail = sortSpaces(railSpaces, railOverride); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 151 | $: pinnedRail = orderedRail.filter((s) => s.favourite); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 152 | $: otherRail = orderedRail.filter((s) => !s.favourite); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 153 | $: railSelected = selectedSpaceId ? topSpaceOf(selectedSpaceId, spaceParents) : null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 154 | $: invites = $rooms.filter((r) => r.membership === 'Invited'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 155 | $: query = search.trim().toLowerCase(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 156 | $: selectedSpace = selectedSpaceId ? ($rooms.find((r) => r.room_id === selectedSpaceId) ?? null) : null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 157 | // While a space's children load (or fail), show no channels rather than the |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 158 | // full list — listing everything would falsely imply it belongs to the space. |
f12c7de2a3ab | atagen | 2026-10-23 08:10 UTC | 159 | $: baseRooms = selectedSpaceId ? (spaceChildIds ? $rooms.filter((r) => spaceChildIds?.includes(r.room_id)) : []) : $rooms; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 160 | $: visibleRooms = query |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 161 | ? baseRooms.filter( |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 162 | (r) => |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 163 | r.name.toLowerCase().includes(query) || r.room_id.toLowerCase().includes(query) |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 164 | ) |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 165 | : baseRooms; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 166 | $: directRooms = pinnedFirst(visibleRooms.filter((r) => r.direct && !r.space && r.membership !== 'Invited')); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 167 | $: groupRooms = pinnedFirst(visibleRooms.filter((r) => !r.direct && !r.space && r.membership !== 'Invited')); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 168 | $: spaceList = pinnedFirst(visibleRooms.filter((r) => r.space && r.membership !== 'Invited')); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 169 | $: channelRooms = baseRooms.filter((r) => !r.space && r.membership !== 'Invited'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 170 | $: recoveryBanner = $encryption && ($encryption.recovery === 'Disabled' || $encryption.recovery === 'Incomplete') ? $encryption : null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 171 | $: verificationBanner = $verification && $verification.kind !== 'Done' ? $verification : null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 172 | $: items = $selectedRoomId ? ($timelines[$selectedRoomId] ?? []) : []; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 173 | $: currentStaged = $selectedRoomId ? (staged[$selectedRoomId] ?? []) : []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 174 | $: members = $selectedRoomId ? ($membersByRoom[$selectedRoomId] ?? []) : []; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 175 | $: people = peopleIn(items, members); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 176 | $: mentionCandidates = mentionQuery ? rankPeople(Object.values(people), mentionQuery.query, $sessionUser ?? null) : []; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 177 | $: if (mentionIndex >= mentionCandidates.length) mentionIndex = 0; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 178 | $: hasStart = items.some((i) => i.kind === 'start'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 179 | $: grouped = buildGroups(items); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 180 | $: lastSentId = lastOwnSent(items); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 181 | $: pendingItems = $selectedRoomId ? ($pendingByRoom[$selectedRoomId] ?? []) : []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 182 | $: lastRealOwn = lastSenderIsOwn(items); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 183 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 184 | function lastSenderIsOwn(list: TimelineItem[]): boolean { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 185 | for (let i = list.length - 1; i >= 0; i -= 1) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 186 | const it = list[i]; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 187 | if (it.kind === 'event') return it.event.sender.user_id === $sessionUser; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 188 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 189 | return false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 190 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 191 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 192 | function pendingShowSender(index: number): boolean { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 193 | return index === 0 ? !lastRealOwn : false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 194 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 195 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 196 | function pendingToEvent(p: PendingMessage): TimelineEvent { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 197 | const state: SendState = p.status === 'failed' ? { kind: 'Failed', will_retry: false } : { kind: 'Sending' }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 198 | return { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 199 | item_id: `pending-${p.id}`, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 200 | event_id: null, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 201 | transaction_id: p.id, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 202 | sender: { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 203 | user_id: $sessionUser ?? '', |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 204 | display_name: profile?.display_name ?? null, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 205 | avatar: null, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 206 | name_ambiguous: false |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 207 | }, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 208 | timestamp_ms: p.createdAt, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 209 | own: true, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 210 | send_state: state, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 211 | content: { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 212 | kind: 'Message', |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 213 | message: { kind: 'Text', body: p.body, geo_uri: null, formatted_body: p.formatted, edited: false, media: null, link_previews: [] } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 214 | }, |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 215 | reply_to: p.replyTo, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 216 | thread_root: null, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 217 | thread_summary: null, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 218 | reactions: [], |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 219 | read_by: [], |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 220 | editable: false |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 221 | }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 222 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 223 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 224 | interface Group { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 225 | key: string; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 226 | item: TimelineItem; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 227 | showSender: boolean; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 228 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 229 | |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 230 | function lastOwnSent(list: TimelineItem[]): string | null { |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 231 | for (let i = list.length - 1; i >= 0; i--) { |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 232 | const item = list[i]; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 233 | if (item.kind === 'event' && item.event.own && item.event.send_state.kind === 'Sent') return item.event.item_id; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 234 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 235 | return null; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 236 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 237 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 238 | function buildGroups(list: TimelineItem[]): Group[] { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 239 | const out: Group[] = []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 240 | let prevSender: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 241 | let prevTs = 0; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 242 | list.forEach((item, index) => { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 243 | let showSender = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 244 | if (item.kind === 'event') { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 245 | const e = item.event; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 246 | showSender = |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 247 | prevSender !== e.sender.user_id || Math.abs(e.timestamp_ms - prevTs) > 5 * 60 * 1000; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 248 | prevSender = e.sender.user_id; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 249 | prevTs = e.timestamp_ms; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 250 | out.push({ key: e.item_id || e.event_id || `m-${index}`, item, showSender }); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 251 | } else { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 252 | prevSender = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 253 | out.push({ key: `${item.kind}-${index}`, item, showSender }); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 254 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 255 | }); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 256 | return out; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 257 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 258 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 259 | function roomUnread(r: RoomSummary): number { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 260 | return r.unread_messages + r.unread_mentions; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 261 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 262 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 263 | onMount(() => { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 264 | void boot(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 265 | return () => { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 266 | disconnectEvents(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 267 | stopTyping(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 268 | if (readTimer !== null) window.clearTimeout(readTimer); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 269 | }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 270 | }); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 271 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 272 | async function boot(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 273 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 274 | const session = await getSession(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 275 | blocked.set(session.blocked ?? false); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 276 | sessionUser.set(session.user_id); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 277 | if (session.user_id) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 278 | softLogout.set(null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 279 | await refreshRooms(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 280 | connectEvents(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 281 | void loadProfile(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 282 | void loadEncryption(); |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 283 | void loadQuickReactions(); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 284 | void loadUrlPreviewSettings(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 285 | } else { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 286 | softLogout.set(session.soft_logout ?? null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 287 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 288 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 289 | pushBanner(e instanceof Error ? `Session check failed: ${e.message}` : 'Session check failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 290 | sessionUser.set(null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 291 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 292 | booted = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 293 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 294 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 295 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 296 | async function refreshRooms(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 297 | roomsLoading = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 298 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 299 | const res = await getRooms(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 300 | rooms.set(res.rooms); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 301 | pruneSpaceFilter(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 302 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 303 | pushBanner(e instanceof Error ? e.message : 'Could not load rooms'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 304 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 305 | roomsLoading = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 306 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 307 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 308 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 309 | async function loadProfile(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 310 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 311 | const raw = await getProfile(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 312 | profile = parseOwnProfile(raw); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 313 | profileMxc = profile.avatar_url; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 314 | } catch { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 315 | profile = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 316 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 317 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 318 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 319 | async function loadEncryption(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 320 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 321 | const res = await getEncryption(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 322 | const state = parseEncryptionState(res.state); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 323 | if (state) encryption.set(state); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 324 | const verificationState = parseVerificationState(res.verification); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 325 | if (verificationState) verification.set(verificationState); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 326 | } catch { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 327 | // Encryption status also arrives over SSE; a failed first fetch is not fatal. |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 328 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 329 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 330 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 331 | function afterLogin(userId: string): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 332 | sessionUser.set(userId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 333 | softLogout.set(null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 334 | blocked.set(false); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 335 | void refreshRooms(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 336 | connectEvents(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 337 | void loadProfile(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 338 | void loadEncryption(); |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 339 | void loadQuickReactions(); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 340 | void loadUrlPreviewSettings(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 341 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 342 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 343 | async function doLogout(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 344 | stopTyping(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 345 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 346 | await logout(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 347 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 348 | pushBanner(e instanceof Error ? e.message : 'Logout failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 349 | return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 350 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 351 | disconnectEvents(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 352 | resetClientState(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 353 | softLogout.set(null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 354 | blocked.set(false); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 355 | sessionUser.set(null); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 356 | lightbox.set(null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 357 | composer = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 358 | drafts = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 359 | dialog = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 360 | membersOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 361 | sidebarOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 362 | profile = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 363 | profileMxc = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 364 | selectedSpaceId = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 365 | spaceChildIds = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 366 | spaceChildrenError = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 367 | openReady = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 368 | openFailed = {}; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 369 | warmRooms = []; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 370 | pickedMentions = {}; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 371 | mentionQuery = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 372 | clearAllStaged(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 373 | avatarByUser = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 374 | resetPending(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 375 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 376 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 377 | /** 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 | 378 | function parentSpaceMap(spaces: RoomSummary[]): Map<string, string> { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 379 | const ids = new Set(spaces.map((s) => s.room_id)); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 380 | const parents = new Map<string, string>(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 381 | for (const space of spaces) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 382 | for (const child of space.children) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 383 | 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 | 384 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 385 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 386 | for (const space of spaces) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 387 | const parent = space.parent_spaces.find((id) => id !== space.room_id && ids.has(id)); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 388 | if (parent && !parents.has(space.room_id)) parents.set(space.room_id, parent); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 389 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 390 | for (const id of [...parents.keys()]) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 391 | const seen = new Set<string>([id]); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 392 | let at = parents.get(id); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 393 | while (at && !seen.has(at)) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 394 | seen.add(at); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 395 | at = parents.get(at); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 396 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 397 | if (at) parents.delete(id); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 398 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 399 | return parents; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 400 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 401 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 402 | function topSpaceOf(id: string, parents: Map<string, string>): string { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 403 | let at = id; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 404 | while (parents.has(at)) at = parents.get(at)!; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 405 | return at; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 406 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 407 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 408 | function pruneSpaceFilter(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 409 | if (!selectedSpaceId) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 410 | if (!$rooms.some((r) => r.room_id === selectedSpaceId)) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 411 | selectedSpaceId = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 412 | spaceChildIds = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 413 | spaceChildrenError = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 414 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 415 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 416 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 417 | async function selectHome(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 418 | selectedSpaceId = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 419 | spaceChildIds = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 420 | spaceChildrenError = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 421 | sidebarOpen = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 422 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 423 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 424 | async function selectSpace(spaceId: string): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 425 | if ($selectedRoomId && composer.trim()) drafts[$selectedRoomId] = composer; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 426 | stopTyping(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 427 | selectedSpaceId = spaceId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 428 | spaceChildIds = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 429 | spaceChildrenError = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 430 | spaceChildrenLoading = true; |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 431 | const last = $lastSpaceRooms[spaceId]; |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 432 | const resume = last && $rooms.some((r) => r.room_id === last && !r.space) ? last : null; |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 433 | if (resume) { |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 434 | void selectRoom(resume); |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 435 | } else { |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 436 | sidebarOpen = true; |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 437 | // A space is navigation, not a message timeline. |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 438 | selectedRoomId.set(null); |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 439 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 440 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 441 | const res = await getSpaceChildren(spaceId); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 442 | if (selectedSpaceId === spaceId) { |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 443 | spaceChildIds = res.room_ids ?? []; |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 444 | if (resume && !spaceChildIds.includes(resume) && $selectedRoomId === resume) { |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 445 | sidebarOpen = true; |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 446 | selectedRoomId.set(null); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 447 | } |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 448 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 449 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 450 | if (selectedSpaceId === spaceId) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 451 | spaceChildrenError = e instanceof Error ? e.message : 'Could not load rooms in this space'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 452 | spaceChildIds = []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 453 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 454 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 455 | if (selectedSpaceId === spaceId) spaceChildrenLoading = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 456 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 457 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 458 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 459 | async function selectRoom(roomId: string, peek = false): Promise<void> { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 460 | peeking = peek ? roomId : null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 461 | if ($selectedRoomId && composer.trim()) drafts[$selectedRoomId] = composer; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 462 | if (roomId === $selectedRoomId && openReady[roomId]) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 463 | sidebarOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 464 | return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 465 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 466 | stopTyping(); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 467 | const spaceId = selectedSpaceId; |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 468 | if (spaceId) lastSpaceRooms.update((all) => ({ ...all, [spaceId]: roomId })); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 469 | selectedRoomId.set(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 470 | composer = drafts[roomId] ?? ''; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 471 | replyingTo = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 472 | editing = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 473 | mentionQuery = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 474 | stickToBottom = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 475 | lastReadKey = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 476 | sidebarOpen = false; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 477 | touchWarmRoom(roomId); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 478 | if (openReady[roomId]) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 479 | if (membersOpen) void loadMembers(roomId); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 480 | await tick(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 481 | scrollToBottom(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 482 | queueReadReceipt(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 483 | composerEl?.focus(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 484 | return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 485 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 486 | if (openFailed[roomId]) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 487 | const nextFailed = { ...openFailed }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 488 | delete nextFailed[roomId]; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 489 | openFailed = nextFailed; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 490 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 491 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 492 | await openRoom(roomId); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 493 | if (warmRooms.includes(roomId)) openReady = { ...openReady, [roomId]: true }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 494 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 495 | const message = e instanceof Error ? e.message : `Could not open room ${roomId}`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 496 | openFailed = { ...openFailed, [roomId]: message }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 497 | pushBanner(message); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 498 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 499 | if (membersOpen) void loadMembers(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 500 | await tick(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 501 | scrollToBottom(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 502 | queueReadReceipt(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 503 | composerEl?.focus(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 504 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 505 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 506 | function touchWarmRoom(roomId: string): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 507 | warmRooms = [...warmRooms.filter((id) => id !== roomId), roomId]; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 508 | while (warmRooms.length > WARM_ROOM_LIMIT) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 509 | const evicted = warmRooms[0]; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 510 | warmRooms = warmRooms.slice(1); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 511 | forgetOpenRoom(evicted); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 512 | closeRoom(evicted).catch(() => undefined); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 513 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 514 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 515 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 516 | function forgetOpenRoom(roomId: string): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 517 | warmRooms = warmRooms.filter((id) => id !== roomId); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 518 | const nextReady = { ...openReady }; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 519 | delete nextReady[roomId]; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 520 | openReady = nextReady; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 521 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 522 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 523 | function scrollToBottom(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 524 | if (timelineEl) timelineEl.scrollTop = timelineEl.scrollHeight; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 525 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 526 | |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 527 | let userScrollUntil = 0; |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 528 | let draggingScrollbar = false; |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 529 | |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 530 | function noteUserScroll(): void { |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 531 | userScrollUntil = performance.now() + 300; |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 532 | } |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 533 | |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 534 | function onTimelineKey(e: KeyboardEvent): void { |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 535 | if (['ArrowUp', 'ArrowDown', 'PageUp', 'PageDown', 'Home', 'End', ' '].includes(e.key)) noteUserScroll(); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 536 | } |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 537 | |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 538 | function onTimelinePointer(e: PointerEvent): void { |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 539 | if (e.target === timelineEl) draggingScrollbar = true; |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 540 | } |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 541 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 542 | function onTimelineScroll(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 543 | if (!timelineEl) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 544 | const gap = timelineEl.scrollHeight - timelineEl.scrollTop - timelineEl.clientHeight; |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 545 | if (gap < 80) stickToBottom = true; |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 546 | else if (draggingScrollbar || performance.now() < userScrollUntil) stickToBottom = false; |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 547 | } |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 548 | |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 549 | function pinTimeline(node: HTMLElement) { |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 550 | const observer = new ResizeObserver(() => { |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 551 | if (stickToBottom) scrollToBottom(); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 552 | }); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 553 | observer.observe(node); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 554 | if (node.parentElement) observer.observe(node.parentElement); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 555 | return { destroy: () => observer.disconnect() }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 556 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 557 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 558 | $: void trackTimeline($selectedRoomId, items); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 559 | async function trackTimeline(roomId: string | null, list: TimelineItem[]): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 560 | if (!roomId || list.length === 0) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 561 | if (roomId !== $selectedRoomId) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 562 | await tick(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 563 | if (stickToBottom) scrollToBottom(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 564 | queueReadReceipt(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 565 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 566 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 567 | function queueReadReceipt(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 568 | if (readTimer !== null) window.clearTimeout(readTimer); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 569 | readTimer = window.setTimeout(() => { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 570 | readTimer = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 571 | void sendReadReceipt(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 572 | }, 800); |
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 | async function sendReadReceipt(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 576 | const roomId = $selectedRoomId; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 577 | if (!roomId || roomId === peeking) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 578 | const list = $timelines[roomId] ?? []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 579 | for (let i = list.length - 1; i >= 0; i -= 1) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 580 | const entry = list[i]; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 581 | if (entry.kind === 'event' && entry.event.event_id) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 582 | const key = `${roomId}:${entry.event.event_id}`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 583 | if (key === lastReadKey) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 584 | lastReadKey = key; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 585 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 586 | await markRead(roomId, entry.event.event_id); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 587 | } catch { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 588 | return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 589 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 590 | return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 591 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 592 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 593 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 594 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 595 | function send(): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 596 | if (editing) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 597 | submitEdit(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 598 | return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 599 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 600 | const roomId = $selectedRoomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 601 | const body = composer.trim(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 602 | const attachments = roomId ? (staged[roomId] ?? []) : []; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 603 | if (!roomId || (!body && attachments.length === 0)) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 604 | if (!openReady[roomId]) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 605 | pushBanner('Still opening this room — sending is disabled until the room is ready.'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 606 | return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 607 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 608 | if (attachments.length > 0 && uploadBusy) return; |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 609 | const command = parseCommand(body); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 610 | if (command && !isKnownCommand(command.name)) { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 611 | pushBanner(`Unknown command /${command.name}`); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 612 | return; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 613 | } |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 614 | if (command && attachments.length > 0) { |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 615 | if (command.name !== 'roomavatar' && command.name !== 'globalavatar') { |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 616 | pushBanner(`/${command.name} doesn't take attachments`); |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 617 | return; |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 618 | } |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 619 | if (command.args || attachments.length !== 1 || !attachments[0].file.type.startsWith('image/')) { |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 620 | pushBanner(`/${command.name} takes a single attached image`); |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 621 | return; |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 622 | } |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 623 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 624 | composer = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 625 | if (roomId in drafts) delete drafts[roomId]; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 626 | stickToBottom = true; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 627 | const reply = replyingTo; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 628 | replyingTo = null; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 629 | const text = unescapeCommand(body); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 630 | const mentions = resolveMentions(text, pickedMentions[roomId] ?? []); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 631 | pickedMentions = { ...pickedMentions, [roomId]: [] }; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 632 | mentionQuery = null; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 633 | if (command) { |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 634 | const image = attachments[0] ?? null; |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 635 | if (image) { |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 636 | const { [roomId]: _used, ...rest } = staged; |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 637 | staged = rest; |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 638 | } |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 639 | void execute(roomId, command, reply, mentions, image?.file ?? null).finally(() => { |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 640 | if (image?.previewUrl) URL.revokeObjectURL(image.previewUrl); |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 641 | }); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 642 | } else if (attachments.length === 0) { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 643 | queueSend(roomId, text, reply, mentions, $markdownEnabled); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 644 | } else { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 645 | const { [roomId]: _sent, ...rest } = staged; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 646 | staged = rest; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 647 | void sendAttachments(roomId, text, reply, mentions, attachments); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 648 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 649 | if (peeking === roomId) stopPeeking(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 650 | composerEl?.focus(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 651 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 652 | |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 653 | function lastOwnEventId(): string | null { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 654 | for (let i = items.length - 1; i >= 0; i -= 1) { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 655 | const entry = items[i]; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 656 | if (entry.kind === 'event' && entry.event.own && entry.event.event_id && entry.event.content.kind !== 'Redacted') { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 657 | return entry.event.event_id; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 658 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 659 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 660 | return null; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 661 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 662 | |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 663 | async function execute( |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 664 | roomId: string, |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 665 | command: ParsedCommand, |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 666 | reply: ReplyReference | null, |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 667 | mentions: Mention[], |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 668 | image: File | null |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 669 | ): Promise<void> { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 670 | const { name, args } = command; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 671 | const target = () => { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 672 | const found = splitTarget(args, Object.values(people)); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 673 | if ('error' in found) throw new Error(found.error); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 674 | return found; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 675 | }; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 676 | const required = (what: string) => { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 677 | if (!args) throw new Error(`/${name} needs ${what}`); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 678 | return args; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 679 | }; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 680 | try { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 681 | switch (name) { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 682 | case 'me': |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 683 | case 'notice': |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 684 | await sendMessage(roomId, required('something to say'), null, mentions, $markdownEnabled, name === 'me' ? 'emote' : 'notice'); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 685 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 686 | case 'msg': { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 687 | const { user_id, rest } = target(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 688 | const res = (await runCommand({ op: 'direct', user_id })) as { room_id: string }; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 689 | await refreshRooms(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 690 | await selectRoom(res.room_id); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 691 | if (rest) queueSend(res.room_id, rest, null, [], $markdownEnabled); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 692 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 693 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 694 | case 'join': |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 695 | await join(required('a room id or alias')); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 696 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 697 | case 'leave': |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 698 | await leave(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 699 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 700 | case 'invite': |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 701 | await runCommand({ op: 'invite', room_id: roomId, user_id: target().user_id }); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 702 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 703 | case 'disinvite': |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 704 | case 'kick': |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 705 | case 'ban': |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 706 | case 'unban': { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 707 | const { user_id, rest } = target(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 708 | const op = name === 'disinvite' ? 'kick' : name; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 709 | await runCommand({ op, room_id: roomId, user_id, reason: rest || null }); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 710 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 711 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 712 | case 'powerlevel': { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 713 | const { user_id, rest } = target(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 714 | const level = Number(rest); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 715 | if (!rest || !Number.isInteger(level)) throw new Error('/powerlevel needs a whole number after the name'); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 716 | await runCommand({ op: 'set_power_level', room_id: roomId, user_id, level }); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 717 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 718 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 719 | case 'mute': |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 720 | case 'unmute': |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 721 | await runCommand({ op: 'mute', room_id: roomId, user_id: target().user_id, muted: name === 'mute' }); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 722 | break; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 723 | case 'ignore': |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 724 | case 'unignore': |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 725 | await runCommand({ op: name, user_id: target().user_id }); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 726 | break; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 727 | case 'roomnick': |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 728 | await runCommand({ op: 'set_room_display_name', room_id: roomId, name: args || null }); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 729 | break; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 730 | case 'roomavatar': |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 731 | if (image) { |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 732 | await uploadRoomAvatar(roomId, image); |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 733 | } else if (args && !args.startsWith('mxc://')) { |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 734 | 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 | 735 | } else { |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 736 | await runCommand({ op: 'set_room_avatar', room_id: roomId, mxc: args || null }); |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 737 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 738 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 739 | case 'delete': { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 740 | const eventId = reply?.event_id ?? lastOwnEventId(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 741 | if (!eventId) throw new Error('Nothing of yours to delete here'); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 742 | await runCommand({ op: 'redact', room_id: roomId, event_id: eventId, reason: args || null }); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 743 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 744 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 745 | case 'globalnick': |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 746 | await runCommand({ op: 'set_display_name', name: required('a name') }); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 747 | await loadProfile(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 748 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 749 | case 'globalavatar': |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 750 | if (image) { |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 751 | await uploadAvatar(image); |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 752 | await loadProfile(); |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 753 | } else if (!args) { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 754 | avatarInput?.click(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 755 | } else if (args.startsWith('mxc://')) { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 756 | await runCommand({ op: 'set_avatar', mxc: args }); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 757 | await loadProfile(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 758 | } else { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 759 | throw new Error('/globalavatar takes an mxc:// link, or nothing to pick a file'); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 760 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 761 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 762 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 763 | } catch (e) { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 764 | pushBanner(e instanceof Error ? e.message : `/${name} failed`); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 765 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 766 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 767 | |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 768 | async function onAvatarChosen(): Promise<void> { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 769 | const file = avatarInput?.files?.[0]; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 770 | if (avatarInput) avatarInput.value = ''; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 771 | if (!file) return; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 772 | try { |
5e9271c9b8f1 | atagen | 2026-10-24 07:45 UTC | 773 | await uploadAvatar(file); |
5e9271c9b8f1 | atagen | 2026-10-24 07:45 UTC | 774 | await loadProfile(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 775 | } catch (e) { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 776 | pushBanner(e instanceof Error ? e.message : 'Avatar upload failed'); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 777 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 778 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 779 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 780 | async function sendAttachments( |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 781 | roomId: string, |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 782 | body: string, |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 783 | reply: ReplyReference | null, |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 784 | mentions: Mention[], |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 785 | attachments: StagedAttachment[] |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 786 | ): Promise<void> { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 787 | let first = true; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 788 | uploadBusy = true; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 789 | try { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 790 | for (const attachment of attachments) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 791 | uploadName = attachment.file.name || 'attachment'; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 792 | try { |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 793 | if (first) await uploadAttachment(roomId, attachment.file, body || null, reply?.event_id ?? null, mentions, $markdownEnabled); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 794 | else await uploadAttachment(roomId, attachment.file); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 795 | first = false; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 796 | } catch (e) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 797 | pushBanner(e instanceof Error ? e.message : 'Upload failed'); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 798 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 799 | if (attachment.previewUrl) URL.revokeObjectURL(attachment.previewUrl); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 800 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 801 | } finally { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 802 | uploadBusy = false; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 803 | uploadName = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 804 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 805 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 806 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 807 | function stageFiles(files: File[]): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 808 | const roomId = $selectedRoomId; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 809 | if (!roomId || !openReady[roomId]) return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 810 | const accepted: StagedAttachment[] = []; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 811 | for (const file of files) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 812 | if (file.size === 0 || file.size > 20 * 1024 * 1024) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 813 | pushBanner(`${file.name || 'File'} must be between 1 byte and 20 MiB.`); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 814 | continue; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 815 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 816 | const previewUrl = file.type.startsWith('image/') ? URL.createObjectURL(file) : null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 817 | accepted.push({ id: nextStagedId++, file, previewUrl }); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 818 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 819 | if (accepted.length === 0) return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 820 | staged = { ...staged, [roomId]: [...(staged[roomId] ?? []), ...accepted] }; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 821 | composerEl?.focus(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 822 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 823 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 824 | function unstage(roomId: string, id: number): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 825 | const list = staged[roomId] ?? []; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 826 | const removed = list.find((a) => a.id === id); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 827 | if (removed?.previewUrl) URL.revokeObjectURL(removed.previewUrl); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 828 | staged = { ...staged, [roomId]: list.filter((a) => a.id !== id) }; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 829 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 830 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 831 | function clearAllStaged(): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 832 | for (const list of Object.values(staged)) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 833 | for (const attachment of list) if (attachment.previewUrl) URL.revokeObjectURL(attachment.previewUrl); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 834 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 835 | staged = {}; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 836 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 837 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 838 | function startEdit(eventId: string, body: string): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 839 | const roomId = $selectedRoomId; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 840 | if (!roomId) return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 841 | const stash = editing ? editing.stash : composer; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 842 | editing = { roomId, eventId, original: body, stash }; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 843 | const entry = items.find((i) => i.kind === 'event' && i.event.event_id === eventId); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 844 | if (entry?.kind === 'event' && entry.event.content.kind === 'Message') { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 845 | const existing = mentionsFromHtml(entry.event.content.message.formatted_body); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 846 | pickedMentions = { ...pickedMentions, [roomId]: [...(pickedMentions[roomId] ?? []), ...existing] }; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 847 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 848 | composer = body; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 849 | replyingTo = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 850 | composerEl?.focus(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 851 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 852 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 853 | function cancelEdit(): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 854 | if (!editing) return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 855 | composer = editing.stash; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 856 | editing = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 857 | composerEl?.focus(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 858 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 859 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 860 | function submitEdit(): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 861 | if (!editing) return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 862 | const { roomId, eventId, original } = editing; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 863 | const body = composer.trim(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 864 | cancelEdit(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 865 | if (!body || body === original.trim()) return; |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 866 | editMessage(roomId, eventId, body, resolveMentions(body, pickedMentions[roomId] ?? []), $markdownEnabled).catch((e) => pushBanner(e instanceof Error ? e.message : 'Edit failed')); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 867 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 868 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 869 | function editLastOwn(): boolean { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 870 | for (let i = items.length - 1; i >= 0; i -= 1) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 871 | const entry = items[i]; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 872 | if (entry.kind !== 'event' || !entry.event.own) continue; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 873 | const ev = entry.event; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 874 | 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 | 875 | startEdit(ev.event_id, ev.content.message.body); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 876 | return true; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 877 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 878 | return false; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 879 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 880 | |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 881 | function startReply(target: ReplyReference): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 882 | if (editing) cancelEdit(); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 883 | replyingTo = target; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 884 | composerEl?.focus(); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 885 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 886 | |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 887 | function jumpTo(eventId: string): void { |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 888 | const el = timelineEl?.querySelector<HTMLElement>(`[data-event="${CSS.escape(eventId)}"]`); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 889 | if (!el) { |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 890 | pushBanner('The original message is not loaded. Scroll up to load older messages.'); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 891 | return; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 892 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 893 | stickToBottom = false; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 894 | el.scrollIntoView({ block: 'center', behavior: 'smooth' }); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 895 | el.classList.remove('flash'); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 896 | void el.offsetWidth; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 897 | el.classList.add('flash'); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 898 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 899 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 900 | let typedText = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 901 | let typedRoom: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 902 | $: trackTypingInput(composer, $selectedRoomId, openReady); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 903 | function trackTypingInput(text: string, roomId: string | null, ready: Record<string, boolean>): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 904 | const edited = roomId === typedRoom && text !== typedText; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 905 | typedText = text; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 906 | typedRoom = roomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 907 | if (!roomId || !ready[roomId] || !text.trim()) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 908 | stopTyping(); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 909 | } else if (edited && roomId !== peeking) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 910 | notifyTyping(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 911 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 912 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 913 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 914 | $: void trackPending($selectedRoomId, pendingItems); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 915 | async function trackPending(roomId: string | null, list: PendingMessage[]): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 916 | if (!roomId || list.length === 0) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 917 | if (roomId !== $selectedRoomId) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 918 | await tick(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 919 | if (stickToBottom) scrollToBottom(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 920 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 921 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 922 | function updateMentionQuery(): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 923 | const roomId = $selectedRoomId; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 924 | const next = composerEl && roomId ? mentionQueryAt(composerEl.value, composerEl.selectionStart ?? composerEl.value.length) : null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 925 | if (next && !mentionQuery && roomId && !$membersByRoom[roomId]) void loadMembers(roomId); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 926 | if (next?.start !== mentionQuery?.start) mentionIndex = 0; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 927 | mentionQuery = next; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 928 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 929 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 930 | async function pickMention(person: Person): Promise<void> { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 931 | const roomId = $selectedRoomId; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 932 | if (!mentionQuery || !roomId || !composerEl) return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 933 | const caret = composerEl.selectionStart ?? composer.length; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 934 | const inserted = `${person.name} `; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 935 | composer = composer.slice(0, mentionQuery.start) + inserted + composer.slice(caret); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 936 | const at = mentionQuery.start + inserted.length; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 937 | pickedMentions = { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 938 | ...pickedMentions, |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 939 | [roomId]: [...(pickedMentions[roomId] ?? []), { user_id: person.user_id, text: person.name }] |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 940 | }; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 941 | mentionQuery = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 942 | await tick(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 943 | composerEl.focus(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 944 | composerEl.setSelectionRange(at, at); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 945 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 946 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 947 | function onComposerKey(ev: KeyboardEvent): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 948 | if (mentionQuery && mentionCandidates.length > 0) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 949 | if (ev.key === 'ArrowDown' || ev.key === 'ArrowUp') { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 950 | ev.preventDefault(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 951 | const step = ev.key === 'ArrowDown' ? 1 : -1; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 952 | mentionIndex = (mentionIndex + step + mentionCandidates.length) % mentionCandidates.length; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 953 | return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 954 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 955 | if ((ev.key === 'Enter' && !ev.shiftKey) || ev.key === 'Tab') { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 956 | ev.preventDefault(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 957 | void pickMention(mentionCandidates[mentionIndex]); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 958 | return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 959 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 960 | if (ev.key === 'Escape') { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 961 | ev.stopPropagation(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 962 | mentionQuery = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 963 | return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 964 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 965 | } |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 966 | if (ev.key === 'Enter' && !ev.shiftKey && !insideOpenFence(composer, composerEl?.selectionStart ?? composer.length)) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 967 | ev.preventDefault(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 968 | send(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 969 | } else if (ev.key === 'Escape' && editing) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 970 | ev.stopPropagation(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 971 | cancelEdit(); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 972 | } else if (ev.key === 'Escape' && replyingTo) { |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 973 | ev.stopPropagation(); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 974 | replyingTo = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 975 | } else if (ev.key === 'ArrowUp' && !composer && !editing && editLastOwn()) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 976 | ev.preventDefault(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 977 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 978 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 979 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 980 | function pickFiles(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 981 | const roomId = $selectedRoomId; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 982 | if (!roomId || !openReady[roomId]) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 983 | fileInput?.click(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 984 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 985 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 986 | function onFileChosen(): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 987 | stageFiles(Array.from(fileInput?.files ?? [])); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 988 | if (fileInput) fileInput.value = ''; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 989 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 990 | |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 991 | function onComposerPaste(ev: ClipboardEvent): void { |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 992 | const data = ev.clipboardData; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 993 | // Office apps put a rendered image next to the copied text, so only take the image when there is no plain text. |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 994 | if (!data || data.types.includes('text/plain')) return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 995 | const images = Array.from(data.files).filter((f) => f.type.startsWith('image/')); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 996 | if (images.length === 0) return; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 997 | ev.preventDefault(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 998 | stageFiles(images); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 999 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1000 | |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1001 | async function react(eventId: string, key: string, shortcode?: string): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1002 | const roomId = $selectedRoomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1003 | if (!roomId || !eventId || reacting) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1004 | reacting = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1005 | try { |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1006 | await reactToMessage(roomId, eventId, key, shortcode); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1007 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1008 | pushBanner(e instanceof Error ? e.message : 'Reaction failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1009 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1010 | reacting = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1011 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1012 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1013 | |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1014 | function previewLoader(roomId: string): (url: string) => void { |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1015 | return (url) => requestLinkPreview(roomId, url); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1016 | } |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1017 | |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1018 | async function changeEncryptedPreviews(enabled: boolean): Promise<void> { |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1019 | try { |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1020 | await saveUrlPreviewSettings({ encrypted_rooms: enabled }); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1021 | } catch (e) { |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1022 | pushBanner(e instanceof Error ? e.message : 'Could not save link preview setting'); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1023 | } |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1024 | } |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1025 | |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1026 | async function changeQuickReactions(list: QuickReaction[]): Promise<void> { |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1027 | try { |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1028 | await saveQuickReactions(list); |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1029 | } catch (e) { |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1030 | pushBanner(e instanceof Error ? e.message : 'Could not save quick reactions'); |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1031 | } |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1032 | } |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1033 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1034 | async function paginate(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1035 | const roomId = $selectedRoomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1036 | if (!roomId || paginateBusy) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1037 | paginateBusy = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1038 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1039 | await paginateRoom(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1040 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1041 | pushBanner(e instanceof Error ? e.message : 'Loading older messages failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1042 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1043 | paginateBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1044 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1045 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1046 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1047 | async function loadMembers(roomId: string): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1048 | if (membersFor === roomId && $membersLoading) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1049 | membersFor = roomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1050 | membersLoading.set(true); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1051 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1052 | const res = await getMembers(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1053 | membersByRoom.update((all) => ({ ...all, [roomId]: res.members })); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1054 | avatarByUser = { ...avatarByUser, ...avatarMap(res.members) }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1055 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1056 | pushBanner(e instanceof Error ? e.message : 'Could not load members'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1057 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1058 | if (membersFor === roomId) membersLoading.set(false); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1059 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1060 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1061 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1062 | function avatarMap(list: MemberSummary[]): Record<string, string | null> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1063 | const next: Record<string, string | null> = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1064 | for (const member of list) next[member.user_id] = member.avatar; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1065 | return next; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1066 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1067 | |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1068 | function peopleIn(list: TimelineItem[], roster: MemberSummary[]): Record<string, Person> { |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1069 | const out: Record<string, Person> = {}; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1070 | for (const item of list) { |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1071 | if (item.kind !== 'event') continue; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1072 | const s = item.event.sender; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1073 | out[s.user_id] = { user_id: s.user_id, name: senderLabel(s), avatar: s.avatar }; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1074 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1075 | for (const m of roster) out[m.user_id] = { user_id: m.user_id, name: m.name, avatar: m.avatar }; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1076 | return out; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1077 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1078 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1079 | function senderAvatarFor(userId: string): string | null { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1080 | return avatarByUser[userId] ?? null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1081 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1082 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1083 | function toggleMembers(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1084 | membersOpen = !membersOpen; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1085 | if (membersOpen && $selectedRoomId) void loadMembers($selectedRoomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1086 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1087 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1088 | async function join(target: string): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1089 | const room = target.trim(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1090 | if (!room || joinBusy) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1091 | joinBusy = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1092 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1093 | const res = await joinRoom(room); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1094 | joinTarget = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1095 | dialog = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1096 | await refreshRooms(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1097 | await selectRoom(res.room_id); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1098 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1099 | pushBanner(e instanceof Error ? e.message : 'Join failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1100 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1101 | joinBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1102 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1103 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1104 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1105 | async function create(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1106 | const name = createName.trim(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1107 | if (!name || createBusy) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1108 | createBusy = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1109 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1110 | const res = await createRoom(name, createTopic.trim() || undefined); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1111 | createName = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1112 | createTopic = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1113 | dialog = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1114 | await refreshRooms(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1115 | await selectRoom(res.room_id); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1116 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1117 | pushBanner(e instanceof Error ? e.message : 'Create room failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1118 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1119 | createBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1120 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1121 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1122 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1123 | async function leave(roomId: string | null = $selectedRoomId): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1124 | if (!roomId || leaveBusy) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1125 | leaveBusy = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1126 | stopTyping(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1127 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1128 | await leaveRoom(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1129 | if ($selectedRoomId === roomId) selectedRoomId.set(null); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1130 | if (warmRooms.includes(roomId)) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1131 | forgetOpenRoom(roomId); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1132 | closeRoom(roomId).catch(() => undefined); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1133 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1134 | await refreshRooms(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1135 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1136 | pushBanner(e instanceof Error ? e.message : 'Leave failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1137 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1138 | leaveBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1139 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1140 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1141 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1142 | function connectionClass(state: string): string { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1143 | if (state === 'online') return 'dot-online'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1144 | if (state === 'connecting' || state === 'reconnecting') return 'dot-busy'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1145 | return 'dot-off'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1146 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1147 | |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1148 | let dragSpaceId: string | null = null; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1149 | let dropTarget: { id: string; after: boolean } | null = null; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1150 | let menu: { items: MenuItem[]; x: number; y: number } | null = null; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1151 | let userCard: { userId: string; x: number; y: number; confirm: 'kick' | 'ban' | null } | null = null; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1152 | let levelsByRoom: Record<string, PowerLevels | null> = {}; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1153 | let peeking: string | null = null; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1154 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1155 | $: roomLevels = $selectedRoomId ? (levelsByRoom[$selectedRoomId] ?? null) : null; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1156 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1157 | function personFor(userId: string): Person { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1158 | return people[userId] ?? { user_id: userId, name: userId, avatar: avatarByUser[userId] ?? null }; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1159 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1160 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1161 | function memberFor(userId: string): MemberSummary | null { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1162 | return members.find((m) => m.user_id === userId) ?? null; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1163 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1164 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1165 | async function loadLevels(roomId: string): Promise<void> { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1166 | try { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1167 | const levels = parsePowerLevels(await runCommand({ op: 'power_levels', room_id: roomId })); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1168 | levelsByRoom = { ...levelsByRoom, [roomId]: levels }; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1169 | } catch { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1170 | levelsByRoom = { ...levelsByRoom, [roomId]: levelsByRoom[roomId] ?? null }; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1171 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1172 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1173 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1174 | async function openUser(userId: string, x: number, y: number, asMenu: boolean): Promise<void> { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1175 | const roomId = $selectedRoomId; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1176 | if (roomId && !(roomId in levelsByRoom)) await loadLevels(roomId); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1177 | else if (roomId) void loadLevels(roomId); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1178 | if (asMenu) menu = { items: userMenuItems(userId, x, y), x, y }; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1179 | else userCard = { userId, x, y, confirm: null }; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1180 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1181 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1182 | function copyText(text: string): void { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1183 | navigator.clipboard.writeText(text).catch(() => pushBanner('Could not copy to the clipboard')); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1184 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1185 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1186 | function userMenuItems(userId: string, x: number, y: number): MenuItem[] { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1187 | const own = userId === $sessionUser; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1188 | const member = memberFor(userId); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1189 | const items: MenuItem[] = []; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1190 | if (!own) items.push({ label: 'Message', action: () => void userAction(userId, { kind: 'message' }) }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1191 | items.push({ label: 'Mention', action: () => void userAction(userId, { kind: 'mention' }) }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1192 | items.push({ label: 'Copy user ID', action: () => copyText(userId) }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1193 | if (roomLevels && $sessionUser) { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1194 | const can = allowed(roomLevels, $sessionUser, userId); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1195 | const banned = member?.membership === 'Ban'; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1196 | if (can.setLevel && !own) { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1197 | const muted = isMuted(roomLevels, userId); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1198 | items.push({ label: muted ? 'Unmute' : 'Mute', action: () => void userAction(userId, { kind: muted ? 'unmute' : 'mute' }) }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1199 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1200 | 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 | 1201 | if (can.ban && banned) items.push({ label: 'Unban', action: () => void userAction(userId, { kind: 'unban' }) }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1202 | 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 | 1203 | if (can.setLevel) items.push({ label: 'Power level…', action: () => (userCard = { userId, x, y, confirm: null }) }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1204 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1205 | if (!own) { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1206 | const kind = member?.ignored ? 'unignore' : 'ignore'; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1207 | items.push({ label: member?.ignored ? 'Unignore' : 'Ignore', action: () => void userAction(userId, { kind }) }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1208 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1209 | return items; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1210 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1211 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1212 | async function insertMention(person: Person): Promise<void> { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1213 | const roomId = $selectedRoomId; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1214 | if (!roomId) return; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1215 | const lead = composer && !/\s$/.test(composer) ? ' ' : ''; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1216 | composer = `${composer}${lead}${person.name} `; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1217 | pickedMentions = { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1218 | ...pickedMentions, |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1219 | [roomId]: [...(pickedMentions[roomId] ?? []), { user_id: person.user_id, text: person.name }] |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1220 | }; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1221 | await tick(); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1222 | composerEl?.focus(); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1223 | composerEl?.setSelectionRange(composer.length, composer.length); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1224 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1225 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1226 | async function userAction(userId: string, action: UserAction): Promise<void> { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1227 | const roomId = $selectedRoomId; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1228 | try { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1229 | switch (action.kind) { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1230 | case 'message': { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1231 | const res = (await runCommand({ op: 'direct', user_id: userId })) as { room_id: string }; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1232 | await refreshRooms(); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1233 | await selectRoom(res.room_id); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1234 | return; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1235 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1236 | case 'mention': |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1237 | await insertMention(personFor(userId)); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1238 | return; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1239 | case 'ignore': |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1240 | case 'unignore': |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1241 | await runCommand({ op: action.kind, user_id: userId }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1242 | if (roomId) void loadMembers(roomId); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1243 | return; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1244 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1245 | if (!roomId) return; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1246 | switch (action.kind) { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1247 | case 'kick': |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1248 | case 'ban': |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1249 | await runCommand({ op: action.kind, room_id: roomId, user_id: userId, reason: action.reason }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1250 | break; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1251 | case 'unban': |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1252 | await runCommand({ op: 'unban', room_id: roomId, user_id: userId, reason: null }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1253 | break; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1254 | case 'mute': |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1255 | case 'unmute': |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1256 | await runCommand({ op: 'mute', room_id: roomId, user_id: userId, muted: action.kind === 'mute' }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1257 | break; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1258 | case 'power': |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1259 | await runCommand({ op: 'set_power_level', room_id: roomId, user_id: userId, level: action.level }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1260 | break; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1261 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1262 | void loadLevels(roomId); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1263 | void loadMembers(roomId); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1264 | } catch (e) { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1265 | pushBanner(e instanceof Error ? e.message : 'That action failed'); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1266 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1267 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1268 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1269 | function roomMenuItems(room: RoomSummary): MenuItem[] { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1270 | const items: MenuItem[] = room.space |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1271 | ? [{ label: 'Open', action: () => void selectSpace(room.room_id) }] |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1272 | : [ |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1273 | { label: 'Open', action: () => void selectRoom(room.room_id) }, |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1274 | { label: 'Peek', action: () => void selectRoom(room.room_id, true) } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1275 | ]; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1276 | items.push({ label: room.favourite ? 'Unpin' : room.space ? 'Pin to top' : 'Pin', action: () => void togglePin(room) }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1277 | items.push({ label: 'Copy link', action: () => copyText(`https://matrix.to/#/${room.canonical_alias ?? room.room_id}`) }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1278 | items.push({ label: 'Copy room ID', action: () => copyText(room.room_id) }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1279 | if (room.membership === 'Joined') items.push({ label: 'Leave', danger: true, action: () => void leave(room.room_id) }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1280 | return items; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1281 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1282 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1283 | function openRoomMenu(ev: MouseEvent, room: RoomSummary): void { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1284 | menu = { items: roomMenuItems(room), x: ev.clientX, y: ev.clientY }; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1285 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1286 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1287 | function stopPeeking(): void { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1288 | peeking = null; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1289 | queueReadReceipt(); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1290 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1291 | |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1292 | async function togglePin(room: RoomSummary): Promise<void> { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1293 | try { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1294 | await runCommand({ op: 'set_favourite', room_id: room.room_id, favourite: !room.favourite }); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1295 | } catch (e) { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1296 | pushBanner(e instanceof Error ? e.message : 'Could not change the pin'); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1297 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1298 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1299 | |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1300 | function startRailDrag(ev: DragEvent, id: string): void { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1301 | dragSpaceId = id; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1302 | if (ev.dataTransfer) { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1303 | ev.dataTransfer.effectAllowed = 'move'; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1304 | ev.dataTransfer.setData('text/plain', id); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1305 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1306 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1307 | |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1308 | function overRailSpace(ev: DragEvent, space: RoomSummary): void { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1309 | const dragged = orderedRail.find((s) => s.room_id === dragSpaceId); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1310 | if (!dragged || dragged.room_id === space.room_id || dragged.favourite !== space.favourite) return; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1311 | ev.preventDefault(); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1312 | const rect = (ev.currentTarget as HTMLElement).getBoundingClientRect(); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1313 | dropTarget = { id: space.room_id, after: ev.clientY > rect.top + rect.height / 2 }; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1314 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1315 | |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1316 | async function dropRailSpace(): Promise<void> { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1317 | const moved = dragSpaceId; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1318 | const target = dropTarget; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1319 | dragSpaceId = null; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1320 | dropTarget = null; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1321 | if (!moved || !target) return; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1322 | const ids = orderedRail.map((s) => s.room_id); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1323 | const before = target.after ? (ids[ids.indexOf(target.id) + 1] ?? null) : target.id; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1324 | const order = moveBefore(ids, moved, before === moved ? null : before); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1325 | if (order.join() === ids.join()) return; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1326 | railOverride = order; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1327 | try { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1328 | await runCommand({ op: 'reorder_spaces', order }); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1329 | } catch (e) { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1330 | railOverride = null; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1331 | pushBanner(e instanceof Error ? e.message : 'Could not reorder spaces'); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1332 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1333 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1334 | |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1335 | let roomMenuOpen = false; |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1336 | let roomMenuEl: HTMLDivElement | null = null; |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1337 | |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1338 | function roomMenuAction(action: () => void): void { |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1339 | roomMenuOpen = false; |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1340 | action(); |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1341 | } |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1342 | |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1343 | function closeRoomMenuOutside(ev: PointerEvent): void { |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1344 | if (roomMenuOpen && !roomMenuEl?.contains(ev.target as Node)) roomMenuOpen = false; |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1345 | } |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1346 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1347 | function onKeydown(ev: KeyboardEvent): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1348 | if (ev.key === 'Escape') { |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1349 | if (roomMenuOpen) roomMenuOpen = false; |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1350 | else if (dialog) dialog = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1351 | else if (membersOpen && window.innerWidth < 1100) membersOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1352 | else if (sidebarOpen) sidebarOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1353 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1354 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1355 | </script> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1356 | |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1357 | <svelte:window |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1358 | on:keydown={onKeydown} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1359 | on:pointerdown={closeRoomMenuOutside} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1360 | on:pointerup={() => (draggingScrollbar = false)} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1361 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1362 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1363 | {#if !booted} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1364 | <div class="splash" role="status" aria-label="Loading Malice"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1365 | <div class="splash-mark" aria-hidden="true">M</div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1366 | <p>Loading Malice…</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1367 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1368 | {:else if $blocked} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1369 | <div class="splash" role="status" aria-label="Malice is open in another tab"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1370 | <div class="splash-mark" aria-hidden="true">M</div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1371 | <p>Malice is open in another tab. Close this tab or use that one instead.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1372 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1373 | {:else if $sessionUser == null} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1374 | <LoginPanel softLogout={$softLogout} on:done={(ev) => afterLogin(ev.detail)} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1375 | {:else} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1376 | <div |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1377 | class="app" |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1378 | class:nav-folded={$navFolded && selectedRoom} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1379 | class:rail-folded={$railFolded && selectedRoom} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1380 | class:members-open={selectedRoom && membersOpen} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1381 | style:--msg-gap={`${$messageSpacing}px`} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1382 | style:--msg-line-height={$lineHeight} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1383 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1384 | <nav class="rail" aria-label="Servers and spaces"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1385 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1386 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1387 | class="rail-btn" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1388 | class:active={selectedSpaceId === null} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1389 | title="Home — all channels" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1390 | aria-label="Home — all channels" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1391 | aria-pressed={selectedSpaceId === null} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1392 | on:click={() => void selectHome()} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1393 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1394 | <span aria-hidden="true">⌂</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1395 | </button> |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1396 | {#each [pinnedRail, otherRail] as group} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1397 | {#if group.length > 0} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1398 | <div class="rail-sep" aria-hidden="true"></div> |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1399 | {/if} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1400 | {#each group as space (space.room_id)} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1401 | <button |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1402 | type="button" |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1403 | class="rail-btn rail-space" |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1404 | class:active={railSelected === space.room_id} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1405 | class:drop-before={dropTarget?.id === space.room_id && !dropTarget.after} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1406 | class:drop-after={dropTarget?.id === space.room_id && dropTarget.after} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1407 | class:pinned={space.favourite} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1408 | title={space.name} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1409 | aria-label={`Show channels in space ${space.name}`} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1410 | aria-pressed={selectedSpaceId === space.room_id} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1411 | draggable="true" |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1412 | on:click={() => void selectSpace(space.room_id)} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1413 | on:contextmenu|preventDefault={(ev) => openRoomMenu(ev, space)} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1414 | on:dragstart={(ev) => startRailDrag(ev, space.room_id)} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1415 | on:dragover={(ev) => overRailSpace(ev, space)} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1416 | on:dragleave={() => dropTarget?.id === space.room_id && (dropTarget = null)} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1417 | on:drop|preventDefault={() => void dropRailSpace()} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1418 | on:dragend={() => ((dragSpaceId = null), (dropTarget = null))} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1419 | > |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1420 | <MxcAvatar mxc={space.avatar} label={space.name} size={44} shape="rounded" /> |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1421 | </button> |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1422 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1423 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1424 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1425 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1426 | class="rail-btn rail-add" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1427 | aria-label="Join or create a room" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1428 | on:click={() => { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1429 | dialog = 'join'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1430 | }} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1431 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1432 | <span aria-hidden="true">+</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1433 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1434 | </nav> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1435 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1436 | {#if menu} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1437 | <ContextMenu items={menu.items} x={menu.x} y={menu.y} onClose={() => (menu = null)} /> |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1438 | {/if} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1439 | {#if userCard} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1440 | {#key userCard} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1441 | {@const cardUser = userCard.userId} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1442 | <UserCard |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1443 | person={personFor(cardUser)} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1444 | member={memberFor(cardUser)} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1445 | levels={roomLevels} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1446 | self={$sessionUser ?? null} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1447 | x={userCard.x} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1448 | y={userCard.y} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1449 | confirm={userCard.confirm} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1450 | onAction={(action) => void userAction(cardUser, action)} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1451 | onClose={() => (userCard = null)} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1452 | /> |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1453 | {/key} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1454 | {/if} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1455 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1456 | <aside class="sidebar" class:open={sidebarOpen} aria-label="Rooms"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1457 | <div class="side-search"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1458 | <label class="visually-hidden" for="room-search">Search rooms</label> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1459 | <input |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1460 | id="room-search" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1461 | type="search" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1462 | placeholder="Search rooms" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1463 | bind:value={search} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1464 | autocomplete="off" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1465 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1466 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1467 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1468 | class="icon-btn" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1469 | title="Refresh rooms" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1470 | aria-label="Refresh rooms" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1471 | disabled={roomsLoading} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1472 | on:click={() => void refreshRooms()} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1473 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1474 | <span aria-hidden="true">⟳</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1475 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1476 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1477 | <div class="side-scroll"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1478 | {#if selectedSpace} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1479 | <div class="space-context"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1480 | <MxcAvatar mxc={selectedSpace.avatar} label={selectedSpace.name} size={28} shape="rounded" /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1481 | <div class="space-context-text"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1482 | <strong>{selectedSpace.name}</strong> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1483 | </div> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1484 | {#if spaceParents.has(selectedSpace.room_id)} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1485 | {@const parentId = spaceParents.get(selectedSpace.room_id) ?? ''} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1486 | <button |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1487 | type="button" |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1488 | class="icon-btn" |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1489 | title="Up to the parent space" |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1490 | aria-label="Up to the parent space" |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1491 | on:click={() => void selectSpace(parentId)} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1492 | > |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1493 | <span aria-hidden="true">↑</span> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1494 | </button> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1495 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1496 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1497 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1498 | <div class="space-context"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1499 | <div class="space-context-text"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1500 | <strong>Home</strong> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1501 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1502 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1503 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1504 | {#if roomsLoading && $rooms.length === 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1505 | <p class="side-note">Loading rooms…</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1506 | {:else if $rooms.length === 0} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1507 | <p class="side-note">No rooms yet</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1508 | <div class="side-cta"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1509 | <button type="button" on:click={() => (dialog = 'join')}>Join a room</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1510 | <button type="button" on:click={() => (dialog = 'create')}>Create one</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1511 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1512 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1513 | {#if selectedSpaceId && spaceChildrenLoading} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1514 | <p class="side-note">Loading channels…</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1515 | {:else if selectedSpaceId && spaceChildrenError} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1516 | <p class="side-note" role="alert">{spaceChildrenError}</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1517 | <div class="side-cta"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1518 | <button type="button" on:click={() => selectedSpaceId && void selectSpace(selectedSpaceId)}>Retry</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1519 | <button type="button" on:click={() => void selectHome()}>Back to Home</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1520 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1521 | {:else if selectedSpaceId && spaceChildIds && channelRooms.length === 0} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1522 | <p class="side-note">No channels</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1523 | <div class="side-cta"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1524 | <button type="button" on:click={() => void selectHome()}>Back to Home</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1525 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1526 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1527 | {#if invites.length > 0 && !selectedSpaceId} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1528 | <h2 class="side-h">Invites</h2> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1529 | <ul class="room-list"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1530 | {#each invites as room (room.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1531 | <li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1532 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1533 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1534 | class="room-row" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1535 | class:active={$selectedRoomId === room.room_id} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1536 | on:click={() => void selectRoom(room.room_id)} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1537 | on:contextmenu|preventDefault={(ev) => openRoomMenu(ev, room)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1538 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1539 | <MxcAvatar mxc={room.avatar} label={room.name} size={26} shape="rounded" /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1540 | <span class="room-name">{room.name}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1541 | <span |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1542 | class="invite-join" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1543 | role="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1544 | tabindex="0" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1545 | aria-label={`Join ${room.name}`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1546 | on:click|stopPropagation={() => void join(room.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1547 | on:keydown|stopPropagation={(ev) => { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1548 | if (ev.key === 'Enter' || ev.key === ' ') { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1549 | ev.preventDefault(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1550 | void join(room.room_id); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1551 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1552 | }} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1553 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1554 | Join |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1555 | </span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1556 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1557 | </li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1558 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1559 | </ul> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1560 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1561 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1562 | {#if directRooms.length > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1563 | <h2 class="side-h">Direct messages</h2> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1564 | <ul class="room-list"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1565 | {#each directRooms as room (room.room_id)} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1566 | <li class="room-item"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1567 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1568 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1569 | class="room-row" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1570 | class:active={$selectedRoomId === room.room_id} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1571 | aria-current={$selectedRoomId === room.room_id ? 'true' : undefined} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1572 | on:click={() => void selectRoom(room.room_id)} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1573 | on:contextmenu|preventDefault={(ev) => openRoomMenu(ev, room)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1574 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1575 | <MxcAvatar mxc={room.avatar} label={room.name} size={26} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1576 | <span class="room-name">{room.name}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1577 | {#if roomUnread(room) > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1578 | <span |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1579 | class="badge" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1580 | class:mention={room.unread_mentions > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1581 | aria-label={`${roomUnread(room)} unread`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1582 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1583 | {roomUnread(room) > 99 ? '99+' : roomUnread(room)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1584 | </span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1585 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1586 | </button> |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1587 | <PinButton pinned={room.favourite} label={room.name} onToggle={() => void togglePin(room)} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1588 | </li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1589 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1590 | </ul> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1591 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1592 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1593 | {#if groupRooms.length > 0} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1594 | <h2 class="side-h">{selectedSpace ? 'Channels' : 'Rooms'}</h2> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1595 | <ul class="room-list"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1596 | {#each groupRooms as room (room.room_id)} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1597 | <li class="room-item"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1598 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1599 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1600 | class="room-row" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1601 | class:active={$selectedRoomId === room.room_id} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1602 | aria-current={$selectedRoomId === room.room_id ? 'true' : undefined} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1603 | on:click={() => void selectRoom(room.room_id)} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1604 | on:contextmenu|preventDefault={(ev) => openRoomMenu(ev, room)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1605 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1606 | <MxcAvatar mxc={room.avatar} label={room.name} size={26} shape="rounded" /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1607 | <span class="room-hash" aria-hidden="true">#</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1608 | <span class="room-name">{room.name}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1609 | {#if roomUnread(room) > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1610 | <span |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1611 | class="badge" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1612 | class:mention={room.unread_mentions > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1613 | aria-label={`${roomUnread(room)} unread`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1614 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1615 | {roomUnread(room) > 99 ? '99+' : roomUnread(room)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1616 | </span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1617 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1618 | </button> |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1619 | <PinButton pinned={room.favourite} label={room.name} onToggle={() => void togglePin(room)} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1620 | </li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1621 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1622 | </ul> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1623 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1624 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1625 | {#if spaceList.length > 0} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1626 | <h2 class="side-h">{selectedSpace ? 'Subspaces' : 'Spaces'}</h2> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1627 | <ul class="room-list"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1628 | {#each spaceList as room (room.room_id)} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1629 | <li class="room-item"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1630 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1631 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1632 | class="room-row" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1633 | class:active={selectedSpaceId === room.room_id} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1634 | aria-label={`Show channels in space ${room.name}`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1635 | on:click={() => void selectSpace(room.room_id)} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1636 | on:contextmenu|preventDefault={(ev) => openRoomMenu(ev, room)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1637 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1638 | <MxcAvatar mxc={room.avatar} label={room.name} size={26} shape="rounded" /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1639 | <span class="room-hash" aria-hidden="true">◇</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1640 | <span class="room-name">{room.name}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1641 | </button> |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1642 | <PinButton pinned={room.favourite} label={room.name} onToggle={() => void togglePin(room)} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1643 | </li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1644 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1645 | </ul> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1646 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1647 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1648 | {#if query && visibleRooms.length === 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1649 | <p class="side-note">No rooms match “{search.trim()}”.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1650 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1651 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1652 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1653 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1654 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1655 | <div class="side-footer"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1656 | <div class="me" title={$sessionUser}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1657 | {#if profileMxc} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1658 | <MxcAvatar mxc={profileMxc} label={profile?.display_name ?? $sessionUser} size={30} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1659 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1660 | <span class="me-avatar" aria-hidden="true">{$sessionUser.slice(1, 2).toUpperCase()}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1661 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1662 | <span class="me-id">{profile?.display_name && profile.display_name !== $sessionUser ? `${profile.display_name} (${$sessionUser})` : $sessionUser}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1663 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1664 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1665 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1666 | class="icon-btn" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1667 | title="Encryption and verification" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1668 | aria-label="Encryption and verification" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1669 | on:click={() => (dialog = 'security')} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1670 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1671 | <span aria-hidden="true">🛡</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1672 | </button> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1673 | <button |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1674 | type="button" |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1675 | class="icon-btn" |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1676 | title="Settings" |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1677 | aria-label="Settings" |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1678 | on:click={() => (dialog = 'settings')} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1679 | > |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1680 | <span aria-hidden="true">⚙</span> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1681 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1682 | <button type="button" class="icon-btn" title="Log out" aria-label="Log out" on:click={() => void doLogout()}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1683 | <span aria-hidden="true">⏻</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1684 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1685 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1686 | </aside> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1687 | {#if sidebarOpen} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1688 | <button type="button" class="scrim" aria-label="Close room list" on:click={() => (sidebarOpen = false)}></button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1689 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1690 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1691 | <main class="chat"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1692 | {#if $banners.length > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1693 | <div class="banners" aria-live="polite"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1694 | {#each $banners as banner (banner.id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1695 | <div class="banner" role="alert"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1696 | <span>{banner.message}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1697 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1698 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1699 | aria-label="Dismiss error" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1700 | on:click={() => dismissBanner(banner.id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1701 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1702 | ✕ |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1703 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1704 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1705 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1706 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1707 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1708 | {#if !selectedRoom} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1709 | <div class="empty"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1710 | <div class="empty-mark" aria-hidden="true">◈</div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1711 | {#if selectedSpace} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1712 | <h1>{selectedSpace.name}</h1> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1713 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1714 | <h1>Welcome to Malice</h1> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1715 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1716 | <div class="empty-cta"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1717 | <button type="button" class="primary-btn" on:click={() => (dialog = 'join')}>Join a room</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1718 | <button type="button" class="ghost-btn" on:click={() => (dialog = 'create')}>Create a room</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1719 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1720 | <p class="conn-line"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1721 | <span class="dot {connectionClass($connection)}" aria-hidden="true"></span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1722 | {$connection} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1723 | </p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1724 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1725 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1726 | <header class="chat-head"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1727 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1728 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1729 | class="icon-btn only-mobile" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1730 | aria-label="Open room list" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1731 | on:click={() => (sidebarOpen = true)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1732 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1733 | <span aria-hidden="true">☰</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1734 | </button> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1735 | <button |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1736 | type="button" |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1737 | class="icon-btn only-desktop pane-toggle" |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1738 | aria-pressed={!$railFolded} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1739 | aria-label={$railFolded ? 'Show spaces' : 'Hide spaces'} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1740 | title={$railFolded ? 'Show spaces' : 'Hide spaces'} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1741 | on:click={() => railFolded.update((v) => !v)} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1742 | > |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1743 | <svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true"> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1744 | <rect x="3" y="4" width="18" height="16" rx="2" fill="none" stroke="currentColor" stroke-width="2" /> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1745 | <circle cx="7" cy="9" r="1.4" fill="currentColor" /> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1746 | <circle cx="7" cy="13" r="1.4" fill="currentColor" /> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1747 | <circle cx="7" cy="17" r="1.4" fill="currentColor" /> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1748 | </svg> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1749 | </button> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1750 | <button |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1751 | type="button" |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1752 | class="icon-btn only-desktop pane-toggle" |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1753 | aria-pressed={!$navFolded} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1754 | aria-label={$navFolded ? 'Show channels' : 'Hide channels'} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1755 | title={$navFolded ? 'Show channels' : 'Hide channels'} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1756 | on:click={() => navFolded.update((v) => !v)} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1757 | > |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1758 | <svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true"> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1759 | <rect x="3" y="4" width="18" height="16" rx="2" fill="none" stroke="currentColor" stroke-width="2" /> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1760 | <path d="M10 4v16" stroke="currentColor" stroke-width="2" /> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1761 | </svg> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1762 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1763 | <div class="head-title"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1764 | <div class="head-room"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1765 | <MxcAvatar mxc={selectedRoom.avatar} label={selectedRoom.name} size={36} shape={selectedRoom.space ? 'rounded' : 'circle'} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1766 | <div class="head-room-text"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1767 | <h1>{selectedRoom.name}</h1> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1768 | <div class="head-meta"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1769 | {#if selectedRoom.space} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1770 | <span class="pill">space</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1771 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1772 | {#if selectedRoom.encrypted} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1773 | <span class="pill" title="End-to-end encrypted">🔒 encrypted</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1774 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1775 | {#if selectedRoom.direct} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1776 | <span class="pill">direct</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1777 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1778 | <span class="conn" title={`Sync state: ${$connection}`}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1779 | <span class="dot {connectionClass($connection)}" aria-hidden="true"></span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1780 | {$connection} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1781 | </span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1782 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1783 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1784 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1785 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1786 | <div class="head-actions"> |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1787 | {#if peeking === selectedRoom.room_id} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1788 | <button type="button" class="icon-btn" aria-pressed="true" aria-label="Stop peeking" title="Stop peeking" on:click={stopPeeking}> |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1789 | <svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true"> |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1790 | <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" /> |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1791 | <circle cx="12" cy="12" r="3" fill="currentColor" /> |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1792 | </svg> |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1793 | </button> |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1794 | {/if} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1795 | {#if selectedRoom.membership !== 'Joined'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1796 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1797 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1798 | class="primary-btn" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1799 | disabled={joinBusy} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1800 | on:click={() => void join(selectedRoom.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1801 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1802 | {joinBusy ? 'Joining…' : 'Join'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1803 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1804 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1805 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1806 | type="button" |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1807 | class="icon-btn" |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1808 | aria-pressed={membersOpen} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1809 | aria-label={membersOpen ? 'Hide members' : 'Show members'} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1810 | title="Members" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1811 | on:click={toggleMembers} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1812 | > |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1813 | <svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true"> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1814 | <circle cx="12" cy="8" r="4" fill="none" stroke="currentColor" stroke-width="2" /> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1815 | <path d="M4 20c0-4 3.6-6 8-6s8 2 8 6" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" /> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1816 | </svg> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1817 | </button> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1818 | <div class="room-menu-wrap" bind:this={roomMenuEl}> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1819 | <button |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1820 | type="button" |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1821 | class="icon-btn" |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1822 | aria-haspopup="menu" |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1823 | aria-expanded={roomMenuOpen} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1824 | aria-label="Room options" |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1825 | title="Room options" |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1826 | on:click={() => (roomMenuOpen = !roomMenuOpen)} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1827 | > |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1828 | <span aria-hidden="true">⋯</span> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1829 | </button> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1830 | {#if roomMenuOpen} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1831 | <div class="room-menu" role="menu"> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1832 | <button type="button" role="menuitem" on:click={() => roomMenuAction(() => (dialog = 'security'))}> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1833 | Security |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1834 | </button> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1835 | {#if selectedRoom.membership === 'Joined'} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1836 | <button |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1837 | type="button" |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1838 | role="menuitem" |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1839 | class="danger" |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1840 | disabled={leaveBusy} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1841 | on:click={() => roomMenuAction(() => void leave())} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1842 | > |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1843 | {leaveBusy ? 'Leaving…' : 'Leave room'} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1844 | </button> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1845 | {/if} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1846 | </div> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1847 | {/if} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1848 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1849 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1850 | </header> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1851 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1852 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1853 | {#if recoveryBanner} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1854 | <div class="sec-banner warn" role="status"> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1855 | <span>Message history is locked</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1856 | <button type="button" on:click={() => (dialog = 'security')}>Recover</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1857 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1858 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1859 | {#if verificationBanner} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1860 | <div class="sec-banner" role="status"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1861 | {#if verificationBanner.kind === 'Incoming'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1862 | <span>A device wants to verify this session</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1863 | <button type="button" on:click={() => (dialog = 'security')}>Review request</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1864 | {:else if verificationBanner.kind === 'Comparison'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1865 | <span>Verification codes ready</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1866 | <button type="button" on:click={() => (dialog = 'security')}>Compare codes</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1867 | {:else if verificationBanner.kind === 'Waiting'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1868 | <span>Verification started</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1869 | <button type="button" on:click={() => (dialog = 'security')}>Open verification</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1870 | {:else if verificationBanner.kind === 'Failed'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1871 | <span>Verification failed: {verificationBanner.message}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1872 | <button type="button" on:click={() => (dialog = 'security')}>Try again</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1873 | {:else if verificationBanner.kind === 'Cancelled'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1874 | <span>Verification cancelled: {verificationBanner.reason}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1875 | <button type="button" on:click={() => (dialog = 'security')}>Open security</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1876 | {:else} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1877 | <span>Verification in progress</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1878 | <button type="button" on:click={() => (dialog = 'security')}>Open security</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1879 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1880 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1881 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1882 | {#if $selectedRoomId && openFailed[$selectedRoomId]} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1883 | <p class="conn-banner error" role="alert">{openFailed[$selectedRoomId]}</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1884 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1885 | |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1886 | <!-- svelte-ignore a11y_no_static_element_interactions --> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1887 | <div |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1888 | class="timeline" |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1889 | bind:this={timelineEl} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1890 | on:scroll={onTimelineScroll} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1891 | on:wheel={noteUserScroll} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1892 | on:touchmove={noteUserScroll} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1893 | on:keydown={onTimelineKey} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1894 | on:pointerdown={onTimelinePointer} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1895 | aria-label={`Messages in ${selectedRoom.name}`} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1896 | > |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1897 | <div class="timeline-inner" use:pinTimeline> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1898 | <div class="timeline-top"> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1899 | {#if hasStart} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1900 | <p class="start-note">Beginning of history</p> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1901 | {:else} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1902 | <button type="button" class="ghost-btn" disabled={paginateBusy} on:click={() => void paginate()}> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1903 | {paginateBusy ? 'Loading…' : 'Load older messages'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1904 | </button> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1905 | {/if} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1906 | </div> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1907 | {#if grouped.length === 0} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1908 | <p class="side-note timeline-empty">No messages yet</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1909 | {:else} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1910 | {#each grouped as g (g.key)} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1911 | {#if g.item.kind === 'day'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1912 | <div class="day-row"><span>{formatDay(g.item.timestamp_ms)}</span></div> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1913 | {:else if g.item.kind === 'readMarker'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1914 | <div class="new-row"><span>New</span></div> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1915 | {:else if g.item.kind === 'start'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1916 | <p class="start-note">Beginning of history</p> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1917 | {:else if g.item.kind === 'unknown'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1918 | <p class="unknown-note">Unsupported event ({g.item.label})</p> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1919 | {:else} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1920 | <MessageRow |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1921 | itemId={g.key} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1922 | event={g.item.event} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1923 | showSender={g.showSender} |
787cdbbf0721 | atagen | 2026-10-24 06:50 UTC | 1924 | senderAvatar={senderAvatarFor(g.item.event.sender.user_id) ?? g.item.event.sender.avatar} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1925 | {reacting} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1926 | onReact={(eventId, key, shortcode) => void react(eventId, key, shortcode)} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1927 | quickReactions={$quickReactions} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1928 | packs={roomPacks} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1929 | linkPreviews={$linkPreviews} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1930 | {loadPreview} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1931 | onQuickChange={(list) => void changeQuickReactions(list)} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1932 | {people} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1933 | self={$sessionUser ?? null} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1934 | onUser={(userId, x, y, asMenu) => void openUser(userId, x, y, asMenu)} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1935 | onReply={selectedRoom.membership === 'Joined' ? startReply : null} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1936 | onJump={jumpTo} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1937 | onEdit={selectedRoom.membership === 'Joined' ? startEdit : null} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1938 | editing={editing !== null && editing.eventId === g.item.event.event_id} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1939 | showSent={g.item.event.item_id === lastSentId && pendingItems.length === 0} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1940 | /> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1941 | {/if} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1942 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1943 | {/if} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1944 | {#each pendingItems as p, i (p.id)} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1945 | <MessageRow |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1946 | itemId={`pending-${p.id}`} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1947 | event={pendingToEvent(p)} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1948 | onJump={jumpTo} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1949 | showSender={pendingShowSender(i)} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1950 | senderAvatar={senderAvatarFor($sessionUser ?? '')} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1951 | {reacting} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1952 | onReact={(eventId, key, shortcode) => void react(eventId, key, shortcode)} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1953 | quickReactions={$quickReactions} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1954 | packs={roomPacks} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1955 | linkPreviews={$linkPreviews} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1956 | {loadPreview} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1957 | onQuickChange={(list) => void changeQuickReactions(list)} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1958 | /> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1959 | {#if p.status === 'failed'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1960 | <div class="pending-actions"> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1961 | <span class="pending-error" role="alert">{p.error}</span> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1962 | <button type="button" class="ghost-btn" on:click={() => retryPending(p.id)}>Retry</button> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1963 | <button type="button" class="ghost-btn danger" on:click={() => discardPending(p.id)}>Discard</button> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1964 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1965 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1966 | {/each} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1967 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1968 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1969 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1970 | {#if selectedRoom.membership === 'Joined'} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1971 | {#if editing} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1972 | <div class="reply-bar" role="status"> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1973 | <span class="reply-bar-label"> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1974 | Editing message |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1975 | <span class="reply-bar-text">{editing.original}</span> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1976 | </span> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1977 | <button type="button" class="icon-btn" aria-label="Cancel edit" title="Cancel edit (Esc)" on:click={cancelEdit}> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1978 | <span aria-hidden="true">✕</span> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1979 | </button> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1980 | </div> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1981 | {:else if replyingTo && replyingTo.details.kind === 'Ready'} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1982 | <div class="reply-bar" role="status"> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1983 | <span class="reply-bar-label"> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1984 | Replying to <strong>{senderLabel(replyingTo.details.sender)}</strong> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1985 | <span class="reply-bar-text">{contentPreview(replyingTo.details.content)}</span> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1986 | </span> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1987 | <button type="button" class="icon-btn" aria-label="Cancel reply" title="Cancel reply (Esc)" on:click={() => (replyingTo = null)}> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1988 | <span aria-hidden="true">✕</span> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1989 | </button> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1990 | </div> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1991 | {/if} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1992 | {#if $selectedRoomId && currentStaged.length > 0} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1993 | {@const stagedRoom = $selectedRoomId} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1994 | <ul class="staged" aria-label="Attachments to send"> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1995 | {#each currentStaged as attachment (attachment.id)} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1996 | <li class="staged-item"> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1997 | {#if attachment.previewUrl} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1998 | <img src={attachment.previewUrl} alt={attachment.file.name || 'Pasted image'} /> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1999 | {:else} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2000 | <span class="staged-name">{attachment.file.name || 'attachment'}</span> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2001 | {/if} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2002 | <button |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2003 | type="button" |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2004 | class="icon-btn staged-remove" |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2005 | aria-label={`Remove ${attachment.file.name || 'attachment'}`} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2006 | title="Remove" |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2007 | on:click={() => unstage(stagedRoom, attachment.id)} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2008 | > |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2009 | <span aria-hidden="true">✕</span> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2010 | </button> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2011 | </li> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2012 | {/each} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2013 | </ul> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2014 | {/if} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2015 | <form class="composer" class:replying={replyingTo || editing} class:staging={currentStaged.length > 0} on:submit|preventDefault={() => send()}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2016 | <label class="visually-hidden" for="composer">Message {selectedRoom.name}</label> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2017 | {#if mentionQuery && mentionCandidates.length > 0} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2018 | <ul class="mention-finder" role="listbox" aria-label="Mention someone"> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2019 | {#each mentionCandidates as person, i (person.user_id)} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2020 | <li |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2021 | role="option" |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2022 | aria-selected={i === mentionIndex} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2023 | class:active={i === mentionIndex} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2024 | on:pointerdown|preventDefault={() => void pickMention(person)} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2025 | on:pointerenter={() => (mentionIndex = i)} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2026 | > |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2027 | <MxcAvatar mxc={person.avatar} label={person.name} size={22} /> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2028 | <span class="mention-name">{person.name}</span> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2029 | <span class="mention-id">{person.user_id}</span> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2030 | </li> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2031 | {/each} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2032 | </ul> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2033 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2034 | <input |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2035 | type="file" |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2036 | multiple |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2037 | bind:this={fileInput} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2038 | class="visually-hidden" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2039 | aria-label="Attach a file" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2040 | on:change={() => void onFileChosen()} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2041 | /> |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 2042 | <input |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 2043 | type="file" |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 2044 | accept="image/*" |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 2045 | bind:this={avatarInput} |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 2046 | class="visually-hidden" |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 2047 | aria-label="Choose a new avatar" |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 2048 | on:change={() => void onAvatarChosen()} |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 2049 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2050 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2051 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2052 | class="ghost-btn" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2053 | title="Attach an image or file" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2054 | aria-label="Attach an image or file" |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2055 | disabled={!($selectedRoomId && openReady[$selectedRoomId])} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2056 | on:click={pickFiles} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2057 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2058 | {uploadBusy ? `Uploading ${uploadName ?? 'file'}…` : '📎'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2059 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2060 | <textarea |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2061 | id="composer" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2062 | bind:this={composerEl} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2063 | bind:value={composer} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2064 | rows="1" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2065 | placeholder={`Message ${selectedRoom.name}`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2066 | aria-label={`Message ${selectedRoom.name}. Enter to send, Shift Enter for a new line.`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2067 | on:keydown={onComposerKey} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2068 | on:input={updateMentionQuery} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2069 | on:click={updateMentionQuery} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2070 | on:keyup={(e) => (e.key.startsWith('Arrow') && e.key !== 'ArrowUp' && e.key !== 'ArrowDown') || e.key === 'Home' || e.key === 'End' ? updateMentionQuery() : undefined} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2071 | on:blur={() => (mentionQuery = null)} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2072 | on:paste={onComposerPaste} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2073 | disabled={!($selectedRoomId && openReady[$selectedRoomId])} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2074 | ></textarea> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2075 | <button |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 2076 | type="button" |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 2077 | class="icon-btn md-toggle" |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 2078 | aria-pressed={$markdownEnabled} |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 2079 | aria-label={$markdownEnabled ? 'Turn markdown off' : 'Turn markdown on'} |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 2080 | title={$markdownEnabled ? 'Markdown on' : 'Markdown off'} |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 2081 | on:click={() => markdownEnabled.update((v) => !v)} |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 2082 | > |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 2083 | <svg viewBox="0 0 24 16" width="22" height="15" aria-hidden="true"> |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 2084 | <rect x="1" y="1" width="22" height="14" rx="2" fill="none" stroke="currentColor" stroke-width="1.6" /> |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 2085 | <path d="M4.5 11.5v-7l2.75 3 2.75-3v7M15.5 4.5v6.5M13 8.5l2.5 2.75L18 8.5" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round" /> |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 2086 | </svg> |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 2087 | </button> |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 2088 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2089 | type="submit" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2090 | class="primary-btn" |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2091 | disabled={(!composer.trim() && currentStaged.length === 0) || |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2092 | !($selectedRoomId && openReady[$selectedRoomId]) || |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2093 | (currentStaged.length > 0 && uploadBusy)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2094 | title={!($selectedRoomId && openReady[$selectedRoomId]) ? 'Waiting for the room to open' : 'Send message'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2095 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2096 | Send |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2097 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2098 | </form> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2099 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2100 | <div class="join-bar"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2101 | <p>You are not a member of this room.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2102 | <button type="button" class="primary-btn" disabled={joinBusy} on:click={() => void join(selectedRoom.room_id)}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2103 | {joinBusy ? 'Joining…' : `Join ${selectedRoom.name}`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2104 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2105 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2106 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2107 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2108 | </main> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2109 | |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 2110 | {#if selectedRoom} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 2111 | <aside class="members" aria-hidden={!membersOpen} aria-label={`Members of ${selectedRoom.name}`}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2112 | <div class="members-head"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2113 | <h2>Members</h2> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2114 | <button type="button" class="icon-btn" aria-label="Close members" on:click={() => (membersOpen = false)}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2115 | <span aria-hidden="true">✕</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2116 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2117 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2118 | {#if $membersLoading && members.length === 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2119 | <p class="side-note">Loading members…</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2120 | {:else if members.length === 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2121 | <p class="side-note">No members loaded.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2122 | {#if $selectedRoomId} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2123 | <button type="button" class="ghost-btn" on:click={() => $selectedRoomId && void loadMembers($selectedRoomId)}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2124 | Retry |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2125 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2126 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2127 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2128 | <ul class="member-list"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2129 | {#each members as member (member.user_id)} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2130 | <li> |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2131 | <button |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2132 | type="button" |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2133 | class="member" |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2134 | on:click={(ev) => { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2135 | const rect = ev.currentTarget.getBoundingClientRect(); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2136 | void openUser(member.user_id, rect.left - 308, rect.top, false); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2137 | }} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2138 | on:contextmenu|preventDefault={(ev) => void openUser(member.user_id, ev.clientX, ev.clientY, true)} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2139 | > |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2140 | <MxcAvatar mxc={member.avatar} label={member.display_name || member.name || member.user_id} size={30} /> |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2141 | <span class="member-names"> |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2142 | <span class="member-name">{member.display_name || member.name}</span> |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2143 | <span class="member-id">{member.user_id}</span> |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2144 | </span> |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2145 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2146 | </li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2147 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2148 | </ul> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2149 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2150 | </aside> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2151 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2152 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2153 | {#if dialog} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2154 | <div class="modal-wrap" role="presentation" on:click|self={() => (dialog = null)}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2155 | {#if dialog === 'security'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2156 | <SecurityPanel |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2157 | encryptionState={$encryption} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2158 | verificationState={$verification} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2159 | onAction={() => void loadEncryption()} |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 2160 | encryptedPreviews={$urlPreviewSettings.encrypted_rooms} |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 2161 | onEncryptedPreviews={(enabled) => void changeEncryptedPreviews(enabled)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2162 | on:close={() => (dialog = null)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2163 | /> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2164 | {:else if dialog === 'settings'} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2165 | <SettingsPanel |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2166 | quick={$quickReactions} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2167 | packs={roomPacks} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2168 | onQuickChange={(list) => void changeQuickReactions(list)} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2169 | on:close={() => (dialog = null)} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2170 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2171 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2172 | <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 | 2173 | <div class="modal-tabs" role="tablist" aria-label="Room actions"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2174 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2175 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2176 | role="tab" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2177 | aria-selected={dialog === 'join'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2178 | class:active={dialog === 'join'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2179 | on:click={() => (dialog = 'join')} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2180 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2181 | Join |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2182 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2183 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2184 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2185 | role="tab" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2186 | aria-selected={dialog === 'create'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2187 | class:active={dialog === 'create'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2188 | on:click={() => (dialog = 'create')} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2189 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2190 | Create |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2191 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2192 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2193 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2194 | class="icon-btn modal-x" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2195 | aria-label="Close dialog" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2196 | on:click={() => (dialog = null)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2197 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2198 | <span aria-hidden="true">✕</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2199 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2200 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2201 | {#if dialog === 'join'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2202 | <form on:submit|preventDefault={() => void join(joinTarget)}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2203 | <label class="field"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2204 | <span>Room ID or alias</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2205 | <input |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2206 | type="text" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2207 | placeholder="!room:example.org or #alias:example.org" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2208 | bind:value={joinTarget} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2209 | required |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2210 | disabled={joinBusy} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2211 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2212 | </label> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2213 | <button type="submit" class="primary-btn wide" disabled={joinBusy || !joinTarget.trim()}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2214 | {joinBusy ? 'Joining…' : 'Join room'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2215 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2216 | </form> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2217 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2218 | <form on:submit|preventDefault={() => void create()}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2219 | <label class="field"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2220 | <span>Room name</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2221 | <input |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2222 | type="text" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2223 | placeholder="Weekend plans" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2224 | bind:value={createName} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2225 | required |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2226 | disabled={createBusy} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2227 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2228 | </label> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2229 | <label class="field"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2230 | <span>Topic (optional)</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2231 | <input |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2232 | type="text" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2233 | placeholder="What should this room be about?" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2234 | bind:value={createTopic} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2235 | disabled={createBusy} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2236 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2237 | </label> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2238 | <button type="submit" class="primary-btn wide" disabled={createBusy || !createName.trim()}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2239 | {createBusy ? 'Creating…' : 'Create room'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2240 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2241 | </form> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2242 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2243 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2244 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2245 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2246 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2247 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2248 | {/if} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2249 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2250 | <ImageLightbox /> |