mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-20 00:51:17 -08:00
Name colors!
Cosmetics tab in settings for controlling permissions. Some brand swappage to Sable.
This commit is contained in:
1 parent
29ec172c8b
commit
acbf9bf16c
25 files changed
+322
-119
No files matched your search
Vendored
+7
-1
@@ -1,5 +1,11 @@
|
||||
{
|
||||
"editor.formatOnSave": true,
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"typescript.tsdk": "node_modules/typescript/lib"
|
||||
"typescript.tsdk": "node_modules/typescript/lib",
|
||||
"[typescript]": {
|
||||
"editor.defaultFormatter": "vscode.typescript-language-features"
|
||||
},
|
||||
"[typescriptreact]": {
|
||||
"editor.defaultFormatter": "vscode.typescript-language-features"
|
||||
}
|
||||
}
|
||||
+4
-2
@@ -1,8 +1,9 @@
|
||||
{
|
||||
"defaultHomeserver": 1,
|
||||
"homeserverList": [
|
||||
"converser.eu",
|
||||
"sable.moe",
|
||||
"matrix.org",
|
||||
"converser.eu",
|
||||
"mozilla.org",
|
||||
"unredacted.org",
|
||||
"xmr.se"
|
||||
@@ -12,6 +13,7 @@
|
||||
"featuredCommunities": {
|
||||
"openAsDefault": false,
|
||||
"spaces": [
|
||||
"#bdsystem:sable.moe",
|
||||
"#cinny-space:matrix.org",
|
||||
"#community:matrix.org",
|
||||
"#space:unredacted.org",
|
||||
@@ -27,7 +29,7 @@
|
||||
"#PrivSec.dev:arcticfoxes.net",
|
||||
"#disroot:aria-net.org"
|
||||
],
|
||||
"servers": [ "matrix.org", "mozilla.org", "unredacted.org" ]
|
||||
"servers": [ "sable.moe", "matrix.org", "mozilla.org", "unredacted.org" ]
|
||||
},
|
||||
|
||||
"hashRouter": {
|
||||
|
||||
+36
-90
@@ -1,96 +1,42 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
|
||||
<title>Cinny</title>
|
||||
<meta name="name" content="Cinny" />
|
||||
<meta name="author" content="Ajay Bura" />
|
||||
<meta
|
||||
name="description"
|
||||
content="A Matrix client where you can enjoy the conversation using simple, elegant and secure interface protected by e2ee with the power of open source."
|
||||
/>
|
||||
<meta
|
||||
name="keywords"
|
||||
content="cinny, cinnyapp, cinnychat, matrix, matrix client, matrix.org, element"
|
||||
/>
|
||||
|
||||
<meta property="og:title" content="Cinny" />
|
||||
<meta property="og:url" content="https://cinny.in" />
|
||||
<meta property="og:image" content="https://cinny.in/assets/favicon-48x48.png" />
|
||||
<meta
|
||||
property="og:description"
|
||||
content="A Matrix client where you can enjoy the conversation using simple, elegant and secure interface protected by e2ee with the power of open source."
|
||||
/>
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
|
||||
<title>Sable Client</title>
|
||||
<meta name="name" content="Sable" />
|
||||
<meta name="author" content="7w1" />
|
||||
<meta name="description"
|
||||
content="A Matrix client where you can enjoy the conversation using (not) simple, elegant and secure interface protected by e2ee with the power of open source. And colorful cosmetics. Because yes." />
|
||||
<meta name="keywords"
|
||||
content="sable client, sable, sableapp, cinnyapp, cinny, cinny client, matrix, matrix client, matrix.org, element" />
|
||||
|
||||
<link id="favicon" rel="shortcut icon" href="./public/favicon.ico" />
|
||||
<meta property="og:title" content="Sable" />
|
||||
<meta property="og:url" content="https://app.sable.moe" />
|
||||
<meta property="og:image" content="./public/favicon.png" />
|
||||
<meta property="og:description"
|
||||
content="A Matrix client where you can enjoy the conversation using (not) simple, elegant and secure interface protected by e2ee with the power of open source. And colorful cosmetics. Because yes." />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
|
||||
<link rel="manifest" href="/manifest.json" />
|
||||
<meta name="mobile-web-app-capable" content="yes" />
|
||||
<meta name="application-name" content="Cinny" />
|
||||
<meta name="apple-mobile-web-app-title" content="Cinny" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||
<link id="favicon" rel="shortcut icon" href="./public/favicon.png" />
|
||||
|
||||
<link
|
||||
rel="apple-touch-icon"
|
||||
sizes="57x57"
|
||||
href="./public/res/apple/apple-touch-icon-57x57.png"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-icon"
|
||||
sizes="60x60"
|
||||
href="./public/res/apple/apple-touch-icon-60x60.png"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-icon"
|
||||
sizes="72x72"
|
||||
href="./public/res/apple/apple-touch-icon-72x72.png"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-icon"
|
||||
sizes="76x76"
|
||||
href="./public/res/apple/apple-touch-icon-76x76.png"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-icon"
|
||||
sizes="114x114"
|
||||
href="./public/res/apple/apple-touch-icon-114x114.png"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-icon"
|
||||
sizes="120x120"
|
||||
href="./public/res/apple/apple-touch-icon-120x120.png"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-icon"
|
||||
sizes="144x144"
|
||||
href="./public/res/apple/apple-touch-icon-144x144.png"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-icon"
|
||||
sizes="152x152"
|
||||
href="./public/res/apple/apple-touch-icon-152x152.png"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-icon"
|
||||
sizes="167x167"
|
||||
href="./public/res/apple/apple-touch-icon-167x167.png"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-icon"
|
||||
sizes="180x180"
|
||||
href="./public/res/apple/apple-touch-icon-180x180.png"
|
||||
/>
|
||||
</head>
|
||||
<body id="appBody">
|
||||
<script>
|
||||
window.global ||= window;
|
||||
</script>
|
||||
<div id="root"></div>
|
||||
<div id="portalContainer"></div>
|
||||
<script type="module" src="./src/index.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
<link rel="manifest" href="/manifest.json" />
|
||||
<meta name="mobile-web-app-capable" content="yes" />
|
||||
<meta name="application-name" content="Sable" />
|
||||
<meta name="apple-mobile-web-app-title" content="Sable" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||
</head>
|
||||
|
||||
<body id="appBody">
|
||||
<script>
|
||||
window.global ||= window;
|
||||
</script>
|
||||
<div id="root"></div>
|
||||
<div id="portalContainer"></div>
|
||||
<script type="module" src="./src/index.tsx"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "cinny",
|
||||
"version": "4.10.3",
|
||||
"description": "Yet another matrix client",
|
||||
"description": "Yet another matrix client fork",
|
||||
"main": "index.js",
|
||||
"type": "module",
|
||||
"engines": {
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 33 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 8.3 KiB |
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "Cinny",
|
||||
"short_name": "Cinny",
|
||||
"description": "Yet another matrix client",
|
||||
"name": "Sable",
|
||||
"short_name": "Sable",
|
||||
"description": "Yet another matrix client fork",
|
||||
"dir": "auto",
|
||||
"lang": "en-US",
|
||||
"display": "standalone",
|
||||
|
||||
@@ -21,7 +21,7 @@ export function SplashScreen({ children }: SplashScreenProps) {
|
||||
justifyContent="Center"
|
||||
>
|
||||
<Text size="H2" align="Center">
|
||||
Cinny
|
||||
Sable
|
||||
</Text>
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
import React, { useCallback } from 'react';
|
||||
import {
|
||||
Box,
|
||||
Text,
|
||||
IconButton,
|
||||
Icon,
|
||||
Icons,
|
||||
Scroll,
|
||||
Switch,
|
||||
} from 'folds';
|
||||
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 { useRoom } from '../../../hooks/useRoom';
|
||||
import { usePowerLevels } from '../../../hooks/usePowerLevels';
|
||||
import { useMatrixClient } from '../../../hooks/useMatrixClient';
|
||||
import { StateEvent } from '../../../../types/matrix/room';
|
||||
import { useRoomCreators } from '../../../hooks/useRoomCreators';
|
||||
import { useRoomPermissions } from '../../../hooks/useRoomPermissions';
|
||||
|
||||
type CosmeticsProps = {
|
||||
requestClose: () => void;
|
||||
};
|
||||
|
||||
export function Cosmetics({ requestClose }: CosmeticsProps) {
|
||||
const mx = useMatrixClient();
|
||||
const room = useRoom();
|
||||
const creators = useRoomCreators(room);
|
||||
const powerLevels = usePowerLevels(room);
|
||||
const isSpace = room.isSpaceRoom();
|
||||
|
||||
const permissions = useRoomPermissions(creators, powerLevels);
|
||||
const canEditPermissions = permissions.stateEvent(StateEvent.RoomPowerLevels, mx.getSafeUserId());
|
||||
|
||||
const currentLevel = (powerLevels as any).events?.[StateEvent.RoomCosmeticsColor] ?? 50;
|
||||
|
||||
const handleToggle = useCallback(async (enabled: boolean) => {
|
||||
const newLevel = enabled ? 0 : 50;
|
||||
|
||||
const newContent = {
|
||||
...powerLevels,
|
||||
events: {
|
||||
...((powerLevels as any).events || {}),
|
||||
[StateEvent.RoomCosmeticsColor]: newLevel,
|
||||
},
|
||||
};
|
||||
|
||||
try {
|
||||
await mx.sendStateEvent(room.roomId, StateEvent.RoomPowerLevels as any, newContent, "");
|
||||
} catch (e) {
|
||||
console.error("Failed to update cosmetic permissions:", e);
|
||||
}
|
||||
}, [mx, room.roomId, powerLevels]);
|
||||
|
||||
return (
|
||||
<Page>
|
||||
<PageHeader outlined={false}>
|
||||
<Box grow="Yes" gap="200">
|
||||
<Box grow="Yes" alignItems="Center" gap="200">
|
||||
<Text size="H3" truncate>
|
||||
Cosmetics
|
||||
</Text>
|
||||
</Box>
|
||||
<Box shrink="No">
|
||||
<IconButton onClick={requestClose} variant="Surface">
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Box>
|
||||
</Box>
|
||||
</PageHeader>
|
||||
<Box grow="Yes">
|
||||
<Scroll hideTrack visibility="Hover">
|
||||
<PageContent>
|
||||
<Box direction="Column" gap="700">
|
||||
<Box direction="Column" gap="100">
|
||||
<Text size="L400">Settings</Text>
|
||||
<SequenceCard
|
||||
className={SequenceCardStyle}
|
||||
variant="SurfaceVariant"
|
||||
direction="Column"
|
||||
gap="400"
|
||||
>
|
||||
<SettingTile
|
||||
title={isSpace ? "Space-Wide Colors" : "Room Colors"}
|
||||
description={
|
||||
isSpace
|
||||
? "Allow everyone to use the /gcolor command to set their global identity for this Space."
|
||||
: "Allow everyone to use the /color command to set a unique color for this room."
|
||||
}
|
||||
after={
|
||||
<Switch
|
||||
variant="Primary"
|
||||
value={currentLevel === 0}
|
||||
onChange={handleToggle}
|
||||
disabled={!canEditPermissions}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</SequenceCard>
|
||||
</Box>
|
||||
</Box>
|
||||
</PageContent>
|
||||
</Scroll>
|
||||
</Box>
|
||||
</Page>
|
||||
);
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import { Permissions } from './permissions';
|
||||
import { RoomSettingsPage } from '../../state/roomSettings';
|
||||
import { useRoom } from '../../hooks/useRoom';
|
||||
import { DeveloperTools } from '../common-settings/developer-tools';
|
||||
import { Cosmetics } from '../common-settings/cosmetics/Cosmetics';
|
||||
|
||||
type RoomSettingsMenuItem = {
|
||||
page: RoomSettingsPage;
|
||||
@@ -42,6 +43,11 @@ const useRoomSettingsMenuItems = (): RoomSettingsMenuItem[] =>
|
||||
name: 'Permissions',
|
||||
icon: Icons.Lock,
|
||||
},
|
||||
{
|
||||
page: RoomSettingsPage.CosmeticsPage,
|
||||
name: 'Cosmetics',
|
||||
icon: Icons.Alphabet,
|
||||
},
|
||||
{
|
||||
page: RoomSettingsPage.EmojisStickersPage,
|
||||
name: 'Emojis & Stickers',
|
||||
@@ -161,6 +167,9 @@ export function RoomSettings({ initialPage, requestClose }: RoomSettingsProps) {
|
||||
{activePage === RoomSettingsPage.PermissionsPage && (
|
||||
<Permissions requestClose={handlePageRequestClose} />
|
||||
)}
|
||||
{activePage === RoomSettingsPage.CosmeticsPage && (
|
||||
<Cosmetics requestClose={handlePageRequestClose} />
|
||||
)}
|
||||
{activePage === RoomSettingsPage.EmojisStickersPage && (
|
||||
<EmojisStickers requestClose={handlePageRequestClose} />
|
||||
)}
|
||||
|
||||
@@ -32,7 +32,7 @@ import React, {
|
||||
} from 'react';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import { useHover, useFocusWithin } from 'react-aria';
|
||||
import { MatrixEvent, Room } from 'matrix-js-sdk';
|
||||
import { EventTimeline, MatrixEvent, Room } from 'matrix-js-sdk';
|
||||
import { Relations } from 'matrix-js-sdk/lib/models/relations';
|
||||
import classNames from 'classnames';
|
||||
import { RoomPinnedEventsEventContent } from 'matrix-js-sdk/lib/types';
|
||||
@@ -79,6 +79,7 @@ import { MemberPowerTag, StateEvent } from '../../../../types/matrix/room';
|
||||
import { PowerIcon } from '../../../components/power';
|
||||
import colorMXID from '../../../../util/colorMXID';
|
||||
import { getPowerTagIconSrc } from '../../../hooks/useMemberPowerTag';
|
||||
import { AccountDataEvent } from '../../../../types/matrix/accountData';
|
||||
|
||||
export type ReactionHandler = (keyOrMxc: string, shortcode: string) => void;
|
||||
|
||||
@@ -741,7 +742,27 @@ export const Message = as<'div', MessageProps>(
|
||||
? getPowerTagIconSrc(mx, useAuthentication, memberPowerTag.icon)
|
||||
: undefined;
|
||||
|
||||
const usernameColor = legacyUsernameColor ? colorMXID(senderId) : tagColor;
|
||||
// Sable cosmetic username colors
|
||||
const localColor = room?.getLiveTimeline()
|
||||
.getState(EventTimeline.FORWARDS)
|
||||
?.getStateEvents(StateEvent.RoomCosmeticsColor, senderId)
|
||||
?.getContent()?.color;
|
||||
|
||||
const parents = room?.getLiveTimeline()
|
||||
.getState(EventTimeline.FORWARDS)
|
||||
?.getStateEvents(StateEvent.SpaceParent);
|
||||
|
||||
let spaceColor;
|
||||
if (parents && parents.length > 0) {
|
||||
const parentSpaceId = parents[0].getStateKey();
|
||||
const parentSpace = mx.getRoom(parentSpaceId);
|
||||
spaceColor = parentSpace?.getLiveTimeline()
|
||||
.getState(EventTimeline.FORWARDS)
|
||||
?.getStateEvents(StateEvent.RoomCosmeticsColor, senderId)
|
||||
?.getContent()?.color;
|
||||
}
|
||||
|
||||
const usernameColor = localColor || spaceColor || (legacyUsernameColor ? colorMXID(senderId) : tagColor);
|
||||
|
||||
const headerJSX = !collapse && (
|
||||
<Box
|
||||
|
||||
@@ -45,10 +45,10 @@ export function About({ requestClose }: AboutProps) {
|
||||
<Box direction="Column" gap="300">
|
||||
<Box direction="Column" gap="100">
|
||||
<Box gap="100" alignItems="End">
|
||||
<Text size="H3">Cinny</Text>
|
||||
<Text size="H3">Sable</Text>
|
||||
<Text size="T200">v4.10.3</Text>
|
||||
</Box>
|
||||
<Text>Yet another matrix client.</Text>
|
||||
<Text>Yet another matrix client fork.</Text>
|
||||
</Box>
|
||||
|
||||
<Box gap="200" wrap="Wrap">
|
||||
|
||||
@@ -27,7 +27,7 @@ function EmailNotification() {
|
||||
device_display_name: email,
|
||||
lang: 'en',
|
||||
data: {
|
||||
brand: 'Cinny',
|
||||
brand: 'Sable',
|
||||
},
|
||||
append: true,
|
||||
});
|
||||
|
||||
@@ -17,6 +17,7 @@ import { Members } from '../common-settings/members';
|
||||
import { DeveloperTools } from '../common-settings/developer-tools';
|
||||
import { General } from './general';
|
||||
import { Permissions } from './permissions';
|
||||
import { Cosmetics } from '../common-settings/cosmetics/Cosmetics';
|
||||
|
||||
type SpaceSettingsMenuItem = {
|
||||
page: SpaceSettingsPage;
|
||||
@@ -42,6 +43,11 @@ const useSpaceSettingsMenuItems = (): SpaceSettingsMenuItem[] =>
|
||||
name: 'Permissions',
|
||||
icon: Icons.Lock,
|
||||
},
|
||||
{
|
||||
page: SpaceSettingsPage.CosmeticsPage,
|
||||
name: 'Cosmetics',
|
||||
icon: Icons.Alphabet,
|
||||
},
|
||||
{
|
||||
page: SpaceSettingsPage.EmojisStickersPage,
|
||||
name: 'Emojis & Stickers',
|
||||
@@ -162,6 +168,9 @@ export function SpaceSettings({ initialPage, requestClose }: SpaceSettingsProps)
|
||||
{activePage === SpaceSettingsPage.PermissionsPage && (
|
||||
<Permissions requestClose={handlePageRequestClose} />
|
||||
)}
|
||||
{activePage === SpaceSettingsPage.CosmeticsPage && (
|
||||
<Cosmetics requestClose={handlePageRequestClose} />
|
||||
)}
|
||||
{activePage === SpaceSettingsPage.EmojisStickersPage && (
|
||||
<EmojisStickers requestClose={handlePageRequestClose} />
|
||||
)}
|
||||
|
||||
@@ -3,6 +3,7 @@ import {
|
||||
EventTimeline,
|
||||
IContextResponse,
|
||||
MatrixClient,
|
||||
MatrixEvent,
|
||||
Method,
|
||||
Preset,
|
||||
Room,
|
||||
@@ -27,6 +28,7 @@ import { Membership, StateEvent } from '../../types/matrix/room';
|
||||
import { getStateEvent } from '../utils/room';
|
||||
import { splitWithSpace } from '../utils/common';
|
||||
import { createRoomEncryptionState } from '../components/create-room';
|
||||
import { AccountDataEvent } from '../../types/matrix/accountData';
|
||||
|
||||
export const SHRUG = '¯\\_(ツ)_/¯';
|
||||
export const TABLEFLIP = '(╯°□°)╯︵ ┻━┻';
|
||||
@@ -138,6 +140,7 @@ export const parseTimestampFlag = (input: string): number | undefined => {
|
||||
export type CommandExe = (payload: string) => Promise<void>;
|
||||
|
||||
export enum Command {
|
||||
// Cinny commands
|
||||
Me = 'me',
|
||||
Notice = 'notice',
|
||||
Shrug = 'shrug',
|
||||
@@ -159,6 +162,9 @@ export enum Command {
|
||||
UnFlip = 'unflip',
|
||||
Delete = 'delete',
|
||||
Acl = 'acl',
|
||||
// Sable commands
|
||||
Color = 'color',
|
||||
GColor = 'gcolor'
|
||||
}
|
||||
|
||||
export type CommandContent = {
|
||||
@@ -174,6 +180,7 @@ export const useCommands = (mx: MatrixClient, room: Room): CommandRecord => {
|
||||
|
||||
const commands: CommandRecord = useMemo(
|
||||
() => ({
|
||||
// Cinny commands
|
||||
[Command.Me]: {
|
||||
name: Command.Me,
|
||||
description: 'Send action message',
|
||||
@@ -483,7 +490,7 @@ export const useCommands = (mx: MatrixClient, room: Room): CommandRecord => {
|
||||
[Command.Acl]: {
|
||||
name: Command.Acl,
|
||||
description:
|
||||
'Manage server access control list. Example /acl [-a servername1] [-d servername2] [-ra servername1] [-rd servername2]',
|
||||
'Manage server access control list. Example: /acl [-a servername1] [-d servername2] [-ra servername1] [-rd servername2]',
|
||||
exe: async (payload) => {
|
||||
const [, flags] = splitPayloadContentAndFlags(payload);
|
||||
|
||||
@@ -531,6 +538,91 @@ export const useCommands = (mx: MatrixClient, room: Room): CommandRecord => {
|
||||
await mx.sendStateEvent(room.roomId, StateEvent.RoomServerAcl as any, aclContent);
|
||||
},
|
||||
},
|
||||
// Sable commands
|
||||
[Command.Color]: {
|
||||
name: Command.Color,
|
||||
description: 'Set a room-specific color. Example: /color #ff00ff | /color reset',
|
||||
exe: async (payload) => {
|
||||
const input = payload.trim().toLowerCase();
|
||||
const userId = mx.getSafeUserId();
|
||||
|
||||
const sendFeedback = (msg: string) => {
|
||||
const localNotice = new (window as any).matrixcs.MatrixEvent({
|
||||
type: 'm.room.message',
|
||||
content: { msgtype: 'm.notice', body: msg },
|
||||
event_id: `~sable-${Date.now()}`,
|
||||
room_id: room.roomId,
|
||||
sender: userId,
|
||||
});
|
||||
(room as any).addLiveEvents([localNotice], { duplicateStrategy: 'ignore' } as any);
|
||||
};
|
||||
|
||||
try {
|
||||
if (input === 'reset' || input === 'clear') {
|
||||
await mx.sendStateEvent(room.roomId, StateEvent.RoomCosmeticsColor as any, {}, userId);
|
||||
sendFeedback('Room color has been reset.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (/^#[0-9A-F]{6}$/i.test(input)) {
|
||||
await mx.sendStateEvent(room.roomId, StateEvent.RoomCosmeticsColor as any, { color: input }, userId);
|
||||
sendFeedback(`Room color set to ${input}.`);
|
||||
} else {
|
||||
sendFeedback('Invalid format. Use #RRGGBB.');
|
||||
}
|
||||
} catch (e: any) {
|
||||
if (e.errcode === 'M_FORBIDDEN') {
|
||||
sendFeedback('Permission Denied. An admin must enable "Room Colors" in Settings > Cosmetics in app.sable.moe or another supported client.');
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
[Command.GColor]: {
|
||||
name: Command.GColor,
|
||||
description: 'Set your global color for the current Space. Example: /gcolor #ff00ff | /gcolor reset',
|
||||
exe: async (payload) => {
|
||||
const input = payload.trim().toLowerCase();
|
||||
const userId = mx.getSafeUserId();
|
||||
|
||||
const sendFeedback = (msg: string) => {
|
||||
const localNotice = new (window as any).matrixcs.MatrixEvent({
|
||||
type: 'm.room.message',
|
||||
content: { msgtype: 'm.notice', body: msg },
|
||||
event_id: `~sable-g-${Date.now()}`,
|
||||
room_id: room.roomId,
|
||||
sender: userId,
|
||||
});
|
||||
(room as any).addLiveEvents([localNotice], { duplicateStrategy: 'ignore' } as any);
|
||||
};
|
||||
|
||||
const parents = room.getLiveTimeline()
|
||||
.getState(EventTimeline.FORWARDS)
|
||||
?.getStateEvents(StateEvent.SpaceParent);
|
||||
|
||||
const targetSpaceId = parents && parents.length > 0
|
||||
? parents[0].getStateKey()
|
||||
: room.roomId;
|
||||
|
||||
try {
|
||||
if (input === 'reset' || input === 'clear') {
|
||||
await mx.sendStateEvent(targetSpaceId as any, StateEvent.RoomCosmeticsColor as any, {}, userId);
|
||||
sendFeedback('Global Space color reset.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (/^#[0-9A-F]{6}$/i.test(input)) {
|
||||
await mx.sendStateEvent(targetSpaceId as any, StateEvent.RoomCosmeticsColor as any, { color: input }, userId);
|
||||
sendFeedback(`Global Space color set to ${input}.`);
|
||||
} else {
|
||||
sendFeedback('Invalid format. Use #RRGGBB.');
|
||||
}
|
||||
} catch (e: any) {
|
||||
if (e.errcode === 'M_FORBIDDEN') {
|
||||
sendFeedback('Permission Denied. An admin must enable "Space-Wide Colors" in Settings > Cosmetics in app.sable.moe or another supported client.');
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}),
|
||||
[mx, room, navigateRoom]
|
||||
);
|
||||
|
||||
@@ -5,13 +5,13 @@ import * as css from './styles.css';
|
||||
export function AuthFooter() {
|
||||
return (
|
||||
<Box className={css.AuthFooter} justifyContent="Center" gap="400" wrap="Wrap">
|
||||
<Text as="a" size="T300" href="https://cinny.in" target="_blank" rel="noreferrer">
|
||||
<Text as="a" size="T300" href="https://app.sable.moe" target="_blank" rel="noreferrer">
|
||||
About
|
||||
</Text>
|
||||
<Text
|
||||
as="a"
|
||||
size="T300"
|
||||
href="https://github.com/ajbura/cinny/releases"
|
||||
href="https://github.com/7w1/sable/"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
} from '../../hooks/useClientConfig';
|
||||
import { AsyncStatus, useAsyncCallback } from '../../hooks/useAsyncCallback';
|
||||
import { LOGIN_PATH, REGISTER_PATH, RESET_PASSWORD_PATH } from '../paths';
|
||||
import CinnySVG from '../../../../public/res/svg/cinny.svg';
|
||||
import CinnySVG from '../../../../public/favicon.png';
|
||||
import { ServerPicker } from './ServerPicker';
|
||||
import { AutoDiscoveryAction, autoDiscovery } from '../../cs-api';
|
||||
import { SpecVersionsLoader } from '../../components/SpecVersionsLoader';
|
||||
@@ -135,7 +135,7 @@ export function AuthLayout() {
|
||||
<Header className={css.AuthHeader} size="600" variant="Surface">
|
||||
<Box grow="Yes" direction="Row" gap="300" alignItems="Center">
|
||||
<img className={css.AuthLogo} src={CinnySVG} alt="Cinny Logo" />
|
||||
<Text size="H3">Cinny</Text>
|
||||
<Text size="H3">Sable</Text>
|
||||
</Box>
|
||||
</Header>
|
||||
<Box className={css.AuthCardContent} direction="Column">
|
||||
|
||||
@@ -133,7 +133,7 @@ export function PasswordLoginForm({ defaultUsername, defaultEmail }: PasswordLog
|
||||
user: username,
|
||||
},
|
||||
password,
|
||||
initial_device_display_name: 'Cinny Web',
|
||||
initial_device_display_name: 'Sable Web',
|
||||
});
|
||||
};
|
||||
|
||||
@@ -151,7 +151,7 @@ export function PasswordLoginForm({ defaultUsername, defaultEmail }: PasswordLog
|
||||
user: mxIdUsername,
|
||||
},
|
||||
password,
|
||||
initial_device_display_name: 'Cinny Web',
|
||||
initial_device_display_name: 'Sable Web',
|
||||
});
|
||||
};
|
||||
const handleEmailLogin = (email: string, password: string) => {
|
||||
@@ -163,7 +163,7 @@ export function PasswordLoginForm({ defaultUsername, defaultEmail }: PasswordLog
|
||||
address: email,
|
||||
},
|
||||
password,
|
||||
initial_device_display_name: 'Cinny Web',
|
||||
initial_device_display_name: 'Sable Web',
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ export function TokenLogin({ token }: TokenLoginProps) {
|
||||
startLogin(baseUrl, {
|
||||
type: 'm.login.token',
|
||||
token,
|
||||
initial_device_display_name: 'Cinny Web',
|
||||
initial_device_display_name: 'Sable Web',
|
||||
});
|
||||
}, [baseUrl, token, startLogin]);
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ function RegisterUIAFlow({
|
||||
auth: authDict,
|
||||
password,
|
||||
username,
|
||||
initial_device_display_name: 'Cinny Web',
|
||||
initial_device_display_name: 'Sable Web',
|
||||
});
|
||||
},
|
||||
[onRegister, formData]
|
||||
@@ -250,7 +250,7 @@ export function PasswordRegisterForm({
|
||||
auth: {
|
||||
session: authData.session,
|
||||
},
|
||||
initial_device_display_name: 'Cinny Web',
|
||||
initial_device_display_name: 'Sable Web',
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -15,12 +15,12 @@ export function WelcomePage() {
|
||||
<PageHeroSection>
|
||||
<PageHero
|
||||
icon={<img width="70" height="70" src={CinnySVG} alt="Cinny Logo" />}
|
||||
title="Welcome to Cinny"
|
||||
title="Welcome to Sable"
|
||||
subTitle={
|
||||
<span>
|
||||
Yet another matrix client.{' '}
|
||||
Yet another matrix client fork.{' '}
|
||||
<a
|
||||
href="https://github.com/cinnyapp/cinny/releases"
|
||||
href="https://github.com/7w1/sable"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
>
|
||||
@@ -33,7 +33,7 @@ export function WelcomePage() {
|
||||
<Box grow="Yes" style={{ maxWidth: toRem(300) }} direction="Column" gap="300">
|
||||
<Button
|
||||
as="a"
|
||||
href="https://github.com/cinnyapp/cinny"
|
||||
href="https://github.com/7w1/sable"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
before={<Icon size="200" src={Icons.Code} />}
|
||||
@@ -44,7 +44,7 @@ export function WelcomePage() {
|
||||
</Button>
|
||||
<Button
|
||||
as="a"
|
||||
href="https://cinny.in/#sponsor"
|
||||
href="https://github.com/7w1/sable"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
fill="Soft"
|
||||
|
||||
@@ -6,6 +6,8 @@ export enum RoomSettingsPage {
|
||||
PermissionsPage,
|
||||
EmojisStickersPage,
|
||||
DeveloperToolsPage,
|
||||
// Sable pages
|
||||
CosmeticsPage,
|
||||
}
|
||||
|
||||
export type RoomSettingsState = {
|
||||
|
||||
@@ -6,6 +6,8 @@ export enum SpaceSettingsPage {
|
||||
PermissionsPage,
|
||||
EmojisStickersPage,
|
||||
DeveloperToolsPage,
|
||||
// Sable pages
|
||||
CosmeticsPage
|
||||
}
|
||||
|
||||
export type SpaceSettingsState = {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
export enum AccountDataEvent {
|
||||
// Cinny and Matrix Account data
|
||||
PushRules = 'm.push_rules',
|
||||
Direct = 'm.direct',
|
||||
IgnoredUserList = 'm.ignored_user_list',
|
||||
@@ -16,6 +17,7 @@ export enum AccountDataEvent {
|
||||
CrossSigningSelf = 'm.cross_signing.self',
|
||||
CrossSigningUser = 'm.cross_signing.user',
|
||||
MegolmBackupV1 = 'm.megolm_backup.v1',
|
||||
|
||||
}
|
||||
|
||||
export type MDirectContent = Record<string, string[]>;
|
||||
|
||||
@@ -17,6 +17,7 @@ export type IMemberContent = {
|
||||
};
|
||||
|
||||
export enum StateEvent {
|
||||
// Cinny/Matrix state events
|
||||
RoomCanonicalAlias = 'm.room.canonical_alias',
|
||||
RoomCreate = 'm.room.create',
|
||||
RoomJoinRules = 'm.room.join_rules',
|
||||
@@ -38,6 +39,9 @@ export enum StateEvent {
|
||||
|
||||
PoniesRoomEmotes = 'im.ponies.room_emotes',
|
||||
PowerLevelTags = 'in.cinny.room.power_level_tags',
|
||||
|
||||
// Sable state events
|
||||
RoomCosmeticsColor = 'moe.sable.room.color',
|
||||
}
|
||||
|
||||
export enum MessageEvent {
|
||||
|
||||
Reference in new issue
Block a user