Commit Graph

54 Commits

Author SHA1 Message Date
javayhu
e6bc1ea9e8 refactor: rename 'credits' to 'amount' in credit-related configurations and components for consistency 2025-08-24 01:16:39 +08:00
javayhu
f1d02720d0 refactor: restructure credit distribution logic and enhance user credit handling 2025-08-17 23:26:10 +08:00
javayhu
c5dfaafe61 chore: optimize distributing credits when user sign up 2025-08-15 22:40:59 +08:00
javayhu
df3f3aa895 feat: support disable newsletter module 2025-08-15 22:39:29 +08:00
javayhu
f6a2df402e fix: fix rate limit for newsletter subscription when sign up 2025-08-15 00:37:30 +08:00
javayhu
52aeb2d61c refactor: rename functions to remove 'IfNeed' suffix for clarity and consistency 2025-07-13 00:37:01 +08:00
javayhu
765f5e1e39 feat: add register gift and monthly refresh credits to new user 2025-07-12 00:55:27 +08:00
javayhu
cd710bb9ed feat: support register gift credits 2025-07-10 09:58:48 +08:00
javayhu
17c7d67743 refactor: add getDb function & update all db calls 2025-06-12 01:40:44 +08:00
javayhu
a7c56f4a6c chore: optimize db instance init with schema 2025-06-12 00:20:06 +08:00
javayhu
0585fb3253 chore: set baseURL in better auth 2025-05-15 23:58:48 +08:00
javayhu
70d35e5fd5 chore: update default ban reason 2025-05-11 11:51:54 +08:00
javayhu
5f6205c150 chore: define type User and use it in users-table 2025-05-11 10:52:11 +08:00
javayhu
061b304aa8 feat: support ban and unban user & show user detailed information 2025-05-11 00:47:05 +08:00
javayhu
dd8b74b096 chore: use Session defined in auth-types 2025-05-01 21:55:11 +08:00
javayhu
35bcbb7a06 docs: add documentation links to various components and configurations 2025-04-21 09:49:43 +08:00
javayhu
23cd59bbac refactor: biome lint part 1 2025-04-18 21:47:14 +08:00
javayhu
9c5e7db748 feat: support auto subscribe to newsletter after sign up 2025-04-14 01:29:59 +08:00
javayhu
f6bec8b78c refactor: restructure sitemap and robots handling
- Removed the old sitemap implementation and replaced it with a new one that generates dynamic routes for categories, posts, and documentation.
- Introduced a new robots.txt handler to manage crawling rules and specify the sitemap location.
- Updated URL handling functions to improve locale support in callback URLs.
- Enhanced the content-collections.ts file by reorganizing documentation comments and reintroducing the extractLocaleAndBase function for better clarity and maintainability.
2025-04-12 08:16:47 +08:00
javayhu
9dca440d91 refactor: rename send function to sendEmail for clarity
- Updated references from send to sendEmail in send-message.ts and auth.ts for consistency.
- Adjusted exports in mail/index.ts to reflect the new function name.
- Removed unused mail-config.ts file to streamline the mail configuration process.
2025-04-09 23:18:01 +08:00
javayhu
3c05657fe0 feat: add userId handling and enhance payment actions & optimize the whole payment process
- Introduced userId parameter in createCheckoutAction and createPortalAction for improved user-specific session management.
- Updated components to pass userId instead of customerId, aligning with the new payment structure.
- Added new actions to retrieve active subscription and lifetime status, ensuring users can check their subscription details securely.
- Created SQL migration for new payment-related tables, establishing a robust foundation for payment management.
- Enhanced error handling and logging in payment actions for better debugging and user feedback.
2025-04-09 14:31:08 +08:00
javayhu
52559865ca feat: remove lifetimeMember from user schema && update fetch subscription
- Created SQL migration to drop unique constraint and columns from the user table.
- Updated journal and snapshot metadata to reflect the new migration version.
- Refactored user schema to remove the lifetimeMember field, aligning with the new subscription management logic.
- Enhanced getUserLifetimeStatus action to utilize updated subscription data structure.
2025-04-07 23:35:15 +08:00
javayhu
9b0d354683 chore: optimize utils.tsx & remove other functions out 2025-04-06 23:01:53 +08:00
javayhu
345528e4b3 chore: remove username plugin in better auth 2025-04-06 17:09:42 +08:00
javayhu
2248cfdc35 feat: add subscription management features and database schema updates
- Introduced new database tables for managing subscriptions and user subscriptions.
- Updated package.json with new database commands for generation, migration, and studio.
- Refactored the user schema to remove deprecated fields and added foreign key relationships.
- Enhanced Stripe payment provider logic to handle subscription creation, updates, and cancellations.
- Improved error handling and logging for subscription events.
2025-04-06 11:12:27 +08:00
javayhu
ba1c87fc3e refactor: move some shared components to layout folder 2025-04-05 17:30:47 +08:00
javayhu
9dbe79593e refactor: rename navigation function and update sidebar component
- Renamed `getNavMainLinks` to `getSidebarLinks` for improved clarity in the configuration file.
- Updated the `DashboardSidebar` component to utilize the new `getSidebarLinks` function and integrated `useCurrentUser` for user status handling.
- Enhanced the sidebar to conditionally display the upgrade card and user profile based on membership status.
- Updated comments for better understanding of the code functionality.
2025-04-05 08:18:55 +08:00
javayhu
ab8d85be00 feat: add subscription and membership fields to user schema and update related actions
- Introduced new columns `subscription_id` and `lifetime_member` to the user table for enhanced subscription management.
- Updated the user schema in the database to reflect these changes.
- Refactored actions to utilize the new user fields for better subscription handling.
- Enhanced error handling and logging in relevant actions for improved user feedback.
- Updated translations to include new messages related to subscription status and lifetime access.
2025-04-04 10:07:39 +08:00
javayhu
128748d33e feat: add inferAdditionalFields plugin to auth 2025-04-03 17:08:57 +08:00
javayhu
acb468fd36 feat: add customerId to user table as additionalFields 2025-03-24 09:48:14 +08:00
javayhu
a6e2ee698a refactor: update site metadata and translations
- Renamed "Site" to "Metadata" in translation files for clarity.
- Updated the title, tagline, and description in both English and Chinese translations to reflect the new branding.
- Adjusted references in various components to use the updated metadata structure.
- Removed the obsolete site.webmanifest file and updated the manifest path in the metadata construction.
2025-03-23 15:37:38 +08:00
javayhu
130338b9a5 refactor: refactor mail module & enhance auth email with locale support
- Added locale handling to email sending functions, allowing for localized URLs in reset password and verification emails.
- Introduced a new utility function `addLocaleToUrl` to append locale to callback URLs in authentication flows.
- Refactored the email sending process to utilize a mail provider interface, supporting both templated and raw email sending.
- Created a comprehensive README for the email system, detailing usage, configuration, and available templates.
- Established a default mail configuration for improved email management.
2025-03-19 01:00:14 +08:00
javayhu
bb7e36cc85 refactor: enhance localization and styling in account deletion flow
- Updated Chinese localization file to include a new "cancel" message for improved user experience during account deletion.
- Adjusted `DeleteAccountCard` footer styling for better alignment and spacing of buttons.
- Modified `auth.ts` to disable freshness check for user deletion, ensuring smoother account removal process.
2025-03-17 00:02:44 +08:00
javayhu
1fd3ef7eeb feat: add reset password functionality for users with social login
- Introduced `ResetPasswordCard` component to guide users who signed up with social providers in setting up a password through the forgot password flow.
- Updated `ConditionalUpdatePasswordCard` to conditionally render `ResetPasswordCard` for users without a credential provider but with an email.
- Enhanced localization files to include new messages for the password setup process in both English and Chinese.
- Implemented email pre-filling in the forgot password form based on URL parameters for improved user experience.
2025-03-16 23:45:29 +08:00
javayhu
c51a608a28 refactor: update user references from username to name
- Replaced instances of `user.username` with `user.name` in `SidebarUser`, `UserButton`, and `UpdateNameCard` components for consistency and clarity.
- Adjusted the default values in the form handling to reflect the change from username to name.
- Updated comments in `auth.ts` to clarify the implementation status of username support.
2025-03-16 15:20:42 +08:00
javayhu
d51a22e030 fix: enhance localization messages and improve account settings UI
- Added new success and failure messages for password updates in English and Chinese localization files.
- Updated `UpdateAvatarCard`, `UpdateNameCard`, and `UpdatePasswordCard` components to improve error handling and user feedback with toast notifications.
- Enhanced styling for the user avatar fallback icon in `UpdateAvatarCard` for better visual consistency.
2025-03-16 00:20:12 +08:00
javayhu
43010fcb64 chore: update localization and metadata handling in email templates
- Refactor email components (ForgotPassword, SubscribeNewsletter, VerifyEmail) to utilize `defaultMessages` for improved localization.
- Enhance `EmailLayout` to accept locale and messages props, ensuring consistent translation across email templates.
- Update manifest generation to use `defaultMessages` for site name and description, streamlining metadata handling.
- Adjust copyright formatting in translation files for better presentation.
2025-03-15 10:24:50 +08:00
javayhu
2ba2eebbaa chore: update database schema and enhance authentication features
- Add `username` column to the `user` table and enforce uniqueness constraint.
- Introduce new SQL migration file for the `username` addition.
- Update `schema.ts` to reflect changes in the `user`, `session`, and `account` tables.
- Enhance authentication client by integrating `usernameClient` plugin for better user management.
- Adjust session management settings for improved caching and freshness.
- Refactor metadata generation in the home page for consistency.
2025-03-15 00:54:13 +08:00
javayhu
3dbf65b62a refactor: streamline email handling and localization
- Introduce a new `send` utility function for sending emails with templates and context.
- Refactor email templates to utilize the updated `defaultMessages` from the i18n module.
- Consolidate email-related types into a new `types.ts` file for better organization.
- Remove deprecated `messages.ts` and `types.ts` files from the mail module.
- Update email components to use the new `BaseEmailProps` type and routing for default locale.
2025-03-13 23:46:24 +08:00
javayhu
8b4dde9042 refactor: centralize website configuration with dynamic translations
- Replace static `siteConfig` with dynamic `getWebsiteInfo()` function
- Add `Site` section to translation JSON files for multilingual support
- Update types to distinguish between website config and website info
- Remove deprecated `site.ts` configuration file
- Modify components and utilities to use new translation-based configuration
- Ensure consistent website metadata generation across the application
2025-03-10 00:48:12 +08:00
javayhu
df17877ede refactor: replace siteConfig.url with dynamic base URL generation
- Replace hardcoded site URL references with dynamic getBaseUrl() function
- Remove unnecessary keywords and author fields from siteConfig
- Simplify metadata generation in constructMetadata function
- Add EMAIL_FROM constant for email configuration
- Improve type definitions and remove redundant configurations
2025-03-09 23:11:51 +08:00
javayhu
34006556c8 refactor: run biome format to src folder 2025-03-09 22:13:59 +08:00
javayhu
8c3f64d0aa refactor: remove email templates and consolidate locale utility functions
- Delete email template files: `email-formats.ts`, `newsletter-welcome.tsx`, `reset-password.tsx`, and `verify-email.tsx`
- Move `getLocaleFromRequest` utility function from `auth.ts` to `utils.ts`
- Update Chinese translation for newsletter and copyright text
- Improve code organization and remove redundant email-related files
2025-03-08 12:02:37 +08:00
javayhu
074a6d9f1e refactor: update routes, middleware, and configuration for improved routing and environment variables
- Update middleware to exclude API routes from locale redirection
- Modify public routes to include new pages and remove documentation routes
- Adjust auth routes order for better readability
- Replace `NEXT_PUBLIC_APP_URL` with `NEXT_PUBLIC_BASE_URL` across configuration files
- Clean up and standardize authentication and site configuration
2025-03-08 11:04:54 +08:00
javayhu
988a1a6b58 refactor: update email template system with improved type safety and locale handling
- Replace `templateId` with `template` in email sending function
- Rename `translations` to `messages` in email template props
- Consolidate email template and sending logic in `send.ts`
- Remove separate `templates.ts` file and merge functionality
- Update email template components to use new message structure
- Improve type definitions for email-related functions and props
2025-03-08 09:41:14 +08:00
javayhu
95ddd0a1dc feat: enhance email internationalization and template system
- Add comprehensive email template system with React Email and use-intl
- Implement dynamic email template rendering with locale-specific translations
- Create reusable email components for consistent design
- Update authentication flow to support multilingual email templates
- Add new email-related dependencies and configuration
- Refactor email sending logic to support dynamic locale detection
2025-03-07 23:34:02 +08:00
javayhu
8aaead0245 feat: add React Email templates and Resend email configuration
- Integrate React Email library for creating email templates
- Add email templates for newsletter welcome, reset password, and email verification
- Create email format styles for consistent email design
- Configure Resend email service with new mail utility
- Update authentication flow to use React Email templates
- Add new email-related dependencies in package.json
2025-03-07 19:14:13 +08:00
javayhu
249efb5e32 chore: add admin menu to user button by the role in user info of session 2025-02-24 00:45:37 +08:00
javayhu
c7c952f27c feat: enable better auth account linking 2025-02-23 23:47:02 +08:00
javayhu
897f906631 feat: add better auth plugin admin to support user role and user ban 2025-02-23 23:23:01 +08:00