Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into jan-bansearchbar
Browse files Browse the repository at this point in the history
  • Loading branch information
sussycatgirl committed Apr 29, 2022
2 parents 854e228 + 988a703 commit 071d5f0
Show file tree
Hide file tree
Showing 119 changed files with 10,610 additions and 6,252 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ body:
id: desktop
attributes:
label: Desktop
description: Is this bug specific to [the desktop client](https://gihtub.com/revoltchat/desktop)? (If not, leave this unchecked.)
description: Is this bug specific to [the desktop client](https://github.com/revoltchat/desktop)? (If not, leave this unchecked.)
options:
- label: Yes, this bug is specific to Revolt Desktop and is *not* an issue with Revolt Desktop itself.
required: false
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ dist-ssr
*.log
/.idea

.yarn/cache
.yarn/install-state.gz

public/assets
public/assets_*
!public/assets_default
Expand Down
546 changes: 546 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-typescript.cjs

Large diffs are not rendered by default.

785 changes: 785 additions & 0 deletions .yarn/releases/yarn-3.2.0.cjs

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
spec: "@yarnpkg/plugin-typescript"

yarnPath: .yarn/releases/yarn-3.2.0.cjs
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ yarn
yarn dev
```

You can now access the client at http://local.revolt.chat:3000.

## CLI Commands

| Command | Description |
Expand Down
2 changes: 1 addition & 1 deletion external/lang
Submodule lang updated 80 files
+145 −145 ang.json
+795 −793 ar.json
+788 −792 az.json
+787 −791 be.json
+788 −792 bg.json
+733 −737 bn.json
+1 −1 bottom.json
+793 −790 br.json
+788 −792 ca.json
+183 −183 ca@valencia.json
+793 −1 ckb.json
+784 −788 cs.json
+222 −222 cy.json
+740 −744 da.json
+816 −814 de.json
+248 −203 de_CH.json
+799 −803 el.json
+125 −78 en.json
+788 −792 en_US.json
+1 −1 enchantment.json
+196 −196 enm.json
+755 −759 eo.json
+814 −812 es.json
+770 −774 et.json
+727 −731 eu.json
+788 −792 fa.json
+804 −802 fi.json
+788 −792 fil.json
+814 −812 fr.json
+707 −685 frm.json
+771 −775 ga.json
+28 −28 got.json
+787 −791 he.json
+611 −611 hi.json
+784 −788 hr.json
+815 −813 hu.json
+788 −792 id.json
+793 −797 it.json
+794 −792 ja.json
+794 −792 ko.json
+173 −173 la.json
+490 −490 lb.json
+1 −772 leet.json
+81 −81 li.json
+811 −815 lt.json
+794 −792 lv.json
+131 −131 mk.json
+94 −94 ml.json
+713 −717 ms.json
+28 −28 mt.json
+787 −791 nb_NO.json
+810 −803 nl.json
+816 −814 owo.json
+504 −508 peo.json
+801 −805 piglatin.json
+817 −815 pl.json
+433 −437 pr.json
+810 −808 pt_BR.json
+794 −792 pt_PT.json
+41 −0 restructurize.ts
+807 −811 ro.json
+713 −717 ro_MD.json
+821 −819 ru.json
+588 −592 si.json
+768 −772 sk.json
+418 −422 sl.json
+511 −513 sq.json
+770 −774 sr.json
+811 −785 sv.json
+404 −404 ta.json
+135 −135 te.json
+794 −739 th.json
+15 −15 tlh-qaak.json
+611 −611 tokipona.json
+814 −812 tr.json
+814 −812 uk.json
+78 −0 vec.json
+793 −791 vi.json
+807 −805 zh_Hans.json
+788 −792 zh_Hant.json
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
"dependencies": {
"@fontsource/bitter": "^4.5.0",
"@insertish/vite-plugin-babel-macros": "^1.0.5",
"color-rgba": "^2.3.0",
"fs-extra": "^10.0.0",
"klaw": "^3.0.0",
"react-beautiful-dnd": "^13.1.0",
Expand All @@ -81,7 +80,7 @@
"@fontsource/noto-sans": "^4.4.5",
"@fontsource/open-sans": "^4.5.2",
"@fontsource/opendyslexic": "^4.5.2",
"@fontsource/poppins": "^4.4.5",
"@fontsource/poppins": "^4.4.5",
"@fontsource/raleway": "^4.4.5",
"@fontsource/roboto": "^4.4.5",
"@fontsource/roboto-mono": "^4.4.5",
Expand All @@ -91,16 +90,16 @@
"@fontsource/ubuntu-mono": "^4.4.5",
"@hcaptcha/react-hcaptcha": "^0.3.6",
"@preact/preset-vite": "^2.0.0",
"@revoltchat/ui": "1.0.28",
"@rollup/plugin-replace": "^2.4.2",
"@styled-icons/boxicons-logos": "^10.34.0",
"@styled-icons/boxicons-regular": "^10.34.0",
"@styled-icons/boxicons-solid": "^10.37.0",
"@styled-icons/boxicons-logos": "^10.38.0",
"@styled-icons/boxicons-regular": "^10.38.0",
"@styled-icons/boxicons-solid": "^10.38.0",
"@styled-icons/simple-icons": "^10.33.0",
"@tippyjs/react": "^4.2.5",
"@traptitech/markdown-it-katex": "^3.4.3",
"@traptitech/markdown-it-spoiler": "^1.1.6",
"@trivago/prettier-plugin-sort-imports": "^2.0.2",
"@types/color-rgba": "^2.1.0",
"@types/lodash.defaultsdeep": "^4.6.6",
"@types/lodash.isequal": "^4.5.5",
"@types/markdown-it": "^12.0.2",
Expand All @@ -118,6 +117,7 @@
"@typescript-eslint/parser": "^4.27.0",
"@vitejs/plugin-legacy": "^1.7.1",
"classnames": "^2.3.1",
"color-rgba": "^2.4.0",
"dayjs": "^1.10.6",
"detect-browser": "^5.2.0",
"eslint": "^7.28.0",
Expand All @@ -127,13 +127,14 @@
"localforage": "^1.9.0",
"lodash.defaultsdeep": "^4.6.1",
"lodash.isequal": "^4.5.0",
"long": "^5.2.0",
"markdown-it": "^12.0.6",
"markdown-it-emoji": "^2.0.0",
"markdown-it-sub": "^1.0.0",
"markdown-it-sup": "^1.0.0",
"mediasoup-client": "npm:@insertish/mediasoup-client@3.6.36-esnext",
"mobx": "^6.3.2",
"mobx-react-lite": "^3.2.0",
"mobx-react-lite": "^3.3.0",
"preact": "^10.5.14",
"preact-context-menu": "0.4.0-patch.0",
"preact-i18n": "^2.4.0-preactx",
Expand All @@ -147,8 +148,7 @@
"react-scroll": "^1.8.2",
"react-virtualized-auto-sizer": "^1.0.5",
"react-virtuoso": "^1.10.4",
"revolt-api": "^0.5.3-alpha.12",
"revolt.js": "^5.2.8",
"revolt.js": "6.0.0-rc.21",
"rimraf": "^3.0.2",
"sass": "^1.35.1",
"shade-blend-color": "^1.0.0",
Expand All @@ -160,10 +160,10 @@
"vite-plugin-pwa": "^0.11.13",
"workbox-precaching": "^6.1.5"
},
"packageManager": "yarn@1.22.17",
"name": "client",
"main": "index.js",
"repository": "https://github.com/revoltchat/revite.git",
"author": "Paul <paulmakles@gmail.com>",
"license": "MIT"
}
"license": "MIT",
"packageManager": "yarn@3.2.0"
}
2 changes: 1 addition & 1 deletion src/components/common/AgeGate.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { observer } from "mobx-react-lite";
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 { Text } from "preact-i18n";
Expand Down
3 changes: 1 addition & 2 deletions src/components/common/AutoComplete.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Channel } from "revolt.js/dist/maps/Channels";
import { User } from "revolt.js/dist/maps/Users";
import { Channel, User } from "revolt.js";
import styled, { css } from "styled-components/macro";

import { StateUpdater, useState } from "preact/hooks";
Expand Down
7 changes: 4 additions & 3 deletions src/components/common/ChannelIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { Hash, VolumeFull } from "@styled-icons/boxicons-regular";
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 { AppContext } from "../../context/revoltjs/RevoltClient";

import { ImageIconBase, IconBaseProps } from "./IconBase";
import fallback from "./assets/group.png";

import { ImageIconBase, IconBaseProps } from "./IconBase";

interface Props extends IconBaseProps<Channel> {
isServerChannel?: boolean;
}
Expand All @@ -32,7 +33,7 @@ export default observer(
...imgProps
} = props;
const iconURL = client.generateFileURL(
target?.icon ?? attachment,
target?.icon ?? attachment ?? undefined,
{ max_side: 256 },
animate,
);
Expand Down
5 changes: 3 additions & 2 deletions src/components/common/IconBase.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { Attachment } from "revolt-api/types/Autumn";
import { API } from "revolt.js";
import { Nullable } from "revolt.js";
import styled, { css } from "styled-components/macro";

import { Ref } from "preact";

export interface IconBaseProps<T> {
target?: T;
url?: string;
attachment?: Attachment;
attachment?: Nullable<API.File>;

size: number;
hover?: boolean;
Expand Down
7 changes: 2 additions & 5 deletions src/components/common/ServerHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@ import { Check } from "@styled-icons/boxicons-regular";
import { Cog } from "@styled-icons/boxicons-solid";
import { observer } from "mobx-react-lite";
import { Link } from "react-router-dom";
import { ServerPermission } from "revolt.js/dist/api/permissions";
import { Server } from "revolt.js/dist/maps/Servers";
import { Server } from "revolt.js";
import styled, { css } from "styled-components/macro";

import { Text } from "preact-i18n";

import { isTouchscreenDevice } from "../../lib/isTouchscreenDevice";

import IconButton from "../ui/IconButton";

import Tooltip from "./Tooltip";
Expand Down Expand Up @@ -125,7 +122,7 @@ export default observer(({ server }: Props) => {
</Tooltip>
) : undefined}
<div className="title">{server.name}</div>
{(server.permission & ServerPermission.ManageServer) > 0 && (
{server.havePermission("ManageServer") && (
<Link to={`/server/${server._id}/settings`}>
<IconButton>
<Cog size={20} />
Expand Down
4 changes: 2 additions & 2 deletions src/components/common/ServerIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
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 { useContext } from "preact/hooks";
Expand Down Expand Up @@ -39,7 +39,7 @@ export default observer(
const { target, attachment, size, animate, server_name, ...imgProps } =
props;
const iconURL = client.generateFileURL(
target?.icon ?? attachment,
target?.icon ?? attachment ?? undefined,
{ max_side: 256 },
animate,
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/messaging/Message.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { observer } from "mobx-react-lite";
import { Message as MessageObject } from "revolt.js/dist/maps/Messages";
import { Message as MessageObject } from "revolt.js";

import { useTriggerEvents } from "preact-context-menu";
import { memo } from "preact/compat";
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/messaging/MessageBase.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
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 { decodeTime } from "ulid";

Expand Down
29 changes: 22 additions & 7 deletions src/components/common/messaging/MessageBox.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
import { Send, ShieldX, HappyBeaming, Box } from "@styled-icons/boxicons-solid";
import { Send, ShieldX } from "@styled-icons/boxicons-solid";
import Axios, { CancelTokenSource } from "axios";
import Long from "long";
import { observer } from "mobx-react-lite";
import { ChannelPermission } from "revolt.js/dist/api/permissions";
import { Channel } from "revolt.js/dist/maps/Channels";
import {
Channel,
DEFAULT_PERMISSION_DIRECT_MESSAGE,
DEFAULT_PERMISSION_VIEW_ONLY,
Permission,
Server,
U32_MAX,
UserPermission,
} from "revolt.js";
import styled, { css } from "styled-components/macro";
import { ulid } from "ulid";

Expand Down Expand Up @@ -125,6 +133,11 @@ const FileAction = styled.div`
display: flex;
align-items: center;
justify-content: center;
}
`;

const ThisCodeWillBeReplacedAnywaysSoIMightAsWellJustDoItThisWay__Padding = styled.div`
width: 16px;
`;

// For sed replacement
Expand All @@ -150,7 +163,7 @@ export default observer(({ channel }: Props) => {

const renderer = getRenderer(channel);

if (!(channel.permission & ChannelPermission.SendMessage)) {
if (!channel.havePermission("SendMessage")) {
return (
<Base>
<Blocked>
Expand Down Expand Up @@ -231,7 +244,7 @@ export default observer(({ channel }: Props) => {
);
renderer.messages.reverse();

if (msg) {
if (msg?.content) {
// eslint-disable-next-line prefer-const
let [_, toReplace, newText, flags] = content.split(/\//);

Expand Down Expand Up @@ -493,7 +506,7 @@ export default observer(({ channel }: Props) => {
setReplies={setReplies}
/>
<Base>
{channel.permission & ChannelPermission.UploadFiles ? (
{channel.havePermission("UploadFiles") ? (
<FileAction>
<FileUploader
size={24}
Expand Down Expand Up @@ -530,7 +543,9 @@ export default observer(({ channel }: Props) => {
}}
/>
</FileAction>
) : undefined}
) : (
<ThisCodeWillBeReplacedAnywaysSoIMightAsWellJustDoItThisWay__Padding />
)}
<TextAreaAutoSize
autoFocus
hideBorder
Expand Down
11 changes: 4 additions & 7 deletions src/components/common/messaging/SystemMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import {
MessageSquareEdit,
} from "@styled-icons/boxicons-solid";
import { observer } from "mobx-react-lite";
import { SystemMessage as SystemMessageI } from "revolt-api/types/Channels";
import { Message } from "revolt.js/dist/maps/Messages";
import { Message, API } from "revolt.js";
import styled from "styled-components/macro";

import { useTriggerEvents } from "preact-context-menu";
Expand Down Expand Up @@ -75,13 +74,11 @@ export const SystemMessage = observer(
({ attachContext, message, highlight, hideInfo }: Props) => {
const data = message.asSystemMessage;
const SystemMessageIcon =
iconDictionary[data.type as SystemMessageI["type"]] ?? InfoCircle;
iconDictionary[data.type as API.SystemMessage["type"]] ??
InfoCircle;

let children;
let children = null;
switch (data.type) {
case "text":
children = <span>{data.content}</span>;
break;
case "user_added":
case "user_remove":
children = (
Expand Down
4 changes: 2 additions & 2 deletions src/components/common/messaging/attachments/Attachment.tsx
Original file line number Diff line number Diff line change
@@ -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 classNames from "classnames";
Expand All @@ -14,7 +14,7 @@ import Spoiler from "./Spoiler";
import TextFile from "./TextFile";

interface Props {
attachment: AttachmentI;
attachment: API.File;
hasContent?: boolean;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
Download,
} from "@styled-icons/boxicons-regular";
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 classNames from "classnames";
Expand All @@ -17,7 +17,7 @@ import { AppContext } from "../../../../context/revoltjs/RevoltClient";
import IconButton from "../../../ui/IconButton";

interface Props {
attachment: Attachment;
attachment: API.File;
}

export default function AttachmentActions({ attachment }: Props) {
Expand Down

0 comments on commit 071d5f0

Please sign in to comment.