feat(api): add application image endpoint#4627
feat(api): add application image endpoint#4627ReenigneArcher merged 8 commits intoLizardByte:masterfrom
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Introduces a new API endpoint that returns a application's image. Adds an error_message argument to the not_found function in confighttp.cpp.
moved the app index checking (wether an application with the given index actually exists) into a reusable function. changed apps_node to apps in deleteApp
Added png validation (check_valid_png function is 100% AI generated!), fixed cover images in the cover directory (e.g a image uploaded with the uploadCover function) and default images (the steam.png and desktop.png).
Used the shorter fs::path alias instead of std::filesystem::path. Also removed unnecesary path conversion.
Moved PNG signature validation logic from confighttp.cpp to process.cpp as check_valid_png, and updated getCover to use validate_app_image_path for image path resolution and validation. Added extensive unit tests for check_valid_png and validate_app_image_path in test_process.cpp. Defined DEFAULT_APP_IMAGE_PATH in process.h and improved error handling and logging for invalid or unreadable PNG files.
d3de613 to
03e22a2
Compare
|
I made a few tweaks to this PR.
|
Added documentation for the error_message parameter in the not_found function to clarify its purpose in the HTTP 404 response.
Bundle ReportBundle size has no change ✅ |
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4627 +/- ##
==========================================
+ Coverage 15.43% 15.46% +0.02%
==========================================
Files 94 94
Lines 19178 19235 +57
Branches 8861 8898 +37
==========================================
+ Hits 2960 2974 +14
+ Misses 14429 14393 -36
- Partials 1789 1868 +79
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Why did you add the check_content_type function in the getCover function? It checks for the Content-Type application/json header, which is weird because you don't have to send any JSON in the request body to use this endpoint. |
|
I'm fixing it in #4631 |




Introduces a new API endpoint that returns a application's image.
Description
Creates a new API route and function. Adds an error_message argument to the not_found function in confighttp.cpp. Updated docs to include new endpoint.
Screenshot
Issues Fixed or Closed
Resolves https://discord.com/channels/804382334370578482/1464609795012169988
Roadmap Issues
Type of Change
Checklist
AI Usage