feat: Add Replay Manager tool with cloud sharing and drag-and-drop#233
feat: Add Replay Manager tool with cloud sharing and drag-and-drop#233undead2146 wants to merge 1 commit intocommunity-outpost:developmentfrom
Conversation
…le management - Implemented ReplayManagerView for managing replay files. - Added drag-and-drop support for importing replay files (.rep, .zip). - Enhanced ToolsViewModel to include Replay Manager services. - Updated UI styles for better visual consistency. - Introduced EnumToBoolConverter and EqualsToConverter for improved data binding. - Added documentation for Replay Manager features and usage. - Registered Replay Manager services in the dependency injection module.
b9f8255 to
615dc70
Compare
|
@greptile |
There was a problem hiding this comment.
Additional Comments (14)
-
GenHub/GenHub.Core/Models/Tools/ToolMetadata.cs, line 21-26 (link)syntax: The XML documentation comments for
Version(line 21-22) andAuthor(line 24-26) properties are swapped.Versionproperty has description 'Gets or sets the author of the tool' andAuthorproperty has description 'Gets or sets the version of the tool'. -
GenHub/GenHub.Core/Interfaces/Tools/ReplayManager/IUrlParserService.cs, line 32 (link)style: method returns nullable string but doesn't document when null is returned
Should the XML documentation specify under what conditions null is returned (e.g., invalid URL, network error, unsupported source)?
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
-
GenHub/GenHub/Infrastructure/Converters/EnumToBoolConverter.cs, line 21 (link)style: String comparison for enum values may not handle all edge cases correctly. Consider using Equals() method or direct enum comparison for better type safety. Are there specific enum types this converter needs to handle that might have custom ToString() implementations?
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
-
GenHub/GenHub.Core/Interfaces/Tools/ReplayManager/UsageInfo.cs, line 12 (link)style: missing newline at end of file
-
GenHub/GenHub/Features/Tools/ReplayManager/ReplayManagerToolPlugin.cs, line 2 (link)style:
System.Collections.Genericimport is unusedNote: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
-
GenHub/GenHub.Core/Constants/PlatformConstants.cs, line 16 (link)style: The select argument format string includes "{0}" but should be properly documented to indicate what parameter is expected (file path).
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
-
GenHub/GenHub.Core/Interfaces/Tools/ReplayManager/IUploadRateLimitService.cs, line 29 (link)style:
RecordUploadis synchronous while other methods are async - consider making this async for consistency. Is there a specific reason this method needs to be synchronous while others are async?Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
-
GenHub/GenHub/Features/Tools/ReplayManager/ViewModels/ReplayManagerViewModel.cs, line 467-478 (link)logic: Potential infinite loop if directory lacks write permissions - the while loop will continue indefinitely as File.Exists will keep returning true for the same path.
-
GenHub/GenHub/Features/Tools/ReplayManager/Services/ReplayExportService.cs, line 91-95 (link)style: File.Delete in finally block could throw if file is locked or inaccessible, potentially masking original exceptions from the try block
-
GenHub/GenHub/Features/Tools/ReplayManager/Services/ReplayExportService.cs, line 185 (link)logic: FileStream is not disposed properly - it's passed to StreamContent but may not be disposed when MultipartFormDataContent is disposed
-
GenHub/GenHub/Features/Tools/ReplayManager/ViewModels/UploadHistoryItemViewModel.cs, line 58 (link)style: Consider using constants from UiConstants for status colors instead of hardcoded hex values
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Context Used: Context from
dashboard- Coding style used in the application which PullRequests and coding style has to be applied to. (source) -
GenHub/GenHub/Features/Tools/ReplayManager/Services/UploadRateLimitService.cs, line 227 (link)logic: returning empty list when file is corrupt could lead to data loss since the cache becomes empty and subsequent saves would overwrite the corrupted file. Should the service attempt to backup the corrupted file before returning an empty list, or throw an exception to prevent potential data loss?
-
GenHub/GenHub.Core/Services/Tools/ToolService.cs, line 207 (link)logic: Empty catch block discards all exception information. At minimum, the exception should be logged for debugging purposes.
-
GenHub/GenHub/Features/Tools/ReplayManager/Views/ReplayManagerView.axaml.cs, line 58-61 (link)style: Automatically adding
.repextension modifies user input without their consent and could cause issues if they intentionally omitted it. Should this behavior be optional or provide user confirmation before modifying the filename?Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
60 files reviewed, 14 comments
|
Closed as of #238 |
This PR introduces a Replay Manager tool to GenHub, enabling users to manage, import, and share Command & Conquer: Generals and Zero Hour replay files directly from the application.
Summary
The Replay Manager is now available as a bundled tool in the Tools tab. It provides a unified interface to handle replay files, supporting drag-and-drop imports, cloud sharing via UploadThing, and local ZIP archiving.
Key Features
Unified Replay Management
Flexible Importing
.repor.zipfiles directly onto the view to import them..rep/.zip).Export & Cloud Sharing
Rate Limiting
Validation
.repfiles.Technical Changes
Core & Infrastructure
IReplayDirectoryService,IReplayImportService,IReplayExportService,IUploadRateLimitService,IUrlParserService, andIZipValidationService.DotNetEnvpackage to support loading environment variables (e.g.,UPLOADTHING_TOKEN) from a.envfile.Avalonia.Controls.DataGridpackage for the file list view.ReplayManagerToolPluginin the Dependency Injection module.ToolServiceto distinguish between "bundled" (built-in) and external plugins, preventing the removal of bundled tools.UI/UX
ReplayManagerViewwith a responsive layout, progress bars, and overlay notifications.ReplayManagerViewModelusing the MVVM pattern with CommunityToolkit.Mvvm.EnumToBoolConverterandEqualsToConverterfor improved data binding.Documentation
docs/.Greptile Summary
Important Files Changed
GenHub/GenHub/Features/Tools/ReplayManager/ViewModels/ReplayManagerViewModel.csGenHub/GenHub/Features/Tools/ReplayManager/Views/ReplayManagerView.axaml.csGenHub/GenHub/Features/Tools/ReplayManager/Services/ReplayExportService.csGenHub/GenHub.Core/Services/Tools/ToolService.csConfidence score: 3/5
ReplayManagerViewModel.csfor async operation handling andReplayExportService.csfor authentication token managementSequence Diagram
sequenceDiagram participant User participant ReplayManagerViewModel participant UploadRateLimitService participant ReplayExportService participant ZipValidationService participant HttpClient participant UploadThing participant Clipboard User->>ReplayManagerViewModel: "Click Upload & Share" ReplayManagerViewModel->>UploadRateLimitService: "CanUploadAsync(totalSize)" UploadRateLimitService-->>ReplayManagerViewModel: "true/false" alt Upload allowed ReplayManagerViewModel->>ReplayExportService: "UploadToUploadThingAsync(replays)" alt Multiple files or single .rep ReplayExportService->>ReplayExportService: "CreateTemporaryZip(replays)" ReplayExportService->>ZipValidationService: "ValidateZip(zipPath)" ZipValidationService-->>ReplayExportService: "validation result" else Single ZIP file ReplayExportService->>ZipValidationService: "ValidateZip(existingZip)" ZipValidationService-->>ReplayExportService: "validation result" end ReplayExportService->>HttpClient: "POST /prepareUpload" HttpClient->>UploadThing: "Request presigned URL" UploadThing-->>HttpClient: "Presigned URL + key" HttpClient-->>ReplayExportService: "Upload instructions" ReplayExportService->>HttpClient: "PUT binary data to presigned URL" HttpClient->>UploadThing: "Upload file" UploadThing-->>HttpClient: "Upload success" HttpClient-->>ReplayExportService: "Upload complete" ReplayExportService-->>ReplayManagerViewModel: "Public URL" ReplayManagerViewModel->>Clipboard: "SetTextAsync(url)" ReplayManagerViewModel->>UploadRateLimitService: "RecordUpload(size, url, filename)" ReplayManagerViewModel->>User: "Show success notification" else Upload denied ReplayManagerViewModel->>User: "Show rate limit error" endContext used:
dashboard- What: Enforce Conventional Commits format with allowed types (feat, fix, docs, style, refactor, perf... (source)dashboard- Coding style used in the application which PullRequests and coding style has to be applied to. (source)