diff --git a/package.json b/package.json index 43ee5956..b68da4f5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vocechat-web", - "version": "0.3.54", + "version": "0.3.55", "private": true, "homepage": "https://voce.chat", "dependencies": { diff --git a/src/app/config.ts b/src/app/config.ts index 92325d40..2cc33e8c 100644 --- a/src/app/config.ts +++ b/src/app/config.ts @@ -12,8 +12,10 @@ let prices: Price[] = [ } ]; const official_dev = `https://dev.voce.chat`; -// const local_dev = `http://07333.qicp.vip:3030`; const local_dev = official_dev; + +// const local_dev = `http://07333.qicp.vip:3030`; +// const local_dev = `https://im.ttt.td`; // const local_dev = `http://localhost:3333`; export const BASE_ORIGIN = process.env.REACT_APP_RELEASE ? `${location.origin}` diff --git a/src/common/component/BlankPlaceholder.tsx b/src/common/component/BlankPlaceholder.tsx index 4268398f..97c73cda 100644 --- a/src/common/component/BlankPlaceholder.tsx +++ b/src/common/component/BlankPlaceholder.tsx @@ -12,7 +12,6 @@ import IconInvite from "../../assets/icons/placeholder.invite.svg"; import IconDownload from "../../assets/icons/placeholder.download.svg"; import UsersModal from "./UsersModal"; import { useAppSelector } from "../../app/store"; -import useLicense from "../hook/useLicense"; interface Props { @@ -25,11 +24,10 @@ const classes = { }; const BlankPlaceholder: FC = ({ type = "chat" }) => { const { t } = useTranslation("welcome"); - const { server, isAdmin } = useAppSelector((store) => { return { server: store.server, isAdmin: store.authData.user?.is_admin }; }); + const { server, isAdmin, upgraded } = useAppSelector((store) => { return { server: store.server, isAdmin: store.authData.user?.is_admin, upgraded: store.server.upgraded }; }); const [inviteModalVisible, setInviteModalVisible] = useState(false); const [createChannelVisible, setCreateChannelVisible] = useState(false); const [userListVisible, setUserListVisible] = useState(false); - const { upgraded } = useLicense(); const toggleChannelModalVisible = () => { setCreateChannelVisible((prev) => !prev); }; diff --git a/src/common/component/Message/Reply.tsx b/src/common/component/Message/Reply.tsx index 2bca8630..e851ca91 100644 --- a/src/common/component/Message/Reply.tsx +++ b/src/common/component/Message/Reply.tsx @@ -77,12 +77,11 @@ const Reply: FC = ({ mid, interactive = true }) => { }, 3000); } }; + const defaultClass = `flex items-start flex-col md:flex-row p-2 bg-gray-100 dark:bg-gray-900 rounded-lg gap-2 mb-1`; if (!data) return
{t("reply_msg_del")}
; const currUser = users[data.from_uid || 0]; if (!currUser) return null; @@ -91,7 +90,7 @@ const Reply: FC = ({ mid, interactive = true }) => {
{ +// type Props = { +// refetchOnMountOrArgChange?: boolean +// } | undefined +const useLicense = (refetchOnMountOrArgChange = false) => { const { userCount, isGuest, upgraded } = useAppSelector((store) => { return { userCount: store.users.ids.length, isGuest: store.authData.guest, upgraded: store.server.upgraded }; }); - const { data: license, refetch: refetchLicense } = useGetLicenseQuery(undefined, { - refetchOnMountOrArgChange: true, + const { data: license, refetch: refetchLicense, isLoading } = useGetLicenseQuery(undefined, { + refetchOnMountOrArgChange, skip: isGuest }); const [check, { isLoading: isChecking, isSuccess: checked }] = useCheckLicenseMutation(); @@ -40,6 +42,7 @@ const useLicense = () => { reachLimit: userCount >= lUserLimit, license, checked, + isLoading, checking: isChecking, upserting, upserted, diff --git a/src/common/hook/usePreload.ts b/src/common/hook/usePreload.ts index 9ee21266..c0a7ea71 100644 --- a/src/common/hook/usePreload.ts +++ b/src/common/hook/usePreload.ts @@ -7,11 +7,13 @@ import { useLazyGetServerQuery } from "../../app/services/server"; import useStreaming from "./useStreaming"; import { useAppSelector } from "../../app/store"; import { useLazyLoadMoreMessagesQuery } from "../../app/services/message"; +import useLicense from "./useLicense"; // type Props={ // guest?:boolean // } let preloadChannelMsgs = false; export default function usePreload() { + const { isLoading: loadingLicense } = useLicense(false); const [preloadChannelMessages] = useLazyLoadMoreMessagesQuery(); const { rehydrate, rehydrated } = useRehydrate(); const { @@ -85,7 +87,7 @@ export default function usePreload() { }, [canStreaming]); return { - loading: usersLoading || serverLoading || favoritesLoading || !rehydrated, + loading: usersLoading || serverLoading || favoritesLoading || !rehydrated || loadingLicense, error: usersError && serverError && favoritesError, success: usersSuccess && serverSuccess && favoritesSuccess, data: { diff --git a/src/routes/chat/SessionList/Session.tsx b/src/routes/chat/SessionList/Session.tsx index 1d425f57..e44b293f 100644 --- a/src/routes/chat/SessionList/Session.tsx +++ b/src/routes/chat/SessionList/Session.tsx @@ -144,7 +144,7 @@ const Session: FC = ({
0 ? `w-36` : ``)}>{renderPreviewMessage(previewMsg)} {unreads > 0 && !isCurrentPath && ( - 99 && 'w-1.5 !h-1.5 p-0 min-w-[unset]', muted && "bg-gray-500")}> + 99 && 'w-1.5 !h-1.5 p-0 min-w-[unset]', muted && "bg-gray-500")}> {unreads > 99 ? null : unreads} )} diff --git a/src/routes/reg/SignInLink.tsx b/src/routes/reg/SignInLink.tsx index 52a75c27..bb993b97 100644 --- a/src/routes/reg/SignInLink.tsx +++ b/src/routes/reg/SignInLink.tsx @@ -1,16 +1,18 @@ import { useEffect } from 'react'; import { useTranslation } from 'react-i18next'; -import { NavLink } from 'react-router-dom'; +import { NavLink, useSearchParams } from 'react-router-dom'; import { isMobile } from '../../common/utils'; export default function SignInLink({ token }: { token?: string }) { const { t } = useTranslation("auth"); + let [searchParams] = useSearchParams(new URLSearchParams(location.search)); + const ctx = searchParams.get("ctx") ?? "app"; useEffect(() => { // 移动端访问,则跳转 - if (isMobile() && !!token) { - location.href = `https://join.voce.chat/download?link=${encodeURIComponent(`${location.origin}&magic_token=${token}`)}`; + if (isMobile() && !!token && ctx == "app") { + location.href = `https://join.voce.chat/download?link=${encodeURIComponent(`${location.origin}?magic_token=${token}`)}`; } - }, [token]); + }, [token, ctx]); return (
diff --git a/src/routes/setting/License/index.tsx b/src/routes/setting/License/index.tsx index e6ad0a93..572cbfed 100644 --- a/src/routes/setting/License/index.tsx +++ b/src/routes/setting/License/index.tsx @@ -27,7 +27,7 @@ const Item = ({ label, data, foldable = false, ...rest }: ItemProps) => { export default function License() { const { t, i18n } = useTranslation("setting"); // const { t: ct } = useTranslation(); - const { license: licenseInfo, reachLimit, upsertLicense, upserting, upserted } = useLicense(); + const { license: licenseInfo, reachLimit, upsertLicense, upserting, upserted } = useLicense(true); const [modalVisible, setModalVisible] = useState(false); const [updateVisible, setUpdateVisible] = useState(false); const [base58Fold, setBase58Fold] = useState(true); diff --git a/src/routes/setting/navs.tsx b/src/routes/setting/navs.tsx index ef4b24a7..ec8575cb 100644 --- a/src/routes/setting/navs.tsx +++ b/src/routes/setting/navs.tsx @@ -14,7 +14,6 @@ import Version from "../../common/component/Version"; import ConfigAgora from "./config/Agora"; import { useAppSelector } from "../../app/store"; import ServerVersionChecker from "../../common/component/ServerVersionChecker"; -import useLicense from "../../common/hook/useLicense"; const navs = [ { @@ -98,10 +97,9 @@ const navs = [ ]; const useNavs = () => { - const { upgraded } = useLicense(); const { t } = useTranslation("setting"); - const loginUser = useAppSelector((store) => { - return store.authData.user; + const { loginUser, upgraded } = useAppSelector((store) => { + return { loginUser: store.authData.user, upgraded: store.server.upgraded }; }); const transformedNavs = navs.map(n => { const { name, items, ...rest } = n; diff --git a/tailwind.config.js b/tailwind.config.js index f379de9f..dbab1e2b 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -4,6 +4,9 @@ module.exports = { content: ["./src/**/*.{js,jsx,ts,tsx}", "./public/*.html"], theme: { extend: { + fontSize: { + xs: ["0.75rem", "1.125rem"] + }, colors: { primary: { 25: "#F5FEFF",