From ae0dc2c30dd62d6ef4f87239298ec89c47c55861 Mon Sep 17 00:00:00 2001 From: Stephen Zhou <38493346+hyoban@users.noreply.github.com> Date: Mon, 16 Dec 2024 19:13:46 +0800 Subject: [PATCH 1/6] feat: register or login with email and password (#2075) * feat: login with password * chore: auto-fix linting and formatting issues * feat: show email * refactor: login form * chore: update * fix: show login error * chore: update * credential provider * feat: confirm password * chore: update * revokeOtherSessions when update password * changelog * typecheck * chore: update * chore: update hono * feat: forget password * chore: update * feat: reset password page * feat: register form * chore: update * chore: update * chore: update * chore: update * fix: email login handler * fix: navigate to login after register * chore: remove forget password button for now * chore: update * feat: forget password page * chore: update hono * fix: forget-password link * feat: login email text * refactor: enhance login and forget password functionality - Updated the forget password page to include a back navigation button using MotionButtonBase. - Refactored the login component to utilize the new Login module, simplifying the structure. - Adjusted translations for consistency in the login text across English and German locales. - Improved the useAuthProviders hook to return a more structured AuthProvider interface. Signed-off-by: Innei * feat: add form validation and UI enhancements for login-related pages - Introduced form validation state management in forget-password, register, and reset-password components. - Updated button states to be disabled when forms are invalid, improving user experience. - Enhanced UI elements with consistent styling and layout adjustments, including the addition of MotionButtonBase for navigation. - Improved accessibility and responsiveness of card components. Signed-off-by: Innei * feat: enhance login component with dynamic provider buttons - Added MotionButtonBase for improved button animations and interactions. - Refactored the rendering logic to conditionally display login options based on the presence of credential providers. - Introduced a new icon mapping for providers to enhance visual representation. - Improved layout and styling for better user experience during login. Signed-off-by: Innei * feat: add GitHub provider icon and adjust button margin in login component - Introduced a GitHub icon to the provider icon map for enhanced visual representation. - Adjusted the margin of the submit button to improve layout consistency. Signed-off-by: Innei * chore: update --------- Signed-off-by: Innei Co-authored-by: hyoban Co-authored-by: DIYgod Co-authored-by: Innei Signed-off-by: Innei --- .../modules/profile/profile-setting-form.tsx | 5 + .../modules/profile/update-password-form.tsx | 138 +++++ .../src/pages/settings/(settings)/profile.tsx | 2 + apps/renderer/src/queries/auth.ts | 19 +- apps/server/client/modules/login/index.tsx | 302 ++++++++++ .../client/pages/(login)/forget-password.tsx | 112 ++++ apps/server/client/pages/(login)/login.tsx | 132 +---- apps/server/client/pages/(login)/register.tsx | 139 +++++ .../client/pages/(login)/reset-password.tsx | 130 ++++ apps/server/client/query/users.ts | 19 +- apps/server/package.json | 4 +- changelog/next.md | 2 + locales/external/de.json | 2 +- locales/external/en.json | 27 +- locales/settings/en.json | 7 + packages/shared/src/auth.ts | 42 +- packages/shared/src/hono.ts | 556 ++++++++++++------ pnpm-lock.yaml | 6 + 18 files changed, 1303 insertions(+), 341 deletions(-) create mode 100644 apps/renderer/src/modules/profile/update-password-form.tsx create mode 100644 apps/server/client/modules/login/index.tsx create mode 100644 apps/server/client/pages/(login)/forget-password.tsx create mode 100644 apps/server/client/pages/(login)/register.tsx create mode 100644 apps/server/client/pages/(login)/reset-password.tsx diff --git a/apps/renderer/src/modules/profile/profile-setting-form.tsx b/apps/renderer/src/modules/profile/profile-setting-form.tsx index 1319b5930..4bc0038f1 100644 --- a/apps/renderer/src/modules/profile/profile-setting-form.tsx +++ b/apps/renderer/src/modules/profile/profile-setting-form.tsx @@ -10,6 +10,7 @@ import { FormMessage, } from "@follow/components/ui/form/index.jsx" import { Input } from "@follow/components/ui/input/index.js" +import { Label } from "@follow/components/ui/label/index.js" import { cn } from "@follow/utils/utils" import { zodResolver } from "@hookform/resolvers/zod" import { useMutation } from "@tanstack/react-query" @@ -72,6 +73,10 @@ export const ProfileSettingForm = ({ return (
+
+ +

{user?.email}

+
data.newPassword === data.confirmPassword, { + message: "Passwords don't match", + path: ["confirmPassword"], + }) + +const UpdateExistingPasswordForm = () => { + const { t } = useTranslation("settings") + + const form = useForm>({ + resolver: zodResolver(updatePasswordFormSchema), + defaultValues: { + currentPassword: "", + newPassword: "", + confirmPassword: "", + }, + }) + + const updateMutation = useMutation({ + mutationFn: async (values: z.infer) => { + const res = await changePassword({ + currentPassword: values.currentPassword, + newPassword: values.newPassword, + revokeOtherSessions: true, + }) + if (res.error) { + throw new Error(res.error.message) + } + }, + onError: (error) => { + toast.error(error.message) + }, + onSuccess: (_) => { + toast(t("profile.update_password_success"), { + duration: 3000, + }) + form.reset() + }, + }) + + function onSubmit(values: z.infer) { + updateMutation.mutate(values) + } + + return ( + + + ( + + {t("profile.change_password.label")} + + + + + + )} + /> + ( + + + + + + + )} + /> + ( + + + + + + + )} + /> +
+ +
+ + + ) +} + +export const UpdatePasswordForm = () => { + const { data: hasPassword, isLoading } = useHasPassword() + + if (isLoading || !hasPassword) { + return null + } + + return +} diff --git a/apps/renderer/src/pages/settings/(settings)/profile.tsx b/apps/renderer/src/pages/settings/(settings)/profile.tsx index 510dfac7c..0a3464f9d 100644 --- a/apps/renderer/src/pages/settings/(settings)/profile.tsx +++ b/apps/renderer/src/pages/settings/(settings)/profile.tsx @@ -1,4 +1,5 @@ import { ProfileSettingForm } from "~/modules/profile/profile-setting-form" +import { UpdatePasswordForm } from "~/modules/profile/update-password-form" import { SettingsTitle } from "~/modules/settings/title" import { defineSettingPageData } from "~/modules/settings/utils" @@ -15,6 +16,7 @@ export function Component() { <> + ) } diff --git a/apps/renderer/src/queries/auth.ts b/apps/renderer/src/queries/auth.ts index 354d9b419..16751ddba 100644 --- a/apps/renderer/src/queries/auth.ts +++ b/apps/renderer/src/queries/auth.ts @@ -1,4 +1,4 @@ -import { getSession } from "@follow/shared/auth" +import { getSession, listAccounts } from "@follow/shared/auth" import type { AuthSession } from "@follow/shared/hono" import type { FetchError } from "ofetch" @@ -7,6 +7,23 @@ import { defineQuery } from "~/lib/defineQuery" export const auth = { getSession: () => defineQuery(["auth", "session"], () => getSession()), + getAccounts: () => + defineQuery(["auth", "accounts"], async () => { + const accounts = await listAccounts() + return accounts.data as Array<{ id: string; provider: string }> + }), +} + +export const useAccounts = () => { + return useAuthQuery(auth.getAccounts()) +} + +export const useHasPassword = () => { + const accounts = useAccounts() + return { + ...accounts, + data: !!accounts.data?.find((account) => account.provider === "credential"), + } } export const useSession = (options?: { enabled?: boolean }) => { diff --git a/apps/server/client/modules/login/index.tsx b/apps/server/client/modules/login/index.tsx new file mode 100644 index 000000000..949408ae0 --- /dev/null +++ b/apps/server/client/modules/login/index.tsx @@ -0,0 +1,302 @@ +import { UserAvatar } from "@client/components/ui/user-avatar" +import { queryClient } from "@client/lib/query-client" +import { useSession } from "@client/query/auth" +import { useAuthProviders } from "@client/query/users" +import { Logo } from "@follow/components/icons/logo.jsx" +import { AutoResizeHeight } from "@follow/components/ui/auto-resize-height/index.jsx" +import { Button, MotionButtonBase } from "@follow/components/ui/button/index.js" +import { Divider } from "@follow/components/ui/divider/index.js" +import { + Form, + FormControl, + FormField, + FormItem, + FormLabel, + FormMessage, +} from "@follow/components/ui/form/index.jsx" +import { Input } from "@follow/components/ui/input/index.js" +import { LoadingCircle } from "@follow/components/ui/loading/index.jsx" +import { authProvidersConfig } from "@follow/constants" +import { createSession, loginHandler, signOut } from "@follow/shared/auth" +import { DEEPLINK_SCHEME } from "@follow/shared/constants" +import { cn } from "@follow/utils/utils" +import { zodResolver } from "@hookform/resolvers/zod" +import { useCallback, useEffect, useMemo, useRef, useState } from "react" +import { useForm } from "react-hook-form" +import { Trans, useTranslation } from "react-i18next" +import { Link, useLocation, useNavigate } from "react-router" +import { toast } from "sonner" +import { z } from "zod" + +const overrideProviderIconMap: Record = { + apple: , + github: , +} + +export function Login() { + const { status, refetch } = useSession() + + const [redirecting, setRedirecting] = useState(false) + + const { data: authProviders, isLoading } = useAuthProviders() + + const location = useLocation() + const urlParams = new URLSearchParams(location.search) + const provider = urlParams.get("provider") + const isCredentialProvider = provider === "credential" + + const isAuthenticated = status === "authenticated" + + const { t } = useTranslation("external") + + useEffect(() => { + if (provider && !isCredentialProvider && status === "unauthenticated") { + loginHandler(provider) + setRedirecting(true) + } + }, [isCredentialProvider, provider, status]) + + const getCallbackUrl = useCallback(async () => { + const { data } = await createSession() + if (!data) return null + return { + url: `${DEEPLINK_SCHEME}auth?ck=${data.ck}&userId=${data.userId}`, + userId: data.userId, + } + }, []) + + const handleOpenApp = useCallback(async () => { + const callbackUrl = await getCallbackUrl() + if (!callbackUrl) return + window.open(callbackUrl.url, "_top") + }, [getCallbackUrl]) + + const onceRef = useRef(false) + useEffect(() => { + if (isAuthenticated && !onceRef.current) { + handleOpenApp() + } + onceRef.current = true + }, [handleOpenApp, isAuthenticated]) + + const LoginOrStatusContent = useMemo(() => { + switch (true) { + case isAuthenticated: { + return ( +
+
+ +
+ +
+
+

+ {t("redirect.successMessage", { app_name: APP_NAME })}
+
+ {t("redirect.instruction", { app_name: APP_NAME })} +

+
+ + + +
+
+ ) + } + default: { + if (!authProviders?.credential) { + return ( +
+ {Object.entries(authProviders || []) + .filter(([key]) => key !== "credential") + .map(([key, provider]) => ( + + ))} +
+ ) + } else { + return ( + <> + +
+
+ +

{t("login.or")}

+ +
+
+
+ {Object.entries(authProviders || []) + .filter(([key]) => key !== "credential") + .map(([key, provider]) => ( + { + loginHandler(key) + }} + > + {overrideProviderIconMap[provider.id] ? ( +
+ {overrideProviderIconMap[provider.id]} +
+ ) : ( +
+ )} + + ))} +
+ + ) + } + } + } + }, [authProviders, handleOpenApp, isAuthenticated, refetch, t]) + const Content = useMemo(() => { + switch (true) { + case redirecting: { + return
{t("login.redirecting")}
+ } + default: { + return
{LoginOrStatusContent}
+ } + } + }, [LoginOrStatusContent, redirecting, t]) + + return ( +
+ + {isLoading && } + + + <> + {!isAuthenticated && !isLoading && ( +

+ {t("login.logInTo")} + {` ${APP_NAME}`} +

+ )} + {Content} + +
+
+ ) +} + +const formSchema = z.object({ + email: z.string().email(), + password: z.string().max(128), +}) + +async function onSubmit(values: z.infer) { + const res = await loginHandler("credential", "browser", values) + if (res?.error) { + toast.error(res.error.message) + return + } + queryClient.invalidateQueries({ queryKey: ["auth", "session"] }) +} + +function LoginWithPassword() { + const { t } = useTranslation("external") + const form = useForm>({ + resolver: zodResolver(formSchema), + defaultValues: { + email: "", + password: "", + }, + }) + const { isValid } = form.formState + const navigate = useNavigate() + + return ( +
+ + ( + + {t("login.email")} + + + + + + )} + /> + ( + + {t("login.password")} + + + + + + )} + /> + + {t("login.forget_password.note")} + + + + + + ) +} diff --git a/apps/server/client/pages/(login)/forget-password.tsx b/apps/server/client/pages/(login)/forget-password.tsx new file mode 100644 index 000000000..7b1f800c8 --- /dev/null +++ b/apps/server/client/pages/(login)/forget-password.tsx @@ -0,0 +1,112 @@ +import { Button, MotionButtonBase } from "@follow/components/ui/button/index.jsx" +import { + Card, + CardContent, + CardDescription, + CardHeader, + CardTitle, +} from "@follow/components/ui/card/index.jsx" +import { + Form, + FormControl, + FormField, + FormItem, + FormLabel, + FormMessage, +} from "@follow/components/ui/form/index.jsx" +import { Input } from "@follow/components/ui/input/index.js" +import { forgetPassword } from "@follow/shared/auth" +import { env } from "@follow/shared/env" +import { zodResolver } from "@hookform/resolvers/zod" +import { useMutation } from "@tanstack/react-query" +import { useForm } from "react-hook-form" +import { useTranslation } from "react-i18next" +import { useNavigate } from "react-router" +import { toast } from "sonner" +import { z } from "zod" + +const forgetPasswordFormSchema = z.object({ + email: z.string().email(), +}) + +export function Component() { + const { t } = useTranslation("external") + const form = useForm>({ + resolver: zodResolver(forgetPasswordFormSchema), + defaultValues: { + email: "", + }, + }) + + const { isValid } = form.formState + const updateMutation = useMutation({ + mutationFn: async (values: z.infer) => { + const res = await forgetPassword({ + email: values.email, + redirectTo: `${env.VITE_WEB_URL}/reset-password`, + }) + if (res.error) { + throw new Error(res.error.message) + } + }, + onError: (error) => { + toast.error(error.message) + }, + onSuccess: () => { + toast.success(t("login.forget_password.success")) + }, + }) + + function onSubmit(values: z.infer) { + updateMutation.mutate(values) + } + + const navigate = useNavigate() + + return ( +
+ + + + { + history.length > 1 ? history.back() : navigate("/login") + }} + className="-ml-1 inline-flex cursor-pointer items-center" + > + + + {t("login.forget_password.label")} + + + + + {t("login.forget_password.description")} + +
+ + ( + + {t("login.email")} + + + + + + )} + /> +
+ +
+ + +
+
+
+ ) +} diff --git a/apps/server/client/pages/(login)/login.tsx b/apps/server/client/pages/(login)/login.tsx index c0d537051..280f89782 100644 --- a/apps/server/client/pages/(login)/login.tsx +++ b/apps/server/client/pages/(login)/login.tsx @@ -1,135 +1,5 @@ -import { UserAvatar } from "@client/components/ui/user-avatar" -import { useSession } from "@client/query/auth" -import { useAuthProviders } from "@client/query/users" -import { Logo } from "@follow/components/icons/logo.jsx" -import { Button } from "@follow/components/ui/button/index.js" -import { authProvidersConfig } from "@follow/constants" -import { createSession, loginHandler, signOut } from "@follow/shared/auth" -import { DEEPLINK_SCHEME } from "@follow/shared/constants" -import { cn } from "@follow/utils/utils" -import { useCallback, useEffect, useRef, useState } from "react" -import { useTranslation } from "react-i18next" -import { useLocation } from "react-router" +import { Login } from "@client/modules/login" export function Component() { return } - -function Login() { - const { status, refetch } = useSession() - - const [redirecting, setRedirecting] = useState(false) - - const { data: authProviders } = useAuthProviders() - const location = useLocation() - const urlParams = new URLSearchParams(location.search) - const provider = urlParams.get("provider") - - const isAuthenticated = status === "authenticated" - - const { t } = useTranslation("external") - - useEffect(() => { - if (provider && status === "unauthenticated") { - loginHandler(provider) - setRedirecting(true) - } - }, [status]) - - const getCallbackUrl = useCallback(async () => { - const { data } = await createSession() - if (!data) return null - return { - url: `${DEEPLINK_SCHEME}auth?ck=${data.ck}&userId=${data.userId}`, - userId: data.userId, - } - }, []) - - const handleOpenApp = useCallback(async () => { - const callbackUrl = await getCallbackUrl() - if (!callbackUrl) return - window.open(callbackUrl.url, "_top") - }, [getCallbackUrl]) - - const onceRef = useRef(false) - useEffect(() => { - if (isAuthenticated && !onceRef.current) { - handleOpenApp() - } - onceRef.current = true - }, [handleOpenApp, isAuthenticated]) - - return ( -
- - {!isAuthenticated && ( -

- {t("login.logInTo")} - {` ${APP_NAME}`} -

- )} - {redirecting ? ( -
{t("login.redirecting")}
- ) : ( -
- {isAuthenticated ? ( -
-
- -
- -
-
-

- {t("redirect.successMessage", { app_name: APP_NAME })}
-
- {t("redirect.instruction", { app_name: APP_NAME })} -

-
- - - -
-
- ) : ( - <> - {Object.entries(authProviders || []).map(([key, provider]) => ( - - ))} - - )} -
- )} -
- ) -} diff --git a/apps/server/client/pages/(login)/register.tsx b/apps/server/client/pages/(login)/register.tsx new file mode 100644 index 000000000..9066b8a65 --- /dev/null +++ b/apps/server/client/pages/(login)/register.tsx @@ -0,0 +1,139 @@ +import { Logo } from "@follow/components/icons/logo.jsx" +import { Button } from "@follow/components/ui/button/index.jsx" +import { + Form, + FormControl, + FormField, + FormItem, + FormLabel, + FormMessage, +} from "@follow/components/ui/form/index.jsx" +import { Input } from "@follow/components/ui/input/index.js" +import { signUp } from "@follow/shared/auth" +import { zodResolver } from "@hookform/resolvers/zod" +import { useForm } from "react-hook-form" +import { Trans, useTranslation } from "react-i18next" +import { Link, useNavigate } from "react-router" +import { toast } from "sonner" +import { z } from "zod" + +export function Component() { + return ( +
+ + +
+ ) +} + +const formSchema = z + .object({ + email: z.string().email(), + password: z.string().min(8).max(128), + confirmPassword: z.string(), + }) + .refine((data) => data.password === data.confirmPassword, { + message: "Passwords don't match", + path: ["confirmPassword"], + }) + +function RegisterForm() { + const { t } = useTranslation("external") + + const form = useForm>({ + resolver: zodResolver(formSchema), + defaultValues: { + email: "", + password: "", + confirmPassword: "", + }, + }) + + const { isValid } = form.formState + + const navigate = useNavigate() + + function onSubmit(values: z.infer) { + return signUp.email({ + email: values.email, + password: values.password, + name: values.email.split("@")[0], + callbackURL: "/", + fetchOptions: { + onSuccess() { + navigate("/login") + }, + onError(context) { + toast.error(context.error.message) + }, + }, + }) + } + + return ( +
+

+ {t("register.label", { app_name: APP_NAME })} +

+
+ + {t("register.login")} + + ), + }} + /> +
+
+ + ( + + {t("register.email")} + + + + + + )} + /> + ( + + {t("register.password")} + + + + + + )} + /> + ( + + {t("register.confirm_password")} + + + + + + )} + /> + + + +
+ ) +} diff --git a/apps/server/client/pages/(login)/reset-password.tsx b/apps/server/client/pages/(login)/reset-password.tsx new file mode 100644 index 000000000..2dac23add --- /dev/null +++ b/apps/server/client/pages/(login)/reset-password.tsx @@ -0,0 +1,130 @@ +import { Button, MotionButtonBase } from "@follow/components/ui/button/index.jsx" +import { + Card, + CardContent, + CardDescription, + CardHeader, + CardTitle, +} from "@follow/components/ui/card/index.jsx" +import { + Form, + FormControl, + FormField, + FormItem, + FormLabel, + FormMessage, +} from "@follow/components/ui/form/index.jsx" +import { Input } from "@follow/components/ui/input/index.js" +import { resetPassword } from "@follow/shared/auth" +import { zodResolver } from "@hookform/resolvers/zod" +import { useMutation } from "@tanstack/react-query" +import { useForm } from "react-hook-form" +import { useTranslation } from "react-i18next" +import { useNavigate } from "react-router" +import { toast } from "sonner" +import { z } from "zod" + +const passwordSchema = z.string().min(8).max(128) +const initPasswordFormSchema = z + .object({ + newPassword: passwordSchema, + confirmPassword: passwordSchema, + }) + .refine((data) => data.newPassword === data.confirmPassword, { + message: "Passwords don't match", + path: ["confirmPassword"], + }) + +export function Component() { + const { t } = useTranslation("external") + const form = useForm>({ + resolver: zodResolver(initPasswordFormSchema), + defaultValues: { + newPassword: "", + confirmPassword: "", + }, + }) + + const { isValid } = form.formState + + const navigate = useNavigate() + const updateMutation = useMutation({ + mutationFn: async (values: z.infer) => { + const res = await resetPassword({ newPassword: values.newPassword }) + const error = res.error?.message + if (error) { + throw new Error(error) + } + }, + onError: (error) => { + toast.error(error.message) + }, + onSuccess: () => { + toast.success(t("login.reset_password.success")) + navigate("/login") + }, + }) + + function onSubmit(values: z.infer) { + updateMutation.mutate(values) + } + + return ( +
+ + + + { + history.length > 1 ? history.back() : navigate("/login") + }} + className="-ml-1 inline-flex cursor-pointer items-center" + > + + + {t("login.forget_password.label")} + + + + {t("login.reset_password.description")} +
+ + ( + + {t("login.new_password.label")} + + + + + + )} + /> + ( + + {t("login.confirm_password.label")} + + + + + + )} + /> + +
+ +
+ + +
+
+
+ ) +} diff --git a/apps/server/client/query/users.ts b/apps/server/client/query/users.ts index 1c2e15531..cdebcba5d 100644 --- a/apps/server/client/query/users.ts +++ b/apps/server/client/query/users.ts @@ -56,20 +56,15 @@ export const useUserQuery = (handleOrId: string | undefined) => { initialData: getHydrateData(`profiles.$get,query:id=${handleOrId}`), }) } - +export interface AuthProvider { + name: string + id: string + color: string + icon: string +} export const useAuthProviders = () => { return useQuery({ queryKey: ["providers"], - queryFn: async () => (await getProviders()).data, - placeholderData: { - google: { - id: "google", - name: "Google", - }, - github: { - id: "github", - name: "GitHub", - }, - }, + queryFn: async () => (await getProviders()).data as Record, }) } diff --git a/apps/server/package.json b/apps/server/package.json index 70e4bd318..067decc90 100644 --- a/apps/server/package.json +++ b/apps/server/package.json @@ -27,6 +27,7 @@ "rc-modal-sheet": "0.3.2", "react": "^18.3.1", "react-blurhash": "^0.3.0", + "react-hook-form": "7.54.0", "react-hotkeys-hook": "4.6.1", "react-i18next": "^15.1.3", "react-photo-view": "1.2.6", @@ -35,7 +36,8 @@ "sonner": "1.7.1", "tailwindcss": "3.4.16", "use-context-selector": "2.0.0", - "xss": "1.0.15" + "xss": "1.0.15", + "zod": "3.23.8" }, "devDependencies": { "@follow/components": "workspace:*", diff --git a/changelog/next.md b/changelog/next.md index 17888d80b..d7f8b9d6f 100644 --- a/changelog/next.md +++ b/changelog/next.md @@ -2,6 +2,8 @@ ## New Features +- Register or Login with email and password + ## Improvements ## Bug Fixes diff --git a/locales/external/de.json b/locales/external/de.json index 40b9c343a..9c662ce99 100644 --- a/locales/external/de.json +++ b/locales/external/de.json @@ -15,7 +15,7 @@ "invitation.getCodeMessage": "You can get an invitation code through the following ways:", "invitation.title": "Invitation Code", "login.backToWebApp": "Back to the web app", - "login.logInTo": "Log in to ", + "login.logInTo": "Login to ", "login.openApp": "Open app", "login.redirecting": "Redirecting", "login.welcomeTo": "Welcome to ", diff --git a/locales/external/en.json b/locales/external/en.json index ac5ff6e0d..a0ac35eb3 100644 --- a/locales/external/en.json +++ b/locales/external/en.json @@ -34,14 +34,37 @@ "invitation.getCodeMessage": "You can get an invitation code in the following ways:", "invitation.title": "Invitation Code", "login.backToWebApp": "Back To Web App", + "login.confirm_password.label": "Confirm Password", "login.continueWith": "Continue with {{provider}}", - "login.logInTo": "Log in to ", + "login.email": "Email", + "login.forget_password.description": "Enter the email address associated with your account and we’ll send you an email about how to reset your password.", + "login.forget_password.label": "Forget Password", + "login.forget_password.note": "Forgot your password?", + "login.forget_password.success": "Email has been sent successfully", + "login.logInTo": "Login to ", + "login.logInWithEmail": "Login with email", + "login.new_password.label": "New Password", "login.openApp": "Open App", + "login.or": "Or", + "login.password": "Password", "login.redirecting": "Redirecting", + "login.register": "Create one", + "login.reset_password.description": "Enter new password and confirm it to reset your password", + "login.reset_password.label": "Reset Password", + "login.reset_password.success": "Password has been successfully reset", "login.signOut": "Sign out", + "login.signUp": "Sign up with email", + "login.submit": "Submit", "login.welcomeTo": "Welcome to ", "redirect.continueInBrowser": "Continue in Browser", "redirect.instruction": "Now is the time to open {{app_name}} and safely close this page.", "redirect.openApp": "Open {{app_name}}", - "redirect.successMessage": "You have successfully connected to {{app_name}} Account." + "redirect.successMessage": "You have successfully connected to {{app_name}} Account.", + "register.confirm_password": "Confirm Password", + "register.email": "Email", + "register.label": "Create a {{app_name}} account", + "register.login": "Login", + "register.note": "Already have an account? ", + "register.password": "Password", + "register.submit": "Create account" } diff --git a/locales/settings/en.json b/locales/settings/en.json index 7c2788fe4..1c770ab96 100644 --- a/locales/settings/en.json +++ b/locales/settings/en.json @@ -259,14 +259,21 @@ "lists.title": "Title", "lists.view": "View", "profile.avatar.label": "Avatar", + "profile.change_password.label": "Change Password", + "profile.confirm_password.label": "Confirm Password", + "profile.current_password.label": "Current Password", + "profile.email.label": "Email", "profile.handle.description": "Your unique identifier.", "profile.handle.label": "Handle", "profile.name.description": "Your public display name.", "profile.name.label": "Display Name", + "profile.new_password.label": "New Password", + "profile.reset_password_mail_sent": "Reset password mail sent.", "profile.sidebar_title": "Profile", "profile.submit": "Submit", "profile.title": "Profile Settings", "profile.updateSuccess": "Profile updated.", + "profile.update_password_success": "Password updated.", "titles.about": "About", "titles.actions": "Actions", "titles.appearance": "Appearance", diff --git a/packages/shared/src/auth.ts b/packages/shared/src/auth.ts index f3a992c5a..6d8d342de 100644 --- a/packages/shared/src/auth.ts +++ b/packages/shared/src/auth.ts @@ -14,6 +14,14 @@ const serverPlugins = [ id: "createSession", $InferServerPlugin: {} as (typeof authPlugins)[1], }, + inferAdditionalFields({ + user: { + handle: { + type: "string", + required: false, + }, + }, + }), ] satisfies BetterAuthClientPlugin[] const authClient = createAuthClient({ @@ -21,14 +29,44 @@ const authClient = createAuthClient({ plugins: serverPlugins, }) -export const { signIn, signOut, getSession, getProviders, createSession } = authClient +// @keep-sorted +export const { + changePassword, + createSession, + forgetPassword, + getProviders, + getSession, + linkSocial, + listAccounts, + resetPassword, + signIn, + signOut, + signUp, + updateUser, +} = authClient export const LOGIN_CALLBACK_URL = `${WEB_URL}/login` export type LoginRuntime = "browser" | "app" -export const loginHandler = (provider: string, runtime: LoginRuntime = "app") => { +export const loginHandler = async ( + provider: string, + runtime?: LoginRuntime, + args?: { + email?: string + password?: string + }, +) => { + const { email, password } = args ?? {} if (IN_ELECTRON) { window.open(`${WEB_URL}/login?provider=${provider}`) } else { + if (provider === "credential") { + if (!email || !password) { + window.location.href = "/login" + return + } + return signIn.email({ email, password }) + } + signIn.social({ provider: provider as "google" | "github" | "apple", callbackURL: runtime === "app" ? LOGIN_CALLBACK_URL : undefined, diff --git a/packages/shared/src/hono.ts b/packages/shared/src/hono.ts index f009cb30c..738643bb7 100644 --- a/packages/shared/src/hono.ts +++ b/packages/shared/src/hono.ts @@ -341,7 +341,32 @@ declare const actions: drizzle_orm_pg_core.PgTableWithColumns<{ baseColumn: never; identity: undefined; generated: undefined; - }, {}, {}>; + }, {}, { + $type: { + name: string; + condition: ConditionItem[] | ConditionItem[][]; + result: { + disabled?: boolean; + translation?: z.infer; + summary?: boolean; + readability?: boolean; + sourceContent?: boolean; + silence?: boolean; + block?: boolean; + newEntryNotification?: boolean; + rewriteRules?: { + from: string; + to: string; + }[]; + blockRules?: { + field: z.infer; + operator: z.infer; + value: string | number; + }[]; + webhooks?: string[]; + }; + }[]; + }>; }; dialect: "pg"; }>; @@ -1004,7 +1029,38 @@ declare const airdrops: drizzle_orm_pg_core.PgTableWithColumns<{ baseColumn: never; identity: undefined; generated: undefined; - }, {}, {}>; + }, {}, { + $type: { + "Invitations count": number; + "Purchase lists cost": number; + "Total tip amount": number; + "Feeds subscriptions count": number; + "Lists subscriptions count": number; + "Inbox subscriptions count": number; + "Recent read count in the last month": number; + "Mint count": number; + "Claimed feeds count": number; + "Claimed feeds subscriptions count": number; + "Lists with more than 1 feed count": number; + "Created lists subscriptions count": number; + "Created lists income amount": number; + "GitHub Community Contributions": number; + "Invitations count Rank": number; + "Purchase lists cost Rank": number; + "Total tip amount Rank": number; + "Feeds subscriptions count Rank": number; + "Lists subscriptions count Rank": number; + "Inbox subscriptions count Rank": number; + "Recent read count in the last month Rank": number; + "Mint count Rank": number; + "Claimed feeds count Rank": number; + "Claimed feeds subscriptions count Rank": number; + "Lists with more than 1 feed count Rank": number; + "Created lists subscriptions count Rank": number; + "Created lists income amount Rank": number; + "GitHub Community Contributions Rank": number; + } | null; + }>; verify: drizzle_orm_pg_core.PgColumn<{ name: "verify"; tableName: "airdrops"; @@ -1485,6 +1541,15 @@ declare const CommonEntryFields: { data: string[]; driverParam: string | string[]; enumValues: [string, ...string[]]; + size: undefined; + baseBuilder: { + name: "categories"; + dataType: "string"; + columnType: "PgText"; + data: string; + enumValues: [string, ...string[]]; + driverParam: string; + }; }, { name: "categories"; dataType: "string"; @@ -1711,7 +1776,9 @@ declare const entries: drizzle_orm_pg_core.PgTableWithColumns<{ baseColumn: never; identity: undefined; generated: undefined; - }, {}, {}>; + }, {}, { + $type: MediaModel[]; + }>; categories: drizzle_orm_pg_core.PgColumn<{ name: "categories"; tableName: "entries"; @@ -1741,10 +1808,20 @@ declare const entries: drizzle_orm_pg_core.PgTableWithColumns<{ baseColumn: never; identity: undefined; generated: undefined; - }, object, object>; + }, {}, {}>; identity: undefined; generated: undefined; - }, {}, {}>; + }, {}, { + baseBuilder: drizzle_orm_pg_core.PgColumnBuilder<{ + name: "categories"; + dataType: "string"; + columnType: "PgText"; + data: string; + enumValues: [string, ...string[]]; + driverParam: string; + }, {}, {}, drizzle_orm.ColumnBuilderExtraConfig>; + size: undefined; + }>; attachments: drizzle_orm_pg_core.PgColumn<{ name: "attachments"; tableName: "entries"; @@ -1761,7 +1838,9 @@ declare const entries: drizzle_orm_pg_core.PgTableWithColumns<{ baseColumn: never; identity: undefined; generated: undefined; - }, {}, {}>; + }, {}, { + $type: AttachmentsModel[]; + }>; extra: drizzle_orm_pg_core.PgColumn<{ name: "extra"; tableName: "entries"; @@ -1778,7 +1857,9 @@ declare const entries: drizzle_orm_pg_core.PgTableWithColumns<{ baseColumn: never; identity: undefined; generated: undefined; - }, {}, {}>; + }, {}, { + $type: ExtraModel; + }>; language: drizzle_orm_pg_core.PgColumn<{ name: "language"; tableName: "entries"; @@ -2250,10 +2331,20 @@ declare const entryReadHistories: drizzle_orm_pg_core.PgTableWithColumns<{ baseColumn: never; identity: undefined; generated: undefined; - }, object, object>; + }, {}, {}>; identity: undefined; generated: undefined; - }, {}, {}>; + }, {}, { + baseBuilder: drizzle_orm_pg_core.PgColumnBuilder<{ + name: "user_ids"; + dataType: "string"; + columnType: "PgText"; + data: string; + enumValues: [string, ...string[]]; + driverParam: string; + }, {}, {}, drizzle_orm.ColumnBuilderExtraConfig>; + size: undefined; + }>; readCount: drizzle_orm_pg_core.PgColumn<{ name: "read_count"; tableName: "entryReadHistories"; @@ -3112,7 +3203,9 @@ declare const inboxesEntries: drizzle_orm_pg_core.PgTableWithColumns<{ baseColumn: never; identity: undefined; generated: undefined; - }, {}, {}>; + }, {}, { + $type: MediaModel[]; + }>; categories: drizzle_orm_pg_core.PgColumn<{ name: "categories"; tableName: "inboxes_entries"; @@ -3142,10 +3235,20 @@ declare const inboxesEntries: drizzle_orm_pg_core.PgTableWithColumns<{ baseColumn: never; identity: undefined; generated: undefined; - }, object, object>; + }, {}, {}>; identity: undefined; generated: undefined; - }, {}, {}>; + }, {}, { + baseBuilder: drizzle_orm_pg_core.PgColumnBuilder<{ + name: "categories"; + dataType: "string"; + columnType: "PgText"; + data: string; + enumValues: [string, ...string[]]; + driverParam: string; + }, {}, {}, drizzle_orm.ColumnBuilderExtraConfig>; + size: undefined; + }>; attachments: drizzle_orm_pg_core.PgColumn<{ name: "attachments"; tableName: "inboxes_entries"; @@ -3162,7 +3265,9 @@ declare const inboxesEntries: drizzle_orm_pg_core.PgTableWithColumns<{ baseColumn: never; identity: undefined; generated: undefined; - }, {}, {}>; + }, {}, { + $type: AttachmentsModel[]; + }>; extra: drizzle_orm_pg_core.PgColumn<{ name: "extra"; tableName: "inboxes_entries"; @@ -3179,7 +3284,9 @@ declare const inboxesEntries: drizzle_orm_pg_core.PgTableWithColumns<{ baseColumn: never; identity: undefined; generated: undefined; - }, {}, {}>; + }, {}, { + $type: ExtraModel; + }>; language: drizzle_orm_pg_core.PgColumn<{ name: "language"; tableName: "inboxes_entries"; @@ -4117,10 +4224,20 @@ declare const lists: drizzle_orm_pg_core.PgTableWithColumns<{ baseColumn: never; identity: undefined; generated: undefined; - }, object, object>; + }, {}, {}>; identity: undefined; generated: undefined; - }, {}, {}>; + }, {}, { + baseBuilder: drizzle_orm_pg_core.PgColumnBuilder<{ + name: "feed_ids"; + dataType: "string"; + columnType: "PgText"; + data: string; + enumValues: [string, ...string[]]; + driverParam: string; + }, {}, {}, drizzle_orm.ColumnBuilderExtraConfig>; + size: undefined; + }>; title: drizzle_orm_pg_core.PgColumn<{ name: "title"; tableName: "lists"; @@ -4710,7 +4827,9 @@ declare const settings: drizzle_orm_pg_core.PgTableWithColumns<{ baseColumn: never; identity: undefined; generated: undefined; - }, {}, {}>; + }, {}, { + $type: Record; + }>; updateAt: drizzle_orm_pg_core.PgColumn<{ name: "update_at"; tableName: "settings"; @@ -5036,16 +5155,16 @@ declare const users: drizzle_orm_pg_core.PgTableWithColumns<{ dialect: "pg"; }>; declare function lower(handle: AnyPgColumn): SQL; -declare const usersOpenApiSchema: z.ZodObject; - email: z.ZodString; - emailVerified: z.ZodNullable; - image: z.ZodNullable; - handle: z.ZodNullable; - createdAt: z.ZodDate; - updatedAt: z.ZodDate; -}, "email">, z.UnknownKeysParam, z.ZodTypeAny, { +declare const usersOpenApiSchema: zod.ZodObject; + email: zod.ZodString; + emailVerified: zod.ZodNullable; + image: zod.ZodNullable; + handle: zod.ZodNullable; + createdAt: zod.ZodDate; + updatedAt: zod.ZodDate; +}, "email">, "strip", zod.ZodTypeAny, { name: string | null; id: string; emailVerified: boolean | null; @@ -6203,12 +6322,13 @@ declare const boosts: drizzle_orm_pg_core.PgTableWithColumns<{ declare const auth: { handler: (request: Request) => Promise; api: { - getSession: ((context: { + getSession: (context: { headers: Headers; query?: { disableCookieCache?: boolean; } | undefined; - }) => Promise<{ + asResponse?: R | undefined; + }) => false extends R ? Promise<{ user: { id: string; createdAt: Date; @@ -6239,17 +6359,17 @@ declare const auth: { toUserId: string | null; } | undefined; role: "user" | "trial"; - } | null>) & { + } | null> & { options: { method: "GET"; query: zod.ZodOptional; + disableCookieCache: zod.ZodOptional]>>; disableRefresh: zod.ZodOptional; }, "strip", zod.ZodTypeAny, { disableCookieCache?: boolean | undefined; disableRefresh?: boolean | undefined; }, { - disableCookieCache?: boolean | undefined; + disableCookieCache?: string | boolean | undefined; disableRefresh?: boolean | undefined; }>>; requireHeaders: true; @@ -6295,9 +6415,19 @@ declare const auth: { metadata: { CUSTOM_SESSION: boolean; }; + query: zod.ZodOptional]>>; + disableRefresh: zod.ZodOptional; + }, "strip", zod.ZodTypeAny, { + disableCookieCache?: boolean | undefined; + disableRefresh?: boolean | undefined; + }, { + disableCookieCache?: string | boolean | undefined; + disableRefresh?: boolean | undefined; + }>>; }; path: "/get-session"; - }; + } : Promise; } & { getProviders: { >; body: zod.ZodObject<{ callbackURL: zod.ZodOptional; + newUserCallbackURL: zod.ZodOptional; errorCallbackURL: zod.ZodOptional; - provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter" | "dropbox" | "linkedin" | "gitlab")[]]>; + provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter" | "dropbox" | "linkedin" | "gitlab" | "reddit")[]]>; disableRedirect: zod.ZodOptional; idToken: zod.ZodOptional>; }, "strip", zod.ZodTypeAny, { - provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter" | "dropbox" | "linkedin" | "gitlab"; + provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter" | "dropbox" | "linkedin" | "gitlab" | "reddit"; idToken?: { token: string; accessToken?: string | undefined; @@ -6385,10 +6516,11 @@ declare const auth: { nonce?: string | undefined; } | undefined; callbackURL?: string | undefined; + newUserCallbackURL?: string | undefined; errorCallbackURL?: string | undefined; disableRedirect?: boolean | undefined; }, { - provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter" | "dropbox" | "linkedin" | "gitlab"; + provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter" | "dropbox" | "linkedin" | "gitlab" | "reddit"; idToken?: { token: string; accessToken?: string | undefined; @@ -6397,6 +6529,7 @@ declare const auth: { nonce?: string | undefined; } | undefined; callbackURL?: string | undefined; + newUserCallbackURL?: string | undefined; errorCallbackURL?: string | undefined; disableRedirect?: boolean | undefined; }>; @@ -6472,8 +6605,9 @@ declare const auth: { }>>; body: zod.ZodObject<{ callbackURL: zod.ZodOptional; + newUserCallbackURL: zod.ZodOptional; errorCallbackURL: zod.ZodOptional; - provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter" | "dropbox" | "linkedin" | "gitlab")[]]>; + provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter" | "dropbox" | "linkedin" | "gitlab" | "reddit")[]]>; disableRedirect: zod.ZodOptional; idToken: zod.ZodOptional>; }, "strip", zod.ZodTypeAny, { - provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter" | "dropbox" | "linkedin" | "gitlab"; + provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter" | "dropbox" | "linkedin" | "gitlab" | "reddit"; idToken?: { token: string; accessToken?: string | undefined; @@ -6504,10 +6638,11 @@ declare const auth: { nonce?: string | undefined; } | undefined; callbackURL?: string | undefined; + newUserCallbackURL?: string | undefined; errorCallbackURL?: string | undefined; disableRedirect?: boolean | undefined; }, { - provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter" | "dropbox" | "linkedin" | "gitlab"; + provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter" | "dropbox" | "linkedin" | "gitlab" | "reddit"; idToken?: { token: string; accessToken?: string | undefined; @@ -6516,6 +6651,7 @@ declare const auth: { nonce?: string | undefined; } | undefined; callbackURL?: string | undefined; + newUserCallbackURL?: string | undefined; errorCallbackURL?: string | undefined; disableRedirect?: boolean | undefined; }>; @@ -6684,11 +6820,25 @@ declare const auth: { schema: { type: "object"; properties: { - user: { + id: { type: string; + description: string; }; - session: { + email: { type: string; + description: string; + }; + name: { + type: string; + description: string; + }; + image: { + type: string; + description: string; + }; + emailVerified: { + type: string; + description: string; }; }; }; @@ -6701,38 +6851,11 @@ declare const auth: { }>]>(...ctx: C): Promise; path: "/sign-up/email"; options: { @@ -6802,11 +6925,25 @@ declare const auth: { schema: { type: "object"; properties: { - user: { + id: { type: string; + description: string; }; - session: { + email: { type: string; + description: string; + }; + name: { + type: string; + description: string; + }; + image: { + type: string; + description: string; + }; + emailVerified: { + type: string; + description: string; }; }; }; @@ -6850,9 +6987,6 @@ declare const auth: { schema: { type: "object"; properties: { - session: { - type: string; - }; user: { type: string; }; @@ -6876,22 +7010,12 @@ declare const auth: { }] ? Response : { user: { id: string; - createdAt: Date; - updatedAt: Date; email: string; - emailVerified: boolean; name: string; - image?: string | null | undefined; - }; - session: { - id: string; - userId: string; + image: string | null | undefined; + emailVerified: boolean; createdAt: Date; updatedAt: Date; - expiresAt: Date; - token: string; - ipAddress?: string | null | undefined; - userAgent?: string | null | undefined; }; redirect: boolean; url: string | undefined; @@ -6926,9 +7050,6 @@ declare const auth: { schema: { type: "object"; properties: { - session: { - type: string; - }; user: { type: string; }; @@ -7806,7 +7927,13 @@ declare const auth: { }>]>(...ctx: C): Promise; path: "/update-user"; options: { @@ -8540,12 +8667,12 @@ declare const auth: { }>>; body: zod.ZodObject<{ callbackURL: zod.ZodOptional; - provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter" | "dropbox" | "linkedin" | "gitlab")[]]>; + provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter" | "dropbox" | "linkedin" | "gitlab" | "reddit")[]]>; }, "strip", zod.ZodTypeAny, { - provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter" | "dropbox" | "linkedin" | "gitlab"; + provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter" | "dropbox" | "linkedin" | "gitlab" | "reddit"; callbackURL?: string | undefined; }, { - provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter" | "dropbox" | "linkedin" | "gitlab"; + provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter" | "dropbox" | "linkedin" | "gitlab" | "reddit"; callbackURL?: string | undefined; }>; use: better_call.Endpoint>; body: zod.ZodObject<{ callbackURL: zod.ZodOptional; - provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter" | "dropbox" | "linkedin" | "gitlab")[]]>; + provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter" | "dropbox" | "linkedin" | "gitlab" | "reddit")[]]>; }, "strip", zod.ZodTypeAny, { - provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter" | "dropbox" | "linkedin" | "gitlab"; + provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter" | "dropbox" | "linkedin" | "gitlab" | "reddit"; callbackURL?: string | undefined; }, { - provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter" | "dropbox" | "linkedin" | "gitlab"; + provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter" | "dropbox" | "linkedin" | "gitlab" | "reddit"; callbackURL?: string | undefined; }>; use: better_call.Endpoint; }; plugins: ({ id: "custom-session"; @@ -8915,6 +9047,16 @@ declare const auth: { metadata: { CUSTOM_SESSION: boolean; }; + query: zod.ZodOptional]>>; + disableRefresh: zod.ZodOptional; + }, "strip", zod.ZodTypeAny, { + disableCookieCache?: boolean | undefined; + disableRefresh?: boolean | undefined; + }, { + disableCookieCache?: string | boolean | undefined; + disableRefresh?: boolean | undefined; + }>>; }> | undefined)?]>(...ctx: C): Promise]>>; + disableRefresh: zod.ZodOptional; + }, "strip", zod.ZodTypeAny, { + disableCookieCache?: boolean | undefined; + disableRefresh?: boolean | undefined; + }, { + disableCookieCache?: string | boolean | undefined; + disableRefresh?: boolean | undefined; + }>>; }; method: better_call.Method | better_call.Method[]; headers: Headers; @@ -9041,6 +9193,28 @@ declare const auth: { }; }; }; + $ErrorCodes: { + USER_NOT_FOUND: string; + FAILED_TO_CREATE_USER: string; + FAILED_TO_CREATE_SESSION: string; + FAILED_TO_UPDATE_USER: string; + FAILED_TO_GET_SESSION: string; + INVALID_PASSWORD: string; + INVALID_EMAIL: string; + INVALID_EMAIL_OR_PASSWORD: string; + SOCIAL_ACCOUNT_ALREADY_LINKED: string; + PROVIDER_NOT_FOUND: string; + INVALID_TOKEN: string; + ID_TOKEN_NOT_SUPPORTED: string; + FAILED_TO_GET_USER_INFO: string; + USER_EMAIL_NOT_FOUND: string; + EMAIL_NOT_VERIFIED: string; + PASSWORD_TOO_SHORT: string; + PASSWORD_TOO_LONG: string; + USER_ALREADY_EXISTS: string; + EMAIL_CAN_NOT_BE_UPDATED: string; + CREDENTIAL_ACCOUNT_NOT_FOUND: string; + }; }; type AuthSession = Awaited>; @@ -9089,7 +9263,7 @@ declare const _routes: hono_hono_base.HonoBase Date: Mon, 16 Dec 2024 22:02:55 +0800 Subject: [PATCH 2/6] feat: email verification Signed-off-by: Innei --- .../modules/profile/profile-setting-form.tsx | 32 ++++++++++++++++++- locales/settings/en.json | 4 +++ packages/components/src/ui/button/index.tsx | 9 +++--- packages/shared/src/auth.ts | 1 + packages/shared/src/hono.ts | 8 +++++ 5 files changed, 49 insertions(+), 5 deletions(-) diff --git a/apps/renderer/src/modules/profile/profile-setting-form.tsx b/apps/renderer/src/modules/profile/profile-setting-form.tsx index 4bc0038f1..51c63e160 100644 --- a/apps/renderer/src/modules/profile/profile-setting-form.tsx +++ b/apps/renderer/src/modules/profile/profile-setting-form.tsx @@ -11,6 +11,7 @@ import { } from "@follow/components/ui/form/index.jsx" import { Input } from "@follow/components/ui/input/index.js" import { Label } from "@follow/components/ui/label/index.js" +import { sendVerificationEmail } from "@follow/shared/auth" import { cn } from "@follow/utils/utils" import { zodResolver } from "@hookform/resolvers/zod" import { useMutation } from "@tanstack/react-query" @@ -66,6 +67,18 @@ export const ProfileSettingForm = ({ }, }) + const verifyEmailMutation = useMutation({ + mutationFn: async () => { + if (!user?.email) return + return sendVerificationEmail({ + email: user.email, + }) + }, + onSuccess: () => { + toast.success(t("profile.email.verification_sent")) + }, + }) + function onSubmit(values: z.infer) { updateMutation.mutate(values) } @@ -75,7 +88,24 @@ export const ProfileSettingForm = ({
-

{user?.email}

+

+ {user?.email} + + {user?.emailVerified ? t("profile.email.verified") : t("profile.email.unverified")} + +

+ {!user?.emailVerified && ( + + )}
->(({ className, buttonClassName, isLoading, variant, status, ...props }, ref) => { +>(({ className, buttonClassName, disabled, isLoading, variant, status, ...props }, ref) => { const handleClick: React.MouseEventHandler = React.useCallback( (e) => { - if (isLoading || props.disabled) { + if (isLoading || disabled) { e.preventDefault() return } props.onClick?.(e) }, - [isLoading, props], + [disabled, isLoading, props], ) return ( diff --git a/packages/shared/src/auth.ts b/packages/shared/src/auth.ts index 6d8d342de..f96a4aa4b 100644 --- a/packages/shared/src/auth.ts +++ b/packages/shared/src/auth.ts @@ -39,6 +39,7 @@ export const { linkSocial, listAccounts, resetPassword, + sendVerificationEmail, signIn, signOut, signUp, diff --git a/packages/shared/src/hono.ts b/packages/shared/src/hono.ts index 738643bb7..dee77e0db 100644 --- a/packages/shared/src/hono.ts +++ b/packages/shared/src/hono.ts @@ -9038,6 +9038,14 @@ declare const auth: { token: string; }): Promise; }; + emailVerification: { + sendOnSignUp: true; + sendVerificationEmail({ user, url }: { + user: better_auth.User; + url: string; + token: string; + }): Promise; + }; plugins: ({ id: "custom-session"; endpoints: { From e0661ff2b9cc76f1a86ba6f293c0c37b5ad8d789 Mon Sep 17 00:00:00 2001 From: Innei Date: Mon, 16 Dec 2024 19:52:57 +0800 Subject: [PATCH 3/6] perf(external): hydrate auth providers Signed-off-by: Innei --- .../(login)/{login.tsx => login/index.tsx} | 0 .../client/pages/(login)/login/metadata.ts | 32 +++++++++++++++++++ apps/server/client/query/users.ts | 10 +++++- apps/server/helper/meta-map.ts | 11 ++++--- apps/server/src/lib/api-client.ts | 20 ++++++++---- apps/server/src/meta-handler.map.ts | 12 ++++--- 6 files changed, 68 insertions(+), 17 deletions(-) rename apps/server/client/pages/(login)/{login.tsx => login/index.tsx} (100%) create mode 100644 apps/server/client/pages/(login)/login/metadata.ts diff --git a/apps/server/client/pages/(login)/login.tsx b/apps/server/client/pages/(login)/login/index.tsx similarity index 100% rename from apps/server/client/pages/(login)/login.tsx rename to apps/server/client/pages/(login)/login/index.tsx diff --git a/apps/server/client/pages/(login)/login/metadata.ts b/apps/server/client/pages/(login)/login/metadata.ts new file mode 100644 index 000000000..fecdef815 --- /dev/null +++ b/apps/server/client/pages/(login)/login/metadata.ts @@ -0,0 +1,32 @@ +import type { GetHydrateData } from "@client/lib/helper" +import type { AuthProvider } from "@client/query/users" + +import { createApiFetch } from "~/lib/api-client" +import { defineMetadata } from "~/meta-handler" + +const getTypedProviders = async () => { + const apiFetch = createApiFetch() + const data = (await apiFetch("/better-auth/get-providers")) as Record + + return data +} + +const meta = defineMetadata(async () => { + const providers = await getTypedProviders() + + return [ + { + type: "title", + title: "Login", + }, + { + type: "hydrate", + data: providers, + path: "/login", + key: `betterAuth`, + }, + ] as const +}) + +export type LoginHydrateData = GetHydrateData +export default meta diff --git a/apps/server/client/query/users.ts b/apps/server/client/query/users.ts index cdebcba5d..586a909d8 100644 --- a/apps/server/client/query/users.ts +++ b/apps/server/client/query/users.ts @@ -1,5 +1,6 @@ import { apiClient } from "@client/lib/api-fetch" import { getHydrateData } from "@client/lib/helper" +import type { LoginHydrateData } from "@client/pages/(login)/login/metadata" import { getProviders } from "@follow/shared/auth" import { capitalizeFirstLetter, isBizId, parseUrl } from "@follow/utils/utils" import { useQuery } from "@tanstack/react-query" @@ -62,9 +63,16 @@ export interface AuthProvider { color: string icon: string } +const getTypedProviders = async () => { + const providers = await getProviders() + return providers.data as Record +} export const useAuthProviders = () => { return useQuery({ queryKey: ["providers"], - queryFn: async () => (await getProviders()).data as Record, + queryFn: async () => getTypedProviders(), + initialData: getHydrateData(`betterAuth`) as LoginHydrateData, }) } + +export { getTypedProviders as getAuthProviders } diff --git a/apps/server/helper/meta-map.ts b/apps/server/helper/meta-map.ts index ba9af11ce..54062ab0b 100644 --- a/apps/server/helper/meta-map.ts +++ b/apps/server/helper/meta-map.ts @@ -4,12 +4,12 @@ import { dirname } from "node:path" import { fileURLToPath } from "node:url" import chokidar from "chokidar" -import { glob } from "glob" +import fg from "fast-glob" const __dirname = dirname(fileURLToPath(import.meta.url)) async function generateMetaMap() { - const files = await glob("./client/pages/(main)/**/metadata.ts", { + const files = await fg.glob("./client/pages/**/*/metadata.ts", { cwd: path.resolve(__dirname, ".."), }) @@ -18,10 +18,13 @@ async function generateMetaMap() { files.forEach((file, index) => { const routePath = file - .replace("client/pages/(main)", "") + .replace("client/pages/", "") .replace("/metadata.ts", "") .replaceAll(/\[([^\]]+)\]/g, ":$1") + .replaceAll(/\([^)]+\)\//g, "") + .replace(/^\./, "") + const importName = `i${index}` imports.push(`import ${importName} from "../${file.replace(".ts", "")}"`) routes[routePath] = importName @@ -47,7 +50,7 @@ ${Object.entries(routes) } async function watch() { - const watchPath = path.resolve(__dirname, "..", "./client/pages/(main)") + const watchPath = path.resolve(__dirname, "..", "./client/pages") console.info("Watching metadata files...") await generateMetaMap() diff --git a/apps/server/src/lib/api-client.ts b/apps/server/src/lib/api-client.ts index afed762e0..c71b2d75c 100644 --- a/apps/server/src/lib/api-client.ts +++ b/apps/server/src/lib/api-client.ts @@ -9,13 +9,9 @@ import { ofetch } from "ofetch" import PKG from "../../../../package.json" import { isDev } from "./env" -export const createApiClient = () => { - const authSessionToken = getTokenFromCookie(requestContext.get("req")?.headers.cookie || "") - +const getBaseURL = () => { const req = requestContext.get("req")! - const { host } = req.headers - let baseURL = env.VITE_EXTERNAL_API_URL || env.VITE_API_URL if (env.VITE_EXTERNAL_API_URL?.startsWith("/")) { @@ -29,11 +25,14 @@ export const createApiClient = () => { if (upstreamEnv === "prod" && env.VITE_EXTERNAL_PROD_API_URL) { baseURL = env.VITE_EXTERNAL_PROD_API_URL } + return baseURL +} +export const createApiFetch = () => { + const baseURL = getBaseURL() - const apiFetch = ofetch.create({ + return ofetch.create({ credentials: "include", retry: false, - onRequest(context) { if (isDev) console.info(`request: ${context.request}`) @@ -44,7 +43,14 @@ export const createApiClient = () => { return } }, + baseURL, }) +} +export const createApiClient = () => { + const authSessionToken = getTokenFromCookie(requestContext.get("req")?.headers.cookie || "") + + const baseURL = getBaseURL() + const apiFetch = createApiFetch() const apiClient = hc(baseURL, { fetch: async (input: any, options = {}) => apiFetch(input.toString(), options), diff --git a/apps/server/src/meta-handler.map.ts b/apps/server/src/meta-handler.map.ts index 52b725b99..5ba72ad65 100644 --- a/apps/server/src/meta-handler.map.ts +++ b/apps/server/src/meta-handler.map.ts @@ -1,10 +1,12 @@ // This file is generated by `pnpm run meta` -import i1 from "../client/pages/(main)/share/feeds/[id]/metadata" -import i2 from "../client/pages/(main)/share/lists/[id]/metadata" -import i0 from "../client/pages/(main)/share/users/[id]/metadata" +import i0 from ".././client/pages/(login)/login/metadata" +import i3 from ".././client/pages/(main)/share/feeds/[id]/metadata" +import i2 from ".././client/pages/(main)/share/lists/[id]/metadata" +import i1 from ".././client/pages/(main)/share/users/[id]/metadata" export default { - "/share/users/:id": i0, - "/share/feeds/:id": i1, + "/login": i0, + "/share/users/:id": i1, "/share/lists/:id": i2, + "/share/feeds/:id": i3, } From de8d3376713be0b696579e16395b887b2658d59f Mon Sep 17 00:00:00 2001 From: Innei Date: Tue, 17 Dec 2024 01:04:12 +0800 Subject: [PATCH 4/6] fix(auth): handle optional icon class names for providers in login components - Updated the LoginModalContent and Login components to safely access provider icon class names using optional chaining. - Excluded the "credential" provider from the list of displayed auth providers to streamline the login options. Signed-off-by: Innei --- apps/renderer/src/modules/auth/LoginModalContent.tsx | 6 ++++-- apps/server/client/modules/login/index.tsx | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/renderer/src/modules/auth/LoginModalContent.tsx b/apps/renderer/src/modules/auth/LoginModalContent.tsx index b811af0ea..0bc306ef8 100644 --- a/apps/renderer/src/modules/auth/LoginModalContent.tsx +++ b/apps/renderer/src/modules/auth/LoginModalContent.tsx @@ -79,7 +79,7 @@ export const LoginModalContent = (props: LoginModalContentProps) => { const extraProviders = useMemo(() => { if (!authProviders) return [] return Object.entries(authProviders) - .filter(([key]) => !defaultProviders[key]) + .filter(([key]) => !defaultProviders[key] && key !== "credential") .map(([_, provider]) => provider) }, [authProviders]) @@ -116,7 +116,9 @@ export const LoginModalContent = (props: LoginModalContentProps) => { }} > - {" "} + {" "} {t("signin.continue_with", { provider: provider.name })} diff --git a/apps/server/client/modules/login/index.tsx b/apps/server/client/modules/login/index.tsx index 949408ae0..11a1b7d09 100644 --- a/apps/server/client/modules/login/index.tsx +++ b/apps/server/client/modules/login/index.tsx @@ -138,7 +138,7 @@ export function Login() { loginHandler(key) }} > - {" "} + {" "} {t("login.continueWith", { provider: provider.name })} ))} From 9d6e7d44363efc50a592e13e7c20aa6eca2e03d0 Mon Sep 17 00:00:00 2001 From: Innei Date: Tue, 17 Dec 2024 01:05:01 +0800 Subject: [PATCH 5/6] fix: import Signed-off-by: Innei --- packages/shared/src/auth.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/shared/src/auth.ts b/packages/shared/src/auth.ts index f96a4aa4b..ac8ddfabf 100644 --- a/packages/shared/src/auth.ts +++ b/packages/shared/src/auth.ts @@ -1,6 +1,7 @@ import { env } from "@follow/shared/env" import type { authPlugins } from "@follow/shared/hono" import type { BetterAuthClientPlugin } from "better-auth/client" +import { inferAdditionalFields } from "better-auth/client/plugins" import { createAuthClient } from "better-auth/react" import { IN_ELECTRON, WEB_URL } from "./constants" From 7dcf006735a0ca24cb68ba5e67eaa596c5812267 Mon Sep 17 00:00:00 2001 From: Innei Date: Tue, 17 Dec 2024 01:05:42 +0800 Subject: [PATCH 6/6] chore(release): hotfix to release v0.2.7-beta.1 --- CHANGELOG.md | 15 ++++++++++++++- package.json | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 721bf8296..0bd18e147 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # CHANGELOG -## [0.2.7-beta.0](https://github.com/RSSNext/follow/compare/v0.2.0-beta.2...v0.2.7-beta.0) (2024-12-12) +## [0.2.7-beta.1](https://github.com/RSSNext/follow/compare/v0.2.7-beta.0...v0.2.7-beta.1) (2024-12-16) ### Bug Fixes @@ -13,6 +13,7 @@ * add changelog ([4de6355](https://github.com/RSSNext/follow/commit/4de6355bb77ae7b00416be6827a5b71a3a724dfa)) * add cleaner cron impl ([faae74b](https://github.com/RSSNext/follow/commit/faae74b8ba465a240bcdd40de33e446bc0799c41)) * add deps for integration cmds ([#1696](https://github.com/RSSNext/follow/issues/1696)) ([1353d4b](https://github.com/RSSNext/follow/commit/1353d4bfc552c20fdcfc9723a4cafb9ef47c769d)) +* add electron as root package deps ([4cde1ac](https://github.com/RSSNext/follow/commit/4cde1acbf027e75a955afed49bda100bf83aac38)) * add entryId to deps, try fix `isActive` judge ([76fc17e](https://github.com/RSSNext/follow/commit/76fc17eddf1137fb9af227b5a951d62ce4e7cc58)) * add feed and feed list overlap ([6395d22](https://github.com/RSSNext/follow/commit/6395d223750d06d6a73e8bef4f5081cdf8d7c46a)) * add manifest to purge cache ([2f8dc0b](https://github.com/RSSNext/follow/commit/2f8dc0bc8561ebf9bb40160de8658eac799b31b0)) @@ -35,11 +36,13 @@ * app upgrade toast open link should in new window ([fc81546](https://github.com/RSSNext/follow/commit/fc81546bed6b07626215a57543a735001728f520)) * app upgraded toast href error ([#1444](https://github.com/RSSNext/follow/issues/1444)) ([c875d69](https://github.com/RSSNext/follow/commit/c875d697b2a1cd9e49f3c91397531a82928e1bc8)) * app version ([c5854f4](https://github.com/RSSNext/follow/commit/c5854f45795bf6cb78a9d24f05678fe548ceba06)) +* article render container responsive width ([cae7fa6](https://github.com/RSSNext/follow/commit/cae7fa67155ee6934a3613d68fbcd515d8761600)) * assets rewrite ([#1204](https://github.com/RSSNext/follow/issues/1204)) ([488e8ef](https://github.com/RSSNext/follow/commit/488e8effc6f00769df7dbf68d4e6d1e4e950b8e7)) * attempt to fix the page freeze issue when re-opening modal after closing ([36d235e](https://github.com/RSSNext/follow/commit/36d235eeb8d08c841d475db2a354ad05d3f268d7)) * audio cover style ([21a93c7](https://github.com/RSSNext/follow/commit/21a93c757dfbc161d67f28500f0129bde1959662)) * audio player on mobile ([1e936e2](https://github.com/RSSNext/follow/commit/1e936e2c593adafa92d54ddc542ff30688c0e3bc)) * audio player width, fixed [#1934](https://github.com/RSSNext/follow/issues/1934) ([238938a](https://github.com/RSSNext/follow/commit/238938a4da5b854f9f3422b93059b9f82f60d09b)) +* **auth:** handle optional icon class names for providers in login components ([de8d337](https://github.com/RSSNext/follow/commit/de8d3376713be0b696579e16395b887b2658d59f)) * **auth:** redirect url ([e7d5576](https://github.com/RSSNext/follow/commit/e7d5576b63a77cd4f4e25a3124f9685f408a73de)) * auto archived list flash ([#1269](https://github.com/RSSNext/follow/issues/1269)) ([8d2478c](https://github.com/RSSNext/follow/commit/8d2478c6a93aa9f5a99fddc55bbb8e532e1a0fe1)) * auto load achieved entries when show achieved button is available ([074a60d](https://github.com/RSSNext/follow/commit/074a60d3cf93bcede88ea4d70b07cf7480be4229)) @@ -127,6 +130,7 @@ * fallback for code can not render to html ([08acded](https://github.com/RSSNext/follow/commit/08acded2d549bc80d2ed8f180a6d89cc3a3c861a)), closes [#1142](https://github.com/RSSNext/follow/issues/1142) * feed action in selection ([ef9db5c](https://github.com/RSSNext/follow/commit/ef9db5c8b39c8229b1e907c6a0e6e74431f677de)) * feed boost modal title wrap ([a3eb287](https://github.com/RSSNext/follow/commit/a3eb2875e9456e8ec30ed96294b2bad82ccd5a4d)) +* feed column pb in mobile ([4035a6b](https://github.com/RSSNext/follow/commit/4035a6b7b839a284e452f51e75c759f25136784a)) * feed icon fallback delay ms ([89239d8](https://github.com/RSSNext/follow/commit/89239d89aa52429eef348e500c7ed7d6170c766a)) * feed icon margin right ([0f32364](https://github.com/RSSNext/follow/commit/0f3236406dc354adc9830c51e73f9fb4790f159a)) * feedIcon margin ([03ce13d](https://github.com/RSSNext/follow/commit/03ce13d45bd89908bd9bcb06484a07873b6388f5)) @@ -153,7 +157,9 @@ * **i18n:** update Japanese translations for better clarity ([#1842](https://github.com/RSSNext/follow/issues/1842)) ([bf9fb22](https://github.com/RSSNext/follow/commit/bf9fb2289ae7d6c553ec10ba28cab9f04e9f1bcd)) * **i18n:** update label for notification badge settings in zh-CN locale and others ([#1455](https://github.com/RSSNext/follow/issues/1455)) ([ec82f03](https://github.com/RSSNext/follow/commit/ec82f036b44a3d0d463c48c1d793fc517def1d07)) * ignore `file` and editor protocols ([2badb9b](https://github.com/RSSNext/follow/commit/2badb9b1c0bf6628d2a2fc177063fd0c7c7fb08b)) +* image error ui ([#2124](https://github.com/RSSNext/follow/issues/2124)) ([008cc98](https://github.com/RSSNext/follow/commit/008cc98f8a2624d4360e7c6bb8ba7176436f8579)) * immer object extensible ([6ad35ad](https://github.com/RSSNext/follow/commit/6ad35ad6712a68db9e231bf5733a2956ccecda90)) +* import ([9d6e7d4](https://github.com/RSSNext/follow/commit/9d6e7d44363efc50a592e13e7c20aa6eca2e03d0)) * improve multi select behavior ([24017df](https://github.com/RSSNext/follow/commit/24017dfb3190c91969ec68d3d88544e051880469)) * improve perform for feed column ([#1708](https://github.com/RSSNext/follow/issues/1708)) ([1f349ed](https://github.com/RSSNext/follow/commit/1f349ed73e912825fb34877f5db9df13c6c6f879)) * initializeDayjs in server ([d408581](https://github.com/RSSNext/follow/commit/d408581a13ad78d5a871d98f3ff0ff9bb5e45ae5)), closes [#1198](https://github.com/RSSNext/follow/issues/1198) @@ -165,6 +171,7 @@ * load instagram image fail ([f8fd58f](https://github.com/RSSNext/follow/commit/f8fd58f78ec11bc221eb9190ac7b6a66dd858f9c)), closes [#1539](https://github.com/RSSNext/follow/issues/1539) * localeCompare is undefined ([ab28156](https://github.com/RSSNext/follow/commit/ab28156cb8bd998ec1bc6b43b9a44bd2ecd17137)) * lock ([97c1ece](https://github.com/RSSNext/follow/commit/97c1ece9e3d855c7dbcf7238e7953e9bd206811c)) +* login override provider icon ([96b8929](https://github.com/RSSNext/follow/commit/96b892923ab1e791d29f0464b847a6873c61f075)) * mark as read when navigating ([423777e](https://github.com/RSSNext/follow/commit/423777e1372631b8ea8d06913ce55fbdf97f1f07)) * mark feed unread dirty, refetch unread next time, fixed [#1830](https://github.com/RSSNext/follow/issues/1830) ([58d0e9c](https://github.com/RSSNext/follow/commit/58d0e9c1902157c2e9fb1444bc1c0db0b775485b)) * mark single feed as all read ([a4acd2f](https://github.com/RSSNext/follow/commit/a4acd2fb65335f228875ed5b38f03a9c71b76e1b)) @@ -318,6 +325,7 @@ * use replace for discover form navigation ([63602f2](https://github.com/RSSNext/follow/commit/63602f266390781a3552a14eefa35455f19c92b6)) * use turbo run concurrently task ([742f915](https://github.com/RSSNext/follow/commit/742f91517d87d136bc8dc6ee65008e9b6880d435)) * validate file format for OPML and XML in import schema ([2f9bd43](https://github.com/RSSNext/follow/commit/2f9bd43775dd0260ade8aac80f7067b927edba7a)) +* values().map is undefined ([74ba483](https://github.com/RSSNext/follow/commit/74ba483b0d6b679e551336db51d1a6737bb000ee)) * vercel do not support `__` prefix for api route ([45a66e0](https://github.com/RSSNext/follow/commit/45a66e0f972d18831795d92b1d3c1f3893f396dc)) * vercel rewrite config ([#1203](https://github.com/RSSNext/follow/issues/1203)) ([c954d61](https://github.com/RSSNext/follow/commit/c954d61f074e282a9a86cbf1d1546748871c20e7)) * video media can not play in video view ([4cbf8a5](https://github.com/RSSNext/follow/commit/4cbf8a54fcf11fb71ff935baee52c79a83f5035c)), closes [#1645](https://github.com/RSSNext/follow/issues/1645) @@ -367,6 +375,7 @@ * **discover:** improve trending style and discover no image placeholer ([86be1a2](https://github.com/RSSNext/follow/commit/86be1a2e46d3298157cece0731e687a462f833d5)) * dnd ([#1471](https://github.com/RSSNext/follow/issues/1471)) ([c9333d5](https://github.com/RSSNext/follow/commit/c9333d5004c170955ab96b9f7f5a2825e1042271)) * dynamic auth providers ([b031ce5](https://github.com/RSSNext/follow/commit/b031ce57b8d7835c15fd9eecc6f99eaf50a368d1)) +* email verification ([3497623](https://github.com/RSSNext/follow/commit/3497623b853f8321ed81788e32d43846be6d6135)) * entry image gallery modal ([e0d3e17](https://github.com/RSSNext/follow/commit/e0d3e17da4ee17217d7b78871b546f43af87d893)) * export database ([85b4502](https://github.com/RSSNext/follow/commit/85b4502f9c113b8de73ccf4a167aa514a3c149ea)) * **external:** move `login` and `redirect` route to external ([7916803](https://github.com/RSSNext/follow/commit/791680332d5e1c2c52eda792dd7ff69281f25adb)) @@ -398,9 +407,12 @@ * multi select with shift ([2158b1c](https://github.com/RSSNext/follow/commit/2158b1cc255baf3ff5e4e1a5806d85b7df64bd55)), closes [#1256](https://github.com/RSSNext/follow/issues/1256) * new user guide in mobile ([9eca05e](https://github.com/RSSNext/follow/commit/9eca05ef6f3612658397719a0af00dfc30196ca3)) * **obsidian:** use readability content when available ([b4a3197](https://github.com/RSSNext/follow/commit/b4a3197e6ebd39bb259a6bc67f408569354a205e)) +* optimize action pages ([a10b78a](https://github.com/RSSNext/follow/commit/a10b78a79ce836bfbd5b40e9021c30dfef64a23e)) * prefer origin addresses for content images ([d4d4345](https://github.com/RSSNext/follow/commit/d4d43451dec839b64239e1835b2ac1a1aa2478be)) * **reader:** support custom css, fixed [#256](https://github.com/RSSNext/follow/issues/256) ([b251fa9](https://github.com/RSSNext/follow/commit/b251fa9421417c75d71707c8f08850f2cc902e1a)) * redesign login modal ([77dd6ce](https://github.com/RSSNext/follow/commit/77dd6ce2f97ea659def1104119085db3201ec029)) +* reduce the size of the list in feed list ([e9f7ff3](https://github.com/RSSNext/follow/commit/e9f7ff31768db6bcc269c9becfb253315386baa1)) +* register or login with email and password ([#2075](https://github.com/RSSNext/follow/issues/2075)) ([ae0dc2c](https://github.com/RSSNext/follow/commit/ae0dc2c30dd62d6ef4f87239298ec89c47c55861)) * remove DISABLE_PERSONAL_DAILY_POWER ([064f8f5](https://github.com/RSSNext/follow/commit/064f8f524398a451d46e88b2d8b604f807d4ea96)) * remove entries total and remaining to reduce big queries ([df343b1](https://github.com/RSSNext/follow/commit/df343b10d0745a239e3b15fe11c1d3b2cd9ac3bb)) * remove entryCount in feed claim list ([723cc43](https://github.com/RSSNext/follow/commit/723cc43891e3fe7e3ce8c09a422df9fdd42577be)) @@ -440,6 +452,7 @@ * add code cache cleaner ([a0fd15f](https://github.com/RSSNext/follow/commit/a0fd15f4abbab340264da4281f2e4ca9f89ffffa)) * batch profile ([#1464](https://github.com/RSSNext/follow/issues/1464)) ([a3e9c0e](https://github.com/RSSNext/follow/commit/a3e9c0edc83628d9c0ceb998d95184c5fd635f6f)) * enable router navigation transition ([24e1aea](https://github.com/RSSNext/follow/commit/24e1aead5e9bbb98b59194166fa4fd07eb167353)) +* **external:** hydrate auth providers ([e0661ff](https://github.com/RSSNext/follow/commit/e0661ff2b9cc76f1a86ba6f293c0c37b5ad8d789)) * lazy show action, reduce lcp time ([fcf775c](https://github.com/RSSNext/follow/commit/fcf775c976591258f83dea6e34ca3161b539b15e)) * modify some animations to CSS animations ([9ec3fe5](https://github.com/RSSNext/follow/commit/9ec3fe562bf3527ad4279a9a57c0b0bb5934dba1)) * optimize dnd re-render ([12bd659](https://github.com/RSSNext/follow/commit/12bd6594585fda9f7b83daad7f6eebae3059d985)) diff --git a/package.json b/package.json index e54697669..b055ec2b8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "Follow", "type": "module", - "version": "0.2.7-beta.0", + "version": "0.2.7-beta.1", "private": true, "packageManager": "pnpm@9.12.3", "description": "Follow your favorites in one inbox",