diff --git a/VERSION b/VERSION
new file mode 100644
index 00000000..c096572f
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+1.0.0-vite
\ No newline at end of file
diff --git a/package.json b/package.json
index d739a386..bce943b8 100644
--- a/package.json
+++ b/package.json
@@ -78,7 +78,6 @@
"sass": "^1.35.1",
"shade-blend-color": "^1.0.0",
"styled-components": "^5.3.0",
- "twemoji": "^13.1.0",
"typescript": "^4.3.2",
"ulid": "^2.3.0",
"use-resize-observer": "^7.0.0",
diff --git a/publish.sh b/publish.sh
new file mode 100644
index 00000000..427d025d
--- /dev/null
+++ b/publish.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+version=$(cat VERSION)
+
+ docker build -t revoltchat/client:${version} . &&
+docker tag revoltchat/client:${version} revoltchat/client:latest &&
+ docker push revoltchat/client:${version} &&
+ docker push revoltchat/client:latest
diff --git a/src/components/common/Emoji.tsx b/src/components/common/Emoji.tsx
index 74e381b5..791a0036 100644
--- a/src/components/common/Emoji.tsx
+++ b/src/components/common/Emoji.tsx
@@ -1,22 +1,43 @@
-import twemoji from 'twemoji';
+import { EmojiPacks } from '../../redux/reducers/settings';
var EMOJI_PACK = 'mutant';
const REVISION = 3;
-/*export function setEmojiPack(pack: EmojiPacks) {
+export function setEmojiPack(pack: EmojiPacks) {
EMOJI_PACK = pack;
-}*/
+}
+
+// Originally taken from Twemoji source code,
+// re-written by bree to be more readable.
+function codePoints(rune: string) {
+ const pairs = [];
+ let low = 0;
+ let i = 0;
+
+ while (i < rune.length) {
+ const charCode = rune.charCodeAt(i++);
+ if (low) {
+ pairs.push(0x10000 + ((low - 0xd800) << 10) + (charCode - 0xdc00));
+ low = 0;
+ } else if (0xd800 <= charCode && charCode <= 0xdbff) {
+ low = charCode;
+ } else {
+ pairs.push(charCode);
+ }
+ }
+
+ return pairs;
+}
// Taken from Twemoji source code.
// scripts/build.js#344
// grabTheRightIcon(rawText);
const UFE0Fg = /\uFE0F/g;
const U200D = String.fromCharCode(0x200D);
-function toCodePoint(emoji: string) {
- return twemoji.convert.toCodePoint(emoji.indexOf(U200D) < 0 ?
- emoji.replace(UFE0Fg, '') :
- emoji
- );
+function toCodePoint(rune: string) {
+ return codePoints(rune.indexOf(U200D) < 0 ? rune.replace(UFE0Fg, '') : rune)
+ .map((val) => val.toString(16))
+ .join("-")
}
function parseEmoji(emoji: string) {
diff --git a/src/components/common/messaging/embed/Embed.tsx b/src/components/common/messaging/embed/Embed.tsx
index 647731d4..f0bd8d78 100644
--- a/src/components/common/messaging/embed/Embed.tsx
+++ b/src/components/common/messaging/embed/Embed.tsx
@@ -52,23 +52,6 @@ export default function Embed({ embed }: Props) {
switch (embed.type) {
case 'Website': {
- // ! FIXME: move this to january
- /*if (embed.url && YOUTUBE_RE.test(embed.url)) {
- embed.color = '#FF424F';
- }
-
- if (embed.url && TWITCH_RE.test(embed.url)) {
- embed.color = '#7B68EE';
- }
-
- if (embed.url && SPOTIFY_RE.test(embed.url)) {
- embed.color = '#1ABC9C';
- }
-
- if (embed.url && SOUNDCLOUD_RE.test(embed.url)) {
- embed.color = '#FF7F50';
- }*/
-
// Determine special embed size.
let mw, mh;
let largeMedia = (embed.special && embed.special.type !== 'None') || embed.image?.size === 'Large';
diff --git a/src/components/navigation/items/Item.module.scss b/src/components/navigation/items/Item.module.scss
index d06e98f4..27116ebc 100644
--- a/src/components/navigation/items/Item.module.scss
+++ b/src/components/navigation/items/Item.module.scss
@@ -145,159 +145,3 @@
background: var(--error);
}
}
-
-/* ! FIXME: check if anything is missing, then remove this block
-.olditem {
- display: flex;
- user-select: none;
- align-items: center;
- flex-direction: row;
-
- gap: 8px;
- height: 48px;
- padding: 0 8px;
- cursor: pointer;
- font-size: 16px;
- border-radius: 6px;
- box-sizing: content-box;
- transition: .1s ease background-color;
-
- color: var(--tertiary-foreground);
- stroke: var(--tertiary-foreground);
-
- .avatar {
- flex-shrink: 0;
- height: 32px;
- flex-shrink: 0;
- padding: 10px 0;
- box-sizing: content-box;
-
- img {
- width: 32px;
- height: 32px;
- border-radius: 50%;
- }
- }
-
- div {
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- transition: color .1s ease-in-out;
-
- &.content {
- gap: 8px;
- flex-grow: 1;
- min-width: 0;
- display: flex;
- align-items: center;
- flex-direction: row;
-
- svg {
- flex-shrink: 0;
- }
-
- span {
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
- }
-
- &.name {
- flex-grow: 1;
- display: flex;
- flex-direction: column;
- font-size: .90625rem;
- font-weight: 600;
-
- .subText {
- font-size: .6875rem;
- margin-top: -1px;
- color: var(--tertiary-foreground);
- font-weight: 500;
- }
- }
-
- &.unread {
- width: 6px;
- height: 6px;
- margin: 9px;
- flex-shrink: 0;
- border-radius: 50%;
- background: var(--foreground);
- }
-
- &.button {
- flex-shrink: 0;
-
- .icon {
- opacity: 0;
- display: none;
- transition: 0.1s ease opacity;
- }
- }
- }
-
- &[data-active="true"] {
- color: var(--foreground);
- stroke: var(--foreground);
- background: var(--hover);
- cursor: default;
-
- .subText {
- color: var(--secondary-foreground) !important;
- }
-
- .unread {
- display: none;
- }
- }
-
- &[data-alert="true"] {
- color: var(--secondary-foreground);
- }
-
- &[data-type="user"] {
- opacity: 0.4;
- color: var(--foreground);
- transition: 0.15s ease opacity;
- cursor: pointer;
-
- &[data-online="true"],
- &:hover {
- opacity: 1;
- //background: none;
- }
- }
-
- &[data-size="compact"] {
- margin-bottom: 2px;
- height: 32px;
- transition: border-inline-start .1s ease-in-out;
- border-inline-start: 4px solid transparent;
-
- &[data-active="true"] {
- border-inline-start: 4px solid var(--accent);
- border-radius: 4px;
- }
- }
-
- &[data-size="small"] {
- margin-bottom: 2px;
- height: 42px;
- }
-
- &:hover {
- background: var(--hover);
-
- div.button .unread {
- display: none;
- }
-
- div.button .icon {
- opacity: 1;
- display: block;
- }
- }
-}*/
diff --git a/src/context/intermediate/popovers/ImageViewer.tsx b/src/context/intermediate/popovers/ImageViewer.tsx
index ae6754e2..e42d6ca1 100644
--- a/src/context/intermediate/popovers/ImageViewer.tsx
+++ b/src/context/intermediate/popovers/ImageViewer.tsx
@@ -3,6 +3,8 @@ import Modal from "../../../components/ui/Modal";
import { useContext, useEffect } from "preact/hooks";
import { AppContext } from "../../revoltjs/RevoltClient";
import { Attachment, EmbedImage } from "revolt.js/dist/api/objects";
+import EmbedMediaActions from "../../../components/common/messaging/embed/EmbedMediaActions";
+import AttachmentActions from "../../../components/common/messaging/attachments/AttachmentActions";
interface Props {
onClose: () => void;
@@ -11,6 +13,12 @@ interface Props {
}
export function ImageViewer({ attachment, embed, onClose }: Props) {
+ // ! FIXME: temp code
+ // ! add proxy function to client
+ function proxyImage(url: string) {
+ return 'https://jan.revolt.chat/proxy?url=' + encodeURIComponent(url);
+ }
+
if (attachment && attachment.metadata.type !== "Image") return null;
const client = useContext(AppContext);
@@ -31,13 +39,13 @@ export function ImageViewer({ attachment, embed, onClose }: Props) {
{ attachment &&
<>
- {/*
*/}
- {/*
+