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'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 6 | import SecurityPanel from './lib/SecurityPanel.svelte'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 7 | import { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 8 | closeRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 9 | createRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 10 | getEncryption, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 11 | getMembers, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 12 | getProfile, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 13 | getRooms, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 14 | getSession, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 15 | getSpaceChildren, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 16 | joinRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 17 | leaveRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 18 | logout, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 19 | markRead, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 20 | openRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 21 | paginateRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 22 | reactToMessage, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 23 | uploadAttachment |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 24 | } from './lib/api'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 25 | import { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 26 | banners, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 27 | blocked, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 28 | connectEvents, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 29 | connection, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 30 | disconnectEvents, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 31 | dismissBanner, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 32 | encryption, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 33 | membersByRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 34 | membersLoading, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 35 | pushBanner, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 36 | resetClientState, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 37 | rooms, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 38 | selectedRoomId, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 39 | sessionUser, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 40 | softLogout, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 41 | timelines, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 42 | verification |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 43 | } from './lib/store'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 44 | import { discardPending, pendingByRoom, queueSend, resetPending, retryPending } from './lib/pending'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 45 | import type { PendingMessage } from './lib/pending'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 46 | import { notifyTyping, stopTyping } from './lib/typing'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 47 | import { formatDay } from './lib/format'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 48 | import { parseEncryptionState, parseOwnProfile, parseVerificationState } from './lib/types'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 49 | import type { MemberSummary, OwnProfile, RoomSummary, SendState, TimelineEvent, TimelineItem } from './lib/types'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 50 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 51 | let roomsLoading = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 52 | let booted = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 53 | let search = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 54 | let sidebarOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 55 | let membersOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 56 | let dialog: 'join' | 'create' | 'security' | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 57 | let joinTarget = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 58 | let joinBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 59 | let createName = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 60 | let createTopic = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 61 | let createBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 62 | let leaveBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 63 | let paginateBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 64 | let reacting = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 65 | let composer = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 66 | let drafts: Record<string, string> = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 67 | let stickToBottom = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 68 | let timelineEl: HTMLElement | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 69 | let composerEl: HTMLTextAreaElement | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 70 | let fileInput: HTMLInputElement | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 71 | let uploadBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 72 | let uploadName: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 73 | let openedRoom: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 74 | let openReady: Record<string, boolean> = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 75 | let openFailed: Record<string, string> = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 76 | let membersFor: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 77 | let lastReadKey = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 78 | let readTimer: number | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 79 | let profile: OwnProfile | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 80 | let profileMxc: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 81 | let selectedSpaceId: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 82 | let spaceChildIds: string[] | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 83 | let spaceChildrenLoading = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 84 | let spaceChildrenError: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 85 | let avatarByUser: Record<string, string | null> = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 86 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 87 | $: selectedRoom = $rooms.find((r) => r.room_id === $selectedRoomId) ?? null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 88 | $: spaceRooms = $rooms.filter((r) => r.space); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 89 | $: invites = $rooms.filter((r) => r.membership === 'Invited'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 90 | $: query = search.trim().toLowerCase(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 91 | $: selectedSpace = selectedSpaceId ? ($rooms.find((r) => r.room_id === selectedSpaceId) ?? null) : null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 92 | // While a space's children load (or fail), show no channels rather than the |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 93 | // full list — listing everything would falsely imply it belongs to the space. |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 94 | $: baseRooms = selectedSpaceId ? (spaceChildIds ? $rooms.filter((r) => spaceChildIds.includes(r.room_id)) : []) : $rooms; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 95 | $: visibleRooms = query |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 96 | ? baseRooms.filter( |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 97 | (r) => |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 98 | r.name.toLowerCase().includes(query) || r.room_id.toLowerCase().includes(query) |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 99 | ) |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 100 | : baseRooms; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 101 | $: directRooms = visibleRooms.filter((r) => r.direct && !r.space && r.membership !== 'Invited'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 102 | $: groupRooms = visibleRooms.filter( |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 103 | (r) => !r.direct && !r.space && r.membership !== 'Invited' |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 104 | ); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 105 | $: spaceList = visibleRooms.filter((r) => r.space && r.membership !== 'Invited'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 106 | $: channelRooms = baseRooms.filter((r) => !r.space && r.membership !== 'Invited'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 107 | $: recoveryBanner = $encryption && ($encryption.recovery === 'Disabled' || $encryption.recovery === 'Incomplete') ? $encryption : null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 108 | $: verificationBanner = $verification && $verification.kind !== 'Done' ? $verification : null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 109 | $: items = $selectedRoomId ? ($timelines[$selectedRoomId] ?? []) : []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 110 | $: members = $selectedRoomId ? ($membersByRoom[$selectedRoomId] ?? []) : []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 111 | $: hasStart = items.some((i) => i.kind === 'start'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 112 | $: grouped = buildGroups(items); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 113 | $: pendingItems = $selectedRoomId ? ($pendingByRoom[$selectedRoomId] ?? []) : []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 114 | $: lastRealOwn = lastSenderIsOwn(items); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 115 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 116 | function lastSenderIsOwn(list: TimelineItem[]): boolean { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 117 | for (let i = list.length - 1; i >= 0; i -= 1) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 118 | const it = list[i]; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 119 | if (it.kind === 'event') return it.event.sender.user_id === $sessionUser; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 120 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 121 | return false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 122 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 123 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 124 | function pendingShowSender(index: number): boolean { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 125 | return index === 0 ? !lastRealOwn : false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 126 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 127 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 128 | function pendingToEvent(p: PendingMessage): TimelineEvent { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 129 | const state: SendState = p.status === 'failed' ? { kind: 'Failed', will_retry: false } : { kind: 'Sending' }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 130 | return { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 131 | item_id: `pending-${p.id}`, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 132 | event_id: null, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 133 | transaction_id: p.id, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 134 | sender: { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 135 | user_id: $sessionUser ?? '', |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 136 | display_name: profile?.display_name ?? null, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 137 | avatar: null, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 138 | name_ambiguous: false |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 139 | }, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 140 | timestamp_ms: p.createdAt, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 141 | own: true, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 142 | send_state: state, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 143 | content: { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 144 | kind: 'Message', |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 145 | message: { kind: 'Text', body: p.body, geo_uri: null, formatted_body: null, edited: false, media: null } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 146 | }, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 147 | reply_to: null, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 148 | thread_root: null, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 149 | thread_summary: null, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 150 | reactions: [], |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 151 | read_by: [], |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 152 | editable: false |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 153 | }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 154 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 155 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 156 | interface Group { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 157 | key: string; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 158 | item: TimelineItem; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 159 | showSender: boolean; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 160 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 161 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 162 | function buildGroups(list: TimelineItem[]): Group[] { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 163 | const out: Group[] = []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 164 | let prevSender: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 165 | let prevTs = 0; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 166 | list.forEach((item, index) => { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 167 | let showSender = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 168 | if (item.kind === 'event') { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 169 | const e = item.event; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 170 | showSender = |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 171 | prevSender !== e.sender.user_id || Math.abs(e.timestamp_ms - prevTs) > 5 * 60 * 1000; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 172 | prevSender = e.sender.user_id; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 173 | prevTs = e.timestamp_ms; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 174 | out.push({ key: e.item_id || e.event_id || `m-${index}`, item, showSender }); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 175 | } else { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 176 | prevSender = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 177 | out.push({ key: `${item.kind}-${index}`, item, showSender }); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 178 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 179 | }); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 180 | return out; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 181 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 182 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 183 | function roomUnread(r: RoomSummary): number { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 184 | return r.unread_messages + r.unread_mentions; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 185 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 186 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 187 | onMount(() => { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 188 | void boot(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 189 | return () => { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 190 | disconnectEvents(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 191 | stopTyping(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 192 | if (readTimer !== null) window.clearTimeout(readTimer); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 193 | }; |
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 | async function boot(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 197 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 198 | const session = await getSession(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 199 | blocked.set(session.blocked ?? false); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 200 | sessionUser.set(session.user_id); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 201 | if (session.user_id) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 202 | softLogout.set(null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 203 | await refreshRooms(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 204 | connectEvents(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 205 | void loadProfile(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 206 | void loadEncryption(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 207 | } else { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 208 | softLogout.set(session.soft_logout ?? null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 209 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 210 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 211 | pushBanner(e instanceof Error ? `Session check failed: ${e.message}` : 'Session check failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 212 | sessionUser.set(null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 213 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 214 | booted = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 215 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 216 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 217 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 218 | async function refreshRooms(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 219 | roomsLoading = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 220 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 221 | const res = await getRooms(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 222 | rooms.set(res.rooms); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 223 | pruneSpaceFilter(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 224 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 225 | pushBanner(e instanceof Error ? e.message : 'Could not load rooms'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 226 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 227 | roomsLoading = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 228 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 229 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 230 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 231 | async function loadProfile(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 232 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 233 | const raw = await getProfile(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 234 | profile = parseOwnProfile(raw); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 235 | profileMxc = profile.avatar_url; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 236 | } catch { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 237 | profile = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 238 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 239 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 240 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 241 | async function loadEncryption(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 242 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 243 | const res = await getEncryption(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 244 | const state = parseEncryptionState(res.state); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 245 | if (state) encryption.set(state); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 246 | const verificationState = parseVerificationState(res.verification); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 247 | if (verificationState) verification.set(verificationState); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 248 | } catch { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 249 | // Encryption status also arrives over SSE; a failed first fetch is not fatal. |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 250 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 251 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 252 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 253 | function afterLogin(userId: string): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 254 | sessionUser.set(userId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 255 | softLogout.set(null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 256 | blocked.set(false); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 257 | void refreshRooms(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 258 | connectEvents(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 259 | void loadProfile(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 260 | void loadEncryption(); |
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 | async function doLogout(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 264 | stopTyping(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 265 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 266 | await logout(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 267 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 268 | pushBanner(e instanceof Error ? e.message : 'Logout failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 269 | return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 270 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 271 | disconnectEvents(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 272 | resetClientState(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 273 | softLogout.set(null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 274 | blocked.set(false); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 275 | sessionUser.set(null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 276 | composer = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 277 | drafts = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 278 | dialog = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 279 | membersOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 280 | sidebarOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 281 | profile = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 282 | profileMxc = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 283 | selectedSpaceId = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 284 | spaceChildIds = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 285 | spaceChildrenError = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 286 | openReady = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 287 | openFailed = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 288 | avatarByUser = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 289 | resetPending(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 290 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 291 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 292 | function pruneSpaceFilter(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 293 | if (!selectedSpaceId) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 294 | if (!$rooms.some((r) => r.room_id === selectedSpaceId)) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 295 | selectedSpaceId = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 296 | spaceChildIds = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 297 | spaceChildrenError = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 298 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 299 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 300 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 301 | async function selectHome(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 302 | selectedSpaceId = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 303 | spaceChildIds = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 304 | spaceChildrenError = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 305 | sidebarOpen = true; |
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 | async function selectSpace(spaceId: string): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 309 | if ($selectedRoomId && composer.trim()) drafts[$selectedRoomId] = composer; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 310 | stopTyping(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 311 | const prev = openedRoom; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 312 | if (prev) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 313 | openedRoom = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 314 | closeRoom(prev).catch(() => undefined); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 315 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 316 | selectedSpaceId = spaceId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 317 | spaceChildIds = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 318 | spaceChildrenError = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 319 | spaceChildrenLoading = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 320 | sidebarOpen = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 321 | // A space is navigation, not a message timeline. |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 322 | selectedRoomId.set(null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 323 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 324 | const res = await getSpaceChildren(spaceId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 325 | if (selectedSpaceId === spaceId) spaceChildIds = res.room_ids ?? []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 326 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 327 | if (selectedSpaceId === spaceId) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 328 | spaceChildrenError = e instanceof Error ? e.message : 'Could not load rooms in this space'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 329 | spaceChildIds = []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 330 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 331 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 332 | if (selectedSpaceId === spaceId) spaceChildrenLoading = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 333 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 334 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 335 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 336 | async function selectRoom(roomId: string): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 337 | if ($selectedRoomId && composer.trim()) drafts[$selectedRoomId] = composer; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 338 | if (roomId === $selectedRoomId && openReady[roomId]) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 339 | sidebarOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 340 | return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 341 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 342 | stopTyping(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 343 | const prev = openedRoom; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 344 | openedRoom = roomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 345 | selectedRoomId.set(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 346 | composer = drafts[roomId] ?? ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 347 | stickToBottom = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 348 | lastReadKey = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 349 | sidebarOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 350 | openReady = { ...openReady, [roomId]: false }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 351 | if (openFailed[roomId]) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 352 | const nextFailed = { ...openFailed }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 353 | delete nextFailed[roomId]; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 354 | openFailed = nextFailed; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 355 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 356 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 357 | await openRoom(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 358 | openReady = { ...openReady, [roomId]: true }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 359 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 360 | const message = e instanceof Error ? e.message : `Could not open room ${roomId}`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 361 | openFailed = { ...openFailed, [roomId]: message }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 362 | pushBanner(message); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 363 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 364 | if (membersOpen) void loadMembers(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 365 | await tick(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 366 | scrollToBottom(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 367 | queueReadReceipt(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 368 | composerEl?.focus(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 369 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 370 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 371 | function scrollToBottom(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 372 | if (timelineEl) timelineEl.scrollTop = timelineEl.scrollHeight; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 373 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 374 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 375 | function onTimelineScroll(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 376 | if (!timelineEl) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 377 | const gap = timelineEl.scrollHeight - timelineEl.scrollTop - timelineEl.clientHeight; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 378 | stickToBottom = gap < 80; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 379 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 380 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 381 | $: void trackTimeline($selectedRoomId, items); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 382 | async function trackTimeline(roomId: string | null, list: TimelineItem[]): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 383 | if (!roomId || list.length === 0) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 384 | if (roomId !== $selectedRoomId) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 385 | await tick(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 386 | if (stickToBottom) scrollToBottom(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 387 | queueReadReceipt(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 388 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 389 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 390 | function queueReadReceipt(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 391 | if (readTimer !== null) window.clearTimeout(readTimer); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 392 | readTimer = window.setTimeout(() => { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 393 | readTimer = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 394 | void sendReadReceipt(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 395 | }, 800); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 396 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 397 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 398 | async function sendReadReceipt(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 399 | const roomId = $selectedRoomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 400 | if (!roomId) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 401 | const list = $timelines[roomId] ?? []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 402 | for (let i = list.length - 1; i >= 0; i -= 1) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 403 | const entry = list[i]; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 404 | if (entry.kind === 'event' && entry.event.event_id) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 405 | const key = `${roomId}:${entry.event.event_id}`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 406 | if (key === lastReadKey) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 407 | lastReadKey = key; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 408 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 409 | await markRead(roomId, entry.event.event_id); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 410 | } catch { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 411 | return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 412 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 413 | return; |
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 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 418 | function send(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 419 | const roomId = $selectedRoomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 420 | const body = composer.trim(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 421 | if (!roomId || !body) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 422 | if (!openReady[roomId]) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 423 | pushBanner('Still opening this room — sending is disabled until the room is ready.'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 424 | return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 425 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 426 | composer = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 427 | if (roomId in drafts) delete drafts[roomId]; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 428 | stickToBottom = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 429 | queueSend(roomId, body); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 430 | composerEl?.focus(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 431 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 432 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 433 | let typedText = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 434 | let typedRoom: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 435 | $: trackTypingInput(composer, $selectedRoomId, openReady); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 436 | function trackTypingInput(text: string, roomId: string | null, ready: Record<string, boolean>): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 437 | const edited = roomId === typedRoom && text !== typedText; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 438 | typedText = text; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 439 | typedRoom = roomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 440 | if (!roomId || !ready[roomId] || !text.trim()) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 441 | stopTyping(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 442 | } else if (edited) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 443 | notifyTyping(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 444 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 445 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 446 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 447 | $: void trackPending($selectedRoomId, pendingItems); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 448 | async function trackPending(roomId: string | null, list: PendingMessage[]): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 449 | if (!roomId || list.length === 0) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 450 | if (roomId !== $selectedRoomId) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 451 | await tick(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 452 | if (stickToBottom) scrollToBottom(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 453 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 454 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 455 | function onComposerKey(ev: KeyboardEvent): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 456 | if (ev.key === 'Enter' && !ev.shiftKey) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 457 | ev.preventDefault(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 458 | send(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 459 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 460 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 461 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 462 | async function upload(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 463 | const roomId = $selectedRoomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 464 | if (!roomId || uploadBusy || !openReady[roomId]) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 465 | fileInput?.click(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 466 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 467 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 468 | async function onFileChosen(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 469 | const roomId = $selectedRoomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 470 | const files = fileInput?.files; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 471 | if (!roomId || !files || files.length === 0) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 472 | const file = files[0]; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 473 | if (file.size === 0 || file.size > 20 * 1024 * 1024) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 474 | pushBanner('File must be between 1 byte and 20 MiB.'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 475 | if (fileInput) fileInput.value = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 476 | return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 477 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 478 | uploadBusy = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 479 | uploadName = file.name || 'attachment'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 480 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 481 | await uploadAttachment(roomId, file); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 482 | stickToBottom = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 483 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 484 | pushBanner(e instanceof Error ? e.message : 'Upload failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 485 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 486 | uploadBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 487 | uploadName = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 488 | if (fileInput) fileInput.value = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 489 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 490 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 491 | async function react(eventId: string, key: string): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 492 | const roomId = $selectedRoomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 493 | if (!roomId || !eventId || reacting) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 494 | reacting = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 495 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 496 | await reactToMessage(roomId, eventId, key); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 497 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 498 | pushBanner(e instanceof Error ? e.message : 'Reaction failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 499 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 500 | reacting = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 501 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 502 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 503 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 504 | async function paginate(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 505 | const roomId = $selectedRoomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 506 | if (!roomId || paginateBusy) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 507 | paginateBusy = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 508 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 509 | await paginateRoom(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 510 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 511 | pushBanner(e instanceof Error ? e.message : 'Loading older messages failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 512 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 513 | paginateBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 514 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 515 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 516 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 517 | async function loadMembers(roomId: string): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 518 | if (membersFor === roomId && $membersLoading) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 519 | membersFor = roomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 520 | membersLoading.set(true); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 521 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 522 | const res = await getMembers(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 523 | membersByRoom.update((all) => ({ ...all, [roomId]: res.members })); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 524 | avatarByUser = { ...avatarByUser, ...avatarMap(res.members) }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 525 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 526 | pushBanner(e instanceof Error ? e.message : 'Could not load members'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 527 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 528 | if (membersFor === roomId) membersLoading.set(false); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 529 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 530 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 531 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 532 | function avatarMap(list: MemberSummary[]): Record<string, string | null> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 533 | const next: Record<string, string | null> = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 534 | for (const member of list) next[member.user_id] = member.avatar; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 535 | return next; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 536 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 537 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 538 | function senderAvatarFor(userId: string): string | null { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 539 | return avatarByUser[userId] ?? null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 540 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 541 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 542 | function toggleMembers(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 543 | membersOpen = !membersOpen; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 544 | if (membersOpen && $selectedRoomId) void loadMembers($selectedRoomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 545 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 546 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 547 | async function join(target: string): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 548 | const room = target.trim(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 549 | if (!room || joinBusy) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 550 | joinBusy = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 551 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 552 | const res = await joinRoom(room); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 553 | joinTarget = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 554 | dialog = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 555 | await refreshRooms(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 556 | await selectRoom(res.room_id); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 557 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 558 | pushBanner(e instanceof Error ? e.message : 'Join failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 559 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 560 | joinBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 561 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 562 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 563 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 564 | async function create(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 565 | const name = createName.trim(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 566 | if (!name || createBusy) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 567 | createBusy = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 568 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 569 | const res = await createRoom(name, createTopic.trim() || undefined); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 570 | createName = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 571 | createTopic = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 572 | dialog = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 573 | await refreshRooms(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 574 | await selectRoom(res.room_id); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 575 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 576 | pushBanner(e instanceof Error ? e.message : 'Create room failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 577 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 578 | createBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 579 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 580 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 581 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 582 | async function leave(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 583 | const roomId = $selectedRoomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 584 | if (!roomId || leaveBusy) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 585 | leaveBusy = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 586 | stopTyping(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 587 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 588 | await leaveRoom(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 589 | const prev = openedRoom; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 590 | if (prev === roomId) openedRoom = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 591 | if ($selectedRoomId === roomId) selectedRoomId.set(null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 592 | if (prev) closeRoom(prev).catch(() => undefined); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 593 | await refreshRooms(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 594 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 595 | pushBanner(e instanceof Error ? e.message : 'Leave failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 596 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 597 | leaveBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 598 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 599 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 600 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 601 | function connectionClass(state: string): string { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 602 | if (state === 'online') return 'dot-online'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 603 | if (state === 'connecting' || state === 'reconnecting') return 'dot-busy'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 604 | return 'dot-off'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 605 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 606 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 607 | function onKeydown(ev: KeyboardEvent): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 608 | if (ev.key === 'Escape') { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 609 | if (dialog) dialog = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 610 | else if (membersOpen && window.innerWidth < 1100) membersOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 611 | else if (sidebarOpen) sidebarOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 612 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 613 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 614 | </script> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 615 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 616 | <svelte:window on:keydown={onKeydown} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 617 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 618 | {#if !booted} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 619 | <div class="splash" role="status" aria-label="Loading Malice"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 620 | <div class="splash-mark" aria-hidden="true">M</div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 621 | <p>Loading Malice…</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 622 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 623 | {:else if $blocked} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 624 | <div class="splash" role="status" aria-label="Malice is open in another tab"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 625 | <div class="splash-mark" aria-hidden="true">M</div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 626 | <p>Malice is open in another tab. Close this tab or use that one instead.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 627 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 628 | {:else if $sessionUser == null} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 629 | <LoginPanel softLogout={$softLogout} on:done={(ev) => afterLogin(ev.detail)} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 630 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 631 | <div class="app"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 632 | <nav class="rail" aria-label="Servers and spaces"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 633 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 634 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 635 | class="rail-btn" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 636 | class:active={selectedSpaceId === null} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 637 | title="Home — all channels" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 638 | aria-label="Home — all channels" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 639 | aria-pressed={selectedSpaceId === null} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 640 | on:click={() => void selectHome()} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 641 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 642 | <span aria-hidden="true">⌂</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 643 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 644 | <div class="rail-sep" aria-hidden="true"></div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 645 | {#each spaceRooms as space (space.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 646 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 647 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 648 | class="rail-btn rail-space" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 649 | class:active={selectedSpaceId === space.room_id} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 650 | title={space.name} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 651 | aria-label={`Show channels in space ${space.name}`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 652 | aria-pressed={selectedSpaceId === space.room_id} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 653 | on:click={() => void selectSpace(space.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 654 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 655 | <MxcAvatar mxc={space.avatar} label={space.name} size={44} shape="rounded" /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 656 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 657 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 658 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 659 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 660 | class="rail-btn rail-add" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 661 | aria-label="Join or create a room" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 662 | on:click={() => { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 663 | dialog = 'join'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 664 | }} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 665 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 666 | <span aria-hidden="true">+</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 667 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 668 | </nav> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 669 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 670 | <aside class="sidebar" class:open={sidebarOpen} aria-label="Rooms"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 671 | <div class="side-search"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 672 | <label class="visually-hidden" for="room-search">Search rooms</label> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 673 | <input |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 674 | id="room-search" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 675 | type="search" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 676 | placeholder="Search rooms" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 677 | bind:value={search} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 678 | autocomplete="off" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 679 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 680 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 681 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 682 | class="icon-btn" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 683 | title="Refresh rooms" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 684 | aria-label="Refresh rooms" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 685 | disabled={roomsLoading} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 686 | on:click={() => void refreshRooms()} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 687 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 688 | <span aria-hidden="true">⟳</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 689 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 690 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 691 | <div class="side-scroll"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 692 | {#if selectedSpace} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 693 | <div class="space-context"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 694 | <MxcAvatar mxc={selectedSpace.avatar} label={selectedSpace.name} size={28} shape="rounded" /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 695 | <div class="space-context-text"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 696 | <strong>{selectedSpace.name}</strong> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 697 | <span>Space — channels below</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 698 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 699 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 700 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 701 | <div class="space-context"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 702 | <div class="space-context-text"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 703 | <strong>Home</strong> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 704 | <span>All channels</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 705 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 706 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 707 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 708 | {#if roomsLoading && $rooms.length === 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 709 | <p class="side-note">Loading rooms…</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 710 | {:else if $rooms.length === 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 711 | <p class="side-note">No rooms yet. Join one or create your own.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 712 | <div class="side-cta"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 713 | <button type="button" on:click={() => (dialog = 'join')}>Join a room</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 714 | <button type="button" on:click={() => (dialog = 'create')}>Create one</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 715 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 716 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 717 | {#if selectedSpaceId && spaceChildrenLoading} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 718 | <p class="side-note">Loading channels in this space…</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 719 | {:else if selectedSpaceId && spaceChildrenError} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 720 | <p class="side-note" role="alert">{spaceChildrenError}</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 721 | <div class="side-cta"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 722 | <button type="button" on:click={() => selectedSpaceId && void selectSpace(selectedSpaceId)}>Retry</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 723 | <button type="button" on:click={() => void selectHome()}>Back to Home</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 724 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 725 | {:else if selectedSpaceId && spaceChildIds && channelRooms.length === 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 726 | <p class="side-note">No channels found in this space yet.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 727 | <div class="side-cta"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 728 | <button type="button" on:click={() => void selectHome()}>Back to Home</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 729 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 730 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 731 | {#if invites.length > 0 && !selectedSpaceId} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 732 | <h2 class="side-h">Invites</h2> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 733 | <ul class="room-list"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 734 | {#each invites as room (room.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 735 | <li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 736 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 737 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 738 | class="room-row" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 739 | class:active={$selectedRoomId === room.room_id} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 740 | on:click={() => void selectRoom(room.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 741 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 742 | <MxcAvatar mxc={room.avatar} label={room.name} size={26} shape="rounded" /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 743 | <span class="room-name">{room.name}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 744 | <span |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 745 | class="invite-join" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 746 | role="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 747 | tabindex="0" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 748 | aria-label={`Join ${room.name}`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 749 | on:click|stopPropagation={() => void join(room.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 750 | on:keydown|stopPropagation={(ev) => { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 751 | if (ev.key === 'Enter' || ev.key === ' ') { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 752 | ev.preventDefault(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 753 | void join(room.room_id); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 754 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 755 | }} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 756 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 757 | Join |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 758 | </span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 759 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 760 | </li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 761 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 762 | </ul> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 763 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 764 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 765 | {#if directRooms.length > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 766 | <h2 class="side-h">Direct messages</h2> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 767 | <ul class="room-list"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 768 | {#each directRooms as room (room.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 769 | <li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 770 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 771 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 772 | class="room-row" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 773 | class:active={$selectedRoomId === room.room_id} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 774 | aria-current={$selectedRoomId === room.room_id ? 'true' : undefined} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 775 | on:click={() => void selectRoom(room.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 776 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 777 | <MxcAvatar mxc={room.avatar} label={room.name} size={26} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 778 | <span class="room-name">{room.name}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 779 | {#if roomUnread(room) > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 780 | <span |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 781 | class="badge" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 782 | class:mention={room.unread_mentions > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 783 | aria-label={`${roomUnread(room)} unread`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 784 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 785 | {roomUnread(room) > 99 ? '99+' : roomUnread(room)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 786 | </span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 787 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 788 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 789 | </li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 790 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 791 | </ul> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 792 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 793 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 794 | {#if groupRooms.length > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 795 | <h2 class="side-h">{selectedSpace ? 'Channels in this space' : 'Rooms'}</h2> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 796 | <ul class="room-list"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 797 | {#each groupRooms as room (room.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 798 | <li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 799 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 800 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 801 | class="room-row" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 802 | class:active={$selectedRoomId === room.room_id} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 803 | aria-current={$selectedRoomId === room.room_id ? 'true' : undefined} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 804 | on:click={() => void selectRoom(room.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 805 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 806 | <MxcAvatar mxc={room.avatar} label={room.name} size={26} shape="rounded" /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 807 | <span class="room-hash" aria-hidden="true">#</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 808 | <span class="room-name">{room.name}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 809 | {#if roomUnread(room) > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 810 | <span |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 811 | class="badge" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 812 | class:mention={room.unread_mentions > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 813 | aria-label={`${roomUnread(room)} unread`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 814 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 815 | {roomUnread(room) > 99 ? '99+' : roomUnread(room)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 816 | </span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 817 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 818 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 819 | </li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 820 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 821 | </ul> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 822 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 823 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 824 | {#if !selectedSpaceId && spaceList.length > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 825 | <h2 class="side-h">Spaces</h2> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 826 | <ul class="room-list"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 827 | {#each spaceList as room (room.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 828 | <li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 829 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 830 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 831 | class="room-row" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 832 | class:active={selectedSpaceId === room.room_id} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 833 | aria-label={`Show channels in space ${room.name}`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 834 | on:click={() => void selectSpace(room.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 835 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 836 | <MxcAvatar mxc={room.avatar} label={room.name} size={26} shape="rounded" /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 837 | <span class="room-hash" aria-hidden="true">◇</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 838 | <span class="room-name">{room.name}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 839 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 840 | </li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 841 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 842 | </ul> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 843 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 844 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 845 | {#if query && visibleRooms.length === 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 846 | <p class="side-note">No rooms match “{search.trim()}”.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 847 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 848 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 849 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 850 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 851 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 852 | <div class="side-footer"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 853 | <div class="me" title={$sessionUser}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 854 | {#if profileMxc} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 855 | <MxcAvatar mxc={profileMxc} label={profile?.display_name ?? $sessionUser} size={30} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 856 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 857 | <span class="me-avatar" aria-hidden="true">{$sessionUser.slice(1, 2).toUpperCase()}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 858 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 859 | <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 | 860 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 861 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 862 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 863 | class="icon-btn" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 864 | title="Encryption and verification" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 865 | aria-label="Encryption and verification" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 866 | on:click={() => (dialog = 'security')} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 867 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 868 | <span aria-hidden="true">🛡</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 869 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 870 | <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 | 871 | <span aria-hidden="true">⏻</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 872 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 873 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 874 | </aside> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 875 | {#if sidebarOpen} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 876 | <button type="button" class="scrim" aria-label="Close room list" on:click={() => (sidebarOpen = false)}></button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 877 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 878 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 879 | <main class="chat"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 880 | {#if $banners.length > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 881 | <div class="banners" aria-live="polite"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 882 | {#each $banners as banner (banner.id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 883 | <div class="banner" role="alert"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 884 | <span>{banner.message}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 885 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 886 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 887 | aria-label="Dismiss error" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 888 | on:click={() => dismissBanner(banner.id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 889 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 890 | ✕ |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 891 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 892 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 893 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 894 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 895 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 896 | {#if !selectedRoom} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 897 | <div class="empty"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 898 | <div class="empty-mark" aria-hidden="true">◈</div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 899 | {#if selectedSpace} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 900 | <h1>{selectedSpace.name}</h1> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 901 | <p>Select a channel below to start chatting. Spaces group channels — they are not chat rooms.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 902 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 903 | <h1>Welcome to Malice</h1> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 904 | <p>Pick a room from the sidebar, or join one to get started.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 905 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 906 | <div class="empty-cta"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 907 | <button type="button" class="primary-btn" on:click={() => (dialog = 'join')}>Join a room</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 908 | <button type="button" class="ghost-btn" on:click={() => (dialog = 'create')}>Create a room</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 909 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 910 | <p class="conn-line"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 911 | <span class="dot {connectionClass($connection)}" aria-hidden="true"></span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 912 | {$connection} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 913 | </p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 914 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 915 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 916 | <header class="chat-head"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 917 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 918 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 919 | class="icon-btn only-mobile" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 920 | aria-label="Open room list" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 921 | on:click={() => (sidebarOpen = true)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 922 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 923 | <span aria-hidden="true">☰</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 924 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 925 | <div class="head-title"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 926 | <div class="head-room"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 927 | <MxcAvatar mxc={selectedRoom.avatar} label={selectedRoom.name} size={36} shape={selectedRoom.space ? 'rounded' : 'circle'} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 928 | <div class="head-room-text"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 929 | <h1>{selectedRoom.name}</h1> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 930 | <div class="head-meta"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 931 | {#if selectedRoom.space} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 932 | <span class="pill">space</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 933 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 934 | {#if selectedRoom.encrypted} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 935 | <span class="pill" title="End-to-end encrypted">🔒 encrypted</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 936 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 937 | {#if selectedRoom.direct} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 938 | <span class="pill">direct</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 939 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 940 | <span class="conn" title={`Sync state: ${$connection}`}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 941 | <span class="dot {connectionClass($connection)}" aria-hidden="true"></span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 942 | {$connection} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 943 | </span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 944 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 945 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 946 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 947 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 948 | <div class="head-actions"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 949 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 950 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 951 | class="ghost-btn" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 952 | aria-label="Encryption and verification" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 953 | title="Encryption and verification" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 954 | on:click={() => (dialog = 'security')} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 955 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 956 | 🛡 Security |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 957 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 958 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 959 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 960 | class="ghost-btn" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 961 | aria-pressed={membersOpen} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 962 | aria-label={membersOpen ? 'Hide members' : 'Show members'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 963 | on:click={toggleMembers} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 964 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 965 | Members |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 966 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 967 | {#if selectedRoom.membership === 'Joined'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 968 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 969 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 970 | class="ghost-btn danger" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 971 | disabled={leaveBusy} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 972 | on:click={() => void leave()} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 973 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 974 | {leaveBusy ? 'Leaving…' : 'Leave'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 975 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 976 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 977 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 978 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 979 | class="primary-btn" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 980 | disabled={joinBusy} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 981 | on:click={() => void join(selectedRoom.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 982 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 983 | {joinBusy ? 'Joining…' : 'Join'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 984 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 985 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 986 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 987 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 988 | class="icon-btn only-mobile" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 989 | aria-label="Toggle members" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 990 | on:click={toggleMembers} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 991 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 992 | <span aria-hidden="true">ⓘ</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 993 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 994 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 995 | </header> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 996 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 997 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 998 | {#if recoveryBanner} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 999 | <div class="sec-banner warn" role="status"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1000 | <span>Message history is locked — recovery is {recoveryBanner.recovery}. Enter your recovery key to decrypt.</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1001 | <button type="button" on:click={() => (dialog = 'security')}>Recover</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1002 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1003 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1004 | {#if verificationBanner} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1005 | <div class="sec-banner" role="status"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1006 | {#if verificationBanner.kind === 'Incoming'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1007 | <span>A device wants to verify this session. Review the request to accept it.</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1008 | <button type="button" on:click={() => (dialog = 'security')}>Review request</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1009 | {:else if verificationBanner.kind === 'Comparison'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1010 | <span>Verification codes are ready — compare emojis and numbers.</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1011 | <button type="button" on:click={() => (dialog = 'security')}>Compare codes</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1012 | {:else if verificationBanner.kind === 'Waiting'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1013 | <span>Verification started — approve on your other device, then compare codes here.</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1014 | <button type="button" on:click={() => (dialog = 'security')}>Open verification</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1015 | {:else if verificationBanner.kind === 'Failed'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1016 | <span>Verification failed: {verificationBanner.message}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1017 | <button type="button" on:click={() => (dialog = 'security')}>Try again</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1018 | {:else if verificationBanner.kind === 'Cancelled'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1019 | <span>Verification cancelled: {verificationBanner.reason}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1020 | <button type="button" on:click={() => (dialog = 'security')}>Open security</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1021 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1022 | <span>Verification in progress.</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1023 | <button type="button" on:click={() => (dialog = 'security')}>Open security</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1024 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1025 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1026 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1027 | {#if $connection !== 'online'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1028 | <p class="conn-banner" role="status"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1029 | Sync is {$connection}. New messages will appear when the connection recovers. |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1030 | </p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1031 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1032 | {#if $selectedRoomId && !openReady[$selectedRoomId] && !openFailed[$selectedRoomId]} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1033 | <p class="conn-banner" role="status">Opening {selectedRoom.name}… sending is disabled until the room is ready.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1034 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1035 | {#if $selectedRoomId && openFailed[$selectedRoomId]} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1036 | <p class="conn-banner error" role="alert">{openFailed[$selectedRoomId]}</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1037 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1038 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1039 | <div class="timeline" bind:this={timelineEl} on:scroll={onTimelineScroll} aria-label={`Messages in ${selectedRoom.name}`}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1040 | <div class="timeline-top"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1041 | {#if hasStart} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1042 | <p class="start-note">This is the beginning of the visible history.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1043 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1044 | <button type="button" class="ghost-btn" disabled={paginateBusy} on:click={() => void paginate()}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1045 | {paginateBusy ? 'Loading…' : 'Load older messages'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1046 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1047 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1048 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1049 | {#if grouped.length === 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1050 | <p class="side-note timeline-empty">No messages yet. Say hello!</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1051 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1052 | {#each grouped as g (g.key)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1053 | {#if g.item.kind === 'day'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1054 | <div class="day-row"><span>{formatDay(g.item.timestamp_ms)}</span></div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1055 | {:else if g.item.kind === 'readMarker'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1056 | <div class="new-row"><span>New</span></div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1057 | {:else if g.item.kind === 'start'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1058 | <p class="start-note">This is the beginning of the visible history.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1059 | {:else if g.item.kind === 'unknown'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1060 | <p class="unknown-note">Unsupported event ({g.item.label})</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1061 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1062 | <MessageRow |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1063 | itemId={g.key} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1064 | event={g.item.event} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1065 | showSender={g.showSender} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1066 | senderAvatar={senderAvatarFor(g.item.event.sender.user_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1067 | {reacting} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1068 | onReact={(eventId, key) => void react(eventId, key)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1069 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1070 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1071 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1072 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1073 | {#each pendingItems as p, i (p.id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1074 | <MessageRow |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1075 | itemId={`pending-${p.id}`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1076 | event={pendingToEvent(p)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1077 | showSender={pendingShowSender(i)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1078 | senderAvatar={senderAvatarFor($sessionUser ?? '')} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1079 | {reacting} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1080 | onReact={(eventId, key) => void react(eventId, key)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1081 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1082 | {#if p.status === 'failed'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1083 | <div class="pending-actions"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1084 | <span class="pending-error" role="alert">{p.error}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1085 | <button type="button" class="ghost-btn" on:click={() => retryPending(p.id)}>Retry</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1086 | <button type="button" class="ghost-btn danger" on:click={() => discardPending(p.id)}>Discard</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1087 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1088 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1089 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1090 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1091 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1092 | {#if selectedRoom.membership === 'Joined'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1093 | <form class="composer" on:submit|preventDefault={() => send()}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1094 | <label class="visually-hidden" for="composer">Message {selectedRoom.name}</label> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1095 | <input |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1096 | type="file" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1097 | bind:this={fileInput} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1098 | class="visually-hidden" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1099 | aria-label="Attach a file" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1100 | on:change={() => void onFileChosen()} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1101 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1102 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1103 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1104 | class="ghost-btn" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1105 | title="Attach an image or file" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1106 | aria-label="Attach an image or file" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1107 | disabled={!($selectedRoomId && openReady[$selectedRoomId]) || uploadBusy} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1108 | on:click={() => void upload()} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1109 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1110 | {uploadBusy ? `Uploading ${uploadName ?? 'file'}…` : '📎'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1111 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1112 | <textarea |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1113 | id="composer" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1114 | bind:this={composerEl} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1115 | bind:value={composer} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1116 | rows="1" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1117 | placeholder={`Message ${selectedRoom.name}`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1118 | aria-label={`Message ${selectedRoom.name}. Enter to send, Shift Enter for a new line.`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1119 | on:keydown={onComposerKey} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1120 | disabled={!($selectedRoomId && openReady[$selectedRoomId])} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1121 | ></textarea> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1122 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1123 | type="submit" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1124 | class="primary-btn" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1125 | disabled={!composer.trim() || !($selectedRoomId && openReady[$selectedRoomId])} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1126 | title={!($selectedRoomId && openReady[$selectedRoomId]) ? 'Waiting for the room to open' : 'Send message'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1127 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1128 | Send |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1129 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1130 | </form> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1131 | <p class="composer-note">Sending and failed states show under your message.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1132 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1133 | <div class="join-bar"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1134 | <p>You are not a member of this room.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1135 | <button type="button" class="primary-btn" disabled={joinBusy} on:click={() => void join(selectedRoom.room_id)}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1136 | {joinBusy ? 'Joining…' : `Join ${selectedRoom.name}`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1137 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1138 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1139 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1140 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1141 | </main> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1142 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1143 | {#if selectedRoom && membersOpen} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1144 | <aside class="members" aria-label={`Members of ${selectedRoom.name}`}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1145 | <div class="members-head"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1146 | <h2>Members</h2> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1147 | <button type="button" class="icon-btn" aria-label="Close members" on:click={() => (membersOpen = false)}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1148 | <span aria-hidden="true">✕</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1149 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1150 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1151 | {#if $membersLoading && members.length === 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1152 | <p class="side-note">Loading members…</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1153 | {:else if members.length === 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1154 | <p class="side-note">No members loaded.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1155 | {#if $selectedRoomId} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1156 | <button type="button" class="ghost-btn" on:click={() => $selectedRoomId && void loadMembers($selectedRoomId)}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1157 | Retry |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1158 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1159 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1160 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1161 | <ul class="member-list"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1162 | {#each members as member (member.user_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1163 | <li class="member"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1164 | <MxcAvatar mxc={member.avatar} label={member.display_name || member.name || member.user_id} size={30} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1165 | <span class="member-names"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1166 | <span class="member-name">{member.display_name || member.name}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1167 | <span class="member-id">{member.user_id}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1168 | </span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1169 | </li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1170 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1171 | </ul> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1172 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1173 | </aside> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1174 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1175 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1176 | {#if dialog} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1177 | <div class="modal-wrap" role="presentation" on:click|self={() => (dialog = null)}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1178 | {#if dialog === 'security'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1179 | <SecurityPanel |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1180 | encryptionState={$encryption} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1181 | verificationState={$verification} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1182 | onAction={() => void loadEncryption()} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1183 | on:close={() => (dialog = null)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1184 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1185 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1186 | <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 | 1187 | <div class="modal-tabs" role="tablist" aria-label="Room actions"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1188 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1189 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1190 | role="tab" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1191 | aria-selected={dialog === 'join'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1192 | class:active={dialog === 'join'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1193 | on:click={() => (dialog = 'join')} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1194 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1195 | Join |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1196 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1197 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1198 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1199 | role="tab" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1200 | aria-selected={dialog === 'create'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1201 | class:active={dialog === 'create'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1202 | on:click={() => (dialog = 'create')} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1203 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1204 | Create |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1205 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1206 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1207 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1208 | class="icon-btn modal-x" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1209 | aria-label="Close dialog" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1210 | on:click={() => (dialog = null)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1211 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1212 | <span aria-hidden="true">✕</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1213 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1214 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1215 | {#if dialog === 'join'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1216 | <form on:submit|preventDefault={() => void join(joinTarget)}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1217 | <label class="field"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1218 | <span>Room ID or alias</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1219 | <input |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1220 | type="text" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1221 | placeholder="!room:example.org or #alias:example.org" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1222 | bind:value={joinTarget} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1223 | required |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1224 | disabled={joinBusy} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1225 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1226 | </label> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1227 | <button type="submit" class="primary-btn wide" disabled={joinBusy || !joinTarget.trim()}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1228 | {joinBusy ? 'Joining…' : 'Join room'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1229 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1230 | </form> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1231 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1232 | <form on:submit|preventDefault={() => void create()}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1233 | <label class="field"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1234 | <span>Room name</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1235 | <input |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1236 | type="text" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1237 | placeholder="Weekend plans" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1238 | bind:value={createName} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1239 | required |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1240 | disabled={createBusy} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1241 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1242 | </label> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1243 | <label class="field"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1244 | <span>Topic (optional)</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1245 | <input |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1246 | type="text" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1247 | placeholder="What should this room be about?" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1248 | bind:value={createTopic} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1249 | disabled={createBusy} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1250 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1251 | </label> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1252 | <button type="submit" class="primary-btn wide" disabled={createBusy || !createName.trim()}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1253 | {createBusy ? 'Creating…' : 'Create room'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1254 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1255 | </form> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1256 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1257 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1258 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1259 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1260 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1261 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1262 | {/if} |