mirror of
https://github.com/fromchat-messenger/web.git
synced 2026-09-22 19:15:08 +03:00
Remove .. relative imports and replace with absolute paths
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
import type { Headers, UploadPublicKeyRequest, BackupBlob } from "../types";
|
import type { Headers, UploadPublicKeyRequest, BackupBlob } from "@/core/types";
|
||||||
import { generateX25519KeyPair } from "../../utils/crypto/asymmetric";
|
import { generateX25519KeyPair } from "@/utils/crypto/asymmetric";
|
||||||
import { encodeBlob, encryptBackupWithPassword, decryptBackupWithPassword, decodeBlob } from "../../utils/crypto/backup";
|
import { encodeBlob, encryptBackupWithPassword, decryptBackupWithPassword, decodeBlob } from "@/utils/crypto/backup";
|
||||||
import { b64, ub64 } from "../../utils/utils";
|
import { b64, ub64 } from "@/utils/utils";
|
||||||
import { API_BASE_URL } from "../config";
|
import { API_BASE_URL } from "@/core/config";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates authentication headers for API requests
|
* Generates authentication headers for API requests
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { API_BASE_URL } from "../config";
|
import { API_BASE_URL } from "@/core/config";
|
||||||
import { getAuthHeaders } from "./authApi";
|
import { getAuthHeaders } from "./authApi";
|
||||||
import { ecdhSharedSecret, deriveWrappingKey } from "../../utils/crypto/asymmetric";
|
import { ecdhSharedSecret, deriveWrappingKey } from "@/utils/crypto/asymmetric";
|
||||||
import { importAesGcmKey, aesGcmEncrypt, aesGcmDecrypt } from "../../utils/crypto/symmetric";
|
import { importAesGcmKey, aesGcmEncrypt, aesGcmDecrypt } from "@/utils/crypto/symmetric";
|
||||||
import { randomBytes } from "../../utils/crypto/kdf";
|
import { randomBytes } from "@/utils/crypto/kdf";
|
||||||
import { getCurrentKeys } from "./authApi";
|
import { getCurrentKeys } from "./authApi";
|
||||||
import { request } from "../websocket";
|
import { request } from "@/core/websocket";
|
||||||
import type { SendDMRequest, DmEnvelope, User, DMEditRequest, DmEncryptedJSON, BaseDmEnvelope } from "../types";
|
import type { SendDMRequest, DmEnvelope, User, DMEditRequest, DmEncryptedJSON, BaseDmEnvelope } from "@/core/types";
|
||||||
import { b64, ub64 } from "../../utils/utils";
|
import { b64, ub64 } from "@/utils/utils";
|
||||||
|
|
||||||
export async function decryptDm(envelope: DmEnvelope, senderPublicKeyB64: string): Promise<string> {
|
export async function decryptDm(envelope: DmEnvelope, senderPublicKeyB64: string): Promise<string> {
|
||||||
const keys = getCurrentKeys();
|
const keys = getCurrentKeys();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { getAuthHeaders } from "./authApi";
|
import { getAuthHeaders } from "./authApi";
|
||||||
import { API_BASE_URL } from "../config";
|
import { API_BASE_URL } from "@/core/config";
|
||||||
import type { UserProfile } from "../types";
|
import type { UserProfile } from "@/core/types";
|
||||||
|
|
||||||
export interface ProfileData {
|
export interface ProfileData {
|
||||||
profile_picture?: string;
|
profile_picture?: string;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import type { Dialog as MduiDialog } from "mdui/components/dialog";
|
import type { Dialog as MduiDialog } from "mdui/components/dialog";
|
||||||
import { useEffect, type Ref } from "react"
|
import { useEffect, type Ref } from "react"
|
||||||
import { createPortal } from "react-dom";
|
import { createPortal } from "react-dom";
|
||||||
import { id } from "../../utils/utils";
|
import { id } from "@/utils/utils";
|
||||||
import useCombinedRefs from "../hooks/useCombinedRefs";
|
import useCombinedRefs from "@/core/hooks/useCombinedRefs";
|
||||||
|
|
||||||
export interface BaseDialogProps {
|
export interface BaseDialogProps {
|
||||||
onOpenChange: (value: boolean) => void;
|
onOpenChange: (value: boolean) => void;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { API_BASE_URL } from "../config";
|
import { API_BASE_URL } from "@/core/config";
|
||||||
import { isElectron } from "../electron/electron";
|
import { isElectron } from "@/core/electron/electron";
|
||||||
import { websocket } from "../websocket";
|
import { websocket } from "@/core/websocket";
|
||||||
import type { NewMessageWebSocketMessage, WebSocketMessage } from "../types";
|
import type { NewMessageWebSocketMessage, WebSocketMessage } from "@/core/types";
|
||||||
import serviceWorker from "./service-worker?worker&url";
|
import serviceWorker from "./service-worker?worker&url";
|
||||||
|
|
||||||
export interface PushSubscriptionData {
|
export interface PushSubscriptionData {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import { API_WS_BASE_URL } from "./config";
|
import { API_WS_BASE_URL } from "./config";
|
||||||
import type { WebSocketMessage } from "./types";
|
import type { WebSocketMessage } from "./types";
|
||||||
import { delay } from "../utils/utils";
|
import { delay } from "@/utils/utils";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new WebSocket connection to the chat server
|
* Creates a new WebSocket connection to the chat server
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
import { useImmer } from "use-immer";
|
import { useImmer } from "use-immer";
|
||||||
import { AlertsContainer, type Alert, type AlertType } from "./Auth";
|
import { AlertsContainer, type Alert, type AlertType } from "./Auth";
|
||||||
import { AuthContainer, AuthHeader } from "./Auth";
|
import { AuthContainer, AuthHeader } from "./Auth";
|
||||||
import type { ErrorResponse, LoginRequest, LoginResponse } from "../../core/types";
|
import type { ErrorResponse, LoginRequest, LoginResponse } from "@/core/types";
|
||||||
import { ensureKeysOnLogin } from "../../core/api/authApi";
|
import { ensureKeysOnLogin } from "@/core/api/authApi";
|
||||||
import { API_BASE_URL } from "../../core/config";
|
import { API_BASE_URL } from "@/core/config";
|
||||||
import { useRef } from "react";
|
import { useRef } from "react";
|
||||||
import type { TextField } from "mdui/components/text-field";
|
import type { TextField } from "mdui/components/text-field";
|
||||||
import { useAppState } from "../chat/state";
|
import { useAppState } from "@/pages/chat/state";
|
||||||
import { MaterialTextField } from "../../core/components/TextField";
|
import { MaterialTextField } from "@/core/components/TextField";
|
||||||
import { initialize, isSupported, startElectronReceiver, subscribe } from "../../core/push-notifications/push-notifications";
|
import { initialize, isSupported, startElectronReceiver, subscribe } from "@/core/push-notifications/push-notifications";
|
||||||
import { isElectron } from "../../core/electron/electron";
|
import { isElectron } from "@/core/electron/electron";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import "./auth.scss";
|
import "./auth.scss";
|
||||||
|
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ import { AuthContainer, AuthHeader } from "./Auth";
|
|||||||
import { AlertsContainer, type Alert, type AlertType } from "./Auth";
|
import { AlertsContainer, type Alert, type AlertType } from "./Auth";
|
||||||
import { useRef } from "react";
|
import { useRef } from "react";
|
||||||
import { TextField } from "mdui/components/text-field";
|
import { TextField } from "mdui/components/text-field";
|
||||||
import type { ErrorResponse, RegisterRequest, LoginResponse } from "../../core/types";
|
import type { ErrorResponse, RegisterRequest, LoginResponse } from "@/core/types";
|
||||||
import { API_BASE_URL } from "../../core/config";
|
import { API_BASE_URL } from "@/core/config";
|
||||||
import { useAppState } from "../chat/state";
|
import { useAppState } from "@/pages/chat/state";
|
||||||
import { MaterialTextField } from "../../core/components/TextField";
|
import { MaterialTextField } from "@/core/components/TextField";
|
||||||
import { ensureKeysOnLogin } from "../../core/api/authApi";
|
import { ensureKeysOnLogin } from "@/core/api/authApi";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import "./auth.scss";
|
import "./auth.scss";
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useState, useEffect, useCallback, useRef } from "react";
|
import { useState, useEffect, useCallback, useRef } from "react";
|
||||||
import { useAppState } from "../state";
|
import { useAppState } from "@/pages/chat/state";
|
||||||
import {
|
import {
|
||||||
fetchUsers,
|
fetchUsers,
|
||||||
fetchUserPublicKey,
|
fetchUserPublicKey,
|
||||||
@@ -7,8 +7,8 @@ import {
|
|||||||
decryptDm,
|
decryptDm,
|
||||||
sendDMViaWebSocket
|
sendDMViaWebSocket
|
||||||
} from "../../../core/api/dmApi";
|
} from "../../../core/api/dmApi";
|
||||||
import type { User, Message, DmEncryptedJSON } from "../../../core/types";
|
import type { User, Message, DmEncryptedJSON } from "@/core/types";
|
||||||
import { websocket } from "../../../core/websocket";
|
import { websocket } from "@/core/websocket";
|
||||||
|
|
||||||
export interface DMUser extends User {
|
export interface DMUser extends User {
|
||||||
lastMessage?: string;
|
lastMessage?: string;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { useState, useCallback, useEffect } from "react";
|
import { useState, useCallback, useEffect } from "react";
|
||||||
import { useAppState } from "../state";
|
import { useAppState } from "@/pages/chat/state";
|
||||||
import { loadProfile, updateProfile, uploadProfilePicture, type ProfileData } from "../../../core/api/profileApi";
|
import { loadProfile, updateProfile, uploadProfilePicture, type ProfileData } from "@/core/api/profileApi";
|
||||||
import { showSuccess, showError } from "../../../utils/notification";
|
import { showSuccess, showError } from "@/utils/notification";
|
||||||
|
|
||||||
export default function useProfile() {
|
export default function useProfile() {
|
||||||
const { user } = useAppState();
|
const { user } = useAppState();
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import { create } from "zustand";
|
import { create } from "zustand";
|
||||||
import type { Message, User } from "../../core/types";
|
import type { Message, User } from "@/core/types";
|
||||||
import { request } from "../../core/websocket";
|
import { request } from "@/core/websocket";
|
||||||
import { MessagePanel } from "./ui/right/panels/MessagePanel";
|
import { MessagePanel } from "./ui/right/panels/MessagePanel";
|
||||||
import { PublicChatPanel } from "./ui/right/panels/PublicChatPanel";
|
import { PublicChatPanel } from "./ui/right/panels/PublicChatPanel";
|
||||||
import { DMPanel, type DMPanelData } from "./ui/right/panels/DMPanel";
|
import { DMPanel, type DMPanelData } from "./ui/right/panels/DMPanel";
|
||||||
import { getAuthHeaders } from "../../core/api/authApi";
|
import { getAuthHeaders } from "@/core/api/authApi";
|
||||||
import { restoreKeys } from "../../core/api/authApi";
|
import { restoreKeys } from "@/core/api/authApi";
|
||||||
import { API_BASE_URL } from "../../core/config";
|
import { API_BASE_URL } from "@/core/config";
|
||||||
import { initialize, subscribe, startElectronReceiver, isSupported } from "../../core/push-notifications/push-notifications";
|
import { initialize, subscribe, startElectronReceiver, isSupported } from "@/core/push-notifications/push-notifications";
|
||||||
import { isElectron } from "../../core/electron/electron";
|
import { isElectron } from "@/core/electron/electron";
|
||||||
|
|
||||||
export type ChatTabs = "chats" | "channels" | "contacts" | "dms"
|
export type ChatTabs = "chats" | "channels" | "contacts" | "dms"
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { LeftPanel } from "./left/LeftPanel";
|
import { LeftPanel } from "./left/LeftPanel";
|
||||||
import { RightPanel } from "./right/RightPanel";
|
import { RightPanel } from "./right/RightPanel";
|
||||||
import "../css/chat.scss";
|
import "@/pages/chat/css/chat.scss";
|
||||||
|
|
||||||
export default function ChatPage() {
|
export default function ChatPage() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { PRODUCT_NAME } from "../../../../core/config";
|
import { PRODUCT_NAME } from "@/core/config";
|
||||||
import useProfile from "../../hooks/useProfile";
|
import useProfile from "@/pages/chat/hooks/useProfile";
|
||||||
import defaultAvatar from "../../../resources/images/default-avatar.png";
|
import defaultAvatar from "@/images/default-avatar.png";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { ProfileDialog } from "./profile/ProfileDialog";
|
import { ProfileDialog } from "./profile/ProfileDialog";
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useAppState } from "../../state";
|
import { useAppState } from "@/pages/chat/state";
|
||||||
|
|
||||||
export function ChatTabs() {
|
export function ChatTabs() {
|
||||||
const { chat, setActiveTab, switchToPublicChat } = useAppState();
|
const { chat, setActiveTab, switchToPublicChat } = useAppState();
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { useDM, type DMUser } from "../../hooks/useDM";
|
import { useDM, type DMUser } from "@/pages/chat/hooks/useDM";
|
||||||
import { useAppState } from "../../state";
|
import { useAppState } from "@/pages/chat/state";
|
||||||
import { fetchUserPublicKey } from "../../../../core/api/dmApi";
|
import { fetchUserPublicKey } from "@/core/api/dmApi";
|
||||||
import defaultAvatar from "../../../../images/default-avatar.png";
|
import defaultAvatar from "@/images/default-avatar.png";
|
||||||
|
|
||||||
export function DMUsersList() {
|
export function DMUsersList() {
|
||||||
const { dmUsers, isLoadingUsers, loadUsers } = useDM();
|
const { dmUsers, isLoadingUsers, loadUsers } = useDM();
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { PRODUCT_NAME } from "../../../../core/config";
|
import { PRODUCT_NAME } from "@/core/config";
|
||||||
import { useAppState } from "../../state";
|
import { useAppState } from "@/pages/chat/state";
|
||||||
import defaultAvatar from "../../../../images/default-avatar.png";
|
import defaultAvatar from "@/images/default-avatar.png";
|
||||||
import { useState, type FormEvent } from "react";
|
import { useState, type FormEvent } from "react";
|
||||||
import { ProfileDialog } from "./profile/ProfileDialog";
|
import { ProfileDialog } from "./profile/ProfileDialog";
|
||||||
import { SettingsDialog } from "./settings/SettingsDialog";
|
import { SettingsDialog } from "./settings/SettingsDialog";
|
||||||
import { DMUsersList } from "./DMUsersList";
|
import { DMUsersList } from "./DMUsersList";
|
||||||
import type { Tabs } from "mdui";
|
import type { Tabs } from "mdui";
|
||||||
import type { ChatTabs } from "../../state";
|
import type { ChatTabs } from "@/pages/chat/state";
|
||||||
|
|
||||||
function BottomAppBar() {
|
function BottomAppBar() {
|
||||||
const [settingsOpen, onSettingsOpenChange] = useState(false);
|
const [settingsOpen, onSettingsOpenChange] = useState(false);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
import type { Size2D, Rect } from "../../../../../core/types";
|
import type { Size2D, Rect } from "@/core/types";
|
||||||
|
|
||||||
interface ImageCropperProps {
|
interface ImageCropperProps {
|
||||||
onCrop: (croppedImageData: string) => void;
|
onCrop: (croppedImageData: string) => void;
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { useState, useEffect, useRef, type FormEvent } from "react";
|
import { useState, useEffect, useRef, type FormEvent } from "react";
|
||||||
import defaultAvatar from "../../../../../images/default-avatar.png";
|
import defaultAvatar from "@/images/default-avatar.png";
|
||||||
import type { TextField } from "mdui/components/text-field";
|
import type { TextField } from "mdui/components/text-field";
|
||||||
import type { DialogProps } from "../../../../../core/types";
|
import type { DialogProps } from "@/core/types";
|
||||||
import { MaterialDialog } from "../../../../../core/components/Dialog";
|
import { MaterialDialog } from "@/core/components/Dialog";
|
||||||
import useProfile from "../../../hooks/useProfile";
|
import useProfile from "@/pages/chat/hooks/useProfile";
|
||||||
import { ImageCropper } from "./ImageCropper";
|
import { ImageCropper } from "./ImageCropper";
|
||||||
import { MaterialTextField } from "../../../../../core/components/TextField";
|
import { MaterialTextField } from "@/core/components/TextField";
|
||||||
|
|
||||||
export function ProfileDialog({ isOpen, onOpenChange }: DialogProps) {
|
export function ProfileDialog({ isOpen, onOpenChange }: DialogProps) {
|
||||||
const { profileData, isLoading, isUpdating, updateProfileData, uploadProfilePictureData } = useProfile();
|
const { profileData, isLoading, isUpdating, updateProfileData, uploadProfilePictureData } = useProfile();
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { PRODUCT_NAME, API_BASE_URL } from "../../../../../core/config";
|
import { PRODUCT_NAME, API_BASE_URL } from "@/core/config";
|
||||||
import type { DialogProps } from "../../../../../core/types";
|
import type { DialogProps } from "@/core/types";
|
||||||
import { MaterialDialog } from "../../../../../core/components/Dialog";
|
import { MaterialDialog } from "@/core/components/Dialog";
|
||||||
import { initialize, isSupported, startElectronReceiver, stopElectronReceiver, subscribe, unsubscribe } from "../../../../../core/push-notifications/push-notifications";
|
import { initialize, isSupported, startElectronReceiver, stopElectronReceiver, subscribe, unsubscribe } from "@/core/push-notifications/push-notifications";
|
||||||
import { isElectron } from "../../../../../core/electron/electron";
|
import { isElectron } from "@/core/electron/electron";
|
||||||
import { useAppState } from "../../../state";
|
import { useAppState } from "@/pages/chat/state";
|
||||||
import type { Switch } from "mdui/components/switch";
|
import type { Switch } from "mdui/components/switch";
|
||||||
import { getAuthHeaders } from "../../../../../core/api/authApi";
|
import { getAuthHeaders } from "@/core/api/authApi";
|
||||||
|
|
||||||
export function SettingsDialog({ isOpen, onOpenChange }: DialogProps) {
|
export function SettingsDialog({ isOpen, onOpenChange }: DialogProps) {
|
||||||
const [activePanel, setActivePanel] = useState("notifications-settings");
|
const [activePanel, setActivePanel] = useState("notifications-settings");
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { useState, useEffect, useRef } from "react";
|
import { useState, useEffect, useRef } from "react";
|
||||||
import { MaterialDialog } from "../../../../core/components/Dialog";
|
import { MaterialDialog } from "@/core/components/Dialog";
|
||||||
import { RichTextArea } from "../../../../core/components/RichTextArea";
|
import { RichTextArea } from "@/core/components/RichTextArea";
|
||||||
import type { Message } from "../../../../core/types";
|
import type { Message } from "@/core/types";
|
||||||
import Quote from "../../../../core/components/Quote";
|
import Quote from "@/core/components/Quote";
|
||||||
import AnimatedHeight from "../../../../core/components/animations/AnimatedHeight";
|
import AnimatedHeight from "@/core/components/animations/AnimatedHeight";
|
||||||
import { useImmer } from "use-immer";
|
import { useImmer } from "use-immer";
|
||||||
import { EmojiMenu } from "./EmojiMenu";
|
import { EmojiMenu } from "./EmojiMenu";
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useAppState } from "../../state";
|
import { useAppState } from "@/pages/chat/state";
|
||||||
import defaultAvatar from "../../../resources/images/default-avatar.png";
|
import defaultAvatar from "@/images/default-avatar.png";
|
||||||
|
|
||||||
export function ChatMainHeader() {
|
export function ChatMainHeader() {
|
||||||
const { currentChat } = useAppState().chat;
|
const { currentChat } = useAppState().chat;
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
import { Message } from "./Message";
|
import { Message } from "./Message";
|
||||||
import { useAppState } from "../../state";
|
import { useAppState } from "@/pages/chat/state";
|
||||||
import type { Message as MessageType } from "../../../../core/types";
|
import type { Message as MessageType } from "@/core/types";
|
||||||
import type { UserProfile } from "../../../../core/types";
|
import type { UserProfile } from "@/core/types";
|
||||||
import { UserProfileDialog } from "./UserProfileDialog";
|
import { UserProfileDialog } from "./UserProfileDialog";
|
||||||
import { MessageContextMenu, type ContextMenuState } from "./MessageContextMenu";
|
import { MessageContextMenu, type ContextMenuState } from "./MessageContextMenu";
|
||||||
import { fetchUserProfile } from "../../../../core/api/profileApi";
|
import { fetchUserProfile } from "@/core/api/profileApi";
|
||||||
import { useEffect, useState, type ReactNode } from "react";
|
import { useEffect, useState, type ReactNode } from "react";
|
||||||
import { delay } from "../../../../utils/utils";
|
import { delay } from "@/utils/utils";
|
||||||
import { MaterialDialog } from "../../../../core/components/Dialog";
|
import { MaterialDialog } from "@/core/components/Dialog";
|
||||||
import { request } from "../../../../core/websocket";
|
import { request } from "@/core/websocket";
|
||||||
import type { AddReactionRequest, AddDmReactionRequest } from "../../../../core/types";
|
import type { AddReactionRequest, AddDmReactionRequest } from "@/core/types";
|
||||||
|
|
||||||
interface ChatMessagesProps {
|
interface ChatMessagesProps {
|
||||||
messages?: MessageType[];
|
messages?: MessageType[];
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useState, useEffect, useRef, useCallback } from "react";
|
import { useState, useEffect, useRef, useCallback } from "react";
|
||||||
import { EMOJI_CATEGORIES, getRecentEmojis, addRecentEmoji } from "./emojiData";
|
import { EMOJI_CATEGORIES, getRecentEmojis, addRecentEmoji } from "./emojiData";
|
||||||
import type { Size2D } from "../../../../core/types";
|
import type { Size2D } from "@/core/types";
|
||||||
|
|
||||||
interface BaseEmojiMenuProps {
|
interface BaseEmojiMenuProps {
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
import { formatTime, id } from "../../../../utils/utils";
|
import { formatTime, id } from "@/utils/utils";
|
||||||
import type { Attachment, Message as MessageType, Reaction } from "../../../../core/types";
|
import type { Attachment, Message as MessageType, Reaction } from "@/core/types";
|
||||||
import defaultAvatar from "../../../../images/default-avatar.png";
|
import defaultAvatar from "@/images/default-avatar.png";
|
||||||
import Quote from "../../../../core/components/Quote";
|
import Quote from "@/core/components/Quote";
|
||||||
import { parse } from "marked";
|
import { parse } from "marked";
|
||||||
import DOMPurify from "dompurify";
|
import DOMPurify from "dompurify";
|
||||||
import { useEffect, useState, useRef } from "react";
|
import { useEffect, useState, useRef } from "react";
|
||||||
import { getCurrentKeys } from "../../../../core/api/authApi";
|
import { getCurrentKeys } from "@/core/api/authApi";
|
||||||
import { ecdhSharedSecret, deriveWrappingKey } from "../../../../utils/crypto/asymmetric";
|
import { ecdhSharedSecret, deriveWrappingKey } from "@/utils/crypto/asymmetric";
|
||||||
import { importAesGcmKey, aesGcmDecrypt } from "../../../../utils/crypto/symmetric";
|
import { importAesGcmKey, aesGcmDecrypt } from "@/utils/crypto/symmetric";
|
||||||
import { getAuthHeaders } from "../../../../core/api/authApi";
|
import { getAuthHeaders } from "@/core/api/authApi";
|
||||||
import { useAppState } from "../../state";
|
import { useAppState } from "@/pages/chat/state";
|
||||||
import { ub64 } from "../../../../utils/utils";
|
import { ub64 } from "@/utils/utils";
|
||||||
import { useImmer } from "use-immer";
|
import { useImmer } from "use-immer";
|
||||||
import { createPortal } from "react-dom";
|
import { createPortal } from "react-dom";
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useState, useEffect, useRef } from "react";
|
import { useState, useEffect, useRef } from "react";
|
||||||
import type { Message, Size2D } from "../../../../core/types";
|
import type { Message, Size2D } from "@/core/types";
|
||||||
import { EmojiMenu } from "./EmojiMenu";
|
import { EmojiMenu } from "./EmojiMenu";
|
||||||
|
|
||||||
interface MessageContextMenuProps {
|
interface MessageContextMenuProps {
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { useState, useEffect, useRef } from "react";
|
import { useState, useEffect, useRef } from "react";
|
||||||
import { useAppState } from "../../state";
|
import { useAppState } from "@/pages/chat/state";
|
||||||
import { MessagePanel, type MessagePanelState } from "./panels/MessagePanel";
|
import { MessagePanel, type MessagePanelState } from "./panels/MessagePanel";
|
||||||
import { ChatMessages } from "./ChatMessages";
|
import { ChatMessages } from "./ChatMessages";
|
||||||
import { ChatInputWrapper } from "./ChatInputWrapper";
|
import { ChatInputWrapper } from "./ChatInputWrapper";
|
||||||
import { setGlobalMessageHandler } from "../../../../core/websocket";
|
import { setGlobalMessageHandler } from "@/core/websocket";
|
||||||
import type { Message, WebSocketMessage } from "../../../../core/types";
|
import type { Message, WebSocketMessage } from "@/core/types";
|
||||||
import defaultAvatar from "../../../../images/default-avatar.png";
|
import defaultAvatar from "@/images/default-avatar.png";
|
||||||
import AnimatedOpacity from "../../../../core/components/animations/AnimatedOpacity";
|
import AnimatedOpacity from "@/core/components/animations/AnimatedOpacity";
|
||||||
import type { DMPanel } from "./panels/DMPanel";
|
import type { DMPanel } from "./panels/DMPanel";
|
||||||
|
|
||||||
interface MessagePanelRendererProps {
|
interface MessagePanelRendererProps {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useAppState } from "../../state";
|
import { useAppState } from "@/pages/chat/state";
|
||||||
import { MessagePanelRenderer } from "./MessagePanelRenderer";
|
import { MessagePanelRenderer } from "./MessagePanelRenderer";
|
||||||
|
|
||||||
export function RightPanel() {
|
export function RightPanel() {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import type { DialogProps } from "../../../../core/types";
|
import type { DialogProps } from "@/core/types";
|
||||||
import type { UserProfile } from "../../../../core/types";
|
import type { UserProfile } from "@/core/types";
|
||||||
import { MaterialDialog } from "../../../../core/components/Dialog";
|
import { MaterialDialog } from "@/core/components/Dialog";
|
||||||
import { formatTime } from "../../../../utils/utils";
|
import { formatTime } from "@/utils/utils";
|
||||||
import defaultAvatar from "../../../../images/default-avatar.png";
|
import defaultAvatar from "@/images/default-avatar.png";
|
||||||
|
|
||||||
interface UserProfileDialogProps extends DialogProps {
|
interface UserProfileDialogProps extends DialogProps {
|
||||||
userProfile: UserProfile | null;
|
userProfile: UserProfile | null;
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import {
|
|||||||
editDmEnvelope,
|
editDmEnvelope,
|
||||||
deleteDmEnvelope
|
deleteDmEnvelope
|
||||||
} from "../../../../../core/api/dmApi";
|
} from "../../../../../core/api/dmApi";
|
||||||
import type { DmEncryptedJSON, DmEnvelope, DMWebSocketMessage, EncryptedMessageJson, Message } from "../../../../../core/types";
|
import type { DmEncryptedJSON, DmEnvelope, DMWebSocketMessage, EncryptedMessageJson, Message } from "@/core/types";
|
||||||
import type { UserState } from "../../../state";
|
import type { UserState } from "@/pages/chat/state";
|
||||||
|
|
||||||
export interface DMPanelData {
|
export interface DMPanelData {
|
||||||
userId: number;
|
userId: number;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { Message, WebSocketMessage } from "../../../../../core/types";
|
import type { Message, WebSocketMessage } from "@/core/types";
|
||||||
import type { UserState } from "../../../state";
|
import type { UserState } from "@/pages/chat/state";
|
||||||
|
|
||||||
export interface MessagePanelState {
|
export interface MessagePanelState {
|
||||||
id: string;
|
id: string;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { MessagePanel } from "./MessagePanel";
|
import { MessagePanel } from "./MessagePanel";
|
||||||
import { API_BASE_URL } from "../../../../../core/config";
|
import { API_BASE_URL } from "@/core/config";
|
||||||
import { getAuthHeaders } from "../../../../../core/api/authApi";
|
import { getAuthHeaders } from "@/core/api/authApi";
|
||||||
import { request } from "../../../../../core/websocket";
|
import { request } from "@/core/websocket";
|
||||||
import type { ChatWebSocketMessage, Message, SendMessageRequest, ReactionUpdateWebSocketMessage } from "../../../../../core/types";
|
import type { ChatWebSocketMessage, Message, SendMessageRequest, ReactionUpdateWebSocketMessage } from "@/core/types";
|
||||||
import type { UserState } from "../../../state";
|
import type { UserState } from "@/pages/chat/state";
|
||||||
|
|
||||||
export class PublicChatPanel extends MessagePanel {
|
export class PublicChatPanel extends MessagePanel {
|
||||||
private messagesLoaded: boolean = false;
|
private messagesLoaded: boolean = false;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Navigate, useNavigate } from "react-router-dom";
|
import { Navigate, useNavigate } from "react-router-dom";
|
||||||
import { useAppState } from "../chat/state";
|
import { useAppState } from "@/pages/chat/state";
|
||||||
import { isElectron } from "../../core/electron/electron";
|
import { isElectron } from "@/core/electron/electron";
|
||||||
import "./home.scss";
|
import "./home.scss";
|
||||||
|
|
||||||
function GitHubLink({ children }: { children: React.ReactNode }) {
|
function GitHubLink({ children }: { children: React.ReactNode }) {
|
||||||
|
|||||||
@@ -13,6 +13,12 @@
|
|||||||
"moduleDetection": "force",
|
"moduleDetection": "force",
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
|
|
||||||
|
/* Path mapping */
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["src/*"]
|
||||||
|
},
|
||||||
|
|
||||||
/* Linting */
|
/* Linting */
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"erasableSyntaxOnly": true,
|
"erasableSyntaxOnly": true,
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { createHtmlPlugin } from "vite-plugin-html";
|
|||||||
import autoprefixer from "autoprefixer";
|
import autoprefixer from "autoprefixer";
|
||||||
import electron from "vite-plugin-electron/simple";
|
import electron from "vite-plugin-electron/simple";
|
||||||
import react from "@vitejs/plugin-react";
|
import react from "@vitejs/plugin-react";
|
||||||
|
import path from "path";
|
||||||
|
|
||||||
const plugins: PluginOption[] = [
|
const plugins: PluginOption[] = [
|
||||||
react(),
|
react(),
|
||||||
@@ -46,6 +47,11 @@ if (process.env.VITE_ELECTRON) {
|
|||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: plugins,
|
plugins: plugins,
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
"@": path.resolve(__dirname, "./src")
|
||||||
|
}
|
||||||
|
},
|
||||||
server: {
|
server: {
|
||||||
host: '0.0.0.0',
|
host: '0.0.0.0',
|
||||||
port: 8301,
|
port: 8301,
|
||||||
|
|||||||
Reference in New Issue
Block a user