From 3d0e95d25df6f327fb089815510091c1feff49d1 Mon Sep 17 00:00:00 2001
From: Ryan Alexander
Date: Sun, 29 Aug 2021 09:56:20 +1000
Subject: [PATCH 01/16] Add external link warning
---
src/components/markdown/Renderer.tsx | 10 ++++++
src/context/intermediate/Intermediate.tsx | 1 +
src/context/intermediate/Modals.tsx | 3 ++
.../modals/ExternalLinkPrompt.tsx | 32 +++++++++++++++++++
4 files changed, 46 insertions(+)
create mode 100644 src/context/intermediate/modals/ExternalLinkPrompt.tsx
diff --git a/src/components/markdown/Renderer.tsx b/src/components/markdown/Renderer.tsx
index d96ef898..9fe876b4 100644
--- a/src/components/markdown/Renderer.tsx
+++ b/src/components/markdown/Renderer.tsx
@@ -24,6 +24,7 @@ import { generateEmoji } from "../common/Emoji";
import { emojiDictionary } from "../../assets/emojis";
import { MarkdownProps } from "./Markdown";
+import {useIntermediate} from "../../context/intermediate/Intermediate";
// TODO: global.d.ts file for defining globals
declare global {
@@ -97,6 +98,8 @@ const RE_CHANNELS = /<#([A-z0-9]{26})>/g;
export default function Renderer({ content, disallowBigEmoji }: MarkdownProps) {
const client = useContext(AppContext);
+ const { openScreen } = useIntermediate();
+
if (typeof content === "undefined") return null;
if (content.length === 0) return null;
@@ -198,6 +201,13 @@ export default function Renderer({ content, disallowBigEmoji }: MarkdownProps) {
if (!internal) {
element.setAttribute("target", "_blank");
+ element.onclick = (ev) => {
+ ev.preventDefault();
+ openScreen({
+ id: "external_link_prompt",
+ link: href
+ })
+ }
}
},
);
diff --git a/src/context/intermediate/Intermediate.tsx b/src/context/intermediate/Intermediate.tsx
index a3d30489..59a3cc1c 100644
--- a/src/context/intermediate/Intermediate.tsx
+++ b/src/context/intermediate/Intermediate.tsx
@@ -24,6 +24,7 @@ export type Screen =
| { id: "signed_out" }
| { id: "error"; error: string }
| { id: "clipboard"; text: string }
+ | { id: "external_link_prompt"; link: string }
| {
id: "_prompt";
question: Children;
diff --git a/src/context/intermediate/Modals.tsx b/src/context/intermediate/Modals.tsx
index fdd3dc6e..8815a16d 100644
--- a/src/context/intermediate/Modals.tsx
+++ b/src/context/intermediate/Modals.tsx
@@ -9,6 +9,7 @@ import { InputModal } from "./modals/Input";
import { OnboardingModal } from "./modals/Onboarding";
import { PromptModal } from "./modals/Prompt";
import { SignedOutModal } from "./modals/SignedOut";
+import {ExternalLinkModal} from "./modals/ExternalLinkPrompt";
export interface Props {
screen: Screen;
@@ -34,6 +35,8 @@ export default function Modals({ screen, openScreen }: Props) {
return ;
case "onboarding":
return ;
+ case "external_link_prompt":
+ return ;
}
return null;
diff --git a/src/context/intermediate/modals/ExternalLinkPrompt.tsx b/src/context/intermediate/modals/ExternalLinkPrompt.tsx
new file mode 100644
index 00000000..da73327c
--- /dev/null
+++ b/src/context/intermediate/modals/ExternalLinkPrompt.tsx
@@ -0,0 +1,32 @@
+import { Text } from "preact-i18n";
+
+import Modal from "../../../components/ui/Modal";
+
+interface Props {
+ onClose: () => void;
+ link: string;
+}
+
+export function ExternalLinkModal({ onClose, link }: Props) {
+ return (
+ }
+ actions={[
+ {
+ onClick: ()=>{window.open(link, "_blank");},
+ confirmation: true,
+ children: "Continue",
+ },
+ {
+ onClick: onClose,
+ confirmation: false,
+ children: "Cancel",
+ },
+ ]}>
+
+ {link}
+
+ );
+}
From fe04951bcffa6e6f83bb0c9a0ef2a7bcf9e99c78 Mon Sep 17 00:00:00 2001
From: Ryan Alexander
Date: Sun, 29 Aug 2021 10:00:23 +1000
Subject: [PATCH 02/16] Make continue button use accent colour
---
src/context/intermediate/modals/ExternalLinkPrompt.tsx | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/context/intermediate/modals/ExternalLinkPrompt.tsx b/src/context/intermediate/modals/ExternalLinkPrompt.tsx
index da73327c..04fecfcf 100644
--- a/src/context/intermediate/modals/ExternalLinkPrompt.tsx
+++ b/src/context/intermediate/modals/ExternalLinkPrompt.tsx
@@ -17,6 +17,8 @@ export function ExternalLinkModal({ onClose, link }: Props) {
{
onClick: ()=>{window.open(link, "_blank");},
confirmation: true,
+ contrast: true,
+ accent: true,
children: "Continue",
},
{
From f3786e473b66e582ff00989d83736a29ae40dc75 Mon Sep 17 00:00:00 2001
From: Ryan Alexander
Date: Sun, 29 Aug 2021 10:29:58 +1000
Subject: [PATCH 03/16] Treat direct messages as mention, group behaviour is
the same
---
.../navigation/left/ServerListSidebar.tsx | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/components/navigation/left/ServerListSidebar.tsx b/src/components/navigation/left/ServerListSidebar.tsx
index 61784aae..a4fef41d 100644
--- a/src/components/navigation/left/ServerListSidebar.tsx
+++ b/src/components/navigation/left/ServerListSidebar.tsx
@@ -240,15 +240,16 @@ export const ServerListSidebar = observer(({ unreads, lastOpened }: Props) => {
let homeUnread: "mention" | "unread" | undefined;
let alertCount = 0;
for (const x of channels) {
- if (
- (x.channel?.channel_type === "DirectMessage"
- ? x.channel?.active
- : x.channel?.channel_type === "Group") &&
- x.unread
- ) {
+ if (x.channel?.channel_type === "Group" && x.unread) {
homeUnread = "unread";
alertCount += x.alertCount ?? 0;
}
+ if (
+ x.channel?.channel_type === "DirectMessage" &&
+ x.unread &&
+ x.unread.length > 0
+ )
+ alertCount++;
}
alertCount += [...client.users.values()].filter(
From 8a3f0a6629a8f93d72054dbe985f1f29b1eff846 Mon Sep 17 00:00:00 2001
From: Snazzah <7025343+Snazzah@users.noreply.github.com>
Date: Mon, 30 Aug 2021 05:03:22 +0000
Subject: [PATCH 04/16] Bump message editor rows to 10
---
src/pages/channels/messaging/MessageEditor.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pages/channels/messaging/MessageEditor.tsx b/src/pages/channels/messaging/MessageEditor.tsx
index 7b4af96e..1a036d87 100644
--- a/src/pages/channels/messaging/MessageEditor.tsx
+++ b/src/pages/channels/messaging/MessageEditor.tsx
@@ -96,7 +96,7 @@ export default function MessageEditor({ message, finish }: Props) {
Date: Mon, 30 Aug 2021 05:38:59 +0000
Subject: [PATCH 05/16] Update Mail Providers
---
src/pages/login/forms/MailProvider.tsx | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/pages/login/forms/MailProvider.tsx b/src/pages/login/forms/MailProvider.tsx
index f4deca50..eb255665 100644
--- a/src/pages/login/forms/MailProvider.tsx
+++ b/src/pages/login/forms/MailProvider.tsx
@@ -16,10 +16,12 @@ function mapMailProvider(email?: string): [string, string] | undefined {
const domain = match[1];
switch (domain) {
case "gmail.com":
+ case "googlemail.com":
return ["Gmail", "https://gmail.com"];
case "tuta.io":
return ["Tutanota", "https://mail.tutanota.com"];
case "outlook.com":
+ case "hotmail.com":
return ["Outlook", "https://outlook.live.com"];
case "yahoo.com":
return ["Yahoo", "https://mail.yahoo.com"];
@@ -27,11 +29,24 @@ function mapMailProvider(email?: string): [string, string] | undefined {
return ["WP Poczta", "https://poczta.wp.pl"];
case "protonmail.com":
case "protonmail.ch":
+ case "pm.me":
return ["ProtonMail", "https://mail.protonmail.com"];
case "seznam.cz":
case "email.cz":
case "post.cz":
return ["Seznam", "https://email.seznam.cz"];
+ case "zoho.com":
+ return ["Zoho Mail", "https://mail.zoho.com/zm/"];
+ case "aol.com":
+ case "aim.com":
+ return ["AOL Mail", "https://mail.aol.com/"];
+ case "icloud.com":
+ return ["iCloud Mail", "https://mail.aol.com/"];
+ case "mail.com":
+ case "email.com":
+ return ["mail.com", "https://www.mail.com/mail/"];
+ case "yandex.com":
+ return ["Yandex Mail", "https://mail.yandex.com/"];
default:
return [domain, `https://${domain}`];
}
From 3443565265dd7675460e334d5579cbfc1008f7c1 Mon Sep 17 00:00:00 2001
From: Paul
Date: Mon, 30 Aug 2021 12:35:12 +0100
Subject: [PATCH 06/16] Fix observer on Profile pane.
---
src/pages/settings/panes/Profile.tsx | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/pages/settings/panes/Profile.tsx b/src/pages/settings/panes/Profile.tsx
index 9447e07a..d936e94a 100644
--- a/src/pages/settings/panes/Profile.tsx
+++ b/src/pages/settings/panes/Profile.tsx
@@ -1,3 +1,4 @@
+import { observer } from "mobx-react-lite";
import { Profile as ProfileI } from "revolt-api/types/Users";
import styles from "./Panes.module.scss";
@@ -20,7 +21,7 @@ import AutoComplete, {
} from "../../../components/common/AutoComplete";
import Button from "../../../components/ui/Button";
-export function Profile() {
+export const Profile = observer(() => {
const status = useContext(StatusContext);
const translate = useTranslation();
const client = useClient();
@@ -169,4 +170,4 @@ export function Profile() {
);
-}
+});
From 44fdee1214bb095fad16b1b5a64c86bb34f89de0 Mon Sep 17 00:00:00 2001
From: Paul
Date: Mon, 30 Aug 2021 13:13:15 +0100
Subject: [PATCH 07/16] Add new languages: et, fil, ga, ja, ko, lb, ms, nb_NO,
sk, sl, ta, vi.
---
external/lang | 2 +-
src/context/Locale.tsx | 26 +++++++++++++++++++++++++-
2 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/external/lang b/external/lang
index 324a942e..eb371618 160000
--- a/external/lang
+++ b/external/lang
@@ -1 +1 @@
-Subproject commit 324a942e2b1da38f82efe0bd5f6b1c8ff7d7a65c
+Subproject commit eb3716182702af2747025e0ee171d6a1a4415fc7
diff --git a/src/context/Locale.tsx b/src/context/Locale.tsx
index 0c3f2bcf..6ca75806 100644
--- a/src/context/Locale.tsx
+++ b/src/context/Locale.tsx
@@ -27,25 +27,37 @@ export enum Language {
GERMAN = "de",
GREEK = "el",
SPANISH = "es",
+ ESTONIAN = "et",
FINNISH = "fi",
+ FILIPINO = "fil",
FRENCH = "fr",
+ IRISH = "ga",
HINDI = "hi",
CROATIAN = "hr",
HUNGARIAN = "hu",
INDONESIAN = "id",
ITALIAN = "it",
+ JAPANESE = "ja",
+ KOREAN = "ko",
+ LUXEMBOURGISH = "lb",
LITHUANIAN = "lt",
MACEDONIAN = "mk",
+ MALAY = "ms",
+ NORWEGIAN_BOKMAL = "nb_NO",
DUTCH = "nl",
POLISH = "pl",
PORTUGUESE_BRAZIL = "pt_BR",
ROMANIAN = "ro",
RUSSIAN = "ru",
+ SLOVAK = "sk",
+ SLOVENIAN = "sl",
SERBIAN = "sr",
SWEDISH = "sv",
+ TAMIL = "ta",
THAI = "th",
TURKISH = "tr",
UKRANIAN = "uk",
+ VIETNAMESE = "vi",
CHINESE_SIMPLIFIED = "zh_Hans",
TOKIPONA = "tokipona",
@@ -81,15 +93,23 @@ export const Languages: { [key in Language]: LanguageEntry } = {
de: { display: "Deutsch", emoji: "🇩🇪", i18n: "de" },
el: { display: "Ελληνικά", emoji: "🇬🇷", i18n: "el" },
es: { display: "Español", emoji: "🇪🇸", i18n: "es" },
- fi: { display: "suomi", emoji: "🇫🇮", i18n: "fi" },
+ et: { display: "Eestlane", emoji: "🇪🇪", i18n: "et" },
+ fi: { display: "Suomi", emoji: "🇫🇮", i18n: "fi" },
+ fil: { display: "Pilipino", emoji: "🇵🇭", i18n: "fil", dayjs: "tl-ph" },
fr: { display: "Français", emoji: "🇫🇷", i18n: "fr" },
+ ga: { display: "Gaeilge", emoji: "🇮🇪", i18n: "ga" },
hi: { display: "हिन्दी", emoji: "🇮🇳", i18n: "hi" },
hr: { display: "Hrvatski", emoji: "🇭🇷", i18n: "hr" },
hu: { display: "Magyar", emoji: "🇭🇺", i18n: "hu" },
id: { display: "bahasa Indonesia", emoji: "🇮🇩", i18n: "id" },
it: { display: "Italiano", emoji: "🇮🇹", i18n: "it" },
+ ja: { display: "日本", emoji: "🇯🇵", i18n: "ja" },
+ ko: { display: "한국인", emoji: "🇰🇷", i18n: "ko" },
+ lb: { display: "Lëtzebuergesch", emoji: "🇱🇺", i18n: "lb" },
lt: { display: "Lietuvių", emoji: "🇱🇹", i18n: "lt" },
mk: { display: "Македонски", emoji: "🇲🇰", i18n: "mk" },
+ ms: { display: "Melayu", emoji: "🇲🇾", i18n: "ms" },
+ nb_NO: { display: "Norsk bokmål", emoji: "🇳🇴", i18n: "nb_NO", dayjs: "nb" },
nl: { display: "Nederlands", emoji: "🇳🇱", i18n: "nl" },
pl: { display: "Polski", emoji: "🇵🇱", i18n: "pl" },
pt_BR: {
@@ -100,11 +120,15 @@ export const Languages: { [key in Language]: LanguageEntry } = {
},
ro: { display: "Română", emoji: "🇷🇴", i18n: "ro" },
ru: { display: "Русский", emoji: "🇷🇺", i18n: "ru" },
+ sk: { display: "Slovensky", emoji: "🇸🇰", i18n: "sk" },
+ sl: { display: "Slovenščina", emoji: "🇸🇮", i18n: "sl" },
sr: { display: "Српски", emoji: "🇷🇸", i18n: "sr" },
sv: { display: "Svenska", emoji: "🇸🇪", i18n: "sv" },
+ ta: { display: "தமிழ்", emoji: "🇱🇰", i18n: "ta" },
th: { display: "ไทย", emoji: "🇹🇭", i18n: "th" },
tr: { display: "Türkçe", emoji: "🇹🇷", i18n: "tr" },
uk: { display: "Українська", emoji: "🇺🇦", i18n: "uk" },
+ vi: { display: "Tiếng Việt", emoji: "🇻🇳", i18n: "vi" },
zh_Hans: {
display: "中文 (简体)",
emoji: "🇨🇳",
From 0ca99ddceb656966fa735c6f2df55c77ee167510 Mon Sep 17 00:00:00 2001
From: Paul
Date: Mon, 30 Aug 2021 13:26:19 +0100
Subject: [PATCH 08/16] Fix ghost notifications on closed DMs. Fix link warning
not closing on open.
---
src/components/navigation/left/ServerListSidebar.tsx | 5 +++--
src/context/intermediate/modals/ExternalLinkPrompt.tsx | 5 ++++-
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/components/navigation/left/ServerListSidebar.tsx b/src/components/navigation/left/ServerListSidebar.tsx
index a4fef41d..dee73e72 100644
--- a/src/components/navigation/left/ServerListSidebar.tsx
+++ b/src/components/navigation/left/ServerListSidebar.tsx
@@ -244,10 +244,11 @@ export const ServerListSidebar = observer(({ unreads, lastOpened }: Props) => {
homeUnread = "unread";
alertCount += x.alertCount ?? 0;
}
+
if (
x.channel?.channel_type === "DirectMessage" &&
- x.unread &&
- x.unread.length > 0
+ x.channel.active &&
+ x.unread
)
alertCount++;
}
diff --git a/src/context/intermediate/modals/ExternalLinkPrompt.tsx b/src/context/intermediate/modals/ExternalLinkPrompt.tsx
index 04fecfcf..b0f5e6df 100644
--- a/src/context/intermediate/modals/ExternalLinkPrompt.tsx
+++ b/src/context/intermediate/modals/ExternalLinkPrompt.tsx
@@ -15,7 +15,10 @@ export function ExternalLinkModal({ onClose, link }: Props) {
title={}
actions={[
{
- onClick: ()=>{window.open(link, "_blank");},
+ onClick: () => {
+ window.open(link, "_blank");
+ onClose();
+ },
confirmation: true,
contrast: true,
accent: true,
From 2a2f711eb52ab908200006069443a347d0a876da Mon Sep 17 00:00:00 2001
From: Paul
Date: Mon, 30 Aug 2021 15:01:15 +0100
Subject: [PATCH 09/16] Fix Korean language name.
---
src/components/navigation/left/ServerListSidebar.tsx | 3 ++-
src/context/Locale.tsx | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/components/navigation/left/ServerListSidebar.tsx b/src/components/navigation/left/ServerListSidebar.tsx
index dee73e72..5a212d9c 100644
--- a/src/components/navigation/left/ServerListSidebar.tsx
+++ b/src/components/navigation/left/ServerListSidebar.tsx
@@ -249,8 +249,9 @@ export const ServerListSidebar = observer(({ unreads, lastOpened }: Props) => {
x.channel?.channel_type === "DirectMessage" &&
x.channel.active &&
x.unread
- )
+ ) {
alertCount++;
+ }
}
alertCount += [...client.users.values()].filter(
diff --git a/src/context/Locale.tsx b/src/context/Locale.tsx
index 6ca75806..199d49e5 100644
--- a/src/context/Locale.tsx
+++ b/src/context/Locale.tsx
@@ -104,7 +104,7 @@ export const Languages: { [key in Language]: LanguageEntry } = {
id: { display: "bahasa Indonesia", emoji: "🇮🇩", i18n: "id" },
it: { display: "Italiano", emoji: "🇮🇹", i18n: "it" },
ja: { display: "日本", emoji: "🇯🇵", i18n: "ja" },
- ko: { display: "한국인", emoji: "🇰🇷", i18n: "ko" },
+ ko: { display: "한국어", emoji: "🇰🇷", i18n: "ko" },
lb: { display: "Lëtzebuergesch", emoji: "🇱🇺", i18n: "lb" },
lt: { display: "Lietuvių", emoji: "🇱🇹", i18n: "lt" },
mk: { display: "Македонски", emoji: "🇲🇰", i18n: "mk" },
From 5631ad8072be316c9138a6ac5102579e3c32b047 Mon Sep 17 00:00:00 2001
From: Paul
Date: Mon, 30 Aug 2021 15:24:15 +0100
Subject: [PATCH 10/16] Add API URL injection back and Docker builds.
---
.gitignore | 1 +
Dockerfile | 20 +++++++
README.md | 18 ++++---
package.json | 6 ++-
scripts/inject.js | 49 ++++++++++++++++++
publish.sh => scripts/publish.sh | 0
yarn.lock | 89 +++++++++++++++++++++++++++++++-
7 files changed, 173 insertions(+), 10 deletions(-)
create mode 100644 Dockerfile
create mode 100644 scripts/inject.js
rename publish.sh => scripts/publish.sh (100%)
mode change 100644 => 100755
diff --git a/.gitignore b/.gitignore
index f1d58e68..913d67a4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
node_modules
.DS_Store
dist
+dist_injected
dist-ssr
*.local
*.log
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 00000000..dcc3fec4
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,20 @@
+FROM node:15-buster AS builder
+
+WORKDIR /usr/src/app
+COPY package*.json ./
+
+RUN yarn --no-cache
+
+COPY . .
+COPY .env.build .env
+RUN yarn typecheck
+RUN yarn build
+RUN npm prune --production
+
+FROM node:15-buster
+WORKDIR /usr/src/app
+COPY --from=builder /usr/src/app .
+RUN rm ./.env
+
+EXPOSE 5000
+CMD [ "yarn", "start:inject" ]
\ No newline at end of file
diff --git a/README.md b/README.md
index 64f4a46b..756236f4 100644
--- a/README.md
+++ b/README.md
@@ -29,14 +29,16 @@ It is also recommended to run `git submodule update` after you pull from upstrea
## CLI Commands
-| Command | Description |
-| ---------------- | -------------------------------------------- |
-| `yarn dev` | Start the Revolt client in development mode. |
-| `yarn build` | Build the Revolt client. |
-| `yarn preview` | Start a local server with the built client. |
-| `yarn lint` | Run ESLint on the client. |
-| `yarn fmt` | Run Prettier on the client. |
-| `yarn typecheck` | Run TypeScript type checking on the client. |
+| Command | Description |
+| ------------------- | -------------------------------------------- |
+| `yarn dev` | Start the Revolt client in development mode. |
+| `yarn build` | Build the Revolt client. |
+| `yarn preview` | Start a local server with the built client. |
+| `yarn lint` | Run ESLint on the client. |
+| `yarn fmt` | Run Prettier on the client. |
+| `yarn typecheck` | Run TypeScript type checking on the client. |
+| `yarn start` | Start a local sirv server with built client. |
+| `yarn start:inject` | Inject a given API URL and start server. |
## License
diff --git a/package.json b/package.json
index f7a1b84f..5912596d 100644
--- a/package.json
+++ b/package.json
@@ -6,7 +6,9 @@
"preview": "vite preview",
"lint": "eslint 'src/**/*.{js,jsx,ts,tsx}'",
"fmt": "prettier --write 'src/**/*.{js,jsx,ts,tsx}'",
- "typecheck": "tsc --noEmit"
+ "typecheck": "tsc --noEmit",
+ "start": "sirv dist --cors --single --host",
+ "start:inject": "node scripts/inject.js && sirv dist_injected --cors --single --host"
},
"eslintConfig": {
"parser": "@typescript-eslint/parser",
@@ -90,6 +92,7 @@
"eslint-config-preact": "^1.1.4",
"eventemitter3": "^4.0.7",
"highlight.js": "^11.0.1",
+ "klaw": "^3.0.0",
"localforage": "^1.9.0",
"lodash.defaultsdeep": "^4.6.1",
"lodash.isequal": "^4.5.0",
@@ -120,6 +123,7 @@
"rimraf": "^3.0.2",
"sass": "^1.35.1",
"shade-blend-color": "^1.0.0",
+ "sirv-cli": "^1.0.14",
"styled-components": "^5.3.0",
"typescript": "^4.3.2",
"ulid": "^2.3.0",
diff --git a/scripts/inject.js b/scripts/inject.js
new file mode 100644
index 00000000..5a4b45a5
--- /dev/null
+++ b/scripts/inject.js
@@ -0,0 +1,49 @@
+/* eslint-disable */
+const { copy, remove, access, readFile, writeFile } = require("fs-extra");
+const klaw = require("klaw");
+
+let target = /__API_URL__/g;
+let replacement = process.env.REVOLT_PUBLIC_URL;
+let BUILD_DIRECTORY = "dist";
+let OUT_DIRECTORY = "dist_injected";
+
+if (typeof replacement === "undefined") {
+ console.error("No REVOLT_PUBLIC_URL specified in environment variables.");
+ process.exit(1);
+}
+
+(async () => {
+ console.log("Ensuring project has been built at least once.");
+ try {
+ await access(BUILD_DIRECTORY);
+ } catch (err) {
+ console.error("Build project at least once!");
+ return process.exit(1);
+ }
+
+ console.log("Determining if injected build already exists...");
+ try {
+ await access(OUT_DIRECTORY);
+
+ console.log("Deleting existing build...");
+ await remove(OUT_DIRECTORY);
+ } catch (err) {}
+
+ await copy(BUILD_DIRECTORY, OUT_DIRECTORY);
+
+ console.log("Processing bundles...");
+ for await (const file of klaw(OUT_DIRECTORY)) {
+ let path = file.path;
+ if (path.endsWith(".js")) {
+ let data = await readFile(path);
+ if (target.test(data)) {
+ console.log("Matched file", path);
+
+ let processed = data.toString().replace(target, replacement);
+ await writeFile(path, processed);
+ }
+ }
+ }
+
+ console.log("Complete.");
+})();
diff --git a/publish.sh b/scripts/publish.sh
old mode 100644
new mode 100755
similarity index 100%
rename from publish.sh
rename to scripts/publish.sh
diff --git a/yarn.lock b/yarn.lock
index 27dd3cfc..64d96793 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1111,6 +1111,11 @@
"@nodelib/fs.scandir" "2.1.5"
fastq "^1.6.0"
+"@polka/url@^1.0.0-next.20":
+ version "1.0.0-next.20"
+ resolved "https://registry.yarnpkg.com/@polka/url/-/url-1.0.0-next.20.tgz#111b5db0f501aa89b05076fa31f0ea0e0c292cd3"
+ integrity sha512-88p7+M0QGxKpmnkfXjS4V26AnoC/eiqZutE8GLdaI5X12NY75bXSdTY9NkmYb2Xyk1O+MmkuO6Frmsj84V6I8Q==
+
"@popperjs/core@^2.8.3":
version "2.9.3"
resolved "https://registry.yarnpkg.com/@popperjs/core/-/core-2.9.3.tgz#8b68da1ebd7fc603999cf6ebee34a4899a14b88e"
@@ -1932,6 +1937,11 @@ concat-map@0.0.1:
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=
+console-clear@^1.1.0:
+ version "1.1.1"
+ resolved "https://registry.yarnpkg.com/console-clear/-/console-clear-1.1.1.tgz#995e20cbfbf14dd792b672cde387bd128d674bf7"
+ integrity sha512-pMD+MVR538ipqkG5JXeOEbKWS5um1H4LUUccUQG68qpeqBYbzYy79Gh55jkd2TtPdRfUaLWdv6LPP//5Zt0aPQ==
+
convert-source-map@^1.7.0:
version "1.8.0"
resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.8.0.tgz#f3373c32d21b4d780dd8004514684fb791ca4369"
@@ -2492,6 +2502,11 @@ get-own-enumerable-property-symbols@^3.0.0:
resolved "https://registry.yarnpkg.com/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.2.tgz#b5fde77f22cbe35f390b4e089922c50bce6ef664"
integrity sha512-I0UBV/XOz1XkIJHEUDMZAbzCThU/H8DxmSfmdGcKPnVhu2VfFqr34jr9777IyaTYvxjedWhqVIilEDsCdP5G6g==
+get-port@^3.2.0:
+ version "3.2.0"
+ resolved "https://registry.yarnpkg.com/get-port/-/get-port-3.2.0.tgz#dd7ce7de187c06c8bf353796ac71e099f0980ebc"
+ integrity sha1-3Xzn3hh8Bsi/NTeWrHHgmfCYDrw=
+
glob-parent@^5.1.2, glob-parent@~5.1.2:
version "5.1.2"
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4"
@@ -2535,7 +2550,7 @@ globby@^11.0.3:
merge2 "^1.3.0"
slash "^3.0.0"
-graceful-fs@^4.1.6, graceful-fs@^4.2.0:
+graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0:
version "4.2.8"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.8.tgz#e412b8d33f5e006593cbd3cee6df9f2cebbe802a"
integrity sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==
@@ -2890,6 +2905,18 @@ katex@^0.13.9:
dependencies:
commander "^6.0.0"
+klaw@^3.0.0:
+ version "3.0.0"
+ resolved "https://registry.yarnpkg.com/klaw/-/klaw-3.0.0.tgz#b11bec9cf2492f06756d6e809ab73a2910259146"
+ integrity sha512-0Fo5oir+O9jnXu5EefYbVK+mHMBeEVEy2cmctR1O1NECcCkPRreJKrS6Qt/j3KC2C148Dfo9i3pCmCMsdqGr0g==
+ dependencies:
+ graceful-fs "^4.1.9"
+
+kleur@^3.0.0:
+ version "3.0.3"
+ resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e"
+ integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==
+
kolorist@^1.2.10:
version "1.5.0"
resolved "https://registry.yarnpkg.com/kolorist/-/kolorist-1.5.0.tgz#a06f7dd11d1b5fdb743d79c8acd4e1ecbcbd89b3"
@@ -2922,6 +2949,11 @@ linkify-it@^3.0.1:
dependencies:
uc.micro "^1.0.1"
+local-access@^1.0.1:
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/local-access/-/local-access-1.1.0.tgz#e007c76ba2ca83d5877ba1a125fc8dfe23ba4798"
+ integrity sha512-XfegD5pyTAfb+GY6chk283Ox5z8WexG56OvM06RWLpAc/UHozO8X6xAxEkIitZOtsSMM1Yr3DkHgW5W+onLhCw==
+
localforage@^1.9.0:
version "1.9.0"
resolved "https://registry.yarnpkg.com/localforage/-/localforage-1.9.0.tgz#f3e4d32a8300b362b4634cc4e066d9d00d2f09d1"
@@ -3077,6 +3109,11 @@ micromatch@^4.0.4:
braces "^3.0.1"
picomatch "^2.2.3"
+mime@^2.3.1:
+ version "2.5.2"
+ resolved "https://registry.yarnpkg.com/mime/-/mime-2.5.2.tgz#6e3dc6cc2b9510643830e5f19d5cb753da5eeabe"
+ integrity sha512-tqkh47FzKeCPD2PUiPB6pkbMzsCasjxAfC62/Wap5qrUWcb+sFasXUC5I3gYM5iBM8v/Qpn4UK0x+j0iHyFPDg==
+
mini-create-react-context@^0.4.0:
version "0.4.1"
resolved "https://registry.yarnpkg.com/mini-create-react-context/-/mini-create-react-context-0.4.1.tgz#072171561bfdc922da08a60c2197a497cc2d1d5e"
@@ -3107,6 +3144,11 @@ mobx@^6.3.2:
resolved "https://registry.yarnpkg.com/mobx/-/mobx-6.3.2.tgz#125590961f702a572c139ab69392bea416d2e51b"
integrity sha512-xGPM9dIE1qkK9Nrhevp0gzpsmELKU4MFUJRORW/jqxVFIHHWIoQrjDjL8vkwoJYY3C2CeVJqgvl38hgKTalTWg==
+mri@^1.1.0:
+ version "1.1.6"
+ resolved "https://registry.yarnpkg.com/mri/-/mri-1.1.6.tgz#49952e1044db21dbf90f6cd92bc9c9a777d415a6"
+ integrity sha512-oi1b3MfbyGa7FJMP9GmLTttni5JoICpYBRlq+x5V16fZbLsnL9N3wFqqIm/nIG43FjUFkFh9Epzp/kzUGUnJxQ==
+
ms@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
@@ -3649,6 +3691,13 @@ run-parallel@^1.1.9:
dependencies:
queue-microtask "^1.2.2"
+sade@^1.6.0:
+ version "1.7.4"
+ resolved "https://registry.yarnpkg.com/sade/-/sade-1.7.4.tgz#ea681e0c65d248d2095c90578c03ca0bb1b54691"
+ integrity sha512-y5yauMD93rX840MwUJr7C1ysLFBgMspsdTo4UVrDg3fXDvtwOyIqykhVAAm6fk/3au77773itJStObgK+LKaiA==
+ dependencies:
+ mri "^1.1.0"
+
safe-buffer@^5.1.0:
version "5.2.1"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
@@ -3671,6 +3720,11 @@ sdp-transform@^2.14.1:
resolved "https://registry.yarnpkg.com/sdp-transform/-/sdp-transform-2.14.1.tgz#2bb443583d478dee217df4caa284c46b870d5827"
integrity sha512-RjZyX3nVwJyCuTo5tGPx+PZWkDMCg7oOLpSlhjDdZfwUoNqG1mM8nyj31IGHyaPWXhjbP7cdK3qZ2bmkJ1GzRw==
+semiver@^1.0.0:
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/semiver/-/semiver-1.1.0.tgz#9c97fb02c21c7ce4fcf1b73e2c7a24324bdddd5f"
+ integrity sha512-QNI2ChmuioGC1/xjyYwyZYADILWyW6AmS1UH6gDj/SFUUUS4MBAWs/7mxnkRPc/F4iHezDP+O8t0dO8WHiEOdg==
+
semver@7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e"
@@ -3726,6 +3780,29 @@ side-channel@^1.0.4:
get-intrinsic "^1.0.2"
object-inspect "^1.9.0"
+sirv-cli@^1.0.14:
+ version "1.0.14"
+ resolved "https://registry.yarnpkg.com/sirv-cli/-/sirv-cli-1.0.14.tgz#4bc60421b3de9caea80ccd292b5004aca4ce3c81"
+ integrity sha512-yyUTNr984ANKDloqepkYbBSqvx3buwYg2sQKPWjSU+IBia5loaoka2If8N9CMwt8AfP179cdEl7kYJ//iWJHjQ==
+ dependencies:
+ console-clear "^1.1.0"
+ get-port "^3.2.0"
+ kleur "^3.0.0"
+ local-access "^1.0.1"
+ sade "^1.6.0"
+ semiver "^1.0.0"
+ sirv "^1.0.13"
+ tinydate "^1.0.0"
+
+sirv@^1.0.13:
+ version "1.0.17"
+ resolved "https://registry.yarnpkg.com/sirv/-/sirv-1.0.17.tgz#86e2c63c612da5a1dace1c16c46f524aaa26ac45"
+ integrity sha512-qx9go5yraB7ekT7bCMqUHJ5jEaOC/GXBxUWv+jeWnb7WzHUFdcQPGWk7YmAwFBaQBrogpuSqd/azbC2lZRqqmw==
+ dependencies:
+ "@polka/url" "^1.0.0-next.20"
+ mime "^2.3.1"
+ totalist "^1.0.0"
+
slash@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634"
@@ -3967,6 +4044,11 @@ tiny-warning@^1.0.0, tiny-warning@^1.0.3:
resolved "https://registry.yarnpkg.com/tiny-warning/-/tiny-warning-1.0.3.tgz#94a30db453df4c643d0fd566060d60a875d84754"
integrity sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==
+tinydate@^1.0.0:
+ version "1.3.0"
+ resolved "https://registry.yarnpkg.com/tinydate/-/tinydate-1.3.0.tgz#e6ca8e5a22b51bb4ea1c3a2a4fd1352dbd4c57fb"
+ integrity sha512-7cR8rLy2QhYHpsBDBVYnnWXm8uRTr38RoZakFSW7Bs7PzfMPNZthuMLkwqZv7MTu8lhQ91cOFYS5a7iFj2oR3w==
+
tippy.js@^6.3.1:
version "6.3.1"
resolved "https://registry.yarnpkg.com/tippy.js/-/tippy.js-6.3.1.tgz#3788a007be7015eee0fd589a66b98fb3f8f10181"
@@ -3986,6 +4068,11 @@ to-regex-range@^5.0.1:
dependencies:
is-number "^7.0.0"
+totalist@^1.0.0:
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/totalist/-/totalist-1.1.0.tgz#a4d65a3e546517701e3e5c37a47a70ac97fe56df"
+ integrity sha512-gduQwd1rOdDMGxFG1gEvhV88Oirdo2p+KjoYFU7k2g+i7n6AFFbDQ5kMPUsW0pNbfQsB/cwXvT1i4Bue0s9g5g==
+
tr46@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/tr46/-/tr46-1.0.1.tgz#a8b13fd6bfd2489519674ccde55ba3693b706d09"
From 17c09baf89ab3ae060619ee5c4daaba4efe01beb Mon Sep 17 00:00:00 2001
From: Paul
Date: Mon, 30 Aug 2021 15:45:18 +0100
Subject: [PATCH 11/16] Try to automate Docker builds.
---
.dockerignore | 7 ++++
.env.build | 2 ++
.github/workflows/docker.yml | 36 +++++++++++++++++++
.github/workflows/{main.yml => mirroring.yml} | 0
4 files changed, 45 insertions(+)
create mode 100644 .dockerignore
create mode 100644 .env.build
create mode 100644 .github/workflows/docker.yml
rename .github/workflows/{main.yml => mirroring.yml} (100%)
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 00000000..65084ffd
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,7 @@
+.github
+.vscode
+dist
+dist_injected
+node_modules
+.env
+.env.local
diff --git a/.env.build b/.env.build
new file mode 100644
index 00000000..bb995aad
--- /dev/null
+++ b/.env.build
@@ -0,0 +1,2 @@
+API_SERVER=__API_URL__
+THEMES_URL=https://static.revolt.chat/themes
\ No newline at end of file
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
new file mode 100644
index 00000000..4ac924d1
--- /dev/null
+++ b/.github/workflows/docker.yml
@@ -0,0 +1,36 @@
+name: Docker
+
+on:
+ push:
+ branches:
+ - "master"
+ tags:
+ - "v*"
+ pull_request:
+ branches:
+ - "master"
+
+jobs:
+ docker:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ - name: Docker meta
+ id: meta
+ uses: docker/metadata-action@v3
+ with:
+ images: name/app
+ - name: Login to DockerHub
+ if: github.event_name != 'pull_request'
+ uses: docker/login-action@v1
+ with:
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
+ - name: Build and push
+ uses: docker/build-push-action@v2
+ with:
+ context: .
+ push: ${{ github.event_name != 'pull_request' }}
+ tags: ${{ steps.meta.outputs.tags }}
+ labels: ${{ steps.meta.outputs.labels }}
diff --git a/.github/workflows/main.yml b/.github/workflows/mirroring.yml
similarity index 100%
rename from .github/workflows/main.yml
rename to .github/workflows/mirroring.yml
From b364fe50f6a077b3e741cd05923b64bda6f81aec Mon Sep 17 00:00:00 2001
From: Paul
Date: Mon, 30 Aug 2021 16:08:22 +0100
Subject: [PATCH 12/16] Make Typescript happy, testing CI build. Adjust
language names.
---
package.json | 2 +-
src/context/Locale.tsx | 4 ++--
src/context/intermediate/Intermediate.tsx | 8 ++++----
src/context/intermediate/Popovers.tsx | 8 ++++++++
src/context/revoltjs/RevoltClient.tsx | 3 ++-
src/pages/settings/panes/Sessions.tsx | 3 ++-
yarn.lock | 8 ++++----
7 files changed, 23 insertions(+), 13 deletions(-)
diff --git a/package.json b/package.json
index 5912596d..5e2bc83e 100644
--- a/package.json
+++ b/package.json
@@ -118,7 +118,7 @@
"react-virtualized-auto-sizer": "^1.0.5",
"react-virtuoso": "^1.10.4",
"redux": "^4.1.0",
- "revolt-api": "0.5.2-alpha.1",
+ "revolt-api": "0.5.2-alpha.2",
"revolt.js": "5.0.1-alpha.6-patch.2",
"rimraf": "^3.0.2",
"sass": "^1.35.1",
diff --git a/src/context/Locale.tsx b/src/context/Locale.tsx
index 199d49e5..da039a64 100644
--- a/src/context/Locale.tsx
+++ b/src/context/Locale.tsx
@@ -93,8 +93,8 @@ export const Languages: { [key in Language]: LanguageEntry } = {
de: { display: "Deutsch", emoji: "🇩🇪", i18n: "de" },
el: { display: "Ελληνικά", emoji: "🇬🇷", i18n: "el" },
es: { display: "Español", emoji: "🇪🇸", i18n: "es" },
- et: { display: "Eestlane", emoji: "🇪🇪", i18n: "et" },
- fi: { display: "Suomi", emoji: "🇫🇮", i18n: "fi" },
+ et: { display: "eesti", emoji: "🇪🇪", i18n: "et" },
+ fi: { display: "suomi", emoji: "🇫🇮", i18n: "fi" },
fil: { display: "Pilipino", emoji: "🇵🇭", i18n: "fil", dayjs: "tl-ph" },
fr: { display: "Français", emoji: "🇫🇷", i18n: "fr" },
ga: { display: "Gaeilge", emoji: "🇮🇪", i18n: "ga" },
diff --git a/src/context/intermediate/Intermediate.tsx b/src/context/intermediate/Intermediate.tsx
index 59a3cc1c..e6a3eb49 100644
--- a/src/context/intermediate/Intermediate.tsx
+++ b/src/context/intermediate/Intermediate.tsx
@@ -79,16 +79,16 @@ export type Screen =
}
// Pop-overs
- | { id: "image_viewer"; attachment?: Attachment; embed?: EmbedImage }
- | { id: "modify_account"; field: "username" | "email" | "password" }
| { id: "profile"; user_id: string }
- | { id: "channel_info"; channel: Channel }
- | { id: "pending_requests"; users: User[] }
| {
id: "user_picker";
omit?: string[];
callback: (users: string[]) => Promise;
}
+ | { id: "image_viewer"; attachment?: Attachment; embed?: EmbedImage }
+ | { id: "channel_info"; channel: Channel }
+ | { id: "pending_requests"; users: User[] }
+ | { id: "modify_account"; field: "username" | "email" | "password" }
| {
id: "server_identity";
server: Server;
diff --git a/src/context/intermediate/Popovers.tsx b/src/context/intermediate/Popovers.tsx
index 199dc349..0834a1f8 100644
--- a/src/context/intermediate/Popovers.tsx
+++ b/src/context/intermediate/Popovers.tsx
@@ -26,22 +26,30 @@ export default function Popovers() {
switch (screen.id) {
case "profile":
+ // @ts-expect-error someone figure this out :)
return ;
case "user_picker":
+ // @ts-expect-error someone figure this out :)
return ;
case "image_viewer":
return ;
case "channel_info":
+ // @ts-expect-error someone figure this out :)
return ;
case "pending_requests":
+ // @ts-expect-error someone figure this out :)
return ;
case "modify_account":
+ // @ts-expect-error someone figure this out :)
return ;
case "special_prompt":
+ // @ts-expect-error someone figure this out :)
return ;
case "special_input":
+ // @ts-expect-error someone figure this out :)
return ;
case "server_identity":
+ // @ts-expect-error someone figure this out :)
return ;
}
diff --git a/src/context/revoltjs/RevoltClient.tsx b/src/context/revoltjs/RevoltClient.tsx
index 5e6efcef..17f2dc90 100644
--- a/src/context/revoltjs/RevoltClient.tsx
+++ b/src/context/revoltjs/RevoltClient.tsx
@@ -15,6 +15,7 @@ import { Children } from "../../types/Preact";
import { useIntermediate } from "../intermediate/Intermediate";
import { registerEvents, setReconnectDisallowed } from "./events";
import { takeError } from "./util";
+import { Session } from "revolt-api/types/Auth";
export enum ClientStatus {
INIT,
@@ -79,7 +80,7 @@ function Context({ auth, children }: Props) {
const login = () =>
dispatch({
type: "LOGIN",
- session: client.session!, // This [null assertion] is ok, we should have a session by now. - insert's words
+ session: client.session as Session,
});
if (onboarding) {
diff --git a/src/pages/settings/panes/Sessions.tsx b/src/pages/settings/panes/Sessions.tsx
index c8021c48..877605d4 100644
--- a/src/pages/settings/panes/Sessions.tsx
+++ b/src/pages/settings/panes/Sessions.tsx
@@ -32,7 +32,8 @@ interface Session {
export function Sessions() {
const client = useContext(AppContext);
- const deviceId = client.session?.id;
+ const deviceId =
+ typeof client.session === "object" ? client.session.id : undefined;
const [sessions, setSessions] = useState(undefined);
const [attemptingDelete, setDelete] = useState([]);
diff --git a/yarn.lock b/yarn.lock
index 64d96793..227e4e0e 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3639,10 +3639,10 @@ reusify@^1.0.4:
resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76"
integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==
-revolt-api@0.5.2-alpha.1:
- version "0.5.2-alpha.1"
- resolved "https://registry.yarnpkg.com/revolt-api/-/revolt-api-0.5.2-alpha.1.tgz#2164d04cd5581267ce59142557666bd386bc85c4"
- integrity sha512-3OrjYCDNPkJ+yO9d87NJvuUDAbungEbUfrfHlvFwV8hJze/RMkuYUTFWe1HyBMwBC7F/yWQK+2V7IoifC5STmw==
+revolt-api@0.5.2-alpha.2:
+ version "0.5.2-alpha.2"
+ resolved "https://registry.yarnpkg.com/revolt-api/-/revolt-api-0.5.2-alpha.2.tgz#a083b918c239d0b8967f8a2c7f10d6466d30d3d5"
+ integrity sha512-Sm6YL7vjyt5fpq1kQCp1OtKdjmaH7lgeWON4YDOycb5Bc1hKc9vgRHS4FhGlie2ilrk9Sox3CdY0tCQ0ENcDSw==
revolt.js@5.0.1-alpha.6-patch.2:
version "5.0.1-alpha.6-patch.2"
From dac6f3dbba3e28b2bf4d18eede9baa6750534835 Mon Sep 17 00:00:00 2001
From: Paul
Date: Mon, 30 Aug 2021 16:25:45 +0100
Subject: [PATCH 13/16] Clone submodules for Docker builds.
---
.github/workflows/docker.yml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index 4ac924d1..3255e8c7 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -16,6 +16,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
+ with:
+ submodules: "recursive"
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
From 4e3e57a7c972521031abbb47c567f8ff69566a91 Mon Sep 17 00:00:00 2001
From: Paul
Date: Mon, 30 Aug 2021 16:45:23 +0100
Subject: [PATCH 14/16] Fix issues introduced in new Typescript version.
---
.../common/messaging/MessageBox.tsx | 3 +-
.../intermediate/modals/Onboarding.tsx | 2 +-
src/lib/vortex/VoiceClient.ts | 3 +-
src/pages/login/forms/Form.tsx | 2 +-
yarn.lock | 308 +++++++++---------
5 files changed, 163 insertions(+), 155 deletions(-)
diff --git a/src/components/common/messaging/MessageBox.tsx b/src/components/common/messaging/MessageBox.tsx
index bcb5f72e..5940100d 100644
--- a/src/components/common/messaging/MessageBox.tsx
+++ b/src/components/common/messaging/MessageBox.tsx
@@ -316,7 +316,8 @@ export default observer(({ channel }: Props) => {
);
}
} catch (err) {
- if (err?.message === "cancel") {
+ // eslint-disable-next-line
+ if ((err as any)?.message === "cancel") {
setUploadState({
type: "attached",
files,
diff --git a/src/context/intermediate/modals/Onboarding.tsx b/src/context/intermediate/modals/Onboarding.tsx
index 2df6ab17..0f6fd490 100644
--- a/src/context/intermediate/modals/Onboarding.tsx
+++ b/src/context/intermediate/modals/Onboarding.tsx
@@ -55,7 +55,7 @@ export function OnboardingModal({ onClose, callback }: Props) {
onSubmit={
handleSubmit(
onSubmit,
- ) as JSX.GenericEventHandler
+ ) as unknown as JSX.GenericEventHandler
}>
{
try {
await this.signaling.stopProduce(type);
} catch (error) {
- if (error.error === WSErrorCode.ProducerNotFound) return;
+ // eslint-disable-next-line
+ if ((error as any).error === WSErrorCode.ProducerNotFound) return;
throw error;
}
}
diff --git a/src/pages/login/forms/Form.tsx b/src/pages/login/forms/Form.tsx
index ca811548..8b1a0fc2 100644
--- a/src/pages/login/forms/Form.tsx
+++ b/src/pages/login/forms/Form.tsx
@@ -152,7 +152,7 @@ export function Form({ page, callback }: Props) {
onSubmit={
handleSubmit(
onSubmit,
- ) as JSX.GenericEventHandler
+ ) as unknown as JSX.GenericEventHandler
}>
{page !== "reset" && (
=3.0.0 <4.0.0"
@@ -3952,9 +3958,9 @@ strip-json-comments@^3.1.0, strip-json-comments@^3.1.1:
integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==
styled-components@^5.3.0:
- version "5.3.0"
- resolved "https://registry.yarnpkg.com/styled-components/-/styled-components-5.3.0.tgz#e47c3d3e9ddfff539f118a3dd0fd4f8f4fb25727"
- integrity sha512-bPJKwZCHjJPf/hwTJl6TbkSZg/3evha+XPEizrZUGb535jLImwDUdjTNxXqjjaASt2M4qO4AVfoHJNe3XB/tpQ==
+ version "5.3.1"
+ resolved "https://registry.yarnpkg.com/styled-components/-/styled-components-5.3.1.tgz#8a86dcd31bff7049c2ed408bae36fa23f03f071a"
+ integrity sha512-JThv2JRzyH0NOIURrk9iskdxMSAAtCfj/b2Sf1WJaCUsloQkblepy1jaCLX/bYE+mhYo3unmwVSI9I5d9ncSiQ==
dependencies:
"@babel/helper-module-imports" "^7.0.0"
"@babel/traverse" "^7.4.5"
@@ -4016,9 +4022,9 @@ tempy@^0.6.0:
unique-string "^2.0.0"
terser@^5.0.0:
- version "5.7.1"
- resolved "https://registry.yarnpkg.com/terser/-/terser-5.7.1.tgz#2dc7a61009b66bb638305cb2a824763b116bf784"
- integrity sha512-b3e+d5JbHAe/JSjwsC3Zn55wsBIM7AsHLjKxT31kGCldgbpFePaFo+PiddtO6uwRZWRw7sPXmAN8dTW61xmnSg==
+ version "5.7.2"
+ resolved "https://registry.yarnpkg.com/terser/-/terser-5.7.2.tgz#d4d95ed4f8bf735cb933e802f2a1829abf545e3f"
+ integrity sha512-0Omye+RD4X7X69O0eql3lC4Heh/5iLj3ggxR/B5ketZLOtLiOqukUgjw3q4PDnNQbsrkKr3UMypqStQG3XKRvw==
dependencies:
commander "^2.20.0"
source-map "~0.7.2"
@@ -4081,9 +4087,9 @@ tr46@^1.0.1:
punycode "^2.1.0"
tsc-watch@^4.1.0:
- version "4.4.0"
- resolved "https://registry.yarnpkg.com/tsc-watch/-/tsc-watch-4.4.0.tgz#3ebbf1db54bcef6bfe534b330fa87284a4139320"
- integrity sha512-+0Yey6ptOOXAnt44OKTk2/EnQnmA0auL7VWXm9d9abMS4tabt0Xdr9B4AK6OJbWAre9ZdLA81+Nk8sz9unptyA==
+ version "4.5.0"
+ resolved "https://registry.yarnpkg.com/tsc-watch/-/tsc-watch-4.5.0.tgz#d6884b932822b2c2ccd37f1c1f3748304566a474"
+ integrity sha512-aXhN4jY+1YEcn/NwCQ/+fHqU43EqOpW+pS+933EPsVEsrKhvyrodPDIjQsk1a1niFrabAK3RIBrRbAslVefEbQ==
dependencies:
cross-spawn "^7.0.3"
node-cleanup "^2.1.2"
@@ -4121,9 +4127,9 @@ type-fest@^0.20.2:
integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==
typescript@^4.3.2:
- version "4.3.5"
- resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.5.tgz#4d1c37cc16e893973c45a06886b7113234f119f4"
- integrity sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==
+ version "4.4.2"
+ resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.2.tgz#6d618640d430e3569a1dfb44f7d7e600ced3ee86"
+ integrity sha512-gzP+t5W4hdy4c+68bfcv0t400HVJMMd2+H9B7gae1nQlBzCqvrXX+6GL/b3GAgyTH966pzrZ70/fRjwAtZksSQ==
ua-parser-js@^0.7.24:
version "0.7.28"
@@ -4198,11 +4204,11 @@ uri-js@^4.2.2:
punycode "^2.1.0"
use-resize-observer@^7.0.0:
- version "7.0.1"
- resolved "https://registry.yarnpkg.com/use-resize-observer/-/use-resize-observer-7.0.1.tgz#82b13d462e7fb5e3ec953bde48d6e02b9aae660d"
- integrity sha512-tJESENDoVXfzkv1Cl9dJ13ySgENcKjvEKSU7QwjckjxjXg/MV2zW1CjEUtLpmXY084womIxJROUR3L1SuqlvOw==
+ version "7.1.0"
+ resolved "https://registry.yarnpkg.com/use-resize-observer/-/use-resize-observer-7.1.0.tgz#709ea7540fbe0a60ceae41ee2bef933d7782e4d4"
+ integrity sha512-6DGWOnZpjAGP/MtslGg7OunZptyueQduMi0i8DC5nVKXtJ8Bdt0wR/1tSxugFRndzYCi/jtD+SlNs5PK8ijvXQ==
dependencies:
- resize-observer-polyfill "^1.5.1"
+ "@juggle/resize-observer" "^3.3.1"
uuid@^8.1.0:
version "8.3.2"
@@ -4445,9 +4451,9 @@ wrappy@1:
integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=
ws@^7.2.1:
- version "7.5.3"
- resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.3.tgz#160835b63c7d97bfab418fc1b8a9fced2ac01a74"
- integrity sha512-kQ/dHIzuLrS6Je9+uv81ueZomEwH0qVYstcAQ4/Z93K8zeko9gtAbttJWzoC5ukqXY1PpoouV3+VSOqEAFt5wg==
+ version "7.5.4"
+ resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.4.tgz#56bfa20b167427e138a7795de68d134fe92e21f9"
+ integrity sha512-zP9z6GXm6zC27YtspwH99T3qTG7bBFv2VIkeHstMLrLlDJuzA7tQ5ls3OJ1hOGGCzTQPniNJoHXIAOS0Jljohg==
yallist@^4.0.0:
version "4.0.0"
From 3628aeffddbda939535e533efef015878d9d2182 Mon Sep 17 00:00:00 2001
From: Paul
Date: Mon, 30 Aug 2021 16:51:06 +0100
Subject: [PATCH 15/16] Select the correct repository.
---
.github/workflows/docker.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index 3255e8c7..dd176b76 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -22,7 +22,7 @@ jobs:
id: meta
uses: docker/metadata-action@v3
with:
- images: name/app
+ images: revoltchat/client
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
From d368820aeb0e6106a064acd35adb186a4cbc2f5d Mon Sep 17 00:00:00 2001
From: Paul
Date: Mon, 30 Aug 2021 18:01:32 +0100
Subject: [PATCH 16/16] Add CTRL + ENTER to force send message. Fix: cursor
jumping to the end of message area. Fix: inconsistent message send button on
mobile.
---
.../common/messaging/MessageBase.tsx | 9 ++++++---
.../common/messaging/MessageBox.tsx | 19 +++++++++++++------
.../common/messaging/bars/JumpToBottom.tsx | 15 +++++++++------
src/components/ui/Header.tsx | 8 +++++---
src/lib/TextAreaAutoSize.tsx | 4 +++-
5 files changed, 36 insertions(+), 19 deletions(-)
diff --git a/src/components/common/messaging/MessageBase.tsx b/src/components/common/messaging/MessageBase.tsx
index 166f2918..2d854173 100644
--- a/src/components/common/messaging/MessageBase.tsx
+++ b/src/components/common/messaging/MessageBase.tsx
@@ -6,6 +6,7 @@ import { decodeTime } from "ulid";
import { Text } from "preact-i18n";
import { useDictionary } from "../../../lib/i18n";
+import { isTouchscreenDevice } from "../../../lib/isTouchscreenDevice";
import { dayjs } from "../../../context/Locale";
@@ -34,9 +35,11 @@ export default styled.div`
flex-direction: row;
padding-inline-end: 16px;
- @media (pointer: coarse) {
- user-select: none;
- }
+ ${() =>
+ isTouchscreenDevice &&
+ css`
+ user-select: none;
+ `}
${(props) =>
props.contrast &&
diff --git a/src/components/common/messaging/MessageBox.tsx b/src/components/common/messaging/MessageBox.tsx
index 5940100d..b561a928 100644
--- a/src/components/common/messaging/MessageBox.tsx
+++ b/src/components/common/messaging/MessageBox.tsx
@@ -3,7 +3,7 @@ import Axios, { CancelTokenSource } from "axios";
import { observer } from "mobx-react-lite";
import { ChannelPermission } from "revolt.js/dist/api/permissions";
import { Channel } from "revolt.js/dist/maps/Channels";
-import styled from "styled-components";
+import styled, { css } from "styled-components";
import { ulid } from "ulid";
import { Text } from "preact-i18n";
@@ -99,11 +99,13 @@ const Action = styled.div`
padding: 12px;
}
- .mobile {
- @media (pointer: fine) {
- display: none;
- }
- }
+ ${() =>
+ !isTouchscreenDevice &&
+ css`
+ .mobile {
+ display: none;
+ }
+ `}
`;
// For sed replacement
@@ -503,6 +505,11 @@ export default observer(({ channel }: Props) => {
value={draft ?? ""}
padding="var(--message-box-padding)"
onKeyDown={(e) => {
+ if (e.ctrlKey && e.key === "Enter") {
+ e.preventDefault();
+ return send();
+ }
+
if (onKeyDown(e)) return;
if (
diff --git a/src/components/common/messaging/bars/JumpToBottom.tsx b/src/components/common/messaging/bars/JumpToBottom.tsx
index dc8e50a1..bde2f086 100644
--- a/src/components/common/messaging/bars/JumpToBottom.tsx
+++ b/src/components/common/messaging/bars/JumpToBottom.tsx
@@ -1,10 +1,11 @@
import { DownArrowAlt } from "@styled-icons/boxicons-regular";
import { observer } from "mobx-react-lite";
import { Channel } from "revolt.js/dist/maps/Channels";
-import styled from "styled-components";
+import styled, { css } from "styled-components";
import { Text } from "preact-i18n";
+import { isTouchscreenDevice } from "../../../../lib/isTouchscreenDevice";
import { getRenderer } from "../../../../lib/renderer/Singleton";
const Bar = styled.div`
@@ -42,11 +43,13 @@ const Bar = styled.div`
transform: translateY(1px);
}
- @media (pointer: coarse) {
- height: 34px;
- top: -32px;
- padding: 0 12px;
- }
+ ${() =>
+ isTouchscreenDevice &&
+ css`
+ height: 34px;
+ top: -32px;
+ padding: 0 12px;
+ `}
}
`;
diff --git a/src/components/ui/Header.tsx b/src/components/ui/Header.tsx
index 24c2cc29..87c59e4c 100644
--- a/src/components/ui/Header.tsx
+++ b/src/components/ui/Header.tsx
@@ -37,9 +37,11 @@ export default styled.div`
padding: 0 12px;
}*/
- @media (pointer: coarse) {
- height: 56px;
- }
+ ${() =>
+ isTouchscreenDevice &&
+ css`
+ height: 56px;
+ `}
${(props) =>
props.background &&
diff --git a/src/lib/TextAreaAutoSize.tsx b/src/lib/TextAreaAutoSize.tsx
index 1efbd705..a4fe2fa6 100644
--- a/src/lib/TextAreaAutoSize.tsx
+++ b/src/lib/TextAreaAutoSize.tsx
@@ -99,7 +99,9 @@ export default function TextAreaAutoSize(props: TextAreaAutoSizeProps) {
// ? it is a quick and dirty hack to fix
// ? value not setting correctly
// ? I have no clue what's going on
- ref.current.value = value;
+ // ref.current.value = value;
+ // * commented out of 30-08-21
+ // * hopefully nothing breaks :v
if (!autoFocus) return;
function keyDown(e: KeyboardEvent) {