mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-09 08:43:37 -05:00
feat: add support for webhooks
fix: removing reactions crashes client
This commit is contained in:
parent
00708bb8f4
commit
1862db89a3
6 changed files with 31 additions and 5 deletions
3
.env
3
.env
|
@ -1,2 +1,3 @@
|
||||||
VITE_API_URL=https://api.revolt.chat
|
# VITE_API_URL=https://api.revolt.chat
|
||||||
|
VITE_API_URL=https://revolt.chat/api
|
||||||
VITE_THEMES_URL=https://themes.revolt.chat
|
VITE_THEMES_URL=https://themes.revolt.chat
|
||||||
|
|
2
external/lang
vendored
2
external/lang
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit e0244eb1c416a01f3c652ab0a2e99832df9b53c4
|
Subproject commit 1c99677d4f9319d7b380d525a4ca25e57a3d8730
|
2
external/revolt.js
vendored
2
external/revolt.js
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 29df60f782652111d1dfd5480a8e84e73643fdc8
|
Subproject commit 1e45043151550187f0b2cb46cab4e8c5f4b087e0
|
|
@ -33,7 +33,7 @@ import InviteList from "./embed/EmbedInvite";
|
||||||
interface Props {
|
interface Props {
|
||||||
attachContext?: boolean;
|
attachContext?: boolean;
|
||||||
queued?: QueuedMessage;
|
queued?: QueuedMessage;
|
||||||
message: MessageObject;
|
message: MessageObject & { webhook: { name: string; avatar?: string } };
|
||||||
highlight?: boolean;
|
highlight?: boolean;
|
||||||
contrast?: boolean;
|
contrast?: boolean;
|
||||||
content?: Children;
|
content?: Children;
|
||||||
|
@ -138,6 +138,11 @@ const Message = observer(
|
||||||
<UserIcon
|
<UserIcon
|
||||||
className="avatar"
|
className="avatar"
|
||||||
url={message.generateMasqAvatarURL()}
|
url={message.generateMasqAvatarURL()}
|
||||||
|
override={
|
||||||
|
message.webhook?.avatar
|
||||||
|
? `https://autumn.revolt.chat/avatars/${message.webhook.avatar}`
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
target={user}
|
target={user}
|
||||||
size={36}
|
size={36}
|
||||||
onClick={handleUserClick}
|
onClick={handleUserClick}
|
||||||
|
@ -158,6 +163,7 @@ const Message = observer(
|
||||||
showServerIdentity
|
showServerIdentity
|
||||||
onClick={handleUserClick}
|
onClick={handleUserClick}
|
||||||
masquerade={message.masquerade!}
|
masquerade={message.masquerade!}
|
||||||
|
override={message.webhook?.name}
|
||||||
{...userContext}
|
{...userContext}
|
||||||
/>
|
/>
|
||||||
<MessageDetail
|
<MessageDetail
|
||||||
|
|
|
@ -14,6 +14,7 @@ import IconBase, { IconBaseProps } from "../IconBase";
|
||||||
type VoiceStatus = "muted" | "deaf";
|
type VoiceStatus = "muted" | "deaf";
|
||||||
interface Props extends IconBaseProps<User> {
|
interface Props extends IconBaseProps<User> {
|
||||||
status?: boolean;
|
status?: boolean;
|
||||||
|
override?: string;
|
||||||
voice?: VoiceStatus;
|
voice?: VoiceStatus;
|
||||||
masquerade?: API.Masquerade;
|
masquerade?: API.Masquerade;
|
||||||
showServerIdentity?: boolean;
|
showServerIdentity?: boolean;
|
||||||
|
@ -70,12 +71,15 @@ export default observer(
|
||||||
showServerIdentity,
|
showServerIdentity,
|
||||||
masquerade,
|
masquerade,
|
||||||
innerRef,
|
innerRef,
|
||||||
|
override,
|
||||||
...svgProps
|
...svgProps
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
let { url } = props;
|
let { url } = props;
|
||||||
if (masquerade?.avatar) {
|
if (masquerade?.avatar) {
|
||||||
url = client.proxyFile(masquerade.avatar);
|
url = client.proxyFile(masquerade.avatar);
|
||||||
|
} else if (override) {
|
||||||
|
url = override;
|
||||||
} else if (!url) {
|
} else if (!url) {
|
||||||
let override;
|
let override;
|
||||||
if (target && showServerIdentity) {
|
if (target && showServerIdentity) {
|
||||||
|
|
|
@ -39,6 +39,7 @@ type UsernameProps = Omit<
|
||||||
masquerade?: API.Masquerade;
|
masquerade?: API.Masquerade;
|
||||||
showServerIdentity?: boolean | "both";
|
showServerIdentity?: boolean | "both";
|
||||||
|
|
||||||
|
override?: string;
|
||||||
innerRef?: Ref<any>;
|
innerRef?: Ref<any>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -64,13 +65,16 @@ export const Username = observer(
|
||||||
masquerade,
|
masquerade,
|
||||||
showServerIdentity,
|
showServerIdentity,
|
||||||
innerRef,
|
innerRef,
|
||||||
|
override,
|
||||||
...otherProps
|
...otherProps
|
||||||
}: UsernameProps) => {
|
}: UsernameProps) => {
|
||||||
let username = user?.username;
|
let username = user?.username;
|
||||||
let color = masquerade?.colour;
|
let color = masquerade?.colour;
|
||||||
let timed_out: Date | undefined;
|
let timed_out: Date | undefined;
|
||||||
|
|
||||||
if (user && showServerIdentity) {
|
if (override) {
|
||||||
|
username = override;
|
||||||
|
} else if (user && showServerIdentity) {
|
||||||
const { server } = useParams<{ server?: string }>();
|
const { server } = useParams<{ server?: string }>();
|
||||||
if (server) {
|
if (server) {
|
||||||
const client = useClient();
|
const client = useClient();
|
||||||
|
@ -146,6 +150,17 @@ export const Username = observer(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (override) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{el}
|
||||||
|
<BotBadge>
|
||||||
|
<Text id="app.main.channel.bot" />
|
||||||
|
</BotBadge>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return el;
|
return el;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue