mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-25 00:20:57 -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
|
||||
|
|
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 {
|
||||
attachContext?: boolean;
|
||||
queued?: QueuedMessage;
|
||||
message: MessageObject;
|
||||
message: MessageObject & { webhook: { name: string; avatar?: string } };
|
||||
highlight?: boolean;
|
||||
contrast?: boolean;
|
||||
content?: Children;
|
||||
|
@ -138,6 +138,11 @@ const Message = observer(
|
|||
<UserIcon
|
||||
className="avatar"
|
||||
url={message.generateMasqAvatarURL()}
|
||||
override={
|
||||
message.webhook?.avatar
|
||||
? `https://autumn.revolt.chat/avatars/${message.webhook.avatar}`
|
||||
: undefined
|
||||
}
|
||||
target={user}
|
||||
size={36}
|
||||
onClick={handleUserClick}
|
||||
|
@ -158,6 +163,7 @@ const Message = observer(
|
|||
showServerIdentity
|
||||
onClick={handleUserClick}
|
||||
masquerade={message.masquerade!}
|
||||
override={message.webhook?.name}
|
||||
{...userContext}
|
||||
/>
|
||||
<MessageDetail
|
||||
|
|
|
@ -14,6 +14,7 @@ import IconBase, { IconBaseProps } from "../IconBase";
|
|||
type VoiceStatus = "muted" | "deaf";
|
||||
interface Props extends IconBaseProps<User> {
|
||||
status?: boolean;
|
||||
override?: string;
|
||||
voice?: VoiceStatus;
|
||||
masquerade?: API.Masquerade;
|
||||
showServerIdentity?: boolean;
|
||||
|
@ -70,12 +71,15 @@ export default observer(
|
|||
showServerIdentity,
|
||||
masquerade,
|
||||
innerRef,
|
||||
override,
|
||||
...svgProps
|
||||
} = props;
|
||||
|
||||
let { url } = props;
|
||||
if (masquerade?.avatar) {
|
||||
url = client.proxyFile(masquerade.avatar);
|
||||
} else if (override) {
|
||||
url = override;
|
||||
} else if (!url) {
|
||||
let override;
|
||||
if (target && showServerIdentity) {
|
||||
|
|
|
@ -39,6 +39,7 @@ type UsernameProps = Omit<
|
|||
masquerade?: API.Masquerade;
|
||||
showServerIdentity?: boolean | "both";
|
||||
|
||||
override?: string;
|
||||
innerRef?: Ref<any>;
|
||||
};
|
||||
|
||||
|
@ -64,13 +65,16 @@ export const Username = observer(
|
|||
masquerade,
|
||||
showServerIdentity,
|
||||
innerRef,
|
||||
override,
|
||||
...otherProps
|
||||
}: UsernameProps) => {
|
||||
let username = user?.username;
|
||||
let color = masquerade?.colour;
|
||||
let timed_out: Date | undefined;
|
||||
|
||||
if (user && showServerIdentity) {
|
||||
if (override) {
|
||||
username = override;
|
||||
} else if (user && showServerIdentity) {
|
||||
const { server } = useParams<{ server?: string }>();
|
||||
if (server) {
|
||||
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;
|
||||
},
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue