diff --git a/index.html b/index.html index 2eefeee2..763aaa82 100644 --- a/index.html +++ b/index.html @@ -4,33 +4,33 @@ - Cinny - - + Vojo + + - - - + + + - + - - + + diff --git a/package-lock.json b/package-lock.json index b7281a0d..65e05e68 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "cinny", + "name": "vojo", "version": "4.11.1", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "cinny", + "name": "vojo", "version": "4.11.1", "license": "AGPL-3.0-only", "dependencies": { diff --git a/package.json b/package.json index 8e7b37b4..cf6d861e 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "cinny", + "name": "vojo", "version": "4.11.1", "description": "Yet another matrix client", "main": "index.js", diff --git a/public/favicon.ico b/public/favicon.ico deleted file mode 100644 index 91671306..00000000 Binary files a/public/favicon.ico and /dev/null differ diff --git a/public/manifest.json b/public/manifest.json index acdcd004..ad0bb403 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -1,7 +1,7 @@ { - "name": "Cinny", - "short_name": "Cinny", - "description": "Yet another matrix client", + "name": "Vojo", + "short_name": "Vojo", + "description": "Vojo Matrix client", "dir": "auto", "lang": "en-US", "display": "standalone", @@ -10,6 +10,12 @@ "background_color": "#fff", "theme_color": "#fff", "icons": [ + { + "src": "./public/res/svg/vojo.svg", + "sizes": "any", + "type": "image/svg+xml", + "purpose": "any maskable" + }, { "src": "./public/android/android-chrome-36x36.png", "sizes": "36x36", diff --git a/public/res/svg/cinny-highlight.svg b/public/res/svg/cinny-highlight.svg deleted file mode 100644 index d59b42a1..00000000 --- a/public/res/svg/cinny-highlight.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/public/res/svg/cinny-unread.svg b/public/res/svg/cinny-unread.svg deleted file mode 100644 index be301375..00000000 --- a/public/res/svg/cinny-unread.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/public/res/svg/cinny.svg b/public/res/svg/cinny.svg deleted file mode 100644 index 8701d67b..00000000 --- a/public/res/svg/cinny.svg +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/public/res/svg/vojo-highlight.svg b/public/res/svg/vojo-highlight.svg new file mode 100644 index 00000000..7b34cf0b --- /dev/null +++ b/public/res/svg/vojo-highlight.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/public/res/svg/vojo-unread.svg b/public/res/svg/vojo-unread.svg new file mode 100644 index 00000000..ad040fad --- /dev/null +++ b/public/res/svg/vojo-unread.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/public/res/svg/vojo.svg b/public/res/svg/vojo.svg new file mode 100644 index 00000000..183c812d --- /dev/null +++ b/public/res/svg/vojo.svg @@ -0,0 +1 @@ +Speak-no-evil-monkey SVG Icon \ No newline at end of file diff --git a/src/app/components/splash-screen/SplashScreen.tsx b/src/app/components/splash-screen/SplashScreen.tsx index 27adadba..1301fe69 100644 --- a/src/app/components/splash-screen/SplashScreen.tsx +++ b/src/app/components/splash-screen/SplashScreen.tsx @@ -21,7 +21,7 @@ export function SplashScreen({ children }: SplashScreenProps) { justifyContent="Center" > - Cinny + Vojo diff --git a/src/app/features/lobby/Lobby.tsx b/src/app/features/lobby/Lobby.tsx index 4b19e516..cd212d72 100644 --- a/src/app/features/lobby/Lobby.tsx +++ b/src/app/features/lobby/Lobby.tsx @@ -43,7 +43,7 @@ import { ASCIILexicalTable, orderKeys } from '../../utils/ASCIILexicalTable'; import { getStateEvent } from '../../utils/room'; import { useClosedLobbyCategoriesAtom } from '../../state/hooks/closedLobbyCategories'; import { - makeCinnySpacesContent, + makeVojoSpacesContent, sidebarItemWithout, useSidebarItems, } from '../../hooks/useSidebarItems'; @@ -421,8 +421,8 @@ export function Lobby() { if (!sidebarSpaces.has(rId)) { newItems.push(rId); } - const newSpacesContent = makeCinnySpacesContent(mx, newItems); - mx.setAccountData(AccountDataEvent.CinnySpaces as any, newSpacesContent as any); + const newSpacesContent = makeVojoSpacesContent(mx, newItems); + mx.setAccountData(AccountDataEvent.VojoSpaces as any, newSpacesContent as any); }, [mx, sidebarItems, sidebarSpaces] ); diff --git a/src/app/features/settings/about/About.tsx b/src/app/features/settings/about/About.tsx index f536d12e..19b29398 100644 --- a/src/app/features/settings/about/About.tsx +++ b/src/app/features/settings/about/About.tsx @@ -4,7 +4,7 @@ import { Page, PageContent, PageHeader } from '../../../components/page'; import { SequenceCard } from '../../../components/sequence-card'; import { SequenceCardStyle } from '../styles.css'; import { SettingTile } from '../../../components/setting-tile'; -import CinnySVG from '../../../../../public/res/svg/cinny.svg'; +import VojoSVG from '../../../../../public/res/svg/vojo.svg'; import { clearCacheAndReload } from '../../../../client/initMatrix'; import { useMatrixClient } from '../../../hooks/useMatrixClient'; @@ -38,47 +38,19 @@ export function About({ requestClose }: AboutProps) { Cinny logo - Cinny + Vojo v4.11.1 Yet another matrix client. - - - - diff --git a/src/app/features/settings/devices/LocalBackup.tsx b/src/app/features/settings/devices/LocalBackup.tsx index 00128c8f..fb89f3f2 100644 --- a/src/app/features/settings/devices/LocalBackup.tsx +++ b/src/app/features/settings/devices/LocalBackup.tsx @@ -28,7 +28,7 @@ function ExportKeys() { const blob = new Blob([encKeys], { type: 'text/plain;charset=us-ascii', }); - FileSaver.saveAs(blob, 'cinny-keys.txt'); + FileSaver.saveAs(blob, 'vojo-keys.txt'); }, [mx] ) diff --git a/src/app/features/settings/notifications/SystemNotification.tsx b/src/app/features/settings/notifications/SystemNotification.tsx index e0df06df..93e0dfdb 100644 --- a/src/app/features/settings/notifications/SystemNotification.tsx +++ b/src/app/features/settings/notifications/SystemNotification.tsx @@ -27,7 +27,7 @@ function EmailNotification() { device_display_name: email, lang: 'en', data: { - brand: 'Cinny', + brand: 'Vojo', }, append: true, }); diff --git a/src/app/hooks/usePowerLevelTags.ts b/src/app/hooks/usePowerLevelTags.ts index 0a6cca50..519774e5 100644 --- a/src/app/hooks/usePowerLevelTags.ts +++ b/src/app/hooks/usePowerLevelTags.ts @@ -87,11 +87,15 @@ const generateFallbackTag = (powerLevelTags: PowerLevelTags, power: number): Mem }; }; +const LEGACY_CINNY_POWER_LEVEL_TAGS = 'in.cinny.room.power_level_tags' as StateEvent; + export const usePowerLevelTags = (room: Room, powerLevels: IPowerLevels): PowerLevelTags => { const tagsEvent = useStateEvent(room, StateEvent.PowerLevelTags); + const legacyTagsEvent = useStateEvent(room, LEGACY_CINNY_POWER_LEVEL_TAGS); + const activeTagsEvent = tagsEvent ?? legacyTagsEvent; const powerLevelTags: PowerLevelTags = useMemo(() => { - const content = tagsEvent?.getContent(); + const content = activeTagsEvent?.getContent(); const powerToTags: PowerLevelTags = { ...content }; const powers = getUsedPowers(powerLevels); @@ -102,7 +106,7 @@ export const usePowerLevelTags = (room: Room, powerLevels: IPowerLevels): PowerL }); return powerToTags; - }, [powerLevels, tagsEvent]); + }, [powerLevels, activeTagsEvent]); return powerLevelTags; }; diff --git a/src/app/hooks/useSidebarItems.ts b/src/app/hooks/useSidebarItems.ts index 16aba225..a7a8c211 100644 --- a/src/app/hooks/useSidebarItems.ts +++ b/src/app/hooks/useSidebarItems.ts @@ -14,7 +14,7 @@ export type ISidebarFolder = { export type TSidebarItem = string | ISidebarFolder; export type SidebarItems = Array; -export type InCinnySpacesContent = { +export type InVojoSpacesContent = { shortcut?: string[]; sidebar?: SidebarItems; }; @@ -22,7 +22,7 @@ export type InCinnySpacesContent = { export const parseSidebar = ( mx: MatrixClient, orphanSpaces: string[], - content?: InCinnySpacesContent + content?: InVojoSpacesContent ) => { const sidebar = content?.sidebar ?? content?.shortcut ?? []; const orphans = new Set(orphanSpaces); @@ -63,34 +63,34 @@ export const parseSidebar = ( return items; }; +const LEGACY_CINNY_SPACES = 'in.cinny.spaces'; + +const getSpacesContent = (mx: MatrixClient): InVojoSpacesContent | undefined => + getAccountData(mx, AccountDataEvent.VojoSpaces)?.getContent() ?? + getAccountData(mx, LEGACY_CINNY_SPACES as AccountDataEvent)?.getContent(); + export const useSidebarItems = ( orphanSpaces: string[] ): [SidebarItems, Dispatch>] => { const mx = useMatrixClient(); - const [sidebarItems, setSidebarItems] = useState(() => { - const inCinnySpacesContent = getAccountData( - mx, - AccountDataEvent.CinnySpaces - )?.getContent(); - return parseSidebar(mx, orphanSpaces, inCinnySpacesContent); - }); + const [sidebarItems, setSidebarItems] = useState(() => + parseSidebar(mx, orphanSpaces, getSpacesContent(mx)) + ); useEffect(() => { - const inCinnySpacesContent = getAccountData( - mx, - AccountDataEvent.CinnySpaces - )?.getContent(); - setSidebarItems(parseSidebar(mx, orphanSpaces, inCinnySpacesContent)); + setSidebarItems(parseSidebar(mx, orphanSpaces, getSpacesContent(mx))); }, [mx, orphanSpaces]); useAccountDataCallback( mx, useCallback( (mEvent) => { - if (mEvent.getType() === AccountDataEvent.CinnySpaces) { - const newContent = mEvent.getContent(); - setSidebarItems(parseSidebar(mx, orphanSpaces, newContent)); + if ( + mEvent.getType() === AccountDataEvent.VojoSpaces || + mEvent.getType() === LEGACY_CINNY_SPACES + ) { + setSidebarItems(parseSidebar(mx, orphanSpaces, mEvent.getContent())); } }, [mx, orphanSpaces] @@ -122,14 +122,13 @@ export const sidebarItemWithout = (items: SidebarItems, roomId: string) => { return newItems; }; -export const makeCinnySpacesContent = ( +export const makeVojoSpacesContent = ( mx: MatrixClient, items: SidebarItems -): InCinnySpacesContent => { - const currentInSpaces = - getAccountData(mx, AccountDataEvent.CinnySpaces)?.getContent() ?? {}; +): InVojoSpacesContent => { + const currentInSpaces = getSpacesContent(mx) ?? {}; - const newSpacesContent: InCinnySpacesContent = { + const newSpacesContent: InVojoSpacesContent = { ...currentInSpaces, sidebar: items, }; diff --git a/src/app/pages/auth/register/PasswordRegisterForm.tsx b/src/app/pages/auth/register/PasswordRegisterForm.tsx index 9f173422..0e182181 100644 --- a/src/app/pages/auth/register/PasswordRegisterForm.tsx +++ b/src/app/pages/auth/register/PasswordRegisterForm.tsx @@ -109,7 +109,7 @@ function RegisterUIAFlow({ auth: authDict, password, username, - initial_device_display_name: 'Cinny Web', + initial_device_display_name: 'Vojo Web', }); }, [onRegister, formData] @@ -250,7 +250,7 @@ export function PasswordRegisterForm({ auth: { session: authData.session, }, - initial_device_display_name: 'Cinny Web', + initial_device_display_name: 'Vojo Web', }); }; diff --git a/src/app/pages/client/ClientNonUIFeatures.tsx b/src/app/pages/client/ClientNonUIFeatures.tsx index ce952bfc..aabe8f88 100644 --- a/src/app/pages/client/ClientNonUIFeatures.tsx +++ b/src/app/pages/client/ClientNonUIFeatures.tsx @@ -3,9 +3,9 @@ import React, { ReactNode, useCallback, useEffect, useRef } from 'react'; import { useNavigate } from 'react-router-dom'; import { RoomEvent, RoomEventHandlerMap } from 'matrix-js-sdk'; import { roomToUnreadAtom, unreadEqual, unreadInfoToUnread } from '../../state/room/roomToUnread'; -import LogoSVG from '../../../../public/res/svg/cinny.svg'; -import LogoUnreadSVG from '../../../../public/res/svg/cinny-unread.svg'; -import LogoHighlightSVG from '../../../../public/res/svg/cinny-highlight.svg'; +import LogoSVG from '../../../../public/res/svg/vojo.svg'; +import LogoUnreadSVG from '../../../../public/res/svg/vojo-unread.svg'; +import LogoHighlightSVG from '../../../../public/res/svg/vojo-highlight.svg'; import NotificationSound from '../../../../public/sound/notification.ogg'; import InviteSound from '../../../../public/sound/invite.ogg'; import { notificationPermission, setFavicon } from '../../utils/dom'; diff --git a/src/app/pages/client/WelcomePage.tsx b/src/app/pages/client/WelcomePage.tsx index b3ec2eb4..885bc4d2 100644 --- a/src/app/pages/client/WelcomePage.tsx +++ b/src/app/pages/client/WelcomePage.tsx @@ -1,7 +1,7 @@ import React from 'react'; -import { Box, Button, Icon, Icons, Text, config, toRem } from 'folds'; +import { Box, config } from 'folds'; import { Page, PageHero, PageHeroSection } from '../../components/page'; -import CinnySVG from '../../../../public/res/svg/cinny.svg'; +import VojoSVG from '../../../../public/res/svg/vojo.svg'; export function WelcomePage() { return ( @@ -14,49 +14,10 @@ export function WelcomePage() { > } - title="Welcome to Cinny" - subTitle={ - - Yet another matrix client.{' '} - - v4.11.1 - - - } - > - - - - - - - + icon={Vojo Logo} + title="Welcome to Vojo" + subTitle={v4.11.1} + /> diff --git a/src/app/pages/client/sidebar/SpaceTabs.tsx b/src/app/pages/client/sidebar/SpaceTabs.tsx index 6fc528a1..1e214b67 100644 --- a/src/app/pages/client/sidebar/SpaceTabs.tsx +++ b/src/app/pages/client/sidebar/SpaceTabs.tsx @@ -68,7 +68,7 @@ import { ISidebarFolder, SidebarItems, TSidebarItem, - makeCinnySpacesContent, + makeVojoSpacesContent, parseSidebar, sidebarItemWithout, useSidebarItems, @@ -744,9 +744,9 @@ export function SpaceTabs({ scrollRef }: SpaceTabsProps) { newItems.push(i); }); - const newSpacesContent = makeCinnySpacesContent(mx, newItems); + const newSpacesContent = makeVojoSpacesContent(mx, newItems); localEchoSidebarItem(parseSidebar(mx, orphanSpaces, newSpacesContent)); - mx.setAccountData(AccountDataEvent.CinnySpaces, newSpacesContent); + mx.setAccountData(AccountDataEvent.VojoSpaces, newSpacesContent); }, [mx, sidebarItems, setOpenedFolder, localEchoSidebarItem, orphanSpaces] ) @@ -790,9 +790,9 @@ export function SpaceTabs({ scrollRef }: SpaceTabsProps) { if (orphanSpaces.includes(roomId)) return; const newItems = sidebarItemWithout(sidebarItems, roomId); - const newSpacesContent = makeCinnySpacesContent(mx, newItems); + const newSpacesContent = makeVojoSpacesContent(mx, newItems); localEchoSidebarItem(parseSidebar(mx, orphanSpaces, newSpacesContent)); - mx.setAccountData(AccountDataEvent.CinnySpaces, newSpacesContent); + mx.setAccountData(AccountDataEvent.VojoSpaces, newSpacesContent); }, [mx, sidebarItems, orphanSpaces, localEchoSidebarItem] ); diff --git a/src/app/state/sessions.ts b/src/app/state/sessions.ts index a9c34ce9..04b1b8ba 100644 --- a/src/app/state/sessions.ts +++ b/src/app/state/sessions.ts @@ -29,28 +29,54 @@ export type SessionStoreName = { // crypto: 'crypto-store', // } as const; +const LEGACY_CINNY_KEYS = { + access_token: 'cinny_access_token', + device_id: 'cinny_device_id', + user_id: 'cinny_user_id', + hs_base_url: 'cinny_hs_base_url', +} as const; + +function migrateLegacyCinnySession() { + if (localStorage.getItem('vojo_access_token') !== null) return; + + const accessToken = localStorage.getItem(LEGACY_CINNY_KEYS.access_token); + const deviceId = localStorage.getItem(LEGACY_CINNY_KEYS.device_id); + const userId = localStorage.getItem(LEGACY_CINNY_KEYS.user_id); + const baseUrl = localStorage.getItem(LEGACY_CINNY_KEYS.hs_base_url); + + if (accessToken && deviceId && userId && baseUrl) { + localStorage.setItem('vojo_access_token', accessToken); + localStorage.setItem('vojo_device_id', deviceId); + localStorage.setItem('vojo_user_id', userId); + localStorage.setItem('vojo_hs_base_url', baseUrl); + } + + Object.values(LEGACY_CINNY_KEYS).forEach((key) => localStorage.removeItem(key)); +} + export function setFallbackSession( accessToken: string, deviceId: string, userId: string, baseUrl: string ) { - localStorage.setItem('cinny_access_token', accessToken); - localStorage.setItem('cinny_device_id', deviceId); - localStorage.setItem('cinny_user_id', userId); - localStorage.setItem('cinny_hs_base_url', baseUrl); + localStorage.setItem('vojo_access_token', accessToken); + localStorage.setItem('vojo_device_id', deviceId); + localStorage.setItem('vojo_user_id', userId); + localStorage.setItem('vojo_hs_base_url', baseUrl); } export const removeFallbackSession = () => { - localStorage.removeItem('cinny_hs_base_url'); - localStorage.removeItem('cinny_user_id'); - localStorage.removeItem('cinny_device_id'); - localStorage.removeItem('cinny_access_token'); + localStorage.removeItem('vojo_hs_base_url'); + localStorage.removeItem('vojo_user_id'); + localStorage.removeItem('vojo_device_id'); + localStorage.removeItem('vojo_access_token'); }; export const getFallbackSession = (): Session | undefined => { - const baseUrl = localStorage.getItem('cinny_hs_base_url'); - const userId = localStorage.getItem('cinny_user_id'); - const deviceId = localStorage.getItem('cinny_device_id'); - const accessToken = localStorage.getItem('cinny_access_token'); + migrateLegacyCinnySession(); + const baseUrl = localStorage.getItem('vojo_hs_base_url'); + const userId = localStorage.getItem('vojo_user_id'); + const deviceId = localStorage.getItem('vojo_device_id'); + const accessToken = localStorage.getItem('vojo_access_token'); if (baseUrl && userId && deviceId && accessToken) { const session: Session = { diff --git a/src/types/matrix/accountData.ts b/src/types/matrix/accountData.ts index 98715996..53d88cec 100644 --- a/src/types/matrix/accountData.ts +++ b/src/types/matrix/accountData.ts @@ -3,7 +3,7 @@ export enum AccountDataEvent { Direct = 'm.direct', IgnoredUserList = 'm.ignored_user_list', - CinnySpaces = 'in.cinny.spaces', + VojoSpaces = 'in.vojo.spaces', ElementRecentEmoji = 'io.element.recent_emoji', diff --git a/src/types/matrix/room.ts b/src/types/matrix/room.ts index c73c0f0b..50edff3f 100644 --- a/src/types/matrix/room.ts +++ b/src/types/matrix/room.ts @@ -39,7 +39,7 @@ export enum StateEvent { SpaceParent = 'm.space.parent', PoniesRoomEmotes = 'im.ponies.room_emotes', - PowerLevelTags = 'in.cinny.room.power_level_tags', + PowerLevelTags = 'in.vojo.room.power_level_tags', } export enum MessageEvent {