mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-01-29 01:28:29 +00:00
add encrypted room url preview toggle
This commit is contained in:
parent
82368418ab
commit
7c204ab8ee
|
@ -472,6 +472,8 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli
|
|||
const [hideNickAvatarEvents] = useSetting(settingsAtom, 'hideNickAvatarEvents');
|
||||
const [mediaAutoLoad] = useSetting(settingsAtom, 'mediaAutoLoad');
|
||||
const [urlPreview] = useSetting(settingsAtom, 'urlPreview');
|
||||
const [encUrlPreview] = useSetting(settingsAtom, 'encUrlPreview');
|
||||
const showUrlPreview = encryptedRoom ? encUrlPreview : urlPreview;
|
||||
const [showHiddenEvents] = useSetting(settingsAtom, 'showHiddenEvents');
|
||||
const setReplyDraft = useSetAtom(roomIdToReplyDraftAtomFamily(room.roomId));
|
||||
const { canDoAction, canSendEvent, getPowerLevel } = usePowerLevelsAPI();
|
||||
|
@ -1006,7 +1008,7 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli
|
|||
|
||||
if (typeof body !== 'string') return null;
|
||||
const trimmedBody = trimReplyFromBody(body);
|
||||
const urlsMatch = urlPreview && !encryptedRoom ? trimmedBody.match(URL_REG) : undefined;
|
||||
const urlsMatch = showUrlPreview && trimmedBody.match(URL_REG);
|
||||
const urls = urlsMatch ? [...new Set(urlsMatch)] : undefined;
|
||||
|
||||
return (
|
||||
|
@ -1039,7 +1041,7 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli
|
|||
|
||||
if (typeof body !== 'string') return null;
|
||||
const trimmedBody = trimReplyFromBody(body);
|
||||
const urlsMatch = urlPreview && !encryptedRoom ? trimmedBody.match(URL_REG) : undefined;
|
||||
const urlsMatch = showUrlPreview && trimmedBody.match(URL_REG);
|
||||
const urls = urlsMatch ? [...new Set(urlsMatch)] : undefined;
|
||||
|
||||
return (
|
||||
|
@ -1070,7 +1072,7 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli
|
|||
|
||||
if (typeof body !== 'string') return null;
|
||||
const trimmedBody = trimReplyFromBody(body);
|
||||
const urlsMatch = urlPreview && !encryptedRoom ? trimmedBody.match(URL_REG) : undefined;
|
||||
const urlsMatch = showUrlPreview && trimmedBody.match(URL_REG);
|
||||
const urls = urlsMatch ? [...new Set(urlsMatch)] : undefined;
|
||||
|
||||
return (
|
||||
|
|
|
@ -60,6 +60,7 @@ function AppearanceSection() {
|
|||
const [hideNickAvatarEvents, setHideNickAvatarEvents] = useSetting(settingsAtom, 'hideNickAvatarEvents');
|
||||
const [mediaAutoLoad, setMediaAutoLoad] = useSetting(settingsAtom, 'mediaAutoLoad');
|
||||
const [urlPreview, setUrlPreview] = useSetting(settingsAtom, 'urlPreview');
|
||||
const [encUrlPreview, setEncUrlPreview] = useSetting(settingsAtom, 'encUrlPreview');
|
||||
const [showHiddenEvents, setShowHiddenEvents] = useSetting(settingsAtom, 'showHiddenEvents');
|
||||
const spacings = ['0', '100', '200', '300', '400', '500']
|
||||
|
||||
|
@ -200,7 +201,17 @@ function AppearanceSection() {
|
|||
onToggle={() => setUrlPreview(!urlPreview)}
|
||||
/>
|
||||
)}
|
||||
content={<Text variant="b3">Show url previews for links in message.</Text>}
|
||||
content={<Text variant="b3">Show url preview for link in messages.</Text>}
|
||||
/>
|
||||
<SettingTile
|
||||
title="Url Preview in Encrypted Room"
|
||||
options={(
|
||||
<Toggle
|
||||
isActive={encUrlPreview}
|
||||
onToggle={() => setEncUrlPreview(!encUrlPreview)}
|
||||
/>
|
||||
)}
|
||||
content={<Text variant="b3">Show url preview for link in encrypted messages.</Text>}
|
||||
/>
|
||||
<SettingTile
|
||||
title="Show hidden events"
|
||||
|
|
|
@ -20,6 +20,7 @@ export interface Settings {
|
|||
hideNickAvatarEvents: boolean;
|
||||
mediaAutoLoad: boolean;
|
||||
urlPreview: boolean;
|
||||
encUrlPreview: boolean;
|
||||
showHiddenEvents: boolean;
|
||||
|
||||
showNotifications: boolean;
|
||||
|
@ -42,6 +43,7 @@ const defaultSettings: Settings = {
|
|||
hideNickAvatarEvents: true,
|
||||
mediaAutoLoad: true,
|
||||
urlPreview: true,
|
||||
encUrlPreview: false,
|
||||
showHiddenEvents: false,
|
||||
|
||||
showNotifications: true,
|
||||
|
|
Loading…
Reference in a new issue