aboutsummaryrefslogtreecommitdiff
path: root/internal
AgeCommit message (Collapse)Author
2025-11-28Merge branch 'master' of https://github.com/jhalter/mobiusHEADmainRuben Beltran del Rio
2025-11-19Fix error when downloading incomplete filesJeff Halter
2025-11-18Replace hardcoded magic values with named constants and improve type safetyJeff Halter
Adds new constants for file format identifiers (FormatFILP), fork types (ForkTypeINFO), and platform identifiers (PlatformAMAC, PlatformMWIN) to improve code maintainability and readability. Changes FlatFileForkHeader.ForkType field from [4]byte to ForkType type alias for better compile-time type checking, matching the pattern used in ForkInfoList.Fork.
2025-11-18Add support for GIF banners with validation and improved error messagesJeff Halter
- Add custom validator for banner file extensions (.jpg, .jpeg, .gif) - Update HandleTranAgreed to dynamically detect banner type from file extension - Export FileTypeFromFilename function for use across packages - Add comprehensive test coverage for banner validation and type detection - Improve error messages to clearly communicate allowed file extensions
2025-07-05Fix TestHandleSetClientUserInfo test expectationsJeff Halter
Fix two failing test cases in TestHandleSetClientUserInfo: - Corrected auto-reply test to use UserOptAutoResponse (bit 2) instead of UserOptRefusePM (bit 0) - Updated refuse private messages test to expect correct flag value when UserOptRefuseChat sets UserFlagRefusePChat The HandleSetClientUserInfo function was working correctly - the test expectations were wrong about how user options map to user flags.
2025-07-04Add comprehensive test coverage for News and improve error handlingJeff Halter
2025-07-04Standardize IP extraction using net.SplitHostPortJeff Halter
Replace custom extractIP function and inconsistent string.Split usage with Go's standard net.SplitHostPort to ensure proper IPv6 compatibility and consistent IP address handling across Redis operations.
2025-07-04Add comprehensive API documentation and improve code documentationJeff Halter
- Add OpenAPI specification (api.yaml) with complete endpoint documentation - Update README with comprehensive API section including authentication and examples - Add godoc comments to all API handlers and types for better code documentation
2025-07-04Fix file handle close warnings by ignoring return valuesJeff Halter
Updated all file close operations to use anonymous functions that ignore return values to satisfy golangci-lint errcheck warnings.
2025-07-01Add documentation and comprehensive test coverage for AccountManagerJeff Halter
- Add GoDoc comments to AccountManager interface and all YAMLAccountManager methods - Add complete table-driven test coverage for Create, Update, Get, and List methods - Tests follow project conventions with proper error handling and temporary directories - All tests pass with comprehensive verification of both memory state and file operations
2025-06-30Replace inappropriate panic calls with proper error handlingJeff Halter
- Convert panic in news article processing to return error instead - Replace panic in API stats endpoint with HTTP error response - Update ThreadedNewsMgr interface to return errors from ListArticles - Ensure server stability by handling errors gracefully
2025-06-29Merge branch 'feature/extract-error-constants'Jeff Halter
2025-06-29Fix tests modifying test fixture files by using temporary directoriesJeff Halter
Previously, running tests would modify test/config/Users/guest.yaml and create test/config/Users/test-user.yaml due to the automatic migration logic in YAMLAccountManager. This caused git diff to show changes after running tests. Solution: - Modified TestNewYAMLAccountManager to use t.TempDir() for test isolation - Added copyTestFiles helper to copy test fixtures to temporary directory - Tests now run against copies, leaving original fixtures untouched This ensures tests are properly isolated and don't have side effects on the repository's test fixture files.
2025-06-29Extract hardcoded error strings into comprehensive public constantsJeff Halter
Replace 60+ hardcoded error strings throughout transaction handlers with public constants and templates for consistent error handling across the Hotline protocol implementation. Features: - 33 authorization error constants (ErrMsgNotAllowed*) - Account operation error constants (ErrMsgAccount*) - File operation error templates with filename parameters (ErrMsgCannot*) - Upload/download restriction templates (ErrMsgUpload*) - Ban message constants (ErrMsgTemporaryBan, ErrMsgPermanentBan) - General error constants (ErrMsgUserNotFound, ErrMsgCreateAlias) - Chat/messaging templates (ErrMsgDoesNotAcceptTemplate) Benefits: - Single source of truth for all error messages - Public API for other packages to import standard error constants - Sprintf-style templates for dynamic content (filenames, usernames) - Clear distinction between protocol errors (ErrMsg*) and golang errors - Improved maintainability and consistency across transaction handlers All error messages are now centralized, making future modifications easier and ensuring consistent user experience across all operations.
2025-06-28Add comprehensive documentation to transaction handler functionsJeff Halter
- Document all transaction handler functions with detailed field specifications - Include request and reply field descriptions with required/optional indicators - Add field numbers and descriptions for easy protocol reference - Remove duplicate comments while preserving important context - Standardize documentation format across all handler functions
2025-06-26Replace filepath.Join with path.Join for Windows compatibilityJeff Halter
Replace all instances of filepath.Join with path.Join across the codebase to improve Windows compatibility following the guidance from https://github.com/golang/go/issues/44305. Key changes: - Replaced filepath.Join with path.Join in 14 files - Updated import statements appropriately - Resolved variable shadowing issues where function parameters named 'path' were conflicting with the path package - Maintained filepath imports where needed for OS-specific functions like filepath.Walk, filepath.IsAbs, filepath.Dir, and filepath.Base All tests pass, confirming the changes maintain functionality while improving cross-platform compatibility.
2025-06-25Fix critical bug in YAMLAccountManager Update methodJeff Halter
Move delete operation before modifying account.Login to prevent deleting wrong key from accounts map.
2025-05-22Update transaction_handlers.goTheo Knez
2025-05-22Update api.goTheo Knez
2025-02-06Account for the rootRuben Beltran del Rio
2025-02-04Share replacement codeRuben Beltran del Rio
2025-02-04Add downloads as wellRuben Beltran del Rio
2025-02-04Allow to delete home files / replace filesRuben Beltran del Rio
2025-02-03Allow home uploadsRuben Beltran del Rio
2025-02-03Allow for personal ~ folderRuben Beltran del Rio
2024-07-31Migrate user account yaml files to new Access flag format if neededJeff Halter
2024-07-30Fix commentsJeff Halter
2024-07-28Improve human readability of account config filesJeff Halter
2024-07-23Fix panic on empty news pathJeff Halter
2024-07-21Clean up loggingJeff Halter
2024-07-19Add option for account-specific file rootJeff Halter
2024-07-19Appease linterJeff Halter
2024-07-18Add initial HTTP API endpointsJeff Halter
2024-07-17Extensive refactor, quality of life enhancementsJeff Halter
* Added ability to reload config, agreement, news, and user accounts without restarting the server by sending SIGHUP to the running process * Added ability to use modern unix or windows line breaks in Agreement.txt and MessageBoard.txt instead of classic MacOS `\r` breaks. * Extensive refactor towards swappable backends for the active server state * Extensive refactored towards making the hotline package generic and re-usable for alternate server implemenations * Fix bug where users whose accounts have been deleted would not be disconnected
2024-07-09Extensive refactor and clean upJeff Halter