diff --git a/public/locales/de/setting.json b/public/locales/de/setting.json index 5fcad045..f1e90c3d 100644 --- a/public/locales/de/setting.json +++ b/public/locales/de/setting.json @@ -38,7 +38,8 @@ "sub_desc": "Jedes VoceSpace-Konto bietet unbegrenzte Gesprächsminuten, 5 gleichzeitige Teilnehmer und eine kostenlose 4K-Auflösung. Es ist keine Kontoerstellung erforderlich. Befolgen Sie die unten stehenden Anweisungen, um Ihren VoceSpace korrekt zu konfigurieren.", "domain_desc": "Diese Domain benötigt einen DNS-A-Eintrag, der auf die IP-Adresse des aktuellen Servers verweist, auf dem Sie VoceChat hosten.", "enable": "Aktivieren", - "how_to": "Nach der Aktivierung legen Sie bitte eine benutzerdefinierte Domain fest. Klicken Sie auf „Speichern“, und das System aktiviert VoceSpace automatisch." + "how_to": "Nach der Aktivierung legen Sie bitte eine benutzerdefinierte Domain fest. Klicken Sie auf „Speichern“, und das System aktiviert VoceSpace automatisch.", + "old": "Ihre aktuelle Serverversion ist veraltet. Wir haben den offiziellen VoceSpace (vocespace.com) als Standard-Audio-/Videodienst aktiviert. Um Ihre eigene private Installation zu nutzen, aktualisieren Sie bitte vocechat-server auf Version 0.5.8 oder höher." }, "channel": { "leave": "Kanal verlassen", diff --git a/public/locales/en/setting.json b/public/locales/en/setting.json index c5ca0376..ce8dc4fc 100644 --- a/public/locales/en/setting.json +++ b/public/locales/en/setting.json @@ -282,7 +282,8 @@ "sub_desc": "Each VoceSpace account will enjoy no limit minutes, 5 person concurrent and 4k resolution for free. No account creation required. Follow the instruction below to configure your VoceSpace correctly.", "domain_desc": "This domain needs to have a DNS A record pointing to the current server IP you are hosting VoceChat.", "enable": "Enable", - "how_to": "After enabling, please set a custom domain then click save, and the system will automatically enable VoceSpace." + "how_to": "After enabling, please set a custom domain then click save, and the system will automatically enable VoceSpace.", + "old": "Your current server version is outdated. We have enabled the official VoceSpace (vocespace.com) as your default audio/video service. To use your own private deployment, please update vocechat-server to v0.5.8 or higher." }, "third_app": { "key": "API Secure Key", diff --git a/public/locales/es/setting.json b/public/locales/es/setting.json index 8bc4d5ff..a0a48cc0 100644 --- a/public/locales/es/setting.json +++ b/public/locales/es/setting.json @@ -38,7 +38,8 @@ ], "domain_desc": "Los nombres de dominio personalizados deben resolver a la dirección IP local (para usuarios en China continental, como Alibaba Cloud y Tencent Cloud, se requiere el registro ICP)", "enable": "Habilitar", - "how_to": "Después de habilitar, configure el nombre de dominio y guarde. Los pasos restantes se completarán automáticamente." + "how_to": "Después de habilitar, configure el nombre de dominio y guarde. Los pasos restantes se completarán automáticamente.", + "old": "Su versión actual del servidor está desactualizada. Hemos habilitado el VoceSpace oficial (vocespace.com) como su servicio de audio/video predeterminado. Para usar su propia implementación privada, actualice vocechat-server a la versión 0.5.8 o superior." }, "channel": { "leave": "Abandonar Canal", diff --git a/public/locales/fr/setting.json b/public/locales/fr/setting.json index c8ff476d..2be3a894 100644 --- a/public/locales/fr/setting.json +++ b/public/locales/fr/setting.json @@ -38,7 +38,8 @@ ], "domain_desc": "Les noms de domaine personnalisés doivent pointer vers l'adresse IP locale (pour les utilisateurs de Chine continentale, tels qu'Alibaba Cloud et Tencent Cloud, un enregistrement ICP est requis)", "enable": "Activer", - "how_to": "Après l'activation, veuillez définir le nom de domaine et enregistrer. Les étapes suivantes seront effectuées automatiquement." + "how_to": "Après l'activation, veuillez définir le nom de domaine et enregistrer. Les étapes suivantes seront effectuées automatiquement.", + "old": "Votre version actuelle du serveur est obsolète. Nous avons activé le VoceSpace officiel (vocespace.com) comme votre service audio/vidéo par défaut. Pour utiliser votre propre déploiement privé, veuillez mettre à jour vocechat-server vers la version 0.5.8 ou supérieure." }, "channel": { "leave": "Quitter le Canal", diff --git a/public/locales/jp/setting.json b/public/locales/jp/setting.json index 7bf5c77e..004cbde0 100644 --- a/public/locales/jp/setting.json +++ b/public/locales/jp/setting.json @@ -35,7 +35,8 @@ "domain_desc": "カスタムドメイン名はローカル IP アドレスに解決される必要があります(Alibaba Cloud や Tencent Cloud など、中国本土のユーザーの場合は ICP 申請が必要です)", "enable": "有効にする", - "how_to": "有効にした後、ドメイン名を設定して保存してください。残りの手順は自動的に完了します。" + "how_to": "有効にした後、ドメイン名を設定して保存してください。残りの手順は自動的に完了します。", + "old": "現在のサーバーバージョンは古くなっています。公式の VoceSpace (vocespace.com) をデフォルトのオーディオ/ビデオサービスとして有効にしました。独自のプライベート導入を使用するには、vocechat-server を v0.5.8 以上に更新してください。" }, "channel": { "leave": "チャンネルを離れる", diff --git a/public/locales/pt/setting.json b/public/locales/pt/setting.json index 90d4bd08..00bb434a 100644 --- a/public/locales/pt/setting.json +++ b/public/locales/pt/setting.json @@ -38,7 +38,8 @@ ], "domain_desc": "Les noms de domaine personnalisés doivent pointer vers l'adresse IP locale (pour les utilisateurs de Chine continentale, tels qu'Alibaba Cloud et Tencent Cloud, un enregistrement ICP est requis)", "enable": "Activer", - "how_to": "Après l'activation, veuillez définir le nom de domaine et enregistrer. Les étapes suivantes seront effectuées automatiquement." + "how_to": "Après l'activation, veuillez définir le nom de domaine et enregistrer. Les étapes suivantes seront effectuées automatiquement.", + "old": "Votre version actuelle du serveur est obsolète. Nous avons activé le VoceSpace officiel (vocespace.com) comme votre service audio/vidéo par défaut. Pour utiliser votre propre déploiement privé, veuillez mettre à jour vocechat-server vers la version 0.5.8 ou supérieure." }, "channel": { "leave": "Leave Channel", diff --git a/public/locales/ru/setting.json b/public/locales/ru/setting.json index 2036604f..2f6e88d9 100644 --- a/public/locales/ru/setting.json +++ b/public/locales/ru/setting.json @@ -38,7 +38,8 @@ ], "domain_desc": "Пользовательские доменные имена должны разрешаться в локальный IP-адрес (для пользователей в материковом Китае, таких как Alibaba Cloud и Tencent Cloud, требуется подача заявки на ICP)", "enable": "Включить", - "how_to": "После включения, пожалуйста, укажите доменное имя и сохраните. Остальные шаги будут выполнены автоматически." + "how_to": "После включения, пожалуйста, укажите доменное имя и сохраните. Остальные шаги будут выполнены автоматически.", + "old": "Ваша текущая версия сервера устарела. Мы включили официальный VoceSpace (vocespace.com) в качестве вашей службы аудио/видео по умолчанию. Чтобы использовать собственное частное развертывание, обновите vocechat-server до версии 0.5.8 или выше." }, "channel": { "leave": "Покинуть канал", diff --git a/public/locales/tr/setting.json b/public/locales/tr/setting.json index 6537f205..80398de8 100644 --- a/public/locales/tr/setting.json +++ b/public/locales/tr/setting.json @@ -39,7 +39,8 @@ ], "domain_desc": "Özel alan adları yerel IP adresine çözümlenmelidir (Alibaba Cloud ve Tencent Cloud gibi Çin anakarasındaki kullanıcılar için ICP dosyalama gereklidir)", "enable": "Etkinleştir", - "how_to": "Etkinleştirdikten sonra lütfen alan adını ayarlayın ve kaydedin. Kalan adımlar otomatik olarak tamamlanacaktır." + "how_to": "Etkinleştirdikten sonra lütfen alan adını ayarlayın ve kaydedin. Kalan adımlar otomatik olarak tamamlanacaktır.", + "old": "Mevcut sunucu sürümünüz güncel değil. Resmi VoceSpace (vocespace.com) varsayılan ses/video hizmetiniz olarak etkinleştirildi. Kendi özel dağıtımınızı kullanmak için lütfen vocechat-server'ı v0.5.8 veya daha yüksek bir sürüme güncelleyin." }, "channel": { "leave": "Kanalı Terket", diff --git a/public/locales/zh/setting.json b/public/locales/zh/setting.json index 62ee7e9f..62271ab2 100644 --- a/public/locales/zh/setting.json +++ b/public/locales/zh/setting.json @@ -281,7 +281,8 @@ ], "domain_desc": "自定义域名需要是解析到本机IP的域名 (中国大陆用户,如阿里云和腾讯云,需备案)", "enable": "启用", - "how_to": "启用后,请设置域名并保存,其余步骤会自动化完成" + "how_to": "启用后,请设置域名并保存,其余步骤会自动化完成", + "old": "您当前的服务器版本过旧,已开启官方部署的VoceSpace地址(vocespace.com)作为默认音视频服务,如果依然需要私有部署,请更新vocechat-server到0.5.8以上版本再尝试。" }, "third_app": { "key": "API 安全密钥", diff --git a/src/routes/chat/VoiceChat/index.tsx b/src/routes/chat/VoiceChat/index.tsx index 9651e437..f388c6a6 100644 --- a/src/routes/chat/VoiceChat/index.tsx +++ b/src/routes/chat/VoiceChat/index.tsx @@ -26,7 +26,7 @@ const VoiceChat = ({ id, context = "channel" }: Props) => { const [chatType, setChatType] = useState<"agora" | "vocespace">("vocespace"); const currentVersion = useAppSelector((store) => store.server.version, shallowEqual); const showVoceSpace = useMemo(() => { - return compareVersion(currentVersion, "0.5.6") >= 0; + return compareVersion(currentVersion, "0.5.8") >= 0; }, [currentVersion]); const { joinVoice, joined, joining = false, joinedAtThisContext } = useVoice({ id, context }); @@ -103,11 +103,12 @@ const VoiceChat = ({ id, context = "channel" }: Props) => { }; const handleSendVocespaceRequest = async () => { + console.warn("vocespaceConfig", vocespaceConfig); + const genUUID = () => + "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (c) => + (+c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (+c / 4)))).toString(16) + ); if (vocespaceConfig && vocespaceConfig.state && vocespaceConfig.state === "undeployed") { - const genUUID = () => - "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (c) => - (+c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (+c / 4)))).toString(16) - ); await sendVoceSpaceMsg( `https://vocespace.com/${context}_${id}_${encodeURIComponent(genUUID())}` ); @@ -120,8 +121,14 @@ const VoiceChat = ({ id, context = "channel" }: Props) => { } await sendVoceSpaceMsg(url); } else { - // 跳转到/setting/video - navigate("/setting/video"); + if (!showVoceSpace) { + await sendVoceSpaceMsg( + `https://vocespace.com/${context}_${id}_${encodeURIComponent(genUUID())}` + ); + } else { + // 跳转到/setting/video + navigate("/setting/video"); + } } }; const handleOnClick = async () => { diff --git a/src/routes/setting/config/Vocespace.tsx b/src/routes/setting/config/Vocespace.tsx index 2a2e6bba..6c2f2a69 100644 --- a/src/routes/setting/config/Vocespace.tsx +++ b/src/routes/setting/config/Vocespace.tsx @@ -7,10 +7,27 @@ import Label from "@/components/styled/Label"; import SaveTip from "@/components/SaveTip"; import useConfig from "@/hooks/useConfig"; import { VocespaceConfig } from "@/types/server"; -import { ChangeEvent, useEffect, useRef, useState } from "react"; +import { ChangeEvent, useEffect, useMemo, useRef, useState } from "react"; +import Radio from "@/components/styled/Radio"; +import { useAppSelector } from "@/app/store"; +import { compareVersion } from "@/utils"; +import { shallowEqual } from "react-redux"; export function ConfigVocespace() { const { t } = useTranslation("setting", { keyPrefix: "vocespace" }); + const currentVersion = useAppSelector((store) => store.server.version, shallowEqual); + const showVoceSpace = useMemo(() => { + return compareVersion(currentVersion, "0.5.8") >= 0; + }, [currentVersion]); + + if (!showVoceSpace) { + return ( +
+ +
+ ); + } + const { changed, reset, values, setValues, toggleEnable, updateConfig, refetch } = useConfig("vocespace"); @@ -20,7 +37,6 @@ export function ConfigVocespace() { alert("Custom domain is required when enabling Vocespace."); return; } - // 后端快速返回结果,只要检测环境可以执行就立即返回成功,不然会一直pending等待,导致前端超时 const res = await updateConfig(_values); @@ -52,10 +68,10 @@ export function ConfigVocespace() { }); }; if (!values) return null; - const { url, license, enabled = false, password, state } = values as VocespaceConfig; + const { url, license, enabled = false, password, state, server_type } = values as VocespaceConfig; return ( -
+
@@ -85,10 +101,58 @@ export function ConfigVocespace() {
  • {t("prerequisite.1")}
  • {t("prerequisite.2")}
  • {t("prerequisite.3")}
  • +
  • + NAS deploy video:{" "} + + nas.mp4 + +
  • +
  • + NAS manual deployment:{" "} + + nas_manual.mp4 + +
  • +
  • + Vps deploy video:{" "} + + vps.mp4 + +
  • +
    + +
    + + { + setValues((prev) => { + if (!prev) return prev; + return { ...prev, server_type: v as "nas" | "vps" | "other" }; + }); + }} + /> +
    @@ -157,7 +221,21 @@ export function ConfigVocespace() { {t("prerequisite.4")}
    - {changed && } + {changed && ( + { + // empty all input + setValues({ + url: "", + license: "", + enabled: true, + password: "", + state, + }); + }} + /> + )} {/* */}
    ); diff --git a/src/types/server.ts b/src/types/server.ts index 8bd46787..e32fae0f 100644 --- a/src/types/server.ts +++ b/src/types/server.ts @@ -47,7 +47,8 @@ export interface VocespaceConfig { password: string; url: string; license: string; - state: "in_progress" | "success" | "failed" | "undeployed" | ""; + state: "success" | "undeployed" | ""; + server_type?: "nas" | "vps" | "other"; } export interface AgoraVoicingListResponse {