Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Proxy Support for Reddit Requests #77

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Add Proxy Support for Reddit Requests #77

wants to merge 2 commits into from

Conversation

maxisoft
Copy link
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.
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.

None yet

1 participant