Fix build

This commit is contained in:
Yukino Song
2025-07-13 23:50:28 +08:00
parent e43420f18b
commit 8509611c26
7 changed files with 28 additions and 31 deletions

View File

@@ -624,7 +624,7 @@ namespace confighttp {
* @api_examples{/api/apps| POST| {"name":"Hello, World!","uuid": "aaaa-bbbb"}}
*/
void saveApp(resp_https_t response, req_https_t request) {
if (!authenticate(response, request) || !validateContentType(response, request, "application/json"sv)) {
if (!validateContentType(response, request, "application/json") || !authenticate(response, request)) {
return;
}
@@ -670,10 +670,7 @@ namespace confighttp {
* @api_examples{/api/apps/close| POST| null}
*/
void closeApp(resp_https_t response, req_https_t request) {
if (!check_content_type(response, request, "application/json")) {
return;
}
if (!authenticate(response, request)) {
if (!validateContentType(response, request, "application/json") || !authenticate(response, request)) {
return;
}
@@ -693,7 +690,7 @@ namespace confighttp {
* @api_examples{/api/apps/reorder| POST| {"order": ["aaaa-bbbb", "cccc-dddd"]}}
*/
void reorderApps(resp_https_t response, req_https_t request) {
if (!authenticate(response, request) || !validateContentType(response, request, "application/json"sv)) {
if (!validateContentType(response, request, "application/json") || !authenticate(response, request)) {
return;
}
@@ -807,7 +804,7 @@ namespace confighttp {
* @api_examples{/api/apps/delete | POST| { uuid: 'aaaa-bbbb' }}
*/
void deleteApp(resp_https_t response, req_https_t request) {
if (!authenticate(response, request) || !validateContentType(response, request, "application/json"sv)) {
if (!validateContentType(response, request, "application/json") || !authenticate(response, request)) {
return;
}
@@ -897,7 +894,7 @@ namespace confighttp {
* @endcode
*/
void updateClient(resp_https_t response, req_https_t request) {
if (!authenticate(response, request) || !validateContentType(response, request, "application/json"sv)) {
if (!validateContentType(response, request, "application/json") || !authenticate(response, request)) {
return;
}
@@ -950,7 +947,7 @@ namespace confighttp {
* @api_examples{/api/clients/unpair| POST| {"uuid":"1234"}}
*/
void unpair(resp_https_t response, req_https_t request) {
if (!authenticate(response, request) || !validateContentType(response, request, "application/json"sv)) {
if (!validateContentType(response, request, "application/json") || !authenticate(response, request)) {
return;
}
@@ -978,7 +975,7 @@ namespace confighttp {
* @api_examples{/api/clients/unpair-all| POST| null}
*/
void unpairAll(resp_https_t response, req_https_t request) {
if (!validateContentType(response, request, "application/json"sv) || !authenticate(response, request)) {
if (!validateContentType(response, request, "application/json") || !authenticate(response, request)) {
return;
}
@@ -1049,7 +1046,7 @@ namespace confighttp {
* @api_examples{/api/config| POST| {"key":"value"}}
*/
void saveConfig(resp_https_t response, req_https_t request) {
if (!authenticate(response, request) || !validateContentType(response, request, "application/json"sv)) {
if (!validateContentType(response, request, "application/json") || !authenticate(response, request)) {
return;
}
@@ -1088,7 +1085,7 @@ namespace confighttp {
* @api_examples{/api/covers/upload| POST| {"key":"igdb_1234","url":"https://images.igdb.com/igdb/image/upload/t_cover_big_2x/abc123.png"}}
*/
void uploadCover(resp_https_t response, req_https_t request) {
if (!authenticate(response, request) || !validateContentType(response, request, "application/json"sv)) {
if (!validateContentType(response, request, "application/json") || !authenticate(response, request)) {
return;
}
@@ -1175,7 +1172,7 @@ namespace confighttp {
* @api_examples{/api/password| POST| {"currentUsername":"admin","currentPassword":"admin","newUsername":"admin","newPassword":"admin","confirmNewPassword":"admin"}}
*/
void savePassword(resp_https_t response, req_https_t request) {
if ((!config::sunshine.username.empty() && !authenticate(response, request)) || !validateContentType(response, request, "application/json"sv))
if ((!config::sunshine.username.empty() && !authenticate(response, request)) || !validateContentType(response, request, "application/json"))
return;
print_req(request);
std::vector<std::string> errors;
@@ -1232,7 +1229,7 @@ namespace confighttp {
* @api_examples{/api/otp| GET| null}
*/
void getOTP(resp_https_t response, req_https_t request) {
if (!authenticate(response, request) || !validateContentType(response, request, "application/json"sv)) {
if (!validateContentType(response, request, "application/json") || !authenticate(response, request)) {
return;
}
@@ -1279,7 +1276,7 @@ namespace confighttp {
* @api_examples{/api/pin| POST| {"pin":"1234","name":"My PC"}}
*/
void savePin(resp_https_t response, req_https_t request) {
if (!authenticate(response, request) || !validateContentType(response, request, "application/json"sv)) {
if (!validateContentType(response, request, "application/json") || !authenticate(response, request)) {
return;
}
@@ -1308,7 +1305,7 @@ namespace confighttp {
* @api_examples{/api/reset-display-device-persistence| POST| null}
*/
void resetDisplayDevicePersistence(resp_https_t response, req_https_t request) {
if (!validateContentType(response, request, "application/json"sv) || !authenticate(response, request)) {
if (!validateContentType(response, request, "application/json") || !authenticate(response, request)) {
return;
}
@@ -1327,7 +1324,7 @@ namespace confighttp {
* @api_examples{/api/restart| POST| null}
*/
void restart(resp_https_t response, req_https_t request) {
if (!validateContentType(response, request, "application/json"sv) || !authenticate(response, request)) {
if (!validateContentType(response, request, "application/json") || !authenticate(response, request)) {
return;
}
@@ -1379,7 +1376,7 @@ namespace confighttp {
* @param request The HTTP request object.
*/
void launchApp(resp_https_t response, req_https_t request) {
if (!authenticate(response, request) || !validateContentType(response, request, "application/json"sv)) {
if (!validateContentType(response, request, "application/json") || !authenticate(response, request)) {
return;
}
@@ -1435,7 +1432,7 @@ namespace confighttp {
* @param request The HTTP request object.
*/
void disconnect(resp_https_t response, req_https_t request) {
if (!authenticate(response, request) || !validateContentType(response, request, "application/json"sv)) {
if (!validateContentType(response, request, "application/json") || !authenticate(response, request)) {
return;
}
@@ -1469,7 +1466,7 @@ namespace confighttp {
* @endcode
*/
void login(resp_https_t response, req_https_t request) {
if (!checkIPOrigin(response, request) || !validateContentType(response, request, "application/json"sv)) {
if (!checkIPOrigin(response, request) || !validateContentType(response, request, "application/json")) {
return;
}

View File

@@ -21,7 +21,6 @@
#include "system_tray.h"
#include "upnp.h"
#include "uuid.h"
#include "version.h"
#include "video.h"
#ifdef _WIN32

View File

@@ -600,6 +600,8 @@ namespace rtsp_stream {
acceptor.close();
io_context.stop();
clear();
}
std::shared_ptr<stream::session_t>
find_session(const std::string_view& uuid) {
auto lg = _session_slots.lock();

View File

@@ -1925,7 +1925,6 @@ namespace video {
// set minimum frame time based on client-requested target framerate
auto minimum_frame_time = std::chrono::milliseconds(1000 / config.framerate);
auto frame_threshold = std::chrono::microseconds(1000ms * 1000 / config.encodingFramerate);
BOOST_LOG(debug) << "Minimum frame time set to "sv << minimum_frame_time.count() << "ms, based on min fps factor of "sv << config::video.min_fps_factor << "."sv;
BOOST_LOG(info) << "Frame threshold: "sv << frame_threshold;
auto shutdown_event = mail->event<bool>(mail::shutdown);