Fix the mechanical lint groups and delete the unused bindings. [skip build]
Checks / checks (push) Successful in 2m12s
Trigger cinny-mobile / dispatch (push) Successful in 2s

This commit is contained in:
litruv committed 2026-11-01 20:31:21 +11:00
1 parent 593dd3bdf3
commit 5477242661
26 files changed
+95 -161

No files matched your search

+1 -1
View File
@@ -34,7 +34,7 @@ export function ServerConfigsLoader({ children }: ServerConfigsLoaderProps) {
if (authMetadata) { if (authMetadata) {
try { try {
validatedAuthMetadata = validateAuthMetadata(authMetadata); validatedAuthMetadata = validateAuthMetadata(authMetadata);
} catch (e) { } catch {
// Server returned auth metadata but it failed validation — ignore silently. // Server returned auth metadata but it failed validation — ignore silently.
} }
} }
@@ -89,7 +89,7 @@ const deleteAllMatrixDatabases = async (): Promise<void> => {
// Delete each database with timeout // Delete each database with timeout
const deletePromises = dbsToDelete.map(async (dbName) => { const deletePromises = dbsToDelete.map(async (dbName) => {
try { try {
const deletePromise = new Promise<void>((resolve, reject) => { const deletePromise = new Promise<void>((resolve) => {
const request = indexedDB.deleteDatabase(dbName); const request = indexedDB.deleteDatabase(dbName);
request.onsuccess = () => { request.onsuccess = () => {
console.log(`[AccountSwitcher] ✅ Deleted database: ${dbName}`); console.log(`[AccountSwitcher] ✅ Deleted database: ${dbName}`);
@@ -155,7 +155,9 @@ export function AccountSwitcher({ currentUserId }: AccountSwitcherProps) {
await deleteAllMatrixDatabases(); await deleteAllMatrixDatabases();
// Small delay to ensure cleanup is complete // Small delay to ensure cleanup is complete
await new Promise((resolve) => setTimeout(resolve, 100)); await new Promise((resolve) => {
setTimeout(resolve, 100);
});
// Reload the page to initialize the new session // Reload the page to initialize the new session
console.log('[AccountSwitcher] Reloading page...'); console.log('[AccountSwitcher] Reloading page...');
+1 -1
View File
@@ -131,7 +131,7 @@ export const CustomEditor = forwardRef<HTMLDivElement, CustomEditorProps>(
const firstChild = editor.children[0]; const firstChild = editor.children[0];
if (SlateElement.isElement(firstChild) && firstChild.type === BlockType.Paragraph) { if (SlateElement.isElement(firstChild) && firstChild.type === BlockType.Paragraph) {
const [firstInline, secondInline] = firstChild.children; const [, secondInline] = firstChild.children;
// Don't decorate if we already have a CommandElement // Don't decorate if we already have a CommandElement
if (SlateElement.isElement(secondInline) && secondInline.type === BlockType.Command) { if (SlateElement.isElement(secondInline) && secondInline.type === BlockType.Command) {
+1 -2
View File
@@ -3,7 +3,7 @@ import { EventTimelineSet, Room } from 'matrix-js-sdk';
import React, { MouseEventHandler, ReactNode, useCallback, useMemo } from 'react'; import React, { MouseEventHandler, ReactNode, useCallback, useMemo } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import { Icon, Icons } from '../icons'; import { Icon, Icons } from '../icons';
import { getMemberAvatarMxc, getMemberDisplayName, trimReplyFromBody } from '../../utils/room'; import { getMemberDisplayName, trimReplyFromBody } from '../../utils/room';
import { getMxIdLocalPart } from '../../utils/matrix'; import { getMxIdLocalPart } from '../../utils/matrix';
import { LinePlaceholder } from './placeholder'; import { LinePlaceholder } from './placeholder';
import { randomNumberBetween } from '../../utils/common'; import { randomNumberBetween } from '../../utils/common';
@@ -116,7 +116,6 @@ export const Reply = as<'div', ReplyProps>(
const { body } = replyEvent?.getContent() ?? {}; const { body } = replyEvent?.getContent() ?? {};
const sender = replyEvent?.getSender(); const sender = replyEvent?.getSender();
const senderAvatarMxc = sender ? getMemberAvatarMxc(room, sender) : undefined;
const customUserColor = useOtherUserColor(sender ?? '', room); const customUserColor = useOtherUserColor(sender ?? '', room);
const powerTag = sender ? getMemberPowerTag?.(sender) : undefined; const powerTag = sender ? getMemberPowerTag?.(sender) : undefined;
const tagColor = powerTag?.color ? accessibleTagColors?.get(powerTag.color) : undefined; const tagColor = powerTag?.color ? accessibleTagColors?.get(powerTag.color) : undefined;
@@ -600,14 +600,6 @@ export function TitleBar({ mx, children }: TitleBarProps) {
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [mx, roomId, roomToParents, mDirects, updateCounter]); }, [mx, roomId, roomToParents, mDirects, updateCounter]);
// Get room name (for backward compatibility, keeping simple name too)
const roomName = useMemo(() => {
if (!mx || !roomId) return null;
const room = mx.getRoom(roomId);
return room?.name || null;
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [mx, roomId, updateCounter]);
// Get total unread count // Get total unread count
const totalUnread = useMemo(() => { const totalUnread = useMemo(() => {
if (!mx) return 0; if (!mx) return 0;
@@ -59,7 +59,6 @@ export function UserRoomProfile({ userId }: UserRoomProfileProps) {
const membership = useMembership(room, userId); const membership = useMembership(room, userId);
const server = getMxIdServer(userId); const server = getMxIdServer(userId);
const displayName = getMemberDisplayName(room, userId);
const avatarMxc = getMemberAvatarMxc(room, userId); const avatarMxc = getMemberAvatarMxc(room, userId);
const avatarUrl = (avatarMxc && mxcUrlToHttp(mx, avatarMxc, useAuthentication)) ?? undefined; const avatarUrl = (avatarMxc && mxcUrlToHttp(mx, avatarMxc, useAuthentication)) ?? undefined;
@@ -23,19 +23,6 @@ interface IncomingCall {
startTime: number; startTime: number;
} }
/**
* Checks if a room is a DM or small group (not a server/space room)
* @param room - The Matrix room to check
* @returns true if the room is a DM or small group
*/
function isDirectOrSmallGroup(room: Room): boolean {
if (room.isSpaceRoom()) {
return false;
}
const memberCount = room.getJoinedMemberCount();
return memberCount <= 10;
}
/** /**
* Gets active call members from a room who are NOT the current user * Gets active call members from a room who are NOT the current user
* Also returns the earliest call start time * Also returns the earliest call start time
+1 -8
View File
@@ -246,14 +246,7 @@ export function useCallService(): CallContextValue {
* Hook to check if a call is active in a specific room * Hook to check if a call is active in a specific room
*/ */
export function useRoomCall(roomId: string) { export function useRoomCall(roomId: string) {
const { const { activeCall, startCall, endCall, callService } = useCall();
activeCall,
startCall,
endCall,
callSupported: globalCallSupported,
callSupportLoading: globalCallSupportLoading,
callService,
} = useCall();
const mx = useMatrixClient(); const mx = useMatrixClient();
const [roomCallSupported, setRoomCallSupported] = useState(false); const [roomCallSupported, setRoomCallSupported] = useState(false);
const [roomCallSupportLoading, setRoomCallSupportLoading] = useState(true); const [roomCallSupportLoading, setRoomCallSupportLoading] = useState(true);
+5 -8
View File
@@ -54,14 +54,11 @@ export function ForumBoardDetail() {
[threads, selectedPostId], [threads, selectedPostId],
); );
const handleReplySent = useCallback( const handleReplySent = useCallback(() => {
(_reply: ForumPost) => { if (selectedPostId) {
if (selectedPostId) { recordThreadReply(selectedPostId);
recordThreadReply(selectedPostId); }
} }, [recordThreadReply, selectedPostId]);
},
[recordThreadReply, selectedPostId],
);
const showThread = Boolean(selectedPostId && activeTopicRoom); const showThread = Boolean(selectedPostId && activeTopicRoom);
const threadInitialPost = optimisticPost?.eventId === selectedPostId ? optimisticPost : null; const threadInitialPost = optimisticPost?.eventId === selectedPostId ? optimisticPost : null;
@@ -42,7 +42,6 @@ export function ForumBoardView({ forumSpace, scope }: ForumBoardViewProps) {
hasMorePosts, hasMorePosts,
loadingMore, loadingMore,
insertThreadFromNewPost, insertThreadFromNewPost,
recordThreadReply,
} = useForumBoard(scope, forumSpace); } = useForumBoard(scope, forumSpace);
const activeTopicRoom = activeTopicRoomId ? mx.getRoom(activeTopicRoomId) : null; const activeTopicRoom = activeTopicRoomId ? mx.getRoom(activeTopicRoomId) : null;
+5 -8
View File
@@ -86,14 +86,11 @@ export function ForumSpaceShell() {
[insertThreadFromNewPost, selectPost], [insertThreadFromNewPost, selectPost],
); );
const handleReplySent = useCallback( const handleReplySent = useCallback(() => {
(_reply: ForumPost) => { if (selectedPostId) {
if (selectedPostId) { recordThreadReply(selectedPostId);
recordThreadReply(selectedPostId); }
} }, [recordThreadReply, selectedPostId]);
},
[recordThreadReply, selectedPostId],
);
const showThread = Boolean(selectedPostId && activeTopicRoom); const showThread = Boolean(selectedPostId && activeTopicRoom);
+1 -1
View File
@@ -342,7 +342,7 @@ export function RoomNavItem({
const rootBody = rootEvent.getContent()?.body ?? ''; const rootBody = rootEvent.getContent()?.body ?? '';
return rootBody; return rootBody;
} catch (error) { } catch {
return undefined; return undefined;
} }
}, [room]); }, [room]);
+1 -7
View File
@@ -94,12 +94,7 @@ import {
getImageMsgContent, getImageMsgContent,
getVideoMsgContent, getVideoMsgContent,
} from './msgContent'; } from './msgContent';
import { import { getMemberDisplayName, getMentionContent, trimReplyFromBody } from '../../utils/room';
getMemberDisplayName,
getMentionContent,
trimReplyFromBody,
getMemberAvatarMxc,
} from '../../utils/room';
import { CommandAutocomplete } from './CommandAutocomplete'; import { CommandAutocomplete } from './CommandAutocomplete';
import { Command, SHRUG, TABLEFLIP, UNFLIP, useCommands } from '../../hooks/useCommands'; import { Command, SHRUG, TABLEFLIP, UNFLIP, useCommands } from '../../hooks/useCommands';
import { pluginRegistry } from '../settings/plugins/PluginAPI'; import { pluginRegistry } from '../settings/plugins/PluginAPI';
@@ -183,7 +178,6 @@ export const RoomInput = forwardRef<HTMLDivElement, RoomInputProps>(
const [msgDraft, setMsgDraft] = useAtom(roomIdToMsgDraftAtomFamily(roomId)); const [msgDraft, setMsgDraft] = useAtom(roomIdToMsgDraftAtomFamily(roomId));
const [replyDraft, setReplyDraft] = useAtom(roomIdToReplyDraftAtomFamily(roomId)); const [replyDraft, setReplyDraft] = useAtom(roomIdToReplyDraftAtomFamily(roomId));
const replyUserID = replyDraft?.userId; const replyUserID = replyDraft?.userId;
const replyAvatarMxc = replyUserID ? getMemberAvatarMxc(room, replyUserID) : undefined;
const powerLevelTags = usePowerLevelTags(room, powerLevels); const powerLevelTags = usePowerLevelTags(room, powerLevels);
const creatorsTag = useRoomCreatorsTag(); const creatorsTag = useRoomCreatorsTag();
-3
View File
@@ -528,9 +528,6 @@ export function RoomViewHeader({ forumLayout = false }: RoomViewHeaderProps) {
: undefined; : undefined;
const dmUserId = isDirect ? guessDmRoomUserId(room, mx.getSafeUserId()) : undefined; const dmUserId = isDirect ? guessDmRoomUserId(room, mx.getSafeUserId()) : undefined;
const dmAvatarMxc =
(dmUserId ? room.getMember(dmUserId)?.getMxcAvatarUrl() : undefined) ||
(isDirect ? avatarMxc : undefined);
const dmCustomColor = useOtherUserColor(dmUserId ?? ''); const dmCustomColor = useOtherUserColor(dmUserId ?? '');
const dmFolderTabColor = const dmFolderTabColor =
stationery && isDirect stationery && isDirect
@@ -495,6 +495,5 @@ export function sampleBurstAngle(profile: EmojiBurstProfile): number {
} }
const bias = profile.angleBias ?? -Math.PI / 2; const bias = profile.angleBias ?? -Math.PI / 2;
const halfSpread = profile.angleSpread / 2;
return bias + (Math.random() - 0.5) * profile.angleSpread * (0.6 + Math.random() * 0.4); return bias + (Math.random() - 0.5) * profile.angleSpread * (0.6 + Math.random() * 0.4);
} }
+6 -10
View File
@@ -11,7 +11,6 @@ import { useMediaAuthentication } from '../../../hooks/useMediaAuthentication';
import { useAuthenticatedMediaUrl } from '../../../hooks/useAuthenticatedMediaUrl'; import { useAuthenticatedMediaUrl } from '../../../hooks/useAuthenticatedMediaUrl';
import { getTextShadowColor } from '../../../utils/common'; import { getTextShadowColor } from '../../../utils/common';
import { useFilePicker } from '../../../hooks/useFilePicker'; import { useFilePicker } from '../../../hooks/useFilePicker';
import { useObjectURL } from '../../../hooks/useObjectURL';
import { createUploadAtom, UploadSuccess } from '../../../state/upload'; import { createUploadAtom, UploadSuccess } from '../../../state/upload';
import { CompactUploadCardRenderer } from '../../../components/upload-card'; import { CompactUploadCardRenderer } from '../../../components/upload-card';
import { useUserColorPreference } from '../../../hooks/useUserColor'; import { useUserColorPreference } from '../../../hooks/useUserColor';
@@ -51,7 +50,7 @@ function ProfileBanner({
const userId = mx.getUserId()!; const userId = mx.getUserId()!;
const profile = useUserProfile(userId); const profile = useUserProfile(userId);
const presence = useUserPresence(userId); const presence = useUserPresence(userId);
const [userBanner, setUserBanner, loading] = useUserBanner(); const [userBanner, setUserBanner] = useUserBanner();
const [collectibles, updateCollectible] = useUserCollectibles(); const [collectibles, updateCollectible] = useUserCollectibles();
const [saving, setSaving] = useState(false); const [saving, setSaving] = useState(false);
const [error, setError] = useState<string>(); const [error, setError] = useState<string>();
@@ -118,7 +117,7 @@ function ProfileBanner({
setColorError(undefined); setColorError(undefined);
try { try {
await setColorPreference({ on_dark: localOnDark, on_light: localOnLight }); await setColorPreference({ on_dark: localOnDark, on_light: localOnLight });
} catch (e) { } catch {
setColorError('Failed to save colors. Your server may not support profile fields (MSC4133).'); setColorError('Failed to save colors. Your server may not support profile fields (MSC4133).');
} }
setSavingColor(false); setSavingColor(false);
@@ -131,7 +130,7 @@ function ProfileBanner({
await setColorPreference(undefined); await setColorPreference(undefined);
setLocalOnDark('#ffd9f5'); setLocalOnDark('#ffd9f5');
setLocalOnLight('#440000'); setLocalOnLight('#440000');
} catch (e) { } catch {
setColorError('Failed to remove colors'); setColorError('Failed to remove colors');
} }
setSavingColor(false); setSavingColor(false);
@@ -157,7 +156,7 @@ function ProfileBanner({
setVerbError(undefined); setVerbError(undefined);
try { try {
await setTypingVerb(parsed); await setTypingVerb(parsed);
} catch (e) { } catch {
setVerbError('Failed to save typing verb. Server may not support profile fields (MSC4133).'); setVerbError('Failed to save typing verb. Server may not support profile fields (MSC4133).');
} }
setSavingVerb(false); setSavingVerb(false);
@@ -169,7 +168,7 @@ function ProfileBanner({
try { try {
await setTypingVerb(undefined); await setTypingVerb(undefined);
setLocalVerb(''); setLocalVerb('');
} catch (e) { } catch {
setVerbError('Failed to remove typing verb'); setVerbError('Failed to remove typing verb');
} }
setSavingVerb(false); setSavingVerb(false);
@@ -330,7 +329,6 @@ function ProfileBanner({
}, [mx, useAuthentication, userBanner, refreshTrigger]); }, [mx, useAuthentication, userBanner, refreshTrigger]);
const [imageFile, setImageFile] = useState<File>(); const [imageFile, setImageFile] = useState<File>();
const imageFileURL = useObjectURL(imageFile);
const uploadAtom = useMemo(() => { const uploadAtom = useMemo(() => {
if (imageFile) return createUploadAtom(imageFile); if (imageFile) return createUploadAtom(imageFile);
return undefined; return undefined;
@@ -414,7 +412,7 @@ function ProfileBanner({
await setUserBanner(undefined); await setUserBanner(undefined);
// Sync user object to propagate changes throughout app // Sync user object to propagate changes throughout app
await syncUserAvatar(); await syncUserAvatar();
} catch (e) { } catch {
setError('Failed to remove banner.'); setError('Failed to remove banner.');
} }
setSaving(false); setSaving(false);
@@ -1209,8 +1207,6 @@ function ProfileBanner({
} }
export function Profile() { export function Profile() {
const mx = useMatrixClient();
const userId = mx.getUserId()!;
const avatarRef = useRef<HTMLDivElement>(null); const avatarRef = useRef<HTMLDivElement>(null);
const nameRef = useRef<HTMLDivElement>(null); const nameRef = useRef<HTMLDivElement>(null);
@@ -315,7 +315,9 @@ function AndroidPushNotifications() {
radii="300" radii="300"
variant="Secondary" variant="Secondary"
disabled={isBusy} disabled={isBusy}
onClick={() => void reset()} onClick={() => {
reset();
}}
> >
{resetState.status === AsyncStatus.Loading ? ( {resetState.status === AsyncStatus.Loading ? (
<Spinner variant="Secondary" size="200" /> <Spinner variant="Secondary" size="200" />
@@ -334,7 +336,9 @@ function AndroidPushNotifications() {
radii="300" radii="300"
variant="Secondary" variant="Secondary"
disabled={isBusy} disabled={isBusy}
onClick={() => void ping()} onClick={() => {
ping();
}}
> >
{pingState.status === AsyncStatus.Loading ? ( {pingState.status === AsyncStatus.Loading ? (
<Spinner variant="Secondary" size="200" /> <Spinner variant="Secondary" size="200" />
+37 -37
View File
@@ -242,6 +242,43 @@ function SettingRenderer({
return null; return null;
} }
function PluginAvatar({ thumbnail, name }: { thumbnail: string; name: string }) {
const [imageError, setImageError] = useState(false);
return (
<Avatar size="500" radii="400">
{!imageError ? (
<img
src={thumbnail}
alt={name}
style={{
width: '100%',
height: '100%',
objectFit: 'cover',
borderRadius: 'inherit',
}}
onError={() => setImageError(true)}
/>
) : (
<Box
justifyContent="Center"
alignItems="Center"
style={{
width: '100%',
height: '100%',
background: `linear-gradient(135deg, ${color.Secondary.Container} 0%, ${color.Primary.Container} 100%)`,
borderRadius: 'inherit',
}}
>
<Text size="H3" priority="300" style={{ fontWeight: 600 }}>
{name.charAt(0).toUpperCase()}
</Text>
</Box>
)}
</Avatar>
);
}
type PluginsProps = { type PluginsProps = {
requestClose: () => void; requestClose: () => void;
}; };
@@ -346,43 +383,6 @@ export function Plugins({ requestClose }: PluginsProps) {
[installedPlugins], [installedPlugins],
); );
function PluginAvatar({ thumbnail, name }: { thumbnail: string; name: string }) {
const [imageError, setImageError] = useState(false);
return (
<Avatar size="500" radii="400">
{!imageError ? (
<img
src={thumbnail}
alt={name}
style={{
width: '100%',
height: '100%',
objectFit: 'cover',
borderRadius: 'inherit',
}}
onError={() => setImageError(true)}
/>
) : (
<Box
justifyContent="Center"
alignItems="Center"
style={{
width: '100%',
height: '100%',
background: `linear-gradient(135deg, ${color.Secondary.Container} 0%, ${color.Primary.Container} 100%)`,
borderRadius: 'inherit',
}}
>
<Text size="H3" priority="300" style={{ fontWeight: 600 }}>
{name.charAt(0).toUpperCase()}
</Text>
</Box>
)}
</Avatar>
);
}
const filteredMarketplacePlugins = useMemo(() => { const filteredMarketplacePlugins = useMemo(() => {
if (!searchQuery.trim()) return marketplacePlugins; if (!searchQuery.trim()) return marketplacePlugins;
return fuzzyFilter(marketplacePlugins, searchQuery, (plugin) => [ return fuzzyFilter(marketplacePlugins, searchQuery, (plugin) => [
@@ -200,7 +200,9 @@ export function Permissions({ requestClose }: PermissionsProps) {
// Add a small delay to avoid rate limiting // Add a small delay to avoid rate limiting
if (completed < total) { if (completed < total) {
await new Promise((resolve) => setTimeout(resolve, 100)); await new Promise((resolve) => {
setTimeout(resolve, 100);
});
} }
} }
} catch (error) { } catch (error) {
@@ -297,7 +299,9 @@ export function Permissions({ requestClose }: PermissionsProps) {
// Add a small delay to avoid rate limiting // Add a small delay to avoid rate limiting
if (completed < total) { if (completed < total) {
await new Promise((resolve) => setTimeout(resolve, 100)); await new Promise((resolve) => {
setTimeout(resolve, 100);
});
} }
} }
} catch (error) { } catch (error) {
@@ -325,7 +329,6 @@ export function Permissions({ requestClose }: PermissionsProps) {
return <PowersEditor powerLevels={powerLevels} requestClose={() => setPowerEditor(false)} />; return <PowersEditor powerLevels={powerLevels} requestClose={() => setPowerEditor(false)} />;
} }
const hasSyncableChildren = allChildren.length > 0;
const isSyncing = syncState.status === AsyncStatus.Loading; const isSyncing = syncState.status === AsyncStatus.Loading;
const syncSuccess = syncState.status === AsyncStatus.Success; const syncSuccess = syncState.status === AsyncStatus.Success;
const syncError = syncState.status === AsyncStatus.Error; const syncError = syncState.status === AsyncStatus.Error;
@@ -235,7 +235,6 @@ function MessageNotifications() {
const notify = useCallback( const notify = useCallback(
({ ({
roomName,
roomAvatar, roomAvatar,
username, username,
messageBody, messageBody,
+1 -1
View File
@@ -384,7 +384,7 @@ export function Home() {
{open && ( {open && (
<JoinAddressPrompt <JoinAddressPrompt
onCancel={() => setOpen(false)} onCancel={() => setOpen(false)}
onOpen={(roomIdOrAlias, viaServers, eventId) => { onOpen={(roomIdOrAlias, viaServers) => {
setOpen(false); setOpen(false);
const searchParams: _RoomSearchParams = { const searchParams: _RoomSearchParams = {
viaServers: viaServers?.join(','), viaServers: viaServers?.join(','),
+4 -2
View File
@@ -410,7 +410,7 @@ class AndroidUnifiedPushManager {
if (!client) return; if (!client) return;
const { registerPlugin } = await loadCapacitorCore(); const { registerPlugin } = await loadCapacitorCore();
const MatrixBackgroundSync = registerPlugin<MatrixBackgroundSyncPlugin>('MatrixBackgroundSync'); registerPlugin<MatrixBackgroundSyncPlugin>('MatrixBackgroundSync');
const status = await this.safeGetStatus(); const status = await this.safeGetStatus();
console.log('[BackgroundSync] Native status before pusher sync:', status); console.log('[BackgroundSync] Native status before pusher sync:', status);
@@ -574,7 +574,9 @@ export const requestResetPushRegistration = async (): Promise<{ success: boolean
// Endpoint arrives asynchronously from the distributor after register(). // Endpoint arrives asynchronously from the distributor after register().
for (let i = 0; i < 40; i += 1) { for (let i = 0; i < 40; i += 1) {
await new Promise((resolve) => setTimeout(resolve, 250)); await new Promise((resolve) => {
setTimeout(resolve, 250);
});
const status = await getBackgroundSyncStatus(); const status = await getBackgroundSyncStatus();
if (status?.registered && status.endpoint) { if (status?.registered && status.endpoint) {
return { success: true }; return { success: true };
+1 -1
View File
@@ -58,7 +58,7 @@ export const setupCopyHandler = (
} }
textNode = walker.nextNode(); textNode = walker.nextNode();
} }
} catch (e) { } catch {
// Fallback: check if selection contains the content element // Fallback: check if selection contains the content element
isSelected = selection.containsNode(contentEl, true); isSelected = selection.containsNode(contentEl, true);
} }
+1 -1
View File
@@ -31,7 +31,7 @@ export const withViewTransition = async (callback: () => void | Promise<void>):
}); });
await transition.finished; await transition.finished;
} catch (error) { } catch {
// Fallback if transition fails // Fallback if transition fails
await callback(); await callback();
} }
+1 -31
View File
@@ -131,33 +131,6 @@ const getAllIndexedDBNames = async (): Promise<string[]> => {
return []; return [];
}; };
const deleteAllMatrixDatabases = async (): Promise<void> => {
console.log('[initMatrix] Clearing all Matrix-related IndexedDB databases...');
const dbNames = await getAllIndexedDBNames();
console.log('[initMatrix] Found databases:', dbNames);
// Delete all Matrix-related databases (with matrix-js-sdk: prefix)
const matrixDbNames = dbNames.filter(
(name) =>
name.startsWith('matrix-js-sdk:') ||
name.startsWith('crypto@') ||
name.startsWith('sync@') ||
name === 'crypto-store' ||
name === 'web-sync-store',
);
console.log('[initMatrix] Deleting Matrix databases:', matrixDbNames);
for (const dbName of matrixDbNames) {
try {
await deleteIndexedDB(dbName);
} catch (error) {
console.error(`[initMatrix] Failed to delete ${dbName}:`, error);
}
}
};
/** /**
* Delete the Rust crypto database to fix one-time key conflicts. * Delete the Rust crypto database to fix one-time key conflicts.
* This happens when the local crypto state has keys that conflict with server state. * This happens when the local crypto state has keys that conflict with server state.
@@ -284,7 +257,7 @@ export const initClient = async (session: Session): Promise<MatrixClient> => {
localStorage.removeItem('cinny_fix_key_conflict'); localStorage.removeItem('cinny_fix_key_conflict');
console.log('[initMatrix] ✅ Crypto database cleared'); console.log('[initMatrix] ✅ Crypto database cleared');
} }
} catch (e) { } catch {
localStorage.removeItem('cinny_fix_key_conflict'); localStorage.removeItem('cinny_fix_key_conflict');
} }
} }
@@ -450,9 +423,6 @@ export const logoutClient = async (mx: MatrixClient) => {
} }
await mx.clearStores(); await mx.clearStores();
// Import sessions management
const { sessionsAtom, currentSessionAtom, getSessionByUserId, getCurrentSession } =
await import('../app/state/sessions');
const { getLocalStorageItem, setLocalStorageItem } = const { getLocalStorageItem, setLocalStorageItem } =
await import('../app/state/utils/atomWithLocalStorage'); await import('../app/state/utils/atomWithLocalStorage');
+12 -7
View File
@@ -138,7 +138,7 @@ function unpackMegolmKeyFile(data) {
// look for the start line // look for the start line
let lineStart = 0; let lineStart = 0;
while (1) { for (;;) {
const lineEnd = fileStr.indexOf('\n', lineStart); const lineEnd = fileStr.indexOf('\n', lineStart);
if (lineEnd < 0) { if (lineEnd < 0) {
throw new Error('Header line not found'); throw new Error('Header line not found');
@@ -156,7 +156,7 @@ function unpackMegolmKeyFile(data) {
const dataStart = lineStart; const dataStart = lineStart;
// look for the end line // look for the end line
while (1) { for (;;) {
const lineEnd = fileStr.indexOf('\n', lineStart); const lineEnd = fileStr.indexOf('\n', lineStart);
const line = fileStr.slice(lineStart, lineEnd < 0 ? undefined : lineEnd).trim(); const line = fileStr.slice(lineStart, lineEnd < 0 ? undefined : lineEnd).trim();
if (line === TRAILER_LINE) { if (line === TRAILER_LINE) {
@@ -304,15 +304,20 @@ export async function encryptMegolmKeyFile(data, password, options) {
const bodyLength = 1 + salt.length + iv.length + 4 + cipherArray.length + 32; const bodyLength = 1 + salt.length + iv.length + 4 + cipherArray.length + 32;
const resultBuffer = new Uint8Array(bodyLength); const resultBuffer = new Uint8Array(bodyLength);
let idx = 0; let idx = 0;
resultBuffer[idx++] = 1; // version resultBuffer[idx] = 1; // version
idx += 1;
resultBuffer.set(salt, idx); resultBuffer.set(salt, idx);
idx += salt.length; idx += salt.length;
resultBuffer.set(iv, idx); resultBuffer.set(iv, idx);
idx += iv.length; idx += iv.length;
resultBuffer[idx++] = kdfRounds >> 24; resultBuffer[idx] = kdfRounds >> 24;
resultBuffer[idx++] = (kdfRounds >> 16) & 0xff; idx += 1;
resultBuffer[idx++] = (kdfRounds >> 8) & 0xff; resultBuffer[idx] = (kdfRounds >> 16) & 0xff;
resultBuffer[idx++] = kdfRounds & 0xff; idx += 1;
resultBuffer[idx] = (kdfRounds >> 8) & 0xff;
idx += 1;
resultBuffer[idx] = kdfRounds & 0xff;
idx += 1;
resultBuffer.set(cipherArray, idx); resultBuffer.set(cipherArray, idx);
idx += cipherArray.length; idx += cipherArray.length;