feat: broaden reddit to use rxddit - #536
Open
Sn0wCrack wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR replaces the previous Reddit handler with a new RxRedditSite implementation that expands Reddit URL handling and rewrites Reddit post links to use rxddit.com, while keeping the existing media?url= decode behavior.
Changes:
- Swap the DI registration from
RedditSitetoRxRedditSite. - Add
RxRedditSitewith broader Reddit URL matching and rxddit link rewriting; remove the oldRedditSite. - Update unit tests and benchmarks to use
RxRedditSite.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| SaucyBot/Site/ServiceRegistration.cs | Registers RxRedditSite as the IRedditSite implementation. |
| SaucyBot/Site/Reddit/RxReddit.cs | New Reddit site implementation with a broader regex and rxddit rewrite behavior. |
| SaucyBot/Site/Reddit/Reddit.cs | Removes the old Reddit implementation. |
| SaucyBot.Tests/Unit/Site/RedditTest.cs | Updates tests to construct RxRedditSite (still only covers media?url= path). |
| SaucyBot.Tests.Benchmark/Benchmarks/SiteMatchingBenchmarks.cs | Updates benchmark wiring to use RxRedditSite. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| { | ||
| public override string Identifier => "Reddit"; | ||
|
|
||
| [GeneratedRegex(@"https?://(www\.)?reddit\.com/(r/(?<subreddit>\S+)/(comments|s)/(?<id>\S+)|media\?url=(?<url>[A-Z0-9\%\.]+))", RegexOptions.IgnoreCase | RegexOptions.Multiline)] |
Comment on lines
+27
to
+33
| public override async Task<ProcessResponse?> Process(ProcessRequest request) | ||
| { | ||
| // Handle mangled URLs first if match exists | ||
| return request.Match.Groups["url"].Success | ||
| ? HandleMangledUrl(request.Match.Groups["url"].Value) | ||
| : HandleRedditPost(request.Match.Groups["subreddit"], request.Match.Groups["id"]); | ||
| } |
Comment on lines
+42
to
+45
| return new ProcessResponse() | ||
| { | ||
| Text = $"https://rxddit.com/r/{subreddit.Value}/comments/{id.Value}" | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.