diff --git a/assets/web/apps.html b/assets/web/apps.html
index 1e72584e..fb6380ee 100644
--- a/assets/web/apps.html
+++ b/assets/web/apps.html
@@ -178,7 +178,7 @@
/>
Application icon/picture/image path that will be sent to client.
- Only full path are working, so no relative path.
+ Only full path are working, so no relative path. Image must be a PNG.
If not set, Sunshine will send default box image.
diff --git a/sunshine/nvhttp.cpp b/sunshine/nvhttp.cpp
index 55e83d78..8afdb35a 100644
--- a/sunshine/nvhttp.cpp
+++ b/sunshine/nvhttp.cpp
@@ -766,11 +766,11 @@ void appasset(resp_https_t response, req_https_t request) {
print_req(request);
auto args = request->parse_query_string();
- auto [ app_image, image_content_type ] = proc::proc.get_app_image(util::from_view(args.at("appid")));
+ auto app_image = proc::proc.get_app_image(util::from_view(args.at("appid")));
std::ifstream in(app_image, std::ios::binary);
SimpleWeb::CaseInsensitiveMultimap headers;
- headers.emplace("Content-Type", "image/" + image_content_type);
+ headers.emplace("Content-Type", "image/png");
response->write(SimpleWeb::StatusCode::success_ok, in, headers);
response->close_connection_after_response = true;
}
diff --git a/sunshine/process.cpp b/sunshine/process.cpp
index 9e217d10..386c43c7 100644
--- a/sunshine/process.cpp
+++ b/sunshine/process.cpp
@@ -193,28 +193,28 @@ std::vector &proc_t::get_apps() {
/// Gets application image from application list.
/// Returns default image if image configuration is not set.
/// returns http content-type header compatible image type
-std::tuple proc_t::get_app_image(int app_id) {
+std::string proc_t::get_app_image(int app_id) {
auto app_index = app_id -1;
if(app_index < 0 || app_index >= _apps.size()) {
BOOST_LOG(error) << "Couldn't find app with ID ["sv << app_id << ']';
- return { SUNSHINE_ASSETS_DIR "/box.png", "png" };
+ return SUNSHINE_ASSETS_DIR "/box.png";
}
auto app_image_path = _apps[app_index].image_path;
if (app_image_path.empty()) {
- return { SUNSHINE_ASSETS_DIR "/box.png", "png" };
+ return SUNSHINE_ASSETS_DIR "/box.png";
}
- auto image_extention = std::filesystem::path(app_image_path).extension().string();
- image_extention = image_extention.substr(1, image_extention.length() - 1);
+ auto image_extension = std::filesystem::path(app_image_path).extension().string();
+ image_extension = image_extension.substr(1, image_extension.length() - 1);
std::error_code code;
- if (!std::filesystem::exists(app_image_path, code) || !CHECK_EXPECTED_PICTURE_EXTENTIONS(image_extention)) {
- return { SUNSHINE_ASSETS_DIR "/box.png", "png" };
+ if (!std::filesystem::exists(app_image_path, code) || image_extension != "png") {
+ return SUNSHINE_ASSETS_DIR "/box.png";
}
// return only "content-type" http header compatible image type.
- return { app_image_path, image_extention == "jpg" ? "jpeg" : image_extention };
+ return app_image_path;
}
proc_t::~proc_t() {
diff --git a/sunshine/process.h b/sunshine/process.h
index 00fdbe80..2b3fdad8 100644
--- a/sunshine/process.h
+++ b/sunshine/process.h
@@ -16,8 +16,6 @@
#include "utility.h"
-#define CHECK_EXPECTED_PICTURE_EXTENTIONS(extention) (extention == "png" || extention == "jpg" || extention == "jpeg")
-
namespace proc {
using file_t = util::safe_ptr_v2;
@@ -81,7 +79,7 @@ public:
const std::vector &get_apps() const;
std::vector &get_apps();
- std::tuple get_app_image(int app_id);
+ std::string get_app_image(int app_id);
void terminate();