aboutsummaryrefslogtreecommitdiff
path: root/hotline/file_wrapper.go
AgeCommit message (Collapse)Author
2026-07-08Decouple FileStore from *os.File for object-store backendsJeff Halter
The FileStore interface returned concrete *os.File from Open/Create/ OpenFile, which no non-filesystem backend (e.g. S3/R2) can produce, and many file-library hot paths bypassed the interface entirely with direct os.* / filepath.Walk calls. Widen the interface to return io.ReadCloser / io.WriteCloser and add ReadDir, ReadLink, and Walk so directory traversal no longer escapes the abstraction. Route every file-library call site (fork writers, upload/ download handlers, GetFileNameList, CalcTotalSize/CalcItemCount, the set- file-info folder rename) through the injected FileStore, and add a WithFileStore option. OSFileStore keeps byte-identical behavior. DownloadHandler now nil-guards the optional resource-fork reader instead of relying on *os.File's nil-receiver tolerance, so a backend returning an untyped-nil reader does not panic.
2025-12-05Improve error handling, logging, and fix race condition in DisconnectJeff Halter
- Add logging for unhandled transaction types in Client.HandleTransaction - Fix race condition in Client.Disconnect by protecting done channel with mutex - Add TranServerMsg to transaction type names map - Use Time type instead of raw byte array in File.flattenedFileObject - Improve error message in handleFileTransfer to include reference number - Simplify return statement in HandleGetFileInfo
2025-11-19Fix error when downloading incomplete filesJeff Halter
2025-11-18Rename hotline.fileWrapper struct to hotline.FileJeff 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-07-06Add ForkType type alias for improved type safetyJeff Halter
- Replace [4]byte with ForkType in ForkInfoList struct - Update constants ForkTypeDATA and ForkTypeMACR to use ForkType - Add String() method to ForkType for better debugging - Improve consistency with existing type patterns (FieldType, TranType) - Clean up unused code and improve documentation
2024-07-30Fix commentsJeff 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-06-18Adopt more fixed size array types for struct fieldsJeff Halter
2024-06-17Fix io.Reader implementations and wrap more errorsJeff Halter
2024-06-17Fix corrupt file info forksJeff Halter
This fixes a bug that happens when: 1. Optional "Enable Resource Forks" feature is true 2. A file comment is added 3. The comment is updated to be shorter than the original The expected behavior is that the hidden .info file is replaced with the new data, but this wasn't happening because the file flag was not set to truncate on write.
2024-06-15Refactoring and cleanupJeff Halter
* Split CLI client into separate project * Convert more functions to follow common Golang idioms e.g io.Reader, io.Writer * Use ldflags for versioning * Misc cleanup and simplification
2024-06-09Convert more bespoke methods to io.Reader/io.Writer interfacesJeff Halter
2023-05-28Misc minor cleanup and linter appeasementJeff Halter
2022-09-15Clean up some linter warningsJeff Halter
2022-06-23Implement GetClientInfoText with per-client file transfer infoJeff Halter
2022-06-21Cleanup and logging improvementsJeff Halter
2022-06-21Replace path.Join with filepath.JoinJeff Halter
2022-06-20Convert hardcoded path separators to filepath.JoinJeff Halter
2022-06-20Add initial support for resource and info forksJeff Halter