mirror of
https://github.com/Stone-Red-Code/EchoHub.git
synced 2026-09-04 09:06:07 +02:00
- Updated EchoHubConnection to use ApiClient for token retrieval. - Introduced ValidationConstants for common validation patterns and limits. - Enhanced AuthDtos with refresh token support and expiration details. - Added new ChatDtos for channel creation and topic updates. - Created CommonDtos for error and paginated responses. - Implemented RefreshToken model for managing refresh tokens. - Modified JwtTokenService to generate and hash refresh tokens. - Updated AuthController to handle registration, login, token refresh, and logout with improved error handling. - Enhanced ChannelsController with channel creation, topic updates, and pagination for channel retrieval. - Added FilesController for file management with rate limiting. - Improved UsersController for profile updates and avatar uploads with validation. - Integrated rate limiting across controllers to manage request load. - Introduced FileValidationHelper for validating uploaded image files. - Updated database context to include RefreshToken and enforce unique constraints. - Enhanced ChatHub for improved channel and message handling with validation. - Updated Program.cs to configure rate limiting and CORS policies.
27 lines
908 B
C#
27 lines
908 B
C#
using System.Text.RegularExpressions;
|
|
|
|
namespace EchoHub.Core.Constants;
|
|
|
|
public static partial class ValidationConstants
|
|
{
|
|
public const string UsernamePattern = @"^[a-zA-Z0-9_-]{3,50}$";
|
|
public const string ChannelNamePattern = @"^[a-zA-Z0-9_-]{2,100}$";
|
|
public const string HexColorPattern = @"^#[0-9a-fA-F]{6}$";
|
|
|
|
public const int MaxPasswordLength = 128;
|
|
public const int MaxDisplayNameLength = 100;
|
|
public const int MaxBioLength = 500;
|
|
public const int MaxStatusMessageLength = 100;
|
|
public const int MaxChannelTopicLength = 500;
|
|
public const int MaxHistoryCount = 100;
|
|
|
|
[GeneratedRegex(UsernamePattern)]
|
|
public static partial Regex UsernameRegex();
|
|
|
|
[GeneratedRegex(ChannelNamePattern)]
|
|
public static partial Regex ChannelNameRegex();
|
|
|
|
[GeneratedRegex(HexColorPattern)]
|
|
public static partial Regex HexColorRegex();
|
|
}
|