Commit graph

2772 commits

Author SHA1 Message Date
Max
436d101cf3 Add GetAllProviders method and related tests for provider information retrieval
- Implemented GetAllProviders method in the Service to return all registered providers.
- Added TestGetAllProviders to validate the functionality, ensuring providers have required attributes and are unique.
- Enhanced GetPublicInfo method in provider implementations to return structured public information.
- Updated OpenAPI handlers to include endpoints for retrieving provider information, improving API usability.
2025-09-28 16:00:35 +08:00
Max
0505adf003 Refactor messenger service to enhance webhook processing and remove deprecated methods
- Implemented TriggerWebhook method to handle incoming webhook requests for various providers, utilizing gin.Context for improved integration.
- Removed the deprecated Receive method from the mailer provider and related functions, streamlining the codebase.
- Updated tests to reflect changes in webhook handling and provider interactions, ensuring compatibility with new implementations.
- Enhanced error handling and logging for webhook processing, improving overall reliability and clarity.
2025-09-28 15:27:20 +08:00
Max
c425b74383 Refactor error handling in various components to improve logging and message formatting
- Updated error messages to use fmt.Errorf with %s for better clarity and consistency.
- Enhanced logging statements to utilize formatted strings for improved readability.
- Refactored multiple Load functions across different modules to standardize error handling practices.
2025-09-28 10:24:17 +08:00
Max
ffc666c4de Enhance messenger service with message handler registration and webhook processing
- Introduced OnReceive method to register multiple message handlers for processing received messages.
- Added RemoveReceiveHandler method to unregister specific message handlers.
- Implemented TriggerWebhook method to process incoming webhook data and trigger registered handlers.
- Updated existing tests to reflect changes in provider types from 'smtp' to 'mailer' for consistency.
2025-09-28 10:00:38 +08:00
Max
1843a64ff5 Update dependencies and enhance mailer functionality
- Bump Go version to 1.24.0 and update toolchain to 1.24.3 for improved performance and compatibility.
- Add new dependencies for IMAP and SASL support, enhancing email handling capabilities.
- Refactor messenger service to integrate a new mailer provider, replacing the deprecated SMTP provider.
- Implement automatic mail receiver startup for mailer providers, improving message handling efficiency.
- Update GitHub Actions workflows to include IMAP server configurations for testing email reception.
2025-09-28 09:33:36 +08:00
Max
09ec6edac3 Enhance Twilio provider tests and configurations for improved SMS functionality
- Added TWILIO_TEST_PHONE environment variable to GitHub Actions workflows for better test configuration.
- Updated Twilio SMS test cases to utilize the new test phone number, improving test reliability.
- Implemented separate test cases for SMS sending using both Auth Token and API Key authentication methods.
- Enhanced existing tests to skip execution if required credentials are not configured, ensuring clearer test outcomes.
- Refactored benchmark tests for SMS sending to support both authentication methods, optimizing performance evaluation.
2025-09-27 08:41:42 +08:00
Max
d0964c942d Refactor Twilio provider methods to include context support
- Updated method signatures for sendSMS, sendWhatsApp, and their respective recipient functions to accept context.Context as a parameter.
- Modified request handling in sendTwilioRequest to utilize context, improving request management and error handling.
- Enhanced overall functionality and maintainability of the Twilio provider by integrating context support.
2025-09-26 19:01:05 +08:00
Max
fecbc87ba8 Update Mailgun test to validate delivery time format with timezone offset
- Modified the test for scheduled email delivery to assert that the delivery time includes a timezone offset in the RFC1123Z format.
- Replaced the previous check for "GMT" with a regex assertion to ensure compliance with the expected format.
2025-09-26 18:44:11 +08:00
Max
ae8efd247a Refactor SMTP provider implementation for improved clarity and functionality
- Renamed SMTPProvider to Provider for consistency across messenger providers.
- Updated method signatures to reflect the new Provider type.
- Added extractEmailAddress function to handle email address extraction from formatted strings.
- Enhanced sendEmail and sendWithTLS methods to support context and improve error handling.
- Refactored message building and sending logic for better maintainability.
2025-09-26 18:37:37 +08:00
Max
9438c6831a Refactor messaging service configurations for improved CI integration
- Enhanced GitHub Actions workflows by refining Mailgun, SMTP, and Twilio configurations for better unit and PR testing.
- Streamlined environment variable management for email and SMS services, ensuring consistent and secure credential handling.
- Updated related tests to validate the new configuration setup, improving overall reliability in communication functionalities.
2025-09-26 18:16:56 +08:00
Max
551af8cf0a Add messaging service configurations to CI workflows
- Integrated Mailgun, SMTP, and Twilio environment variables into the GitHub Actions workflows for unit testing and PR testing.
- Configured necessary credentials and settings for Mailgun and Gmail SMTP servers, enhancing email functionality.
- Added Twilio configuration for SMS and email services, improving communication capabilities in tests.
2025-09-26 17:43:03 +08:00
Max
c9917f8193 Enhance messenger functionality with context support and environment variable resolution
- Added context support to Send and SendBatch methods across all messenger providers (Twilio, Mailgun, SMTP).
- Implemented environment variable resolution in provider configurations to enhance flexibility.
- Updated Load function in the engine to include messenger loading, ensuring all components are initialized properly.
- Refactored related tests to validate new context handling and configuration parsing, improving overall robustness.
2025-09-26 17:39:10 +08:00
Max
d12ce099c3 Add API Key authentication support in Twilio provider
- Introduced optional API Key and API SID fields for enhanced authentication.
- Updated validation logic to require either an auth token or both API SID and API Key.
- Modified request handling to prioritize API Key authentication over auth token, improving security and flexibility.
2025-09-26 16:34:23 +08:00
Max
9ce1bb60cf
Merge pull request #1161 from trheyi/main
Implement team member invitation expiration handling
2025-09-25 10:34:10 +08:00
Max
9e0afa3f42 Implement team member invitation expiration handling
- Added functionality to manage expiration of member invitations, ensuring that outdated invitations are automatically invalidated.
- Updated invitation-related data structures to include expiration timestamps for better tracking.
- Enhanced the invitation workflow by implementing checks for expired invitations during member management operations.
- Refactored related tests to cover new expiration logic, ensuring robust validation of invitation handling.
2025-09-25 10:33:35 +08:00
Max
5bbdfa3286
Merge pull request #1160 from trheyi/main
Add team ownership and membership checks in user management
2025-09-23 17:48:03 +08:00
Max
b9a912b7d9 Enhance member invitation management and related functionality
- Introduced invitation_id handling for member management, allowing for unique identification of pending invitations.
- Added methods to create, update, and remove members by invitation_id, improving the invitation workflow.
- Updated member data structures and API responses to include invitation-related fields, enhancing clarity and usability.
- Implemented tests for invitation ID operations, ensuring robust validation and error handling.
- Refactored team access checks to streamline member management processes.
2025-09-23 17:47:43 +08:00
Max
35afc1d58c Add team ownership and membership checks in user management
- Introduced IsTeamOwner and IsTeamMember methods to verify user ownership and membership status within a team.
- Added CheckTeamAccess method to assess a user's access level, returning ownership and membership status.
- Enhanced user types with new MemberResponse and MemberDetailResponse structures for improved member management.
- Updated routing for team member management to utilize new handler functions for clarity and consistency.
2025-09-23 16:14:42 +08:00
Max
eb68c72967
Merge pull request #1159 from trheyi/main
Add team member removal functionality and related tests
2025-09-23 11:25:24 +08:00
Max
9aff88d2fc Add team member removal functionality and related tests
- Implemented RemoveAllTeamMembers method in DefaultUser to delete all members from a team during team deletion.
- Added TestTeamDeleteMemberCleanup to verify that all members are removed when a team is deleted.
- Refactored team creation and deletion logic to ensure proper member management and error handling during these operations.
2025-09-23 11:24:57 +08:00
Max
c24bda7a21
Merge pull request #1158 from trheyi/main
Remove unnecessary blank line in test utility function to enhance cod…
2025-09-23 10:30:46 +08:00
Max
abeae77619 Remove unnecessary blank line in test utility function to enhance code clarity. 2025-09-23 10:30:10 +08:00
Max
1852e2cff0
Merge pull request #1157 from trheyi/main
Add authorized info handling and session ID retrieval in OAuth guard
2025-09-23 10:23:23 +08:00
Max
5a894c11ab Add authorized info handling and session ID retrieval in OAuth guard
- Introduced methods to set and retrieve authorized information from the context, enhancing the OAuth guard functionality.
- Added a new `AuthorizedInfo` type to encapsulate user-related data such as subject, client ID, user ID, and scope.
- Implemented session ID retrieval from various sources (cookies, headers, query strings) to improve session management.
- Updated test utilities to support the creation of test users and access tokens, ensuring comprehensive testing of OAuth functionalities.
2025-09-23 10:22:52 +08:00
Max
a8a9187ee6
Merge pull request #1156 from trheyi/main
Add MFA support to login response and related structures
2025-09-22 14:40:22 +08:00
Max
774ebe5c7d Add MFA support to login response and related structures
- Updated the LoginResponse structure to include MFAEnabled status, reflecting the user's MFA configuration.
- Modified the authback function in oauth.go to return the MFAEnabled status in the response.
- Introduced a utility function to convert various types to boolean for determining MFA status from user data.
2025-09-22 14:39:18 +08:00
Max
59bb5caf4a
Merge pull request #1155 from trheyi/main
Refactor login response structure to enhance clarity and security
2025-09-22 11:35:00 +08:00
Max
637558aeb7 Refactor login response structure to enhance clarity and security
- Removed the refreshCaptcha function from the login.go file to streamline the codebase.
- Updated the authback function in oauth.go to return a structured LoginSuccessResponse, including session ID, access token, refresh token, and their expiration times for improved response clarity.
- Introduced a new LoginSuccessResponse type in types.go to standardize the login success response format.
2025-09-22 11:34:02 +08:00
Max
33a73b8f7c
Merge pull request #1154 from trheyi/main
Remove signin module and refactor OpenAPI to eliminate signin depende…
2025-09-22 11:04:41 +08:00
Max
7977b7f48e Remove signin module and refactor OpenAPI to eliminate signin dependencies
- Deleted the entire signin module, including related files and configurations, to streamline the authentication process.
- Updated OpenAPI to remove references to signin, including the loading of signin configurations and associated handlers.
- Refactored user authentication routes to integrate captcha functionality directly within the user module, enhancing user experience and security.
- Adjusted routing structure to reflect the removal of signin, ensuring clarity and consistency in user management operations.
2025-09-22 11:04:00 +08:00
Max
ad57e18d1b
Merge pull request #1153 from trheyi/main
Refactor login cookie handling to improve security and organization
2025-09-18 10:11:49 +08:00
Max
6f3a57cb33 Refactor login cookie handling to improve security and organization
- Consolidated cookie management into a new SendLoginCookies function, which sends access token, refresh token, and session ID cookies with appropriate security settings.
- Updated authback functions in the signin and oauth files to utilize the new SendLoginCookies function, enhancing code clarity and reducing duplication.
2025-09-18 10:10:58 +08:00
Max
b251d507dc
Merge pull request #1152 from trheyi/main
Fix formatting in OAuth authorization test for improved readability
2025-09-18 09:11:33 +08:00
Max
54d7120626 Fix formatting in OAuth authorization test for improved readability
- Removed unnecessary blank line in TestUserOAuthAuthorizationURLParameters to enhance code clarity and maintain consistency in test formatting.
2025-09-18 09:11:09 +08:00
Max
e8734849c2
Merge pull request #1151 from trheyi/main
Add user configuration loading and update authentication routes
2025-09-18 09:03:38 +08:00
Max
a6e1f6e382 Add user configuration loading and update authentication routes
- Integrated user configuration loading in the OpenAPI server initialization to enhance user management capabilities.
- Migrated authentication routes from /signin to /login, updating handler functions for clarity and consistency.
- Adjusted OAuth provider routes to reflect new paths, improving the overall routing structure for user authentication.
2025-09-18 09:02:54 +08:00
Max
8f1e3a27a3
Merge pull request #1150 from trheyi/main
Update MFA endpoint naming in API documentation and routing
2025-09-17 10:02:25 +08:00
Max
c5ea4dbfe8 Update MFA endpoint naming in API documentation and routing
- Renamed 2FA references to MFA in the user management API documentation and routing structure for consistency and clarity.
- Adjusted README to reflect the new endpoint paths for TOTP and SMS MFA functionalities.
2025-09-17 10:01:54 +08:00
Max
c4a1f7040b
Merge pull request #1149 from trheyi/main
Refactor user management API documentation and routing structure
2025-09-17 09:56:06 +08:00
Max
88efa1bc99 Refactor user management API documentation and routing structure
- Updated README to reflect changes in user management APIs, renaming balance management to credits management and updating endpoints accordingly.
- Enhanced team management section with detailed CRUD operations and member management, including invitation handling.
- Refactored user.go to align with new API structure, replacing balance with credits and invite management with referral management, while adding invitation response handling.
2025-09-17 09:55:35 +08:00
Max
aeeeaa6ed8
Merge pull request #1148 from trheyi/main
Add user and team handler attachments to OpenAPI server
2025-09-17 09:43:04 +08:00
Max
3f5e0caef8 Add user and team handler attachments to OpenAPI server
- Integrated user and team handler functions into the OpenAPI server's routing structure.
- Established new routes for user and team management under the OpenAPI framework, enhancing the server's capabilities for handling user-related operations.
2025-09-17 09:42:35 +08:00
Max
f78af80014
Merge pull request #1147 from trheyi/main
Refactor invitation handling and data parsing in user provider
2025-09-16 17:55:26 +08:00
Max
6c73395158 Refactor invitation handling and data parsing in user provider
- Updated TestMemberInvitationExpiry to use a consistent expired time for invitations.
- Simplified invitation expiration check in AcceptInvitation by utilizing a new checkTimeExpired function.
- Enhanced member ID parsing in AcceptInvitation to handle potential errors more gracefully.
- Refactored total extraction logic in CountOAuthAccounts, CountRoles, CountTeams, CountTypes, and CountUsers to use a new utility function for improved clarity and consistency.
- Introduced parseTimeFromDB and parseIntFromDB functions to streamline data parsing from database fields.
2025-09-16 17:54:56 +08:00
Max
4a2eab202b
Merge pull request #1146 from trheyi/main
Add team and member management capabilities to user provider
2025-09-16 17:34:12 +08:00
Max
b20ddee701 Add team and member management capabilities to user provider
- Introduced new constants for team and member error handling, enhancing error reporting.
- Added default field lists for teams and members, improving data structure organization.
- Expanded the UserProvider interface with methods for team and member management, including creation, updates, and retrieval.
- Enhanced the NewDefaultUser function to support team and member configurations, ensuring flexibility in user management.
2025-09-16 17:33:25 +08:00
Max
acc9527e05
Merge pull request #1145 from trheyi/main
Enhance member model to support robot members and their configurations
2025-09-16 10:00:42 +08:00
Max
a2df75b6e2 Enhance member model to support robot members and their configurations
- Updated the member model to include a new member_type field, allowing differentiation between human and robot members.
- Added fields specific to robot members, including robot_name, robot_description, and robot_avatar, to capture essential information.
- Introduced robot configuration fields such as robot_config, agents, tools, and data_access_permissions for enhanced functionality.
- Implemented scheduling and automation features for robots, including is_active_robot, schedule_config, and activity_frequency.
- Enhanced indexing to support efficient queries for robot members and their activities, improving overall system performance.
2025-09-16 10:00:04 +08:00
Max
c145a14606
Merge pull request #1144 from trheyi/main
Refactor user and model structures to enhance organization and role m…
2025-09-16 09:36:30 +08:00
Max
580f3683e2 Refactor user and model structures to enhance organization and role management
- Reorganized models by replacing the assistant and chat models with a new agent structure, including assistant, chat, and history models.
- Updated user model relationships to reflect changes in role and type references, ensuring consistency with the new model structure.
- Removed obsolete organization and user role models, streamlining the overall architecture.
- Adjusted system model mappings to incorporate new member and role models, enhancing clarity in user management.
2025-09-16 09:35:18 +08:00