diff --git a/public/widget.js b/public/widget.js index 59ee2624..171d369a 100644 --- a/public/widget.js +++ b/public/widget.js @@ -20,7 +20,7 @@ const styles = { Object.assign(wrapper.style, styles); wrapper.src = `${new URL(_src).origin}/widget.html?host=${hostId}&themeColor=${encodeURIComponent( themeColor -)}&from=${encodeURIComponent(location.host)}`; +)}&from=${encodeURIComponent(location.hostname)}`; wrapper.width = closeWidth; wrapper.height = closeHeight; wrapper.frameborder = 0; diff --git a/src/widget/Popup/Login/index.tsx b/src/widget/Popup/Login/index.tsx index 3dc19c7f..5ec1243d 100644 --- a/src/widget/Popup/Login/index.tsx +++ b/src/widget/Popup/Login/index.tsx @@ -34,12 +34,13 @@ const Login = () => { } const data = new FormData(form); const name = data.get("username") as string; - const email = data.get("email") as string; - console.log("name,email", name, email); + // const email = data.get("email") as string; + console.log("name,email", name); + const randomEmail = `${name}-${(Math.random() + 1).toString(36).substring(7)}@${from}`; register({ - name: `${name}-[${from}]`, - email, - password: email, + name, + email: randomEmail, + password: randomEmail, }); // const content = new FormData(form).get("prompt") as string; }; @@ -61,10 +62,7 @@ const Login = () => { } } }, [error]); - - if (!loginConfigSuccess) return null; - const { github: enableGithubLogin, google: enableGoogleLogin, @@ -76,7 +74,7 @@ const Login = () => {
- + {/* */} Start Chat {hasSocialLogins && } {googleLogin && } diff --git a/src/widget/WidgetContext.tsx b/src/widget/WidgetContext.tsx index 0d009140..ddda44a7 100644 --- a/src/widget/WidgetContext.tsx +++ b/src/widget/WidgetContext.tsx @@ -4,7 +4,7 @@ import { useAppSelector } from '../app/store'; import { getContrastColor } from '../common/utils'; const color = decodeURIComponent(new URLSearchParams(location.search).get("themeColor") || "#1fe1f9"); -const from = decodeURIComponent(new URLSearchParams(location.search).get("from") || "widget"); +const from = decodeURIComponent(new URLSearchParams(location.search).get("from") || "widget.link"); const fgColor = getContrastColor(color); // 判断是否是iframe上下文 const embed = window.location !== window.parent.location; @@ -12,7 +12,7 @@ const WidgetContext = createContext({ color, fgColor, embed, from, loading: true function WidgetProvider({ children }: { children: ReactNode }) { - const { isLoading: loadingServerData, isError } = useGetServerQuery(); + const { isLoading: loadingServerData } = useGetServerQuery(); const { isLoading: loadingConfig, data: loginConfig } = useGetLoginConfigQuery(); const serverData = useAppSelector(store => store.server);