Skip to content

Add Proxy Support for Reddit Requests#77

Merged
maxisoft merged 5 commits intomainfrom
reddit_proxy
Aug 8, 2024
Merged

Add Proxy Support for Reddit Requests#77
maxisoft merged 5 commits intomainfrom
reddit_proxy

Conversation

@maxisoft
Copy link
Copy Markdown
Owner

@maxisoft maxisoft commented Jun 6, 2024

This pull request implements proxy support for Reddit requests within the ASFFreeGames plugin, addressing issues #75 and #76.
Users can now leverage proxies Reddit.com api specific connections, increasing flexibility for those utilizing proxy servers for Reddit interactions.

Changes:

  • New configuration options:

    • ASFFreeGamesOptions.cs: Added properties Proxy and RedditProxy to support proxy configuration for general and Reddit connections, respectively.
    • ASFFreeGamesOptionsLoader.cs: Updated to load proxy settings from configuration and environment variables. These settings are then merged to ensure all configurations are considered.
  • Refactored Reddit communication:

    • FreeGamesCommand.cs: Modified GetGames to utilize SimpleHttpClientFactory and its CreateForReddit method, enabling the use of the configured Reddit proxy.
    • RedditHelper.cs: Replaced WebBrowser usage with SimpleHttpClient for Reddit communication, allowing proxy support.

Benefits:

  • Increased flexibility for users who require proxy servers for Reddit interactions.
  • Improved code maintainability by utilizing SimpleHttpClient consistently.

Disclaimers/Bugs/Issues:

  • Potential Security Concern: Merging environment variables and configuration file settings for proxy information could lead to sensitive data (like proxy passwords) being unintentionally written to the JSON file. Consider implementing a mechanism to exclude sensitive data from being saved to the configuration file.
  • Potential for Future System.MissingMethodException: This change might introduce the possibility of encountering System.MissingMethodException errors in future ASF updates. Thorough testing and potential code updates may be required to mitigate this risk.

Testing:

  • Manual testing with various proxy configurations is recommended to ensure proper functionality.

Additional Notes:

  • Consider adding a note about potential limitations or specific proxy requirements (if applicable).

TO-DOs:

  • Update README to reflect the new proxy support functionality.
  • Create new issues for the identified security concern.
  • Conduct more comprehensive testing to ensure stability across various configurations.

This commit introduces proxy support for Reddit requests within the ASFFreeGames plugin, addressing issues #75 #76.

Users can now configure proxies for both general and Reddit-specific connections through the Proxy and RedditProxy settings in ASFFreeGamesOptions.cs.

Key changes:

- ASFFreeGamesOptions.cs: Added properties Proxy and RedditProxy to support proxy configuration for general and Reddit connections respectively.
- ASFFreeGamesOptionsLoader.cs: Updated to load proxy settings from configuration and environment variables.
- FreeGamesCommand.cs: Modified GetGames to utilize SimpleHttpClientFactory and its CreateForReddit method, enabling the use of the configured Reddit proxy.
- RedditHelper.cs: Replaced WebBrowser usage with SimpleHttpClient for Reddit communication, allowing proxy support.

These improvements enhance the plugin's flexibility by allowing users to leverage proxy servers for Reddit interactions.
@maxisoft maxisoft added the enhancement New feature or request label Jun 6, 2024
@maxisoft maxisoft self-assigned this Jun 6, 2024
@maxisoft maxisoft marked this pull request as draft June 6, 2024 10:31
…limiting from Reddit.

* Added checks for remaining rate limit and reset time to implement appropriate delays based on Reddit's response headers.
GetStreamAsync() internal request object use configured http version
@maxisoft maxisoft marked this pull request as ready for review August 8, 2024 13:54
@maxisoft maxisoft merged commit 2b7d29b into main Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant