feat: switch to revolt.js@6.0.0 + new revolt-api

This commit is contained in:
Paul Makles 2022-04-09 15:47:04 +01:00
parent dc3925c003
commit b2f4411850
91 changed files with 528 additions and 460 deletions

View file

@ -147,8 +147,7 @@
"react-scroll": "^1.8.2", "react-scroll": "^1.8.2",
"react-virtualized-auto-sizer": "^1.0.5", "react-virtualized-auto-sizer": "^1.0.5",
"react-virtuoso": "^1.10.4", "react-virtuoso": "^1.10.4",
"revolt-api": "0.5.3-alpha.12", "revolt.js": "6.0.0-rc.3",
"revolt.js": "5.2.8",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"sass": "^1.35.1", "sass": "^1.35.1",
"shade-blend-color": "^1.0.0", "shade-blend-color": "^1.0.0",

View file

@ -1,6 +1,6 @@
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { useHistory } from "react-router-dom"; import { useHistory } from "react-router-dom";
import { Channel } from "revolt.js/dist/maps/Channels"; import { Channel } from "revolt.js";
import styled from "styled-components/macro"; import styled from "styled-components/macro";
import { Text } from "preact-i18n"; import { Text } from "preact-i18n";

View file

@ -1,5 +1,4 @@
import { Channel } from "revolt.js/dist/maps/Channels"; import { Channel, User } from "revolt.js";
import { User } from "revolt.js/dist/maps/Users";
import styled, { css } from "styled-components/macro"; import styled, { css } from "styled-components/macro";
import { StateUpdater, useState } from "preact/hooks"; import { StateUpdater, useState } from "preact/hooks";

View file

@ -1,14 +1,15 @@
import { Hash, VolumeFull } from "@styled-icons/boxicons-regular"; import { Hash, VolumeFull } from "@styled-icons/boxicons-regular";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { Channel } from "revolt.js/dist/maps/Channels"; import { Channel } from "revolt.js";
import { useContext } from "preact/hooks"; import { useContext } from "preact/hooks";
import { AppContext } from "../../context/revoltjs/RevoltClient"; import { AppContext } from "../../context/revoltjs/RevoltClient";
import { ImageIconBase, IconBaseProps } from "./IconBase";
import fallback from "./assets/group.png"; import fallback from "./assets/group.png";
import { ImageIconBase, IconBaseProps } from "./IconBase";
interface Props extends IconBaseProps<Channel> { interface Props extends IconBaseProps<Channel> {
isServerChannel?: boolean; isServerChannel?: boolean;
} }
@ -32,7 +33,7 @@ export default observer(
...imgProps ...imgProps
} = props; } = props;
const iconURL = client.generateFileURL( const iconURL = client.generateFileURL(
target?.icon ?? attachment, target?.icon ?? attachment ?? undefined,
{ max_side: 256 }, { max_side: 256 },
animate, animate,
); );

View file

@ -1,10 +1,11 @@
import { Attachment } from "revolt-api/types/Autumn"; import { API } from "revolt.js";
import { Nullable } from "revolt.js/dist/util/null";
import styled, { css } from "styled-components/macro"; import styled, { css } from "styled-components/macro";
export interface IconBaseProps<T> { export interface IconBaseProps<T> {
target?: T; target?: T;
url?: string; url?: string;
attachment?: Attachment; attachment?: Nullable<API.File>;
size: number; size: number;
hover?: boolean; hover?: boolean;

View file

@ -2,8 +2,7 @@ import { Check } from "@styled-icons/boxicons-regular";
import { Cog } from "@styled-icons/boxicons-solid"; import { Cog } from "@styled-icons/boxicons-solid";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import { Permission } from "revolt.js/dist/api/permissions"; import { Server } from "revolt.js";
import { Server } from "revolt.js/dist/maps/Servers";
import styled, { css } from "styled-components/macro"; import styled, { css } from "styled-components/macro";
import { Text } from "preact-i18n"; import { Text } from "preact-i18n";

View file

@ -1,5 +1,5 @@
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { Server } from "revolt.js/dist/maps/Servers"; import { Server } from "revolt.js";
import styled from "styled-components/macro"; import styled from "styled-components/macro";
import { useContext } from "preact/hooks"; import { useContext } from "preact/hooks";
@ -39,7 +39,7 @@ export default observer(
const { target, attachment, size, animate, server_name, ...imgProps } = const { target, attachment, size, animate, server_name, ...imgProps } =
props; props;
const iconURL = client.generateFileURL( const iconURL = client.generateFileURL(
target?.icon ?? attachment, target?.icon ?? attachment ?? undefined,
{ max_side: 256 }, { max_side: 256 },
animate, animate,
); );

View file

@ -1,5 +1,5 @@
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { Message as MessageObject } from "revolt.js/dist/maps/Messages"; import { Message as MessageObject } from "revolt.js";
import { attachContextMenu } from "preact-context-menu"; import { attachContextMenu } from "preact-context-menu";
import { memo } from "preact/compat"; import { memo } from "preact/compat";

View file

@ -1,5 +1,5 @@
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { Message } from "revolt.js/dist/maps/Messages"; import { Message } from "revolt.js";
import styled, { css, keyframes } from "styled-components/macro"; import styled, { css, keyframes } from "styled-components/macro";
import { decodeTime } from "ulid"; import { decodeTime } from "ulid";

View file

@ -1,8 +1,7 @@
import { Send, ShieldX, HappyBeaming, Box } from "@styled-icons/boxicons-solid"; import { Send, ShieldX } from "@styled-icons/boxicons-solid";
import Axios, { CancelTokenSource } from "axios"; import Axios, { CancelTokenSource } from "axios";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { Permission } from "revolt.js/dist/api/permissions"; import { Channel, Permission } from "revolt.js";
import { Channel } from "revolt.js/dist/maps/Channels";
import styled, { css } from "styled-components/macro"; import styled, { css } from "styled-components/macro";
import { ulid } from "ulid"; import { ulid } from "ulid";

View file

@ -11,8 +11,7 @@ import {
MessageSquareEdit, MessageSquareEdit,
} from "@styled-icons/boxicons-solid"; } from "@styled-icons/boxicons-solid";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { SystemMessage as SystemMessageI } from "revolt-api/types/Channels"; import { Message, API } from "revolt.js";
import { Message } from "revolt.js/dist/maps/Messages";
import styled from "styled-components/macro"; import styled from "styled-components/macro";
import { attachContextMenu } from "preact-context-menu"; import { attachContextMenu } from "preact-context-menu";
@ -75,7 +74,8 @@ export const SystemMessage = observer(
({ attachContext, message, highlight, hideInfo }: Props) => { ({ attachContext, message, highlight, hideInfo }: Props) => {
const data = message.asSystemMessage; const data = message.asSystemMessage;
const SystemMessageIcon = const SystemMessageIcon =
iconDictionary[data.type as SystemMessageI["type"]] ?? InfoCircle; iconDictionary[data.type as API.SystemMessage["type"]] ??
InfoCircle;
let children; let children;
switch (data.type) { switch (data.type) {

View file

@ -1,4 +1,4 @@
import { Attachment as AttachmentI } from "revolt-api/types/Autumn"; import { API } from "revolt.js";
import styles from "./Attachment.module.scss"; import styles from "./Attachment.module.scss";
import classNames from "classnames"; import classNames from "classnames";
@ -14,7 +14,7 @@ import Spoiler from "./Spoiler";
import TextFile from "./TextFile"; import TextFile from "./TextFile";
interface Props { interface Props {
attachment: AttachmentI; attachment: API.File;
hasContent?: boolean; hasContent?: boolean;
} }

View file

@ -4,7 +4,7 @@ import {
Download, Download,
} from "@styled-icons/boxicons-regular"; } from "@styled-icons/boxicons-regular";
import { File, Video } from "@styled-icons/boxicons-solid"; import { File, Video } from "@styled-icons/boxicons-solid";
import { Attachment } from "revolt-api/types/Autumn"; import { API } from "revolt.js";
import styles from "./AttachmentActions.module.scss"; import styles from "./AttachmentActions.module.scss";
import classNames from "classnames"; import classNames from "classnames";
@ -17,7 +17,7 @@ import { AppContext } from "../../../../context/revoltjs/RevoltClient";
import IconButton from "../../../ui/IconButton"; import IconButton from "../../../ui/IconButton";
interface Props { interface Props {
attachment: Attachment; attachment: API.File;
} }
export default function AttachmentActions({ attachment }: Props) { export default function AttachmentActions({ attachment }: Props) {

View file

@ -1,4 +1,4 @@
import { Attachment } from "revolt-api/types/Autumn"; import { API } from "revolt.js";
import styles from "./Attachment.module.scss"; import styles from "./Attachment.module.scss";
import classNames from "classnames"; import classNames from "classnames";
@ -10,12 +10,12 @@ import { AppContext } from "../../../../context/revoltjs/RevoltClient";
enum ImageLoadingState { enum ImageLoadingState {
Loading, Loading,
Loaded, Loaded,
Error Error,
} }
type Props = JSX.HTMLAttributes<HTMLImageElement> & { type Props = JSX.HTMLAttributes<HTMLImageElement> & {
attachment: Attachment; attachment: API.File;
} };
export default function ImageFile({ attachment, ...props }: Props) { export default function ImageFile({ attachment, ...props }: Props) {
const [loading, setLoading] = useState(ImageLoadingState.Loading); const [loading, setLoading] = useState(ImageLoadingState.Loading);
@ -23,25 +23,19 @@ export default function ImageFile({ attachment, ...props }: Props) {
const { openScreen } = useIntermediate(); const { openScreen } = useIntermediate();
const url = client.generateFileURL(attachment)!; const url = client.generateFileURL(attachment)!;
return <img return (
{...props} <img
src={url} {...props}
alt={attachment.filename} src={url}
loading="lazy" alt={attachment.filename}
className={classNames(styles.image, { loading="lazy"
[styles.loading]: loading !== ImageLoadingState.Loaded className={classNames(styles.image, {
})} [styles.loading]: loading !== ImageLoadingState.Loaded,
onClick={() => })}
openScreen({ id: "image_viewer", attachment }) onClick={() => openScreen({ id: "image_viewer", attachment })}
} onMouseDown={(ev) => ev.button === 1 && window.open(url, "_blank")}
onMouseDown={(ev) => onLoad={() => setLoading(ImageLoadingState.Loaded)}
ev.button === 1 && window.open(url, "_blank") onError={() => setLoading(ImageLoadingState.Error)}
} />
onLoad={() => );
setLoading(ImageLoadingState.Loaded)
}
onError={() =>
setLoading(ImageLoadingState.Error)
}
/>
} }

View file

@ -2,9 +2,7 @@ import { Reply } from "@styled-icons/boxicons-regular";
import { File } from "@styled-icons/boxicons-solid"; import { File } from "@styled-icons/boxicons-solid";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { useHistory } from "react-router-dom"; import { useHistory } from "react-router-dom";
import { RelationshipStatus } from "revolt-api/types/Users"; import { Channel, Message, API } from "revolt.js";
import { Channel } from "revolt.js/dist/maps/Channels";
import { Message } from "revolt.js/dist/maps/Messages";
import styled, { css } from "styled-components/macro"; import styled, { css } from "styled-components/macro";
import { Text } from "preact-i18n"; import { Text } from "preact-i18n";
@ -174,7 +172,7 @@ export const MessageReply = observer(
<ReplyBase head={index === 0}> <ReplyBase head={index === 0}>
{/*<Reply size={16} />*/} {/*<Reply size={16} />*/}
{message.author?.relationship === RelationshipStatus.Blocked ? ( {message.author?.relationship === "Blocked" ? (
<Text id="app.main.channel.misc.blocked_user" /> <Text id="app.main.channel.misc.blocked_user" />
) : ( ) : (
<> <>

View file

@ -1,5 +1,5 @@
import axios from "axios"; import axios from "axios";
import { Attachment } from "revolt-api/types/Autumn"; import { API } from "revolt.js";
import styles from "./Attachment.module.scss"; import styles from "./Attachment.module.scss";
import { useContext, useEffect, useState } from "preact/hooks"; import { useContext, useEffect, useState } from "preact/hooks";
@ -13,7 +13,7 @@ import {
import Preloader from "../../../ui/Preloader"; import Preloader from "../../../ui/Preloader";
interface Props { interface Props {
attachment: Attachment; attachment: API.File;
} }
const fileCache: { [key: string]: string } = {}; const fileCache: { [key: string]: string } = {};

View file

@ -1,6 +1,6 @@
import { DownArrowAlt } from "@styled-icons/boxicons-regular"; import { DownArrowAlt } from "@styled-icons/boxicons-regular";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { Channel } from "revolt.js/dist/maps/Channels"; import { Channel } from "revolt.js";
import styled, { css } from "styled-components/macro"; import styled, { css } from "styled-components/macro";
import { Text } from "preact-i18n"; import { Text } from "preact-i18n";

View file

@ -8,7 +8,7 @@ import {
} from "@styled-icons/boxicons-solid"; } from "@styled-icons/boxicons-solid";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { Permission } from "revolt.js"; import { Permission } from "revolt.js";
import { Message as MessageObject } from "revolt.js/dist/maps/Messages"; import { Message as MessageObject } from "revolt.js";
import styled from "styled-components"; import styled from "styled-components";
import { openContextMenu } from "preact-context-menu"; import { openContextMenu } from "preact-context-menu";

View file

@ -1,7 +1,7 @@
import { UpArrowAlt } from "@styled-icons/boxicons-regular"; import { UpArrowAlt } from "@styled-icons/boxicons-regular";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { useHistory } from "react-router-dom"; import { useHistory } from "react-router-dom";
import { Channel } from "revolt.js/dist/maps/Channels"; import { Channel } from "revolt.js";
import { decodeTime } from "ulid"; import { decodeTime } from "ulid";
import { Text } from "preact-i18n"; import { Text } from "preact-i18n";

View file

@ -1,8 +1,7 @@
import { At, Reply as ReplyIcon } from "@styled-icons/boxicons-regular"; import { At } from "@styled-icons/boxicons-regular";
import { File, XCircle } from "@styled-icons/boxicons-solid"; import { File, XCircle } from "@styled-icons/boxicons-solid";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { Channel } from "revolt.js/dist/maps/Channels"; import { Channel, Message } from "revolt.js";
import { Message } from "revolt.js/dist/maps/Messages";
import styled from "styled-components/macro"; import styled from "styled-components/macro";
import { Text } from "preact-i18n"; import { Text } from "preact-i18n";

View file

@ -1,6 +1,5 @@
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { RelationshipStatus } from "revolt-api/types/Users"; import { Channel } from "revolt.js";
import { Channel } from "revolt.js/dist/maps/Channels";
import styled from "styled-components/macro"; import styled from "styled-components/macro";
import { Text } from "preact-i18n"; import { Text } from "preact-i18n";
@ -65,7 +64,7 @@ export default observer(({ channel }: Props) => {
(x) => (x) =>
typeof x !== "undefined" && typeof x !== "undefined" &&
x._id !== x.client.user!._id && x._id !== x.client.user!._id &&
x.relationship !== RelationshipStatus.Blocked, x.relationship !== "Blocked",
); );
if (users.length > 0) { if (users.length > 0) {

View file

@ -1,4 +1,4 @@
import { Embed as EmbedI } from "revolt-api/types/Channels"; import { API } from "revolt.js";
import styles from "./Embed.module.scss"; import styles from "./Embed.module.scss";
import classNames from "classnames"; import classNames from "classnames";
@ -13,7 +13,7 @@ import Attachment from "../attachments/Attachment";
import EmbedMedia from "./EmbedMedia"; import EmbedMedia from "./EmbedMedia";
interface Props { interface Props {
embed: EmbedI; embed: API.Embed;
} }
const MAX_EMBED_WIDTH = 480; const MAX_EMBED_WIDTH = 480;
@ -128,7 +128,7 @@ export default function Embed({ embed }: Props) {
<a <a
onMouseDown={(ev) => onMouseDown={(ev) =>
(ev.button === 0 || ev.button === 1) && (ev.button === 0 || ev.button === 1) &&
openLink(embed.url) openLink(embed.url!)
} }
className={styles.title}> className={styles.title}>
{embed.title} {embed.title}

View file

@ -1,14 +1,12 @@
import { Group } from "@styled-icons/boxicons-solid"; import { Group } from "@styled-icons/boxicons-solid";
import { autorun, reaction } from "mobx"; import { reaction } from "mobx";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { useHistory } from "react-router-dom"; import { useHistory } from "react-router-dom";
import { RetrievedInvite } from "revolt-api/types/Invites"; import { Message, API } from "revolt.js";
import { Message } from "revolt.js/dist/maps/Messages";
import styled, { css } from "styled-components/macro"; import styled, { css } from "styled-components/macro";
import { useContext, useEffect, useState } from "preact/hooks"; import { useContext, useEffect, useState } from "preact/hooks";
import { defer } from "../../../../lib/defer";
import { isTouchscreenDevice } from "../../../../lib/isTouchscreenDevice"; import { isTouchscreenDevice } from "../../../../lib/isTouchscreenDevice";
import { import {
@ -85,9 +83,9 @@ export function EmbedInvite({ code }: Props) {
const [processing, setProcessing] = useState(false); const [processing, setProcessing] = useState(false);
const [error, setError] = useState<string | undefined>(undefined); const [error, setError] = useState<string | undefined>(undefined);
const [joinError, setJoinError] = useState<string | undefined>(undefined); const [joinError, setJoinError] = useState<string | undefined>(undefined);
const [invite, setInvite] = useState<RetrievedInvite | undefined>( const [invite, setInvite] = useState<
undefined, (API.InviteResponse & { type: "Server" }) | undefined
); >(undefined);
useEffect(() => { useEffect(() => {
if ( if (
@ -96,7 +94,9 @@ export function EmbedInvite({ code }: Props) {
) { ) {
client client
.fetchInvite(code) .fetchInvite(code)
.then((data) => setInvite(data)) .then((data) =>
setInvite(data as API.InviteResponse & { type: "Server" }),
)
.catch((err) => setError(takeError(err))); .catch((err) => setError(takeError(err)));
} }
}, [client, code, invite, status]); }, [client, code, invite, status]);

View file

@ -1,5 +1,5 @@
/* eslint-disable react-hooks/rules-of-hooks */ /* eslint-disable react-hooks/rules-of-hooks */
import { JanuaryEmbed } from "revolt-api/types/January"; import { API } from "revolt.js";
import styles from "./Embed.module.scss"; import styles from "./Embed.module.scss";
@ -7,7 +7,7 @@ import { useIntermediate } from "../../../../context/intermediate/Intermediate";
import { useClient } from "../../../../context/revoltjs/RevoltClient"; import { useClient } from "../../../../context/revoltjs/RevoltClient";
interface Props { interface Props {
embed: JanuaryEmbed; embed: API.Embed;
width?: number; width?: number;
height: number; height: number;
} }
@ -94,7 +94,7 @@ export default function EmbedMedia({ embed, width, height }: Props) {
onClick={() => onClick={() =>
openScreen({ openScreen({
id: "image_viewer", id: "image_viewer",
embed: embed.image, embed: embed.image!,
}) })
} }
onMouseDown={(ev) => onMouseDown={(ev) =>

View file

@ -1,12 +1,12 @@
import { LinkExternal } from "@styled-icons/boxicons-regular"; import { LinkExternal } from "@styled-icons/boxicons-regular";
import { EmbedImage } from "revolt-api/types/January"; import { API } from "revolt.js";
import styles from "./Embed.module.scss"; import styles from "./Embed.module.scss";
import IconButton from "../../../ui/IconButton"; import IconButton from "../../../ui/IconButton";
interface Props { interface Props {
embed: EmbedImage; embed: API.Image;
} }
export default function EmbedMediaActions({ embed }: Props) { export default function EmbedMediaActions({ embed }: Props) {

View file

@ -1,11 +1,23 @@
import { Shield } from "@styled-icons/boxicons-regular"; import { Shield } from "@styled-icons/boxicons-regular";
import { Badges } from "revolt-api/types/Users";
import styled from "styled-components/macro"; import styled from "styled-components/macro";
import { Localizer, Text } from "preact-i18n"; import { Localizer, Text } from "preact-i18n";
import Tooltip from "../Tooltip"; import Tooltip from "../Tooltip";
enum Badges {
Developer = 1,
Translator = 2,
Supporter = 4,
ResponsibleDisclosure = 8,
Founder = 16,
PlatformModeration = 32,
ActiveSupporter = 64,
Paw = 128,
EarlyAdopter = 256,
ReservedRelevantJokeBadge1 = 512,
}
const BadgesBase = styled.div` const BadgesBase = styled.div`
gap: 8px; gap: 8px;
display: flex; display: flex;

View file

@ -1,4 +1,4 @@
import { User } from "revolt.js/dist/maps/Users"; import { User } from "revolt.js";
import Checkbox, { CheckboxProps } from "../../ui/Checkbox"; import Checkbox, { CheckboxProps } from "../../ui/Checkbox";

View file

@ -1,7 +1,7 @@
import { Cog } from "@styled-icons/boxicons-solid"; import { Cog } from "@styled-icons/boxicons-solid";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import { User } from "revolt.js/dist/maps/Users"; import { User } from "revolt.js";
import styled from "styled-components/macro"; import styled from "styled-components/macro";
import { openContextMenu } from "preact-context-menu"; import { openContextMenu } from "preact-context-menu";

View file

@ -1,4 +1,4 @@
import { User } from "revolt.js/dist/maps/Users"; import { User } from "revolt.js";
import styled from "styled-components/macro"; import styled from "styled-components/macro";
import { Children } from "../../../types/Preact"; import { Children } from "../../../types/Preact";

View file

@ -1,9 +1,7 @@
import { VolumeMute, MicrophoneOff } from "@styled-icons/boxicons-solid"; import { VolumeMute, MicrophoneOff } from "@styled-icons/boxicons-solid";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { useParams } from "react-router-dom"; import { useParams } from "react-router-dom";
import { Masquerade } from "revolt-api/types/Channels"; import { User, API } from "revolt.js";
import { Presence } from "revolt-api/types/Users";
import { User } from "revolt.js/dist/maps/Users";
import styled, { css } from "styled-components/macro"; import styled, { css } from "styled-components/macro";
import { useApplicationState } from "../../../mobx/State"; import { useApplicationState } from "../../../mobx/State";
@ -18,17 +16,17 @@ type VoiceStatus = "muted" | "deaf";
interface Props extends IconBaseProps<User> { interface Props extends IconBaseProps<User> {
status?: boolean; status?: boolean;
voice?: VoiceStatus; voice?: VoiceStatus;
masquerade?: Masquerade; masquerade?: API.Masquerade;
showServerIdentity?: boolean; showServerIdentity?: boolean;
} }
export function useStatusColour(user?: User) { export function useStatusColour(user?: User) {
const theme = useApplicationState().settings.theme; const theme = useApplicationState().settings.theme;
return user?.online && user?.status?.presence !== Presence.Invisible return user?.online && user?.status?.presence !== "Invisible"
? user?.status?.presence === Presence.Idle ? user?.status?.presence === "Idle"
? theme.getVariable("status-away") ? theme.getVariable("status-away")
: user?.status?.presence === Presence.Busy : user?.status?.presence === "Busy"
? theme.getVariable("status-busy") ? theme.getVariable("status-busy")
: theme.getVariable("status-online") : theme.getVariable("status-online")
: theme.getVariable("status-invisible"); : theme.getVariable("status-invisible");
@ -94,7 +92,7 @@ export default observer(
url = url =
client.generateFileURL( client.generateFileURL(
override ?? target?.avatar ?? attachment, override ?? target?.avatar ?? attachment ?? undefined,
{ max_side: 256 }, { max_side: 256 },
animate, animate,
) ?? (target ? target.defaultAvatarURL : fallback); ) ?? (target ? target.defaultAvatarURL : fallback);

View file

@ -1,8 +1,6 @@
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { useParams } from "react-router-dom"; import { useParams } from "react-router-dom";
import { Masquerade } from "revolt-api/types/Channels"; import { User, API } from "revolt.js";
import { User } from "revolt.js/dist/maps/Users";
import { Nullable } from "revolt.js/dist/util/null";
import styled from "styled-components/macro"; import styled from "styled-components/macro";
import { Text } from "preact-i18n"; import { Text } from "preact-i18n";
@ -31,7 +29,7 @@ const BotBadge = styled.div`
type UsernameProps = JSX.HTMLAttributes<HTMLElement> & { type UsernameProps = JSX.HTMLAttributes<HTMLElement> & {
user?: User; user?: User;
prefixAt?: boolean; prefixAt?: boolean;
masquerade?: Masquerade; masquerade?: API.Masquerade;
showServerIdentity?: boolean | "both"; showServerIdentity?: boolean | "both";
}; };
@ -116,7 +114,7 @@ export default function UserShort({
user?: User; user?: User;
size?: number; size?: number;
prefixAt?: boolean; prefixAt?: boolean;
masquerade?: Masquerade; masquerade?: API.Masquerade;
showServerIdentity?: boolean; showServerIdentity?: boolean;
}) { }) {
const { openScreen } = useIntermediate(); const { openScreen } = useIntermediate();

View file

@ -1,6 +1,5 @@
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { Presence } from "revolt-api/types/Users"; import { User, API } from "revolt.js";
import { User } from "revolt.js/dist/maps/Users";
import { Text } from "preact-i18n"; import { Text } from "preact-i18n";
@ -25,15 +24,15 @@ export default observer(({ user, tooltip }: Props) => {
return <>{user.status.text}</>; return <>{user.status.text}</>;
} }
if (user.status?.presence === Presence.Busy) { if (user.status?.presence === "Busy") {
return <Text id="app.status.busy" />; return <Text id="app.status.busy" />;
} }
if (user.status?.presence === Presence.Idle) { if (user.status?.presence === "Idle") {
return <Text id="app.status.idle" />; return <Text id="app.status.idle" />;
} }
if (user.status?.presence === Presence.Invisible) { if (user.status?.presence === "Invisible") {
return <Text id="app.status.offline" />; return <Text id="app.status.offline" />;
} }

View file

@ -3,7 +3,7 @@ import { Suspense, lazy } from "preact/compat";
const Renderer = lazy(() => import("./Renderer")); const Renderer = lazy(() => import("./Renderer"));
export interface MarkdownProps { export interface MarkdownProps {
content?: string; content?: string | null;
disallowBigEmoji?: boolean; disallowBigEmoji?: boolean;
} }

View file

@ -129,7 +129,7 @@ export default function Renderer({ content, disallowBigEmoji }: MarkdownProps) {
const { openLink } = useIntermediate(); const { openLink } = useIntermediate();
if (typeof content === "undefined") return null; if (typeof content === "undefined") return null;
if (content.length === 0) return null; if (!content || content.length === 0) return null;
// We replace the message with the mention at the time of render. // We replace the message with the mention at the time of render.
// We don't care if the mention changes. // We don't care if the mention changes.

View file

@ -1,9 +1,7 @@
import { X } from "@styled-icons/boxicons-regular"; import { X } from "@styled-icons/boxicons-regular";
import { Crown } from "@styled-icons/boxicons-solid"; import { Crown } from "@styled-icons/boxicons-solid";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { Presence } from "revolt-api/types/Users"; import { User, Channel } from "revolt.js";
import { Channel } from "revolt.js/dist/maps/Channels";
import { User } from "revolt.js/dist/maps/Users";
import styles from "./Item.module.scss"; import styles from "./Item.module.scss";
import classNames from "classnames"; import classNames from "classnames";
@ -64,7 +62,7 @@ export const UserButton = observer((props: UserProps) => {
data-alert={typeof alert === "string"} data-alert={typeof alert === "string"}
data-online={ data-online={
typeof channel !== "undefined" || typeof channel !== "undefined" ||
(user.online && user.status?.presence !== Presence.Invisible) (user.online && user.status?.presence !== "Invisible")
} }
onContextMenu={attachContextMenu("Menu", { onContextMenu={attachContextMenu("Menu", {
user: user._id, user: user._id,

View file

@ -5,8 +5,7 @@ import {
Notepad, Notepad,
} from "@styled-icons/boxicons-solid"; } from "@styled-icons/boxicons-solid";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { Link, Redirect, useLocation, useParams } from "react-router-dom"; import { Link, useLocation, useParams } from "react-router-dom";
import { RelationshipStatus } from "revolt-api/types/Users";
import styled, { css } from "styled-components/macro"; import styled, { css } from "styled-components/macro";
import { Text } from "preact-i18n"; import { Text } from "preact-i18n";
@ -68,7 +67,7 @@ export default observer(() => {
// ! FIXME: must be a better way // ! FIXME: must be a better way
const incoming = [...client.users.values()].filter( const incoming = [...client.users.values()].filter(
(user) => user?.relationship === RelationshipStatus.Incoming, (user) => user?.relationship === "Incoming",
); );
return ( return (

View file

@ -2,11 +2,9 @@ import { Plus } from "@styled-icons/boxicons-regular";
import { Cog, Compass } from "@styled-icons/boxicons-solid"; import { Cog, Compass } from "@styled-icons/boxicons-solid";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { Link, useHistory, useLocation, useParams } from "react-router-dom"; import { Link, useHistory, useLocation, useParams } from "react-router-dom";
import { RelationshipStatus } from "revolt-api/types/Users";
import styled, { css } from "styled-components/macro"; import styled, { css } from "styled-components/macro";
import { attachContextMenu } from "preact-context-menu"; import { attachContextMenu } from "preact-context-menu";
import { Text } from "preact-i18n";
import ConditionalLink from "../../../lib/ConditionalLink"; import ConditionalLink from "../../../lib/ConditionalLink";
import PaintCounter from "../../../lib/PaintCounter"; import PaintCounter from "../../../lib/PaintCounter";
@ -248,7 +246,7 @@ export default observer(() => {
const { openScreen } = useIntermediate(); const { openScreen } = useIntermediate();
let alertCount = [...client.users.values()].filter( let alertCount = [...client.users.values()].filter(
(x) => x.relationship === RelationshipStatus.Incoming, (x) => x.relationship === "Incoming",
).length; ).length;
const homeActive = const homeActive =

View file

@ -1,6 +1,6 @@
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { Redirect, useParams } from "react-router"; import { Redirect, useParams } from "react-router";
import { Server } from "revolt.js/dist/maps/Servers"; import { Server } from "revolt.js";
import styled, { css } from "styled-components/macro"; import styled, { css } from "styled-components/macro";
import { attachContextMenu } from "preact-context-menu"; import { attachContextMenu } from "preact-context-menu";

View file

@ -1,6 +1,6 @@
/* eslint-disable react-hooks/rules-of-hooks */ /* eslint-disable react-hooks/rules-of-hooks */
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { Channel } from "revolt.js/dist/maps/Channels"; import { Channel } from "revolt.js";
import { getRenderer } from "../../../lib/renderer/Singleton"; import { getRenderer } from "../../../lib/renderer/Singleton";

View file

@ -1,7 +1,6 @@
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import { GroupedVirtuoso } from "react-virtuoso"; import { GroupedVirtuoso } from "react-virtuoso";
import { Channel } from "revolt.js/dist/maps/Channels"; import { Channel, User } from "revolt.js";
import { User } from "revolt.js/dist/maps/Users";
import styled, { css } from "styled-components/macro"; import styled, { css } from "styled-components/macro";
import { Text } from "preact-i18n"; import { Text } from "preact-i18n";

View file

@ -2,11 +2,7 @@
import { autorun } from "mobx"; import { autorun } from "mobx";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { useParams } from "react-router-dom"; import { useParams } from "react-router-dom";
import { Role } from "revolt-api/types/Servers"; import { Channel, Server, User, API } from "revolt.js";
import { Presence } from "revolt-api/types/Users";
import { Channel } from "revolt.js/dist/maps/Channels";
import { Server } from "revolt.js/dist/maps/Servers";
import { User } from "revolt.js/dist/maps/Users";
import { useContext, useEffect, useState } from "preact/hooks"; import { useContext, useEffect, useState } from "preact/hooks";
@ -62,7 +58,7 @@ function useEntries(
.map((id) => { .map((id) => {
return [id, roles![id], roles![id].rank ?? 0] as [ return [id, roles![id], roles![id].rank ?? 0] as [
string, string,
Role, API.Role,
number, number,
]; ];
}) })
@ -96,7 +92,7 @@ function useEntries(
const sort = member?.nickname ?? u.username; const sort = member?.nickname ?? u.username;
const entry = [u, sort] as [User, string]; const entry = [u, sort] as [User, string];
if (!u.online || u.status?.presence === Presence.Invisible) { if (!u.online || u.status?.presence === "Invisible") {
categories.offline.push(entry); categories.offline.push(entry);
} else { } else {
if (isServer) { if (isServer) {

View file

@ -1,5 +1,5 @@
import { Link, useParams } from "react-router-dom"; import { Link, useParams } from "react-router-dom";
import { Message as MessageI } from "revolt.js/dist/maps/Messages"; import { Message as MessageI } from "revolt.js";
import styled from "styled-components/macro"; import styled from "styled-components/macro";
import { Text } from "preact-i18n"; import { Text } from "preact-i18n";

View file

@ -1,11 +1,11 @@
import { OverrideField } from "revolt-api/types/_common"; import { API } from "revolt.js";
import { Permission } from "revolt.js"; import { Permission } from "revolt.js";
import { PermissionSelect } from "./PermissionSelect"; import { PermissionSelect } from "./PermissionSelect";
interface Props { interface Props {
value: OverrideField | number; value: API.OverrideField | number;
onChange: (v: OverrideField | number) => void; onChange: (v: API.OverrideField | number) => void;
filter?: (keyof typeof Permission)[]; filter?: (keyof typeof Permission)[];
} }

View file

@ -1,5 +1,5 @@
import Long from "long"; import Long from "long";
import { OverrideField } from "revolt-api/types/_common"; import { API } from "revolt.js";
import { Permission } from "revolt.js"; import { Permission } from "revolt.js";
import styled from "styled-components"; import styled from "styled-components";
@ -13,8 +13,8 @@ import { OverrideSwitch } from "./OverrideSwitch";
interface PermissionSelectProps { interface PermissionSelectProps {
id: keyof typeof Permission; id: keyof typeof Permission;
permission: number; permission: number;
value: OverrideField | number; value: API.OverrideField | number;
onChange: (value: OverrideField | number) => void; onChange: (value: API.OverrideField | number) => void;
} }
type State = "Allow" | "Neutral" | "Deny"; type State = "Allow" | "Neutral" | "Deny";

View file

@ -1,9 +1,9 @@
import { Role } from "revolt-api/types/Servers"; import { API } from "revolt.js";
import Checkbox from "../../ui/Checkbox"; import Checkbox from "../../ui/Checkbox";
export type RoleOrDefault = ( export type RoleOrDefault = (
| Role | API.Role
| { | {
name: string; name: string;
permissions: number; permissions: number;

View file

@ -1,13 +1,6 @@
import { Prompt } from "react-router"; import { Prompt } from "react-router";
import { useHistory } from "react-router-dom"; import { useHistory } from "react-router-dom";
import type { Attachment } from "revolt-api/types/Autumn"; import { API, Channel, Message, Server, User } from "revolt.js";
import { Bot } from "revolt-api/types/Bots";
import { TextChannel, VoiceChannel } from "revolt-api/types/Channels";
import type { EmbedImage } from "revolt-api/types/January";
import { Channel } from "revolt.js/dist/maps/Channels";
import { Message } from "revolt.js/dist/maps/Messages";
import { Server } from "revolt.js/dist/maps/Servers";
import { User } from "revolt.js/dist/maps/Users";
import { createContext } from "preact"; import { createContext } from "preact";
import { useContext, useEffect, useMemo, useState } from "preact/hooks"; import { useContext, useEffect, useMemo, useState } from "preact/hooks";
@ -61,7 +54,11 @@ export type Screen =
| { | {
type: "create_channel"; type: "create_channel";
target: Server; target: Server;
cb?: (channel: TextChannel | VoiceChannel) => void; cb?: (
channel: Channel & {
channel_type: "TextChannel" | "VoiceChannel";
},
) => void;
} }
| { type: "create_category"; target: Server } | { type: "create_category"; target: Server }
)) ))
@ -101,11 +98,11 @@ export type Screen =
omit?: string[]; omit?: string[];
callback: (users: string[]) => Promise<void>; callback: (users: string[]) => Promise<void>;
} }
| { id: "image_viewer"; attachment?: Attachment; embed?: EmbedImage } | { id: "image_viewer"; attachment?: API.File; embed?: API.Image }
| { id: "channel_info"; channel: Channel } | { id: "channel_info"; channel: Channel }
| { id: "pending_requests"; users: User[] } | { id: "pending_requests"; users: User[] }
| { id: "modify_account"; field: "username" | "email" | "password" } | { id: "modify_account"; field: "username" | "email" | "password" }
| { id: "create_bot"; onCreate: (bot: Bot) => void } | { id: "create_bot"; onCreate: (bot: API.Bot) => void }
| { | {
id: "server_identity"; id: "server_identity";
server: Server; server: Server;

View file

@ -1,5 +1,5 @@
import { useHistory } from "react-router"; import { useHistory } from "react-router";
import { Server } from "revolt.js/dist/maps/Servers"; import { Server } from "revolt.js";
import { ulid } from "ulid"; import { ulid } from "ulid";
import { Text } from "preact-i18n"; import { Text } from "preact-i18n";
@ -99,7 +99,6 @@ export function SpecialInputModal(props: SpecialProps) {
callback={async (name) => { callback={async (name) => {
const group = await client.channels.createGroup({ const group = await client.channels.createGroup({
name, name,
nonce: ulid(),
users: [], users: [],
}); });
@ -117,7 +116,6 @@ export function SpecialInputModal(props: SpecialProps) {
callback={async (name) => { callback={async (name) => {
const server = await client.servers.createServer({ const server = await client.servers.createServer({
name, name,
nonce: ulid(),
}); });
history.push(`/server/${server._id}`); history.push(`/server/${server._id}`);
@ -146,7 +144,7 @@ export function SpecialInputModal(props: SpecialProps) {
onClose={onClose} onClose={onClose}
question={<Text id="app.context_menu.set_custom_status" />} question={<Text id="app.context_menu.set_custom_status" />}
field={<Text id="app.context_menu.custom_status" />} field={<Text id="app.context_menu.custom_status" />}
defaultValue={client.user?.status?.text} defaultValue={client.user?.status?.text ?? undefined}
callback={(text) => callback={(text) =>
client.users.edit({ client.users.edit({
status: { status: {
@ -164,11 +162,8 @@ export function SpecialInputModal(props: SpecialProps) {
onClose={onClose} onClose={onClose}
question={"Add Friend"} question={"Add Friend"}
callback={(username) => callback={(username) =>
client client.api
.req( .put(`/users/${username as ""}/friend`)
"PUT",
`/users/${username}/friend` as "/users/id/friend",
)
.then(undefined) .then(undefined)
} }
/> />

View file

@ -16,6 +16,10 @@
h1 { h1 {
margin: 0; margin: 0;
} }
img {
max-height: 80px;
}
} }
&.form { &.form {

View file

@ -1,10 +1,6 @@
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { useHistory } from "react-router-dom"; import { useHistory } from "react-router-dom";
import { TextChannel, VoiceChannel } from "revolt-api/types/Channels"; import { Channel, Message as MessageI, Server, User } from "revolt.js";
import { Channel } from "revolt.js/dist/maps/Channels";
import { Message as MessageI } from "revolt.js/dist/maps/Messages";
import { Server } from "revolt.js/dist/maps/Servers";
import { User } from "revolt.js/dist/maps/Users";
import { ulid } from "ulid"; import { ulid } from "ulid";
import styles from "./Prompt.module.scss"; import styles from "./Prompt.module.scss";
@ -74,7 +70,11 @@ type SpecialProps = { onClose: () => void } & (
| { | {
type: "create_channel"; type: "create_channel";
target: Server; target: Server;
cb?: (channel: TextChannel | VoiceChannel) => void; cb?: (
channel: Channel & {
channel_type: "TextChannel" | "VoiceChannel";
},
) => void;
} }
| { type: "create_category"; target: Server } | { type: "create_category"; target: Server }
); );
@ -429,11 +429,10 @@ export const SpecialPromptModal = observer((props: SpecialProps) => {
await props.target.createChannel({ await props.target.createChannel({
type, type,
name, name,
nonce: ulid(),
}); });
if (props.cb) { if (props.cb) {
props.cb(channel); props.cb(channel as any);
} else { } else {
history.push( history.push(
`/server/${props.target._id}/channel/${channel._id}`, `/server/${props.target._id}/channel/${channel._id}`,

View file

@ -1,6 +1,6 @@
import { X } from "@styled-icons/boxicons-regular"; import { X } from "@styled-icons/boxicons-regular";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { Channel } from "revolt.js/dist/maps/Channels"; import { Channel } from "revolt.js";
import styles from "./ChannelInfo.module.scss"; import styles from "./ChannelInfo.module.scss";

View file

@ -1,5 +1,5 @@
import { SubmitHandler, useForm } from "react-hook-form"; import { SubmitHandler, useForm } from "react-hook-form";
import { Bot } from "revolt-api/types/Bots"; import { API } from "revolt.js";
import { Text } from "preact-i18n"; import { Text } from "preact-i18n";
import { useContext, useState } from "preact/hooks"; import { useContext, useState } from "preact/hooks";
@ -13,7 +13,7 @@ import { takeError } from "../../revoltjs/util";
interface Props { interface Props {
onClose: () => void; onClose: () => void;
onCreate: (bot: Bot) => void; onCreate: (bot: API.Bot) => void;
} }
interface FormInputs { interface FormInputs {

View file

@ -1,6 +1,5 @@
/* eslint-disable react-hooks/rules-of-hooks */ /* eslint-disable react-hooks/rules-of-hooks */
import { Attachment, AttachmentMetadata } from "revolt-api/types/Autumn"; import { API } from "revolt.js";
import { EmbedImage } from "revolt-api/types/January";
import styles from "./ImageViewer.module.scss"; import styles from "./ImageViewer.module.scss";
@ -12,11 +11,11 @@ import { useClient } from "../../revoltjs/RevoltClient";
interface Props { interface Props {
onClose: () => void; onClose: () => void;
embed?: EmbedImage; embed?: API.Image;
attachment?: Attachment; attachment?: API.File;
} }
type ImageMetadata = AttachmentMetadata & { type: "Image" }; type ImageMetadata = API.Metadata & { type: "Image" };
export function ImageViewer({ attachment, embed, onClose }: Props) { export function ImageViewer({ attachment, embed, onClose }: Props) {
if (attachment && attachment.metadata.type !== "Image") { if (attachment && attachment.metadata.type !== "Image") {

View file

@ -43,19 +43,19 @@ export function ModifyAccountModal({ onClose, field }: Props) {
try { try {
if (field === "email") { if (field === "email") {
await client.req("PATCH", "/auth/account/change/email", { await client.api.patch("/auth/account/change/email", {
current_password: password, current_password: password,
email: new_email, email: new_email,
}); });
onClose(); onClose();
} else if (field === "password") { } else if (field === "password") {
await client.req("PATCH", "/auth/account/change/password", { await client.api.patch("/auth/account/change/password", {
current_password: password, current_password: password,
password: new_password, password: new_password,
}); });
onClose(); onClose();
} else if (field === "username") { } else if (field === "username") {
await client.req("PATCH", "/users/id/username", { await client.api.patch("/users/@me/username", {
username: new_username, username: new_username,
password, password,
}); });

View file

@ -1,5 +1,5 @@
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { User } from "revolt.js/dist/maps/Users"; import { User } from "revolt.js";
import styles from "./UserPicker.module.scss"; import styles from "./UserPicker.module.scss";
import { Text } from "preact-i18n"; import { Text } from "preact-i18n";

View file

@ -1,11 +1,12 @@
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { Server } from "revolt.js/dist/maps/Servers"; import { Server } from "revolt.js";
import styled, { css } from "styled-components/macro";
import styles from "./ServerIdentityModal.module.scss"; import styles from "./ServerIdentityModal.module.scss";
import { Text } from "preact-i18n"; import { Text } from "preact-i18n";
import { useEffect, useState } from "preact/hooks"; import { useEffect, useState } from "preact/hooks";
import { noop } from "../../../lib/js";
import Button from "../../../components/ui/Button"; import Button from "../../../components/ui/Button";
import InputBox from "../../../components/ui/InputBox"; import InputBox from "../../../components/ui/InputBox";
import Modal from "../../../components/ui/Modal"; import Modal from "../../../components/ui/Modal";
@ -57,8 +58,12 @@ export const ServerIdentityModal = observer(({ server, onClose }: Props) => {
fileType="avatars" fileType="avatars"
behaviour="upload" behaviour="upload"
maxFileSize={4_000_000} maxFileSize={4_000_000}
onUpload={(avatar) => member.edit({ avatar })} onUpload={(avatar) =>
remove={() => member.edit({ remove: "Avatar" })} member.edit({ avatar }).then(noop)
}
remove={() =>
member.edit({ remove: ["Avatar"] }).then(noop)
}
defaultPreview={client.user?.generateAvatarURL( defaultPreview={client.user?.generateAvatarURL(
{ {
max_side: 256, max_side: 256,
@ -92,7 +97,7 @@ export const ServerIdentityModal = observer(({ server, onClose }: Props) => {
<Button <Button
plain plain
onClick={() => onClick={() =>
member.edit({ remove: "Nickname" }) member.edit({ remove: ["Nickname"] })
}> }>
<Text id="app.special.modals.actions.remove" /> <Text id="app.special.modals.actions.remove" />
</Button> </Button>

View file

@ -1,5 +1,3 @@
import { RelationshipStatus } from "revolt-api/types/Users";
import styles from "./UserPicker.module.scss"; import styles from "./UserPicker.module.scss";
import { Text } from "preact-i18n"; import { Text } from "preact-i18n";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
@ -37,7 +35,7 @@ export function UserPicker(props: Props) {
.filter( .filter(
(x) => (x) =>
x && x &&
x.relationship === RelationshipStatus.Friend && x.relationship === "Friend" &&
!omit.includes(x._id), !omit.includes(x._id),
) )
.map((x) => ( .map((x) => (

View file

@ -9,9 +9,7 @@ import {
} from "@styled-icons/boxicons-solid"; } from "@styled-icons/boxicons-solid";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { Link, useHistory } from "react-router-dom"; import { Link, useHistory } from "react-router-dom";
import { Profile, RelationshipStatus } from "revolt-api/types/Users"; import { UserPermission, API } from "revolt.js";
import { UserPermission } from "revolt.js/dist/api/permissions";
import { Route } from "revolt.js/dist/api/routes";
import styles from "./UserProfile.module.scss"; import styles from "./UserProfile.module.scss";
import { Localizer, Text } from "preact-i18n"; import { Localizer, Text } from "preact-i18n";
@ -44,18 +42,18 @@ interface Props {
user_id: string; user_id: string;
dummy?: boolean; dummy?: boolean;
onClose?: () => void; onClose?: () => void;
dummyProfile?: Profile; dummyProfile?: API.UserProfile;
} }
export const UserProfile = observer( export const UserProfile = observer(
({ user_id, onClose, dummy, dummyProfile }: Props) => { ({ user_id, onClose, dummy, dummyProfile }: Props) => {
const { openScreen, writeClipboard } = useIntermediate(); const { openScreen, writeClipboard } = useIntermediate();
const [profile, setProfile] = useState<undefined | null | Profile>( const [profile, setProfile] = useState<
undefined, undefined | null | API.UserProfile
); >(undefined);
const [mutual, setMutual] = useState< const [mutual, setMutual] = useState<
undefined | null | Route<"GET", "/users/id/mutual">["response"] undefined | null | API.MutualResponse
>(undefined); >(undefined);
const [isPublicBot, setIsPublicBot] = useState< const [isPublicBot, setIsPublicBot] = useState<
undefined | null | boolean undefined | null | boolean
@ -139,7 +137,11 @@ export const UserProfile = observer(
const backgroundURL = const backgroundURL =
profile && profile &&
client.generateFileURL(profile.background, { width: 1000 }, true); client.generateFileURL(
profile.background as any,
{ width: 1000 },
true,
);
const badges = user.badges ?? 0; const badges = user.badges ?? 0;
const flags = user.flags ?? 0; const flags = user.flags ?? 0;
@ -198,7 +200,7 @@ export const UserProfile = observer(
</Button> </Button>
</Link> </Link>
)} )}
{user.relationship === RelationshipStatus.Friend && ( {user.relationship === "Friend" && (
<Localizer> <Localizer>
<Tooltip <Tooltip
content={ content={
@ -214,28 +216,25 @@ export const UserProfile = observer(
</Tooltip> </Tooltip>
</Localizer> </Localizer>
)} )}
{user.relationship === RelationshipStatus.User && {user.relationship === "User" && !dummy && (
!dummy && ( <IconButton
<IconButton onClick={() => {
onClick={() => { onClose?.();
onClose?.(); history.push(`/settings/profile`);
history.push(`/settings/profile`); }}>
}}> <Edit size={28} />
<Edit size={28} /> </IconButton>
</IconButton> )}
)}
{!user.bot && {!user.bot &&
flags != 2 && flags != 2 &&
flags != 4 && flags != 4 &&
(user.relationship === (user.relationship === "Incoming" ||
RelationshipStatus.Incoming || user.relationship === "None") && (
user.relationship ===
RelationshipStatus.None) && (
<IconButton onClick={() => user.addFriend()}> <IconButton onClick={() => user.addFriend()}>
<UserPlus size={28} /> <UserPlus size={28} />
</IconButton> </IconButton>
)} )}
{user.relationship === RelationshipStatus.Outgoing && ( {user.relationship === "Outgoing" && (
<IconButton onClick={() => user.removeFriend()}> <IconButton onClick={() => user.removeFriend()}>
<UserX size={28} /> <UserX size={28} />
</IconButton> </IconButton>
@ -247,7 +246,7 @@ export const UserProfile = observer(
onClick={() => setTab("profile")}> onClick={() => setTab("profile")}>
<Text id="app.special.popovers.user_profile.profile" /> <Text id="app.special.popovers.user_profile.profile" />
</div> </div>
{user.relationship !== RelationshipStatus.User && ( {user.relationship !== "User" && (
<> <>
<div <div
data-active={tab === "friends"} data-active={tab === "friends"}

View file

@ -1,7 +1,5 @@
import { Route, Switch, useHistory, useParams } from "react-router-dom"; import { Route, Switch, useHistory, useParams } from "react-router-dom";
import { Presence, RelationshipStatus } from "revolt-api/types/Users"; import { Message, User } from "revolt.js";
import { Message } from "revolt.js/dist/maps/Messages";
import { User } from "revolt.js/dist/maps/Users";
import { decodeTime } from "ulid"; import { decodeTime } from "ulid";
import { useCallback, useContext, useEffect } from "preact/hooks"; import { useCallback, useContext, useEffect } from "preact/hooks";
@ -210,17 +208,17 @@ function Notifier() {
const relationship = useCallback( const relationship = useCallback(
async (user: User) => { async (user: User) => {
if (client.user?.status?.presence === Presence.Busy) return; if (client.user?.status?.presence === "Busy") return;
if (!showNotification) return; if (!showNotification) return;
let event; let event;
switch (user.relationship) { switch (user.relationship) {
case RelationshipStatus.Incoming: case "Incoming":
event = translate("notifications.sent_request", { event = translate("notifications.sent_request", {
person: user.username, person: user.username,
}); });
break; break;
case RelationshipStatus.Friend: case "Friend":
event = translate("notifications.now_friends", { event = translate("notifications.now_friends", {
person: user.username, person: user.username,
}); });

View file

@ -50,7 +50,7 @@ export default observer(({ children }: Props) => {
useEffect(() => { useEffect(() => {
if (navigator.onLine) { if (navigator.onLine) {
state.config.createClient().req("GET", "/").then(state.config.set); state.config.createClient().api.get("/").then(state.config.set);
} }
}, []); }, []);
@ -79,7 +79,7 @@ export default observer(({ children }: Props) => {
} }
}, [state.auth.getSession()]); }, [state.auth.getSession()]);
useEffect(() => registerEvents(state.auth, setStatus, client), [client]); useEffect(() => registerEvents(state, setStatus, client), [client]);
if (!loaded || status === ClientStatus.LOADING) { if (!loaded || status === ClientStatus.LOADING) {
return <Preloader type="spinner" />; return <Preloader type="spinner" />;

View file

@ -1,7 +1,7 @@
/** /**
* This file monitors the message cache to delete any queued messages that have already sent. * This file monitors the message cache to delete any queued messages that have already sent.
*/ */
import { Message } from "revolt.js/dist/maps/Messages"; import { Message } from "revolt.js";
import { useContext, useEffect } from "preact/hooks"; import { useContext, useEffect } from "preact/hooks";

View file

@ -1,17 +1,16 @@
import { Client } from "revolt.js/dist"; import { Client, Server } from "revolt.js";
import { Server } from "revolt.js/dist/maps/Servers";
import { StateUpdater } from "preact/hooks"; import { StateUpdater } from "preact/hooks";
import { deleteRenderer } from "../../lib/renderer/Singleton"; import { deleteRenderer } from "../../lib/renderer/Singleton";
import Auth from "../../mobx/stores/Auth"; import State from "../../mobx/State";
import { resetMemberSidebarFetched } from "../../components/navigation/right/MemberSidebar"; import { resetMemberSidebarFetched } from "../../components/navigation/right/MemberSidebar";
import { ClientStatus } from "./RevoltClient"; import { ClientStatus } from "./RevoltClient";
export function registerEvents( export function registerEvents(
auth: Auth, state: State,
setStatus: StateUpdater<ClientStatus>, setStatus: StateUpdater<ClientStatus>,
client: Client, client: Client,
) { ) {
@ -28,7 +27,8 @@ export function registerEvents(
}, },
logout: () => { logout: () => {
auth.logout(); state.auth.logout();
state.reset();
setStatus(ClientStatus.READY); setStatus(ClientStatus.READY);
}, },

View file

@ -1,4 +1,4 @@
import { Channel } from "revolt.js/dist/maps/Channels"; import { Channel } from "revolt.js";
import { Text } from "preact-i18n"; import { Text } from "preact-i18n";

View file

@ -12,13 +12,8 @@ import {
} from "@styled-icons/boxicons-regular"; } from "@styled-icons/boxicons-regular";
import { Cog, UserVoice } from "@styled-icons/boxicons-solid"; import { Cog, UserVoice } from "@styled-icons/boxicons-solid";
import { useHistory } from "react-router-dom"; import { useHistory } from "react-router-dom";
import { Attachment } from "revolt-api/types/Autumn"; import { Channel, Message, Server, User, API } from "revolt.js";
import { Presence, RelationshipStatus } from "revolt-api/types/Users";
import { Permission, UserPermission } from "revolt.js/dist/api/permissions"; import { Permission, UserPermission } from "revolt.js/dist/api/permissions";
import { Channel } from "revolt.js/dist/maps/Channels";
import { Message } from "revolt.js/dist/maps/Messages";
import { Server } from "revolt.js/dist/maps/Servers";
import { User } from "revolt.js/dist/maps/Users";
import { import {
ContextMenuWithData, ContextMenuWithData,
@ -56,7 +51,7 @@ interface ContextMenuData {
server_list?: string; server_list?: string;
channel?: string; channel?: string;
message?: Message; message?: Message;
attachment?: Attachment; attachment?: API.File;
unread?: boolean; unread?: boolean;
queued?: QueuedMessage; queued?: QueuedMessage;
@ -78,9 +73,9 @@ type Action =
| { action: "quote_message"; content: string } | { action: "quote_message"; content: string }
| { action: "edit_message"; id: string } | { action: "edit_message"; id: string }
| { action: "delete_message"; target: Message } | { action: "delete_message"; target: Message }
| { action: "open_file"; attachment: Attachment } | { action: "open_file"; attachment: API.File }
| { action: "save_file"; attachment: Attachment } | { action: "save_file"; attachment: API.File }
| { action: "copy_file_link"; attachment: Attachment } | { action: "copy_file_link"; attachment: API.File }
| { action: "open_link"; link: string } | { action: "open_link"; link: string }
| { action: "copy_link"; link: string } | { action: "copy_link"; link: string }
| { action: "remove_member"; channel: Channel; user: User } | { action: "remove_member"; channel: Channel; user: User }
@ -93,7 +88,7 @@ type Action =
| { action: "add_friend"; user: User } | { action: "add_friend"; user: User }
| { action: "remove_friend"; user: User } | { action: "remove_friend"; user: User }
| { action: "cancel_friend"; user: User } | { action: "cancel_friend"; user: User }
| { action: "set_presence"; presence: Presence } | { action: "set_presence"; presence: API.Presence }
| { action: "set_status" } | { action: "set_status" }
| { action: "clear_status" } | { action: "clear_status" }
| { action: "create_channel"; target: Server } | { action: "create_channel"; target: Server }
@ -588,29 +583,29 @@ export default function ContextMenus() {
if (!user.bot) { if (!user.bot) {
let actions: Action["action"][]; let actions: Action["action"][];
switch (user.relationship) { switch (user.relationship) {
case RelationshipStatus.User: case "User":
actions = []; actions = [];
break; break;
case RelationshipStatus.Friend: case "Friend":
actions = ["remove_friend", "block_user"]; actions = ["remove_friend", "block_user"];
break; break;
case RelationshipStatus.Incoming: case "Incoming":
actions = [ actions = [
"add_friend", "add_friend",
"cancel_friend", "cancel_friend",
"block_user", "block_user",
]; ];
break; break;
case RelationshipStatus.Outgoing: case "Outgoing":
actions = ["cancel_friend", "block_user"]; actions = ["cancel_friend", "block_user"];
break; break;
case RelationshipStatus.Blocked: case "Blocked":
actions = ["unblock_user"]; actions = ["unblock_user"];
break; break;
case RelationshipStatus.BlockedOther: case "BlockedOther":
actions = ["block_user"]; actions = ["block_user"];
break; break;
case RelationshipStatus.None: case "None":
default: default:
if ( if (
(user.flags && 2) || (user.flags && 2) ||
@ -1047,7 +1042,7 @@ export default function ContextMenus() {
<MenuItem <MenuItem
data={{ data={{
action: "set_presence", action: "set_presence",
presence: Presence.Online, presence: "Online",
}} }}
disabled={!isOnline}> disabled={!isOnline}>
<div className="indicator online" /> <div className="indicator online" />
@ -1056,7 +1051,7 @@ export default function ContextMenus() {
<MenuItem <MenuItem
data={{ data={{
action: "set_presence", action: "set_presence",
presence: Presence.Idle, presence: "Idle",
}} }}
disabled={!isOnline}> disabled={!isOnline}>
<div className="indicator idle" /> <div className="indicator idle" />
@ -1065,7 +1060,7 @@ export default function ContextMenus() {
<MenuItem <MenuItem
data={{ data={{
action: "set_presence", action: "set_presence",
presence: Presence.Busy, presence: "Busy",
}} }}
disabled={!isOnline}> disabled={!isOnline}>
<div className="indicator busy" /> <div className="indicator busy" />
@ -1074,7 +1069,7 @@ export default function ContextMenus() {
<MenuItem <MenuItem
data={{ data={{
action: "set_presence", action: "set_presence",
presence: Presence.Invisible, presence: "Invisible",
}} }}
disabled={!isOnline}> disabled={!isOnline}>
<div className="indicator invisible" /> <div className="indicator invisible" />

View file

@ -1,7 +1,7 @@
// @ts-expect-error No typings. // @ts-expect-error No typings.
import stringify from "json-stringify-deterministic"; import stringify from "json-stringify-deterministic";
import localforage from "localforage"; import localforage from "localforage";
import { makeAutoObservable, reaction } from "mobx"; import { makeAutoObservable, reaction, runInAction } from "mobx";
import { Client } from "revolt.js"; import { Client } from "revolt.js";
import { reportError } from "../lib/ErrorBoundary"; import { reportError } from "../lib/ErrorBoundary";
@ -59,6 +59,7 @@ export default class State {
this.sync = new Sync(this); this.sync = new Sync(this);
makeAutoObservable(this); makeAutoObservable(this);
this.register(); this.register();
this.setDisabled = this.setDisabled.bind(this); this.setDisabled = this.setDisabled.bind(this);
} }
@ -159,10 +160,12 @@ export default class State {
} }
if (Object.keys(obj).length > 0) { if (Object.keys(obj).length > 0) {
client.syncSetSettings( if (client.websocket.connected) {
obj as any, client.syncSetSettings(
revision, obj as any,
); revision,
);
}
} }
break; break;
} }
@ -173,12 +176,14 @@ export default class State {
} }
this.sync.setRevision(id, revision); this.sync.setRevision(id, revision);
client.syncSetSettings( if (client.websocket.connected) {
( client.syncSetSettings(
store as unknown as Syncable (
).toSyncable(), store as unknown as Syncable
revision, ).toSyncable(),
); revision,
);
}
} }
} }
} }
@ -229,6 +234,24 @@ export default class State {
// Dump stores back to disk. // Dump stores back to disk.
await this.save(); await this.save();
} }
/**
* Reset known state values.
*/
reset() {
runInAction(() => {
this.draft = new Draft();
this.experiments = new Experiments();
this.layout = new Layout();
this.notifications = new NotificationOptions();
this.queue = new MessageQueue();
this.settings = new Settings();
this.sync = new Sync(this);
this.persistent = [];
this.register();
});
}
} }
var state: State; var state: State;

View file

@ -1,5 +1,5 @@
import { runInAction } from "mobx"; import { runInAction } from "mobx";
import { Session } from "revolt-api/types/Auth"; import { API } from "revolt.js";
import { Language } from "../../context/Locale"; import { Language } from "../../context/Locale";
import { import {
@ -63,7 +63,7 @@ export interface LegacySyncOptions {
export interface LegacyAuthState { export interface LegacyAuthState {
accounts: { accounts: {
[key: string]: { [key: string]: {
session: Session; session: API.Session;
}; };
}; };
active?: string; active?: string;

View file

@ -1,5 +1,5 @@
import { action, computed, makeAutoObservable, ObservableMap } from "mobx"; import { action, computed, makeAutoObservable, ObservableMap } from "mobx";
import { Session } from "revolt-api/types/Auth"; import { API } from "revolt.js";
import { Nullable } from "revolt.js/dist/util/null"; import { Nullable } from "revolt.js/dist/util/null";
import { mapToRecord } from "../../lib/conversion"; import { mapToRecord } from "../../lib/conversion";
@ -8,7 +8,7 @@ import Persistent from "../interfaces/Persistent";
import Store from "../interfaces/Store"; import Store from "../interfaces/Store";
interface Account { interface Account {
session: Session; session: API.Session;
} }
export interface Data { export interface Data {
@ -82,7 +82,7 @@ export default class Auth implements Store, Persistent<Data> {
* Add a new session to the auth manager. * Add a new session to the auth manager.
* @param session Session * @param session Session
*/ */
@action setSession(session: Session) { @action setSession(session: API.Session) {
this.sessions.set(session.user_id, { session }); this.sessions.set(session.user_id, { session });
this.current = session.user_id; this.current = session.user_id;
} }

View file

@ -1,5 +1,4 @@
import { action, computed, makeAutoObservable, ObservableMap } from "mobx"; import { action, computed, makeAutoObservable, ObservableMap } from "mobx";
import { Presence, RelationshipStatus } from "revolt-api/types/Users";
import { Channel } from "revolt.js/dist/maps/Channels"; import { Channel } from "revolt.js/dist/maps/Channels";
import { Message } from "revolt.js/dist/maps/Messages"; import { Message } from "revolt.js/dist/maps/Messages";
import { Server } from "revolt.js/dist/maps/Servers"; import { Server } from "revolt.js/dist/maps/Servers";
@ -113,7 +112,7 @@ export default class NotificationOptions
*/ */
shouldNotify(message: Message) { shouldNotify(message: Message) {
// Make sure the author is not blocked. // Make sure the author is not blocked.
if (message.author?.relationship === RelationshipStatus.Blocked) { if (message.author?.relationship === "Blocked") {
return false; return false;
} }
@ -124,7 +123,7 @@ export default class NotificationOptions
} }
// Check whether we are busy. // Check whether we are busy.
if (user.status?.presence === Presence.Busy) { if (user.status?.presence === "Busy") {
return false; return false;
} }

View file

@ -1,5 +1,5 @@
import { action, computed, makeAutoObservable } from "mobx"; import { action, computed, makeAutoObservable } from "mobx";
import { RevoltConfiguration } from "revolt-api/types/Core"; import { API } from "revolt.js";
import { Client } from "revolt.js"; import { Client } from "revolt.js";
import { Nullable } from "revolt.js/dist/util/null"; import { Nullable } from "revolt.js/dist/util/null";
@ -11,9 +11,9 @@ import Store from "../interfaces/Store";
* Stores server configuration data. * Stores server configuration data.
*/ */
export default class ServerConfig export default class ServerConfig
implements Store, Persistent<RevoltConfiguration> implements Store, Persistent<API.RevoltConfig>
{ {
private config: Nullable<RevoltConfiguration>; private config: Nullable<API.RevoltConfig>;
/** /**
* Construct new ServerConfig store. * Construct new ServerConfig store.
@ -32,7 +32,7 @@ export default class ServerConfig
return JSON.parse(JSON.stringify(this.config)); return JSON.parse(JSON.stringify(this.config));
} }
@action hydrate(data: RevoltConfiguration) { @action hydrate(data: API.RevoltConfig) {
this.config = data ?? null; this.config = data ?? null;
} }
@ -68,7 +68,7 @@ export default class ServerConfig
* Set server configuration. * Set server configuration.
* @param config Server configuration * @param config Server configuration
*/ */
@action set(config: RevoltConfiguration) { @action set(config: API.RevoltConfig) {
this.config = config; this.config = config;
} }
} }

View file

@ -7,7 +7,6 @@ import {
runInAction, runInAction,
} from "mobx"; } from "mobx";
import { Client } from "revolt.js"; import { Client } from "revolt.js";
import { UserSettings } from "revolt-api/types/Sync";
import { mapToRecord } from "../../lib/conversion"; import { mapToRecord } from "../../lib/conversion";
@ -104,7 +103,7 @@ export default class Sync implements Store, Persistent<Data> {
return this.revision.get(key); return this.revision.get(key);
} }
@action apply(data: UserSettings) { @action apply(data: Record<string, [number, string]>) {
const tryRead = (key: string) => { const tryRead = (key: string) => {
if (key in data) { if (key in data) {
const revision = data[key][0]; const revision = data[key][0];

View file

@ -149,9 +149,9 @@ const TextChannel = observer(({ channel }: { channel: ChannelI }) => {
// Mark channel as read. // Mark channel as read.
useEffect(() => { useEffect(() => {
setLastId( setLastId(
channel.unread (channel.unread
? channel.client.unreads?.getUnread(channel._id)?.last_id ? channel.client.unreads?.getUnread(channel._id)?.last_id
: undefined ?? undefined, : undefined) ?? undefined,
); );
const checkUnread = () => const checkUnread = () =>

View file

@ -2,8 +2,7 @@
import { X } from "@styled-icons/boxicons-regular"; import { X } from "@styled-icons/boxicons-regular";
import isEqual from "lodash.isequal"; import isEqual from "lodash.isequal";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { Masquerade } from "revolt-api/types/Channels"; import { API } from "revolt.js";
import { RelationshipStatus } from "revolt-api/types/Users";
import { Message as MessageI } from "revolt.js/dist/maps/Messages"; import { Message as MessageI } from "revolt.js/dist/maps/Messages";
import { Nullable } from "revolt.js/dist/util/null"; import { Nullable } from "revolt.js/dist/util/null";
import styled from "styled-components/macro"; import styled from "styled-components/macro";
@ -99,10 +98,10 @@ export default observer(({ last_id, renderer, highlight }: Props) => {
function compare( function compare(
current: string, current: string,
curAuthor: string, curAuthor: string,
currentMasq: Nullable<Masquerade>, currentMasq: Nullable<API.Masquerade>,
previous: string, previous: string,
prevAuthor: string, prevAuthor: string,
previousMasq: Nullable<Masquerade>, previousMasq: Nullable<API.Masquerade>,
) { ) {
head = false; head = false;
const atime = decodeTime(current), const atime = decodeTime(current),
@ -172,9 +171,7 @@ export default observer(({ last_id, renderer, highlight }: Props) => {
highlight={highlight === message._id} highlight={highlight === message._id}
/>, />,
); );
} else if ( } else if (message.author?.relationship === "Blocked") {
message.author?.relationship === RelationshipStatus.Blocked
) {
blocked++; blocked++;
} else { } else {
if (blocked > 0) pushBlocked(); if (blocked > 0) pushBlocked();

View file

@ -2,7 +2,6 @@ import { X, Plus } from "@styled-icons/boxicons-regular";
import { PhoneCall, Envelope, UserX } from "@styled-icons/boxicons-solid"; import { PhoneCall, Envelope, UserX } from "@styled-icons/boxicons-solid";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { useHistory } from "react-router-dom"; import { useHistory } from "react-router-dom";
import { RelationshipStatus } from "revolt-api/types/Users";
import { User } from "revolt.js/dist/maps/Users"; import { User } from "revolt.js/dist/maps/Users";
import styles from "./Friend.module.scss"; import styles from "./Friend.module.scss";
@ -33,7 +32,7 @@ export const Friend = observer(({ user }: Props) => {
const actions: Children[] = []; const actions: Children[] = [];
let subtext: Children = null; let subtext: Children = null;
if (user.relationship === RelationshipStatus.Friend) { if (user.relationship === "Friend") {
subtext = <UserStatus user={user} />; subtext = <UserStatus user={user} />;
actions.push( actions.push(
<> <>
@ -70,7 +69,7 @@ export const Friend = observer(({ user }: Props) => {
); );
} }
if (user.relationship === RelationshipStatus.Incoming) { if (user.relationship === "Incoming") {
actions.push( actions.push(
<IconButton <IconButton
type="circle" type="circle"
@ -83,14 +82,14 @@ export const Friend = observer(({ user }: Props) => {
subtext = <Text id="app.special.friends.incoming" />; subtext = <Text id="app.special.friends.incoming" />;
} }
if (user.relationship === RelationshipStatus.Outgoing) { if (user.relationship === "Outgoing") {
subtext = <Text id="app.special.friends.outgoing" />; subtext = <Text id="app.special.friends.outgoing" />;
} }
if ( if (
user.relationship === RelationshipStatus.Friend || user.relationship === "Friend" ||
user.relationship === RelationshipStatus.Outgoing || user.relationship === "Outgoing" ||
user.relationship === RelationshipStatus.Incoming user.relationship === "Incoming"
) { ) {
actions.push( actions.push(
<IconButton <IconButton
@ -103,7 +102,7 @@ export const Friend = observer(({ user }: Props) => {
onClick={(ev) => onClick={(ev) =>
stopPropagation( stopPropagation(
ev, ev,
user.relationship === RelationshipStatus.Friend user.relationship === "Friend"
? openScreen({ ? openScreen({
id: "special_prompt", id: "special_prompt",
type: "unfriend_user", type: "unfriend_user",
@ -117,7 +116,7 @@ export const Friend = observer(({ user }: Props) => {
); );
} }
if (user.relationship === RelationshipStatus.Blocked) { if (user.relationship === "Blocked") {
actions.push( actions.push(
<IconButton <IconButton
type="circle" type="circle"

View file

@ -1,9 +1,7 @@
import { ChevronRight } from "@styled-icons/boxicons-regular"; import { ChevronRight } from "@styled-icons/boxicons-regular";
import { UserDetail, MessageAdd, UserPlus } from "@styled-icons/boxicons-solid"; import { UserDetail, MessageAdd, UserPlus } from "@styled-icons/boxicons-solid";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { RelationshipStatus, Presence } from "revolt-api/types/Users";
import { User } from "revolt.js/dist/maps/Users"; import { User } from "revolt.js/dist/maps/Users";
import styled, { css } from "styled-components/macro";
import styles from "./Friend.module.scss"; import styles from "./Friend.module.scss";
import classNames from "classnames"; import classNames from "classnames";
@ -31,37 +29,32 @@ export default observer(() => {
const users = [...client.users.values()]; const users = [...client.users.values()];
users.sort((a, b) => a.username.localeCompare(b.username)); users.sort((a, b) => a.username.localeCompare(b.username));
const friends = users.filter( const friends = users.filter((x) => x.relationship === "Friend");
(x) => x.relationship === RelationshipStatus.Friend,
);
const lists = [ const lists = [
[ ["", users.filter((x) => x.relationship === "Incoming")],
"",
users.filter((x) => x.relationship === RelationshipStatus.Incoming),
],
[ [
"app.special.friends.sent", "app.special.friends.sent",
users.filter((x) => x.relationship === RelationshipStatus.Outgoing), users.filter((x) => x.relationship === "Outgoing"),
"outgoing", "outgoing",
], ],
[ [
"app.status.online", "app.status.online",
friends.filter( friends.filter(
(x) => x.online && x.status?.presence !== Presence.Invisible, (x) => x.online && x.status?.presence !== "Invisible",
), ),
"online", "online",
], ],
[ [
"app.status.offline", "app.status.offline",
friends.filter( friends.filter(
(x) => !x.online || x.status?.presence === Presence.Invisible, (x) => !x.online || x.status?.presence === "Invisible",
), ),
"offline", "offline",
], ],
[ [
"app.special.friends.blocked", "app.special.friends.blocked",
users.filter((x) => x.relationship === RelationshipStatus.Blocked), users.filter((x) => x.relationship === "Blocked"),
"blocked", "blocked",
], ],
] as [string, User[], string][]; ] as [string, User[], string][];

View file

@ -1,7 +1,7 @@
import { ArrowBack } from "@styled-icons/boxicons-regular"; import { ArrowBack } from "@styled-icons/boxicons-regular";
import { autorun } from "mobx"; import { autorun } from "mobx";
import { Redirect, useHistory, useParams } from "react-router-dom"; import { Redirect, useHistory, useParams } from "react-router-dom";
import { RetrievedInvite } from "revolt-api/types/Invites"; import { API } from "revolt.js";
import styles from "./Invite.module.scss"; import styles from "./Invite.module.scss";
import { Text } from "preact-i18n"; import { Text } from "preact-i18n";
@ -36,7 +36,7 @@ export default function Invite() {
const { code } = useParams<{ code: string }>(); const { code } = useParams<{ code: string }>();
const [processing, setProcessing] = useState(false); const [processing, setProcessing] = useState(false);
const [error, setError] = useState<string | undefined>(undefined); const [error, setError] = useState<string | undefined>(undefined);
const [invite, setInvite] = useState<RetrievedInvite | undefined>( const [invite, setInvite] = useState<API.InviteResponse | undefined>(
undefined, undefined,
); );
@ -92,6 +92,8 @@ export default function Invite() {
); );
} }
if (invite.type === "Group") return <h1>unimplemented</h1>;
return ( return (
<div <div
className={styles.invite} className={styles.invite}

View file

@ -1,6 +1,5 @@
import { useParams } from "react-router-dom"; import { useParams } from "react-router-dom";
import { Permission } from "revolt.js"; import { API, Permission } from "revolt.js";
import { Route } from "revolt.js/dist/api/routes";
import styled from "styled-components/macro"; import styled from "styled-components/macro";
import { useEffect, useState } from "preact/hooks"; import { useEffect, useState } from "preact/hooks";
@ -37,8 +36,7 @@ const Option = styled.div`
export default function InviteBot() { export default function InviteBot() {
const { id } = useParams<{ id: string }>(); const { id } = useParams<{ id: string }>();
const client = useClient(); const client = useClient();
const [data, setData] = const [data, setData] = useState<API.PublicBot>();
useState<Route<"GET", "/bots/id/invite">["response"]>();
useEffect(() => { useEffect(() => {
client.bots.fetchPublic(id).then(setData); client.bots.fetchPublic(id).then(setData);

View file

@ -1,6 +1,5 @@
import { detect } from "detect-browser"; import { detect } from "detect-browser";
import { Session } from "revolt-api/types/Auth"; import { API } from "revolt.js";
import { Client } from "revolt.js";
import { useApplicationState } from "../../../mobx/State"; import { useApplicationState } from "../../../mobx/State";
@ -44,25 +43,26 @@ export function FormLogin() {
// This should be replaced in the future. // This should be replaced in the future.
const client = state.config.createClient(); const client = state.config.createClient();
await client.fetchConfiguration(); await client.fetchConfiguration();
const session = (await client.req( const session = await client.api.post("/auth/session/login", {
"POST", ...data,
"/auth/session/login", friendly_name,
{ ...data, friendly_name }, });
)) as unknown as Session;
client.session = session; if (session.result !== "Success") {
(client as any).Axios.defaults.headers = { alert("unsupported!");
"x-session-token": session?.token, return;
};
async function login() {
state.auth.setSession(session);
} }
const { onboarding } = await client.req( const s = session;
"GET",
"/onboard/hello", client.session = session;
); (client as any).$updateHeaders();
async function login() {
state.auth.setSession(s);
}
const { onboarding } = await client.api.get("/onboard/hello");
if (onboarding) { if (onboarding) {
openScreen({ openScreen({

View file

@ -16,7 +16,7 @@ export function FormSendReset() {
<Form <Form
page="send_reset" page="send_reset"
callback={async (data) => { callback={async (data) => {
await client.req("POST", "/auth/account/reset_password", data); await client.api.post("/auth/account/reset_password", data);
}} }}
/> />
); );
@ -32,7 +32,7 @@ export function FormReset() {
<Form <Form
page="reset" page="reset"
callback={async (data) => { callback={async (data) => {
await client.req("PATCH", "/auth/account/reset_password", { await client.api.patch("/auth/account/reset_password", {
token, token,
...data, ...data,
}); });

View file

@ -20,7 +20,7 @@ export function FormResend() {
<Form <Form
page="resend" page="resend"
callback={async (data) => { callback={async (data) => {
await client.req("POST", "/auth/account/reverify", data); await client.api.post("/auth/account/reverify", data);
}} }}
/> />
); );
@ -34,11 +34,8 @@ export function FormVerify() {
const history = useHistory(); const history = useHistory();
useEffect(() => { useEffect(() => {
client client.api
.req( .post(`/auth/account/verify/${token as ""}`)
"POST",
`/auth/account/verify/${token}` as "/auth/account/verify/:code",
)
.then(() => history.push("/login")) .then(() => history.push("/login"))
.catch((err) => setError(takeError(err))); .catch((err) => setError(takeError(err)));
// eslint-disable-next-line // eslint-disable-next-line

View file

@ -337,7 +337,9 @@ export default observer(() => {
<Trash <Trash
size={24} size={24}
onClick={() => onClick={() =>
client.users.edit({ remove: "StatusText" }) client.users.edit({
remove: ["StatusText"],
})
} }
/> />
)} )}

View file

@ -69,7 +69,7 @@ export default observer(({ channel }: Props) => {
{ max_side: 256 }, { max_side: 256 },
true, true,
)} )}
remove={() => channel.edit({ remove: "Icon" })} remove={() => channel.edit({ remove: ["Icon"] })}
defaultPreview={ defaultPreview={
channel.channel_type === "Group" channel.channel_type === "Group"
? "/assets/group.png" ? "/assets/group.png"

View file

@ -1,7 +1,6 @@
import isEqual from "lodash.isequal"; import isEqual from "lodash.isequal";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { OverrideField } from "revolt-api/types/_common"; import { Channel, API } from "revolt.js";
import { Channel } from "revolt.js/dist/maps/Channels";
import { useLayoutEffect, useState } from "preact/hooks"; import { useLayoutEffect, useState } from "preact/hooks";
@ -42,7 +41,7 @@ export default observer(({ channel }: Props) => {
// Keep track of whatever role we're editing right now. // Keep track of whatever role we're editing right now.
const [selected, setSelected] = useState("default"); const [selected, setSelected] = useState("default");
const [value, setValue] = useState<OverrideField | number | undefined>( const [value, setValue] = useState<API.OverrideField | number | undefined>(
undefined, undefined,
); );
const currentPermission = currentRoles.find( const currentPermission = currentRoles.find(
@ -64,10 +63,10 @@ export default observer(({ channel }: Props) => {
selected, selected,
typeof currentValue === "number" typeof currentValue === "number"
? currentValue ? currentValue
: { : ({
allow: currentValue.a, allow: currentValue.a,
deny: currentValue.d, deny: currentValue.d,
}, } as any),
); );
} }

View file

@ -1,4 +1,4 @@
import { At, Key, Block, ListOl } from "@styled-icons/boxicons-regular"; import { At, Key, Block } from "@styled-icons/boxicons-regular";
import { import {
Envelope, Envelope,
HelpCircle, HelpCircle,
@ -8,7 +8,7 @@ import {
} from "@styled-icons/boxicons-solid"; } from "@styled-icons/boxicons-solid";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { useHistory } from "react-router-dom"; import { useHistory } from "react-router-dom";
import { Profile } from "revolt-api/types/Users"; import { API } from "revolt.js";
import styles from "./Panes.module.scss"; import styles from "./Panes.module.scss";
import { Text } from "preact-i18n"; import { Text } from "preact-i18n";
@ -37,7 +37,9 @@ export const Account = observer(() => {
const [email, setEmail] = useState("..."); const [email, setEmail] = useState("...");
const [revealEmail, setRevealEmail] = useState(false); const [revealEmail, setRevealEmail] = useState(false);
const [profile, setProfile] = useState<undefined | Profile>(undefined); const [profile, setProfile] = useState<undefined | API.UserProfile>(
undefined,
);
const history = useHistory(); const history = useHistory();
function switchPage(to: string) { function switchPage(to: string) {
@ -46,8 +48,8 @@ export const Account = observer(() => {
useEffect(() => { useEffect(() => {
if (email === "..." && status === ClientStatus.ONLINE) { if (email === "..." && status === ClientStatus.ONLINE) {
client client.api
.req("GET", "/auth/account") .get("/auth/account/")
.then((account) => setEmail(account.email)); .then((account) => setEmail(account.email));
} }

View file

@ -1,9 +1,9 @@
// ! FIXME: this code is garbage, need to replace
import { Key, Clipboard, Globe, Plus } from "@styled-icons/boxicons-regular"; import { Key, Clipboard, Globe, Plus } from "@styled-icons/boxicons-regular";
import { LockAlt, HelpCircle } from "@styled-icons/boxicons-solid"; import { LockAlt, HelpCircle } from "@styled-icons/boxicons-solid";
import type { AxiosError } from "axios"; import type { AxiosError } from "axios";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { Bot } from "revolt-api/types/Bots"; import { API } from "revolt.js";
import { Profile as ProfileI } from "revolt-api/types/Users";
import { User } from "revolt.js/dist/maps/Users"; import { User } from "revolt.js/dist/maps/Users";
import styled from "styled-components/macro"; import styled from "styled-components/macro";
@ -43,7 +43,7 @@ interface Changes {
name?: string; name?: string;
public?: boolean; public?: boolean;
interactions_url?: string; interactions_url?: string;
remove?: "InteractionsURL"; remove?: "InteractionsURL"[];
} }
const BotBadge = styled.div` const BotBadge = styled.div`
@ -62,7 +62,7 @@ const BotBadge = styled.div`
`; `;
interface Props { interface Props {
bot: Bot; bot: API.Bot;
onDelete(): void; onDelete(): void;
onUpdate(changes: Changes): void; onUpdate(changes: Changes): void;
} }
@ -75,7 +75,7 @@ function BotCard({ bot, onDelete, onUpdate }: Props) {
_id: bot._id, _id: bot._id,
username: user.username, username: user.username,
public: bot.public, public: bot.public,
interactions_url: bot.interactions_url, interactions_url: bot.interactions_url as any,
}); });
const [error, setError] = useState<string | JSX.Element>(""); const [error, setError] = useState<string | JSX.Element>("");
const [saving, setSaving] = useState(false); const [saving, setSaving] = useState(false);
@ -87,23 +87,21 @@ function BotCard({ bot, onDelete, onUpdate }: Props) {
useState<HTMLInputElement | null>(null); useState<HTMLInputElement | null>(null);
const { writeClipboard, openScreen } = useIntermediate(); const { writeClipboard, openScreen } = useIntermediate();
const [profile, setProfile] = useState<undefined | ProfileI>(undefined); const [profile, setProfile] = useState<undefined | API.UserProfile>(
undefined,
);
const refreshProfile = useCallback(() => { const refreshProfile = useCallback(() => {
client client.api
.request( .get(`/users/${bot._id as ""}/profile`, undefined, {
"GET", headers: { "x-bot-token": bot.token },
`/users/${bot._id}/profile` as "/users/id/profile", transformRequest: (data, headers) => {
{ // Remove user headers for this request
headers: { "x-bot-token": bot.token }, delete headers?.["x-user-id"];
transformRequest: (data, headers) => { delete headers?.["x-session-token"];
// Remove user headers for this request return data;
delete headers["x-user-id"];
delete headers["x-session-token"];
return data;
},
}, },
) })
.then((profile) => setProfile(profile ?? {})); .then((profile) => setProfile(profile ?? {}));
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [user, setProfile]); }, [user, setProfile]);
@ -122,14 +120,14 @@ function BotCard({ bot, onDelete, onUpdate }: Props) {
const changes: Changes = {}; const changes: Changes = {};
if (data.username !== user!.username) changes.name = data.username; if (data.username !== user!.username) changes.name = data.username;
if (data.public !== bot.public) changes.public = data.public; if (data.public !== bot.public) changes.public = data.public;
if (data.interactions_url === "") changes.remove = "InteractionsURL"; if (data.interactions_url === "") changes.remove = ["InteractionsURL"];
else if (data.interactions_url !== bot.interactions_url) else if (data.interactions_url !== bot.interactions_url)
changes.interactions_url = data.interactions_url; changes.interactions_url = data.interactions_url;
setSaving(true); setSaving(true);
setError(""); setError("");
try { try {
await client.bots.edit(bot._id, changes); await client.bots.edit(bot._id, changes);
if (changed) await editBotContent(profile?.content); if (changed) await editBotContent(profile?.content ?? undefined);
onUpdate(changes); onUpdate(changes);
setChanged(false); setChanged(false);
setEditMode(false); setEditMode(false);
@ -152,19 +150,22 @@ function BotCard({ bot, onDelete, onUpdate }: Props) {
async function editBotAvatar(avatar?: string) { async function editBotAvatar(avatar?: string) {
setSaving(true); setSaving(true);
setError(""); setError("");
await client.request("PATCH", "/users/id", { await client.api.patch(
headers: { "x-bot-token": bot.token }, "/users/@me",
transformRequest: (data, headers) => { avatar ? { avatar } : { remove: ["Avatar"] },
// Remove user headers for this request {
delete headers["x-user-id"]; headers: { "x-bot-token": bot.token },
delete headers["x-session-token"]; transformRequest: (data, headers) => {
return data; // Remove user headers for this request
delete headers?.["x-user-id"];
delete headers?.["x-session-token"];
return data;
},
}, },
data: JSON.stringify(avatar ? { avatar } : { remove: "Avatar" }), );
});
const res = await client.bots.fetch(bot._id); const res = await client.bots.fetch(bot._id);
if (!avatar) res.user.update({}, "Avatar"); if (!avatar) res.user.update({}, ["Avatar"]);
setUser(res.user); setUser(res.user);
setSaving(false); setSaving(false);
} }
@ -172,20 +173,21 @@ function BotCard({ bot, onDelete, onUpdate }: Props) {
async function editBotBackground(background?: string) { async function editBotBackground(background?: string) {
setSaving(true); setSaving(true);
setError(""); setError("");
await client.request("PATCH", "/users/id", { await client.api.patch(
headers: { "x-bot-token": bot.token }, "/users/@me",
transformRequest: (data, headers) => { background
// Remove user headers for this request ? { profile: { background } }
delete headers["x-user-id"]; : { remove: ["ProfileBackground"] },
delete headers["x-session-token"]; {
return data; headers: { "x-bot-token": bot.token },
transformRequest: (data, headers) => {
// Remove user headers for this request
delete headers?.["x-user-id"];
delete headers?.["x-session-token"];
return data;
},
}, },
data: JSON.stringify( );
background
? { profile: { background } }
: { remove: "ProfileBackground" },
),
});
if (!background) setProfile({ ...profile, background: undefined }); if (!background) setProfile({ ...profile, background: undefined });
else refreshProfile(); else refreshProfile();
@ -195,20 +197,19 @@ function BotCard({ bot, onDelete, onUpdate }: Props) {
async function editBotContent(content?: string) { async function editBotContent(content?: string) {
setSaving(true); setSaving(true);
setError(""); setError("");
await client.request("PATCH", "/users/id", { await client.api.patch(
headers: { "x-bot-token": bot.token }, "/users/@me",
transformRequest: (data, headers) => { content ? { profile: { content } } : { remove: ["ProfileContent"] },
// Remove user headers for this request {
delete headers["x-user-id"]; headers: { "x-bot-token": bot.token },
delete headers["x-session-token"]; transformRequest: (data, headers) => {
return data; // Remove user headers for this request
delete headers?.["x-user-id"];
delete headers?.["x-session-token"];
return data;
},
}, },
data: JSON.stringify( );
content
? { profile: { content } }
: { remove: "ProfileContent" },
),
});
if (!content) setProfile({ ...profile, content: undefined }); if (!content) setProfile({ ...profile, content: undefined });
else refreshProfile(); else refreshProfile();
@ -333,7 +334,7 @@ function BotCard({ bot, onDelete, onUpdate }: Props) {
_id: bot._id, _id: bot._id,
username: user!.username, username: user!.username,
public: bot.public, public: bot.public,
interactions_url: bot.interactions_url, interactions_url: bot.interactions_url as any,
}); });
usernameRef!.value = user!.username; usernameRef!.value = user!.username;
interactionsRef!.value = bot.interactions_url || ""; interactionsRef!.value = bot.interactions_url || "";
@ -521,7 +522,7 @@ function BotCard({ bot, onDelete, onUpdate }: Props) {
export const MyBots = observer(() => { export const MyBots = observer(() => {
const client = useClient(); const client = useClient();
const [bots, setBots] = useState<Bot[] | undefined>(undefined); const [bots, setBots] = useState<API.Bot[] | undefined>(undefined);
useEffect(() => { useEffect(() => {
client.bots.fetchOwned().then(({ bots }) => setBots(bots)); client.bots.fetchOwned().then(({ bots }) => setBots(bots));
@ -582,7 +583,7 @@ export const MyBots = observer(() => {
changes.interactions_url; changes.interactions_url;
if ( if (
changes.remove === changes.remove ===
"InteractionsURL" ["InteractionsURL"]
) )
x.interactions_url = undefined; x.interactions_url = undefined;
} }

View file

@ -81,7 +81,7 @@ export const Notifications = observer(() => {
// tell the server we just subscribed // tell the server we just subscribed
const json = sub.toJSON(); const json = sub.toJSON();
if (json.keys) { if (json.keys) {
client.req("POST", "/push/subscribe", { client.api.post("/push/subscribe", {
endpoint: sub.endpoint, endpoint: sub.endpoint,
...(json.keys as { ...(json.keys as {
p256dh: string; p256dh: string;
@ -96,7 +96,7 @@ export const Notifications = observer(() => {
sub?.unsubscribe(); sub?.unsubscribe();
setPushEnabled(false); setPushEnabled(false);
client.req("POST", "/push/unsubscribe"); client.api.post("/push/unsubscribe");
} }
} }
} catch (err) { } catch (err) {

View file

@ -1,7 +1,7 @@
import { Markdown } from "@styled-icons/boxicons-logos"; import { Markdown } from "@styled-icons/boxicons-logos";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { useHistory } from "react-router-dom"; import { useHistory } from "react-router-dom";
import { Profile as ProfileI } from "revolt-api/types/Users"; import { API } from "revolt.js";
import styles from "./Panes.module.scss"; import styles from "./Panes.module.scss";
import { Text } from "preact-i18n"; import { Text } from "preact-i18n";
@ -30,7 +30,9 @@ export const Profile = observer(() => {
const client = useClient(); const client = useClient();
const history = useHistory(); const history = useHistory();
const [profile, setProfile] = useState<undefined | ProfileI>(undefined); const [profile, setProfile] = useState<undefined | API.UserProfile>(
undefined,
);
// ! FIXME: temporary solution // ! FIXME: temporary solution
// ! we should just announce profile changes through WS // ! we should just announce profile changes through WS
@ -103,7 +105,7 @@ export const Profile = observer(() => {
behaviour="upload" behaviour="upload"
maxFileSize={4_000_000} maxFileSize={4_000_000}
onUpload={(avatar) => client.users.edit({ avatar })} onUpload={(avatar) => client.users.edit({ avatar })}
remove={() => client.users.edit({ remove: "Avatar" })} remove={() => client.users.edit({ remove: ["Avatar"] })}
defaultPreview={client.user!.generateAvatarURL( defaultPreview={client.user!.generateAvatarURL(
{ max_side: 256 }, { max_side: 256 },
true, true,
@ -132,7 +134,7 @@ export const Profile = observer(() => {
}} }}
remove={async () => { remove={async () => {
await client.users.edit({ await client.users.edit({
remove: "ProfileBackground", remove: ["ProfileBackground"],
}); });
setProfile({ ...profile, background: undefined }); setProfile({ ...profile, background: undefined });
}} }}

View file

@ -11,7 +11,7 @@ import {
} from "@styled-icons/simple-icons"; } from "@styled-icons/simple-icons";
import relativeTime from "dayjs/plugin/relativeTime"; import relativeTime from "dayjs/plugin/relativeTime";
import { useHistory } from "react-router-dom"; import { useHistory } from "react-router-dom";
import { SessionInfo } from "revolt-api/types/Auth"; import { API } from "revolt.js";
import { decodeTime } from "ulid"; import { decodeTime } from "ulid";
import styles from "./Panes.module.scss"; import styles from "./Panes.module.scss";
@ -33,7 +33,7 @@ export function Sessions() {
const deviceId = const deviceId =
typeof client.session === "object" ? client.session._id : undefined; typeof client.session === "object" ? client.session._id : undefined;
const [sessions, setSessions] = useState<SessionInfo[] | undefined>( const [sessions, setSessions] = useState<API.SessionInfo[] | undefined>(
undefined, undefined,
); );
const [attemptingDelete, setDelete] = useState<string[]>([]); const [attemptingDelete, setDelete] = useState<string[]>([]);
@ -44,7 +44,7 @@ export function Sessions() {
} }
useEffect(() => { useEffect(() => {
client.req("GET", "/auth/session/all").then((data) => { client.api.get("/auth/session/all").then((data) => {
data.sort( data.sort(
(a, b) => (a, b) =>
(b._id === deviceId ? 1 : 0) - (a._id === deviceId ? 1 : 0), (b._id === deviceId ? 1 : 0) - (a._id === deviceId ? 1 : 0),
@ -61,7 +61,7 @@ export function Sessions() {
); );
} }
function getIcon(session: SessionInfo) { function getIcon(session: API.SessionInfo) {
const name = session.name; const name = session.name;
switch (true) { switch (true) {
case /firefox/i.test(name): case /firefox/i.test(name):
@ -83,7 +83,7 @@ export function Sessions() {
} }
} }
function getSystemIcon(session: SessionInfo) { function getSystemIcon(session: API.SessionInfo) {
const name = session.name; const name = session.name;
switch (true) { switch (true) {
case /linux/i.test(name): case /linux/i.test(name):
@ -187,9 +187,10 @@ export function Sessions() {
...attemptingDelete, ...attemptingDelete,
session._id, session._id,
]); ]);
await client.req( await client.api.delete(
"DELETE", `/auth/session/${
`/auth/session/${session._id}` as "/auth/session/id", session._id as ""
}`,
); );
setSessions( setSessions(
sessions?.filter( sessions?.filter(
@ -222,10 +223,7 @@ export function Sessions() {
setDelete(del); setDelete(del);
for (const id of del) { for (const id of del) {
await client.req( await client.api.delete(`/auth/session/${id as ""}`);
"DELETE",
`/auth/session/${id}` as "/auth/session/id",
);
} }
setSessions(sessions.filter((x) => x._id === deviceId)); setSessions(sessions.filter((x) => x._id === deviceId));

View file

@ -1,9 +1,7 @@
import { XCircle } from "@styled-icons/boxicons-regular"; import { XCircle } from "@styled-icons/boxicons-regular";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { Virtuoso } from "react-virtuoso"; import { Virtuoso } from "react-virtuoso";
import { Ban } from "revolt-api/types/Servers"; import { API } from "revolt.js";
import { User } from "revolt-api/types/Users";
import { Route } from "revolt.js/dist/api/routes";
import { Server } from "revolt.js/dist/maps/Servers"; import { Server } from "revolt.js/dist/maps/Servers";
import styles from "./Panes.module.scss"; import styles from "./Panes.module.scss";
@ -15,8 +13,8 @@ import IconButton from "../../../components/ui/IconButton";
import Preloader from "../../../components/ui/Preloader"; import Preloader from "../../../components/ui/Preloader";
interface InnerProps { interface InnerProps {
ban: Ban; ban: API.ServerBan;
users: Pick<User, "username" | "avatar" | "_id">[]; users: Pick<API.User, "username" | "avatar" | "_id">[];
server: Server; server: Server;
removeSelf: () => void; removeSelf: () => void;
} }
@ -53,9 +51,7 @@ interface Props {
} }
export const Bans = observer(({ server }: Props) => { export const Bans = observer(({ server }: Props) => {
const [data, setData] = useState< const [data, setData] = useState<API.BanListResult | undefined>(undefined);
Route<"GET", "/servers/id/bans">["response"] | undefined
>(undefined);
useEffect(() => { useEffect(() => {
server.fetchBans().then(setData); server.fetchBans().then(setData);

View file

@ -1,9 +1,7 @@
import { Plus, X } from "@styled-icons/boxicons-regular"; import { Plus, X } from "@styled-icons/boxicons-regular";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { DragDropContext } from "react-beautiful-dnd"; import { DragDropContext } from "react-beautiful-dnd";
import { TextChannel, VoiceChannel } from "revolt-api/types/Channels"; import { Channel, Server, API } from "revolt.js";
import { Category } from "revolt-api/types/Servers";
import { Server } from "revolt.js/dist/maps/Servers";
import styled, { css } from "styled-components/macro"; import styled, { css } from "styled-components/macro";
import { ulid } from "ulid"; import { ulid } from "ulid";
@ -135,7 +133,7 @@ interface Props {
export const Categories = observer(({ server }: Props) => { export const Categories = observer(({ server }: Props) => {
const [status, setStatus] = useState<EditStatus>("saved"); const [status, setStatus] = useState<EditStatus>("saved");
const [categories, setCategories] = useState<Category[]>( const [categories, setCategories] = useState<API.Category[]>(
server.categories ?? [], server.categories ?? [],
); );
@ -327,12 +325,14 @@ function ListElement({
addChannel, addChannel,
draggable, draggable,
}: { }: {
category: Category; category: API.Category;
server: Server; server: Server;
index: number; index: number;
setTitle?: (title: string) => void; setTitle?: (title: string) => void;
deleteSelf?: () => void; deleteSelf?: () => void;
addChannel: (channel: TextChannel | VoiceChannel) => void; addChannel: (
channel: Channel & { channel_type: "TextChannel" | "VoiceChannel" },
) => void;
draggable?: boolean; draggable?: boolean;
}) { }) {
const { openScreen } = useIntermediate(); const { openScreen } = useIntermediate();

View file

@ -1,8 +1,7 @@
import { XCircle } from "@styled-icons/boxicons-regular"; import { XCircle } from "@styled-icons/boxicons-regular";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { Virtuoso } from "react-virtuoso"; import { Virtuoso } from "react-virtuoso";
import { Invite, ServerInvite } from "revolt-api/types/Invites"; import { API, Server } from "revolt.js";
import { Server } from "revolt.js/dist/maps/Servers";
import styles from "./Panes.module.scss"; import styles from "./Panes.module.scss";
import { Text } from "preact-i18n"; import { Text } from "preact-i18n";
@ -16,7 +15,7 @@ import IconButton from "../../../components/ui/IconButton";
import Preloader from "../../../components/ui/Preloader"; import Preloader from "../../../components/ui/Preloader";
interface InnerProps { interface InnerProps {
invite: Invite; invite: API.Invite;
server: Server; server: Server;
removeSelf: () => void; removeSelf: () => void;
} }
@ -52,12 +51,10 @@ interface Props {
} }
export const Invites = ({ server }: Props) => { export const Invites = ({ server }: Props) => {
const [invites, setInvites] = useState<ServerInvite[] | undefined>( const [invites, setInvites] = useState<API.Invite[] | undefined>(undefined);
undefined,
);
useEffect(() => { useEffect(() => {
server.fetchInvites().then(setInvites); server.fetchInvites().then((v) => setInvites(v));
}, [server, setInvites]); }, [server, setInvites]);
return ( return (

View file

@ -8,6 +8,7 @@ import { Text } from "preact-i18n";
import { useEffect, useState } from "preact/hooks"; import { useEffect, useState } from "preact/hooks";
import TextAreaAutoSize from "../../../lib/TextAreaAutoSize"; import TextAreaAutoSize from "../../../lib/TextAreaAutoSize";
import { noop } from "../../../lib/js";
import { FileUploader } from "../../../context/revoltjs/FileUploads"; import { FileUploader } from "../../../context/revoltjs/FileUploads";
import { getChannelName } from "../../../context/revoltjs/util"; import { getChannelName } from "../../../context/revoltjs/util";
@ -60,9 +61,9 @@ export const Overview = observer(({ server }: Props) => {
fileType="icons" fileType="icons"
behaviour="upload" behaviour="upload"
maxFileSize={2_500_000} maxFileSize={2_500_000}
onUpload={(icon) => server.edit({ icon })} onUpload={(icon) => server.edit({ icon }).then(noop)}
previewURL={server.generateIconURL({ max_side: 256 }, true)} previewURL={server.generateIconURL({ max_side: 256 }, true)}
remove={() => server.edit({ remove: "Icon" })} remove={() => server.edit({ remove: ["Icon"] }).then(noop)}
/> />
<div className={styles.name}> <div className={styles.name}>
<h3> <h3>
@ -117,9 +118,9 @@ export const Overview = observer(({ server }: Props) => {
fileType="banners" fileType="banners"
behaviour="upload" behaviour="upload"
maxFileSize={6_000_000} maxFileSize={6_000_000}
onUpload={(banner) => server.edit({ banner })} onUpload={(banner) => server.edit({ banner }).then(noop)}
previewURL={server.generateBannerURL({ width: 1000 }, true)} previewURL={server.generateBannerURL({ width: 1000 }, true)}
remove={() => server.edit({ remove: "Banner" })} remove={() => server.edit({ remove: ["Banner"] }).then(noop)}
/> />
<hr /> <hr />
<h3> <h3>

107
yarn.lock
View file

@ -1375,6 +1375,16 @@
resolved "https://registry.yarnpkg.com/@insertish/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz#5bcd6f73b93efa9ccdb6abf887ae808d40827169" resolved "https://registry.yarnpkg.com/@insertish/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz#5bcd6f73b93efa9ccdb6abf887ae808d40827169"
integrity sha512-kFD/p8T4Hkqr992QrdkbW/cQ/W/q2d9MPCobwzBv2PwTKLkCD9RaYDy6m17qRnSLQQ5PU0kHCG8kaOwAqzj1vQ== integrity sha512-kFD/p8T4Hkqr992QrdkbW/cQ/W/q2d9MPCobwzBv2PwTKLkCD9RaYDy6m17qRnSLQQ5PU0kHCG8kaOwAqzj1vQ==
"@insertish/oapi@0.1.13":
version "0.1.13"
resolved "https://registry.yarnpkg.com/@insertish/oapi/-/oapi-0.1.13.tgz#92579172bd6896152e9b68ef5bafcf8cc2048492"
integrity sha512-yj1Jk3VlNCjp0hNOsknevyR7PwVzSzc5pbUTuyhtyPlbuHRTv1b9DWs8Ki7xbF/mrIy2DzkHoUu4Ik/Q4oS93w==
dependencies:
typescript "^4.6.2"
optionalDependencies:
axios "^0.26.1"
openapi-typescript "^5.2.0"
"@insertish/vite-plugin-babel-macros@^1.0.5": "@insertish/vite-plugin-babel-macros@^1.0.5":
version "1.0.5" version "1.0.5"
resolved "https://registry.yarnpkg.com/@insertish/vite-plugin-babel-macros/-/vite-plugin-babel-macros-1.0.5.tgz#399c79f22d08bf5ba8830dd4500bd6b4e5f14f92" resolved "https://registry.yarnpkg.com/@insertish/vite-plugin-babel-macros/-/vite-plugin-babel-macros-1.0.5.tgz#399c79f22d08bf5ba8830dd4500bd6b4e5f14f92"
@ -2083,6 +2093,13 @@ axios@^0.21.4:
dependencies: dependencies:
follow-redirects "^1.14.0" follow-redirects "^1.14.0"
axios@^0.26.1:
version "0.26.1"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.26.1.tgz#1ede41c51fcf51bbbd6fd43669caaa4f0495aaa9"
integrity sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==
dependencies:
follow-redirects "^1.14.8"
babel-eslint@^10.0.1: babel-eslint@^10.0.1:
version "10.1.0" version "10.1.0"
resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.1.0.tgz#6968e568a910b78fb3779cdd8b6ac2f479943232" resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.1.0.tgz#6968e568a910b78fb3779cdd8b6ac2f479943232"
@ -3027,6 +3044,11 @@ follow-redirects@^1.14.0:
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.4.tgz#838fdf48a8bbdd79e52ee51fb1c94e3ed98b9379" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.4.tgz#838fdf48a8bbdd79e52ee51fb1c94e3ed98b9379"
integrity sha512-zwGkiSXC1MUJG/qmeIFH2HBJx9u0V46QGUe3YR1fXG8bXQxq7fLj0RjLZQ5nubr9qNJUZrH+xUcwXEoXNpfS+g== integrity sha512-zwGkiSXC1MUJG/qmeIFH2HBJx9u0V46QGUe3YR1fXG8bXQxq7fLj0RjLZQ5nubr9qNJUZrH+xUcwXEoXNpfS+g==
follow-redirects@^1.14.8:
version "1.14.9"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.9.tgz#dd4ea157de7bfaf9ea9b3fbd85aa16951f78d8d7"
integrity sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==
fs-extra@^10.0.0: fs-extra@^10.0.0:
version "10.0.0" version "10.0.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.0.0.tgz#9ff61b655dde53fb34a82df84bb214ce802e17c1" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.0.0.tgz#9ff61b655dde53fb34a82df84bb214ce802e17c1"
@ -3129,6 +3151,11 @@ globals@^13.6.0, globals@^13.9.0:
dependencies: dependencies:
type-fest "^0.20.2" type-fest "^0.20.2"
globalyzer@0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/globalyzer/-/globalyzer-0.1.0.tgz#cb76da79555669a1519d5a8edf093afaa0bf1465"
integrity sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==
globby@^11.0.3: globby@^11.0.3:
version "11.0.4" version "11.0.4"
resolved "https://registry.yarnpkg.com/globby/-/globby-11.0.4.tgz#2cbaff77c2f2a62e71e9b2813a67b97a3a3001a5" resolved "https://registry.yarnpkg.com/globby/-/globby-11.0.4.tgz#2cbaff77c2f2a62e71e9b2813a67b97a3a3001a5"
@ -3141,6 +3168,11 @@ globby@^11.0.3:
merge2 "^1.3.0" merge2 "^1.3.0"
slash "^3.0.0" slash "^3.0.0"
globrex@^0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/globrex/-/globrex-0.1.2.tgz#dd5d9ec826232730cd6793a5e33a9302985e6098"
integrity sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==
graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0: graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0:
version "4.2.8" version "4.2.8"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.8.tgz#e412b8d33f5e006593cbd3cee6df9f2cebbe802a" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.8.tgz#e412b8d33f5e006593cbd3cee6df9f2cebbe802a"
@ -3457,6 +3489,13 @@ js-yaml@^3.13.1:
argparse "^1.0.7" argparse "^1.0.7"
esprima "^4.0.0" esprima "^4.0.0"
js-yaml@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602"
integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==
dependencies:
argparse "^2.0.1"
jsesc@^2.5.1: jsesc@^2.5.1:
version "2.5.2" version "2.5.2"
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4"
@ -3757,6 +3796,11 @@ mime@^2.3.1:
resolved "https://registry.yarnpkg.com/mime/-/mime-2.5.2.tgz#6e3dc6cc2b9510643830e5f19d5cb753da5eeabe" resolved "https://registry.yarnpkg.com/mime/-/mime-2.5.2.tgz#6e3dc6cc2b9510643830e5f19d5cb753da5eeabe"
integrity sha512-tqkh47FzKeCPD2PUiPB6pkbMzsCasjxAfC62/Wap5qrUWcb+sFasXUC5I3gYM5iBM8v/Qpn4UK0x+j0iHyFPDg== integrity sha512-tqkh47FzKeCPD2PUiPB6pkbMzsCasjxAfC62/Wap5qrUWcb+sFasXUC5I3gYM5iBM8v/Qpn4UK0x+j0iHyFPDg==
mime@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/mime/-/mime-3.0.0.tgz#b374550dca3a0c18443b0c950a6a58f1931cf7a7"
integrity sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==
mini-create-react-context@^0.4.0: mini-create-react-context@^0.4.0:
version "0.4.1" version "0.4.1"
resolved "https://registry.yarnpkg.com/mini-create-react-context/-/mini-create-react-context-0.4.1.tgz#072171561bfdc922da08a60c2197a497cc2d1d5e" resolved "https://registry.yarnpkg.com/mini-create-react-context/-/mini-create-react-context-0.4.1.tgz#072171561bfdc922da08a60c2197a497cc2d1d5e"
@ -3889,6 +3933,18 @@ once@^1.3.0:
dependencies: dependencies:
wrappy "1" wrappy "1"
openapi-typescript@^5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/openapi-typescript/-/openapi-typescript-5.2.0.tgz#c0712d7a17e4502ac083162c42f946c0e966a505"
integrity sha512-EGoPTmxrpiN40R6An5Wqol2l74sRb773pv/KXWYCQaMCXNtMGN7Jv+y/jY4B1Bd4hsIW2j9GFmQXxqfGmOXaxA==
dependencies:
js-yaml "^4.1.0"
mime "^3.0.0"
prettier "^2.5.1"
tiny-glob "^0.2.9"
undici "^4.14.1"
yargs-parser "^21.0.0"
optionator@^0.9.1: optionator@^0.9.1:
version "0.9.1" version "0.9.1"
resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.1.tgz#4f236a6373dae0566a6d43e1326674f50c291499" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.1.tgz#4f236a6373dae0566a6d43e1326674f50c291499"
@ -4023,6 +4079,11 @@ prettier@^2.3.1:
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.2.tgz#ef280a05ec253712e486233db5c6f23441e7342d" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.2.tgz#ef280a05ec253712e486233db5c6f23441e7342d"
integrity sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ== integrity sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==
prettier@^2.5.1:
version "2.6.0"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.6.0.tgz#12f8f504c4d8ddb76475f441337542fa799207d4"
integrity sha512-m2FgJibYrBGGgQXNzfd0PuDGShJgRavjUoRCw1mZERIWVSXF0iLzLm+aOqTAbLnC3n6JzUhAA8uZnFVghHJ86A==
pretty-bytes@^5.3.0, pretty-bytes@^5.6.0: pretty-bytes@^5.3.0, pretty-bytes@^5.6.0:
version "5.6.0" version "5.6.0"
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-5.6.0.tgz#356256f643804773c82f64723fe78c92c62beaeb" resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-5.6.0.tgz#356256f643804773c82f64723fe78c92c62beaeb"
@ -4303,15 +4364,19 @@ reusify@^1.0.4:
resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76"
integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==
revolt-api@0.5.3-alpha.12: revolt-api@0.5.3-rc.7:
version "0.5.3-alpha.12" version "0.5.3-rc.7"
resolved "https://registry.yarnpkg.com/revolt-api/-/revolt-api-0.5.3-alpha.12.tgz#78f25b567b840c1fd072595526592a422cb01f25" resolved "https://registry.yarnpkg.com/revolt-api/-/revolt-api-0.5.3-rc.7.tgz#eed82fcd014a25a4d080c4502c0ae4aa283adddb"
integrity sha512-MM42oI5+5JJMnAs3JiOwSQOy/SUYzYs3M8YRC5QI4G6HU7CfyB2HNWh5jFsyRlcLdSi13dGazHm31FUPHsxOzw== integrity sha512-72SJ+P19nRRD+xE8bXAV8mFZNBgtKkXogQACDvNSIdATUmszYl91YRPqX+UQ1Oz4ePgKFwyWPxrnmfede7Q83g==
dependencies:
"@insertish/oapi" "0.1.13"
axios "^0.26.1"
lodash.defaultsdeep "^4.6.1"
revolt.js@5.2.8: revolt.js@6.0.0-rc.3:
version "5.2.8" version "6.0.0-rc.3"
resolved "https://registry.yarnpkg.com/revolt.js/-/revolt.js-5.2.8.tgz#5c9b3b10d3ea488e74b3208a9309e2106fb8c2c2" resolved "https://registry.yarnpkg.com/revolt.js/-/revolt.js-6.0.0-rc.3.tgz#0bf791eebf49b70c0baa2d2bd645c500c40ba737"
integrity sha512-J3n2Rwbqen9UTqfgl/N2RJx/9QaXhuZWdp/Pce0wrw9pP/xCTk87FlHHG0ZWuJvX4fltg9lbCHGMcUIT6UA2wA== integrity sha512-b3jh/U80cWHJgjZxhyufCEspsWUOgKHPV+h3/1gWpt3fvpUWC2BPxDtJSVNXKe9AjQOpofpYaNQ8l9wlEfxA4A==
dependencies: dependencies:
"@insertish/exponential-backoff" "3.1.0-patch.0" "@insertish/exponential-backoff" "3.1.0-patch.0"
"@insertish/isomorphic-ws" "^4.0.1" "@insertish/isomorphic-ws" "^4.0.1"
@ -4320,8 +4385,9 @@ revolt.js@5.2.8:
lodash.defaultsdeep "^4.6.1" lodash.defaultsdeep "^4.6.1"
lodash.flatten "^4.4.0" lodash.flatten "^4.4.0"
lodash.isequal "^4.5.0" lodash.isequal "^4.5.0"
long "^5.2.0"
mobx "^6.3.2" mobx "^6.3.2"
revolt-api "0.5.3-alpha.12" revolt-api "0.5.3-rc.7"
ulid "^2.3.0" ulid "^2.3.0"
ws "^8.2.2" ws "^8.2.2"
@ -4737,6 +4803,14 @@ text-table@^0.2.0:
resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=
tiny-glob@^0.2.9:
version "0.2.9"
resolved "https://registry.yarnpkg.com/tiny-glob/-/tiny-glob-0.2.9.tgz#2212d441ac17928033b110f8b3640683129d31e2"
integrity sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==
dependencies:
globalyzer "0.1.0"
globrex "^0.1.2"
tiny-invariant@^1.0.2, tiny-invariant@^1.0.6: tiny-invariant@^1.0.2, tiny-invariant@^1.0.6:
version "1.1.0" version "1.1.0"
resolved "https://registry.yarnpkg.com/tiny-invariant/-/tiny-invariant-1.1.0.tgz#634c5f8efdc27714b7f386c35e6760991d230875" resolved "https://registry.yarnpkg.com/tiny-invariant/-/tiny-invariant-1.1.0.tgz#634c5f8efdc27714b7f386c35e6760991d230875"
@ -4822,6 +4896,11 @@ typescript@^4.4.2:
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.2.tgz#6d618640d430e3569a1dfb44f7d7e600ced3ee86" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.2.tgz#6d618640d430e3569a1dfb44f7d7e600ced3ee86"
integrity sha512-gzP+t5W4hdy4c+68bfcv0t400HVJMMd2+H9B7gae1nQlBzCqvrXX+6GL/b3GAgyTH966pzrZ70/fRjwAtZksSQ== integrity sha512-gzP+t5W4hdy4c+68bfcv0t400HVJMMd2+H9B7gae1nQlBzCqvrXX+6GL/b3GAgyTH966pzrZ70/fRjwAtZksSQ==
typescript@^4.6.2:
version "4.6.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.6.2.tgz#fe12d2727b708f4eef40f51598b3398baa9611d4"
integrity sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==
ua-parser-js@^0.7.24: ua-parser-js@^0.7.24:
version "0.7.28" version "0.7.28"
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.28.tgz#8ba04e653f35ce210239c64661685bf9121dec31" resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.28.tgz#8ba04e653f35ce210239c64661685bf9121dec31"
@ -4847,6 +4926,11 @@ unbox-primitive@^1.0.1:
has-symbols "^1.0.2" has-symbols "^1.0.2"
which-boxed-primitive "^1.0.2" which-boxed-primitive "^1.0.2"
undici@^4.14.1:
version "4.16.0"
resolved "https://registry.yarnpkg.com/undici/-/undici-4.16.0.tgz#469bb87b3b918818d3d7843d91a1d08da357d5ff"
integrity sha512-tkZSECUYi+/T1i4u+4+lwZmQgLXd4BLGlrc7KZPcLIW7Jpq99+Xpc30ONv7nS6F5UNOxp/HBZSSL9MafUrvJbw==
unicode-canonical-property-names-ecmascript@^1.0.4: unicode-canonical-property-names-ecmascript@^1.0.4:
version "1.0.4" version "1.0.4"
resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz#2619800c4c825800efdd8343af7dd9933cbe2818" resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz#2619800c4c825800efdd8343af7dd9933cbe2818"
@ -5189,6 +5273,11 @@ yaml@^1.10.0:
resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b"
integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==
yargs-parser@^21.0.0:
version "21.0.1"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.0.1.tgz#0267f286c877a4f0f728fceb6f8a3e4cb95c6e35"
integrity sha512-9BK1jFpLzJROCI5TzwZL/TU4gqjK5xiHV/RfWLOahrjAko/e4DJkRDZQXfvqAsiZzzYhgAzbgz6lg48jcm4GLg==
yocto-queue@^0.1.0: yocto-queue@^0.1.0:
version "0.1.0" version "0.1.0"
resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"