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

Improve ASF-FreeGames: JSON serialization, error handling, and HttpClient optimizations #85

Merged
merged 7 commits into from
Aug 8, 2024

Conversation

maxisoft
Copy link
Owner

@maxisoft maxisoft commented Aug 8, 2024

This pull request addresses several key areas to enhance the ASF-FreeGames plugin:

  • JSON serialization: Fixes compatibility issues with recent ASF versions and improves reliability of config.json handling.
  • Error handling: Provides more informative error messages and logging for better troubleshooting.
  • HttpClient optimizations: Introduces SimpleHttpClient for better network performance and handles potential issues gracefully.

Specific changes include:

  • Resolved compatibility problems with recent ASF versions causing issues with config.json loading (ASFFreeGamesOptionsSaver.cs).
  • Implemented a new SaveOptions method that validates and writes configuration options to the file in a more independant way.
  • Added unit tests to ensure proper JSON serialization (ASFFreeGamesOptionsSaverTests.cs).
  • Improved error message when encountering issues during config.json loading (ASFFreeGames.cs).
  • Provided more informative logging in case of unexpected errors (ASFFreeGamesOptionsLoader.cs).
  • Introduced SimpleHttpClient class with improved configuration options (SimpleHttpClient.cs).
  • Set default MaxConnectionsPerServer to limit resource usage (SimpleHttpClient.cs).
  • Implemented a workaround for missing CheckCertificateRevocationList property in older .NET versions (SimpleHttpClient.cs).
  • Improved stream handling in HttpStreamResponse class to gracefully handle potential null streams (SimpleHttpClient.cs, HttpStreamResponse.cs).
  • Added comments and code formatting for better readability.
  • Updated code to adhere to modern C# practices.

TO-DOs:

These changes contribute to a more stable, efficient, and user-friendly ASF-FreeGames plugin.

maxisoft added 4 commits June 6, 2024 12:13
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.
…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
…ent optimizations (#84, improvements)

This commit addresses several improvements and bug fixes for the ASF-FreeGames plugin:

* Fixed JSON serialization issue:
    * Resolved compatibility problems with recent ASF versions causing issues with `config.json` loading (`ASFFreeGamesOptionsSaver.cs`).
    * Implemented a new `SaveOptions` method that validates and writes configuration options to the file in a more robust way.
    * Added unit tests to ensure proper JSON serialization (`ASFFreeGamesOptionsSaverTests.cs`).
* Enhanced error handling:
    * Improved error message when encountering issues during `config.json` loading (`ASFFreeGames.cs`).
    * Provided more informative logging in case of unexpected errors (`ASFFreeGamesOptionsLoader.cs`).
* Optimized HttpClient usage:
    * Introduced `SimpleHttpClient` class with improved configuration options (`SimpleHttpClient.cs`).
    * Set default `MaxConnectionsPerServer` to limit resource usage (`SimpleHttpClient.cs`).
    * Implemented a workaround for missing `CheckCertificateRevocationList` property (`SimpleHttpClient.cs`).
    * Improved stream handling in `HttpStreamResponse` class to gracefully handle potential null streams (`SimpleHttpClient.cs`, `HttpStreamResponse.cs`).
* Minor improvements:
    * Added comments and code formatting for better readability.
    * Updated code to adhere to modern C# practices.

These changes ensure compatibility with recent ASF versions, provide better error handling for configuration issues, and optimize the performance and reliability of the plugin's network communication.
@maxisoft maxisoft added the bug Something isn't working label Aug 8, 2024
@maxisoft maxisoft self-assigned this Aug 8, 2024
@maxisoft
Copy link
Owner Author

maxisoft commented Aug 8, 2024

before merging need #77 to be completed

@maxisoft
Copy link
Owner Author

maxisoft commented Aug 8, 2024

merging this will merge #77 also

@maxisoft maxisoft merged commit 79fb49d into main Aug 8, 2024
22 checks passed
@EsdrubalMagano
Copy link

Thank you maxisoft! I was really looking forward to this update :)

Is it possible to use user:pass proxies? If yes, on what format?

  • ip:port:user:pass
  • user:pass:ip:port
  • user:pass@ip:port

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants