diff --git a/src/config.cpp b/src/config.cpp index 59b4b01a..9aae15c4 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -441,6 +441,7 @@ namespace config { sunshine_t sunshine { false, // hide_tray_controls + true, // enable_pairing "en", // locale 2, // min_log_level 0, // flags @@ -1135,6 +1136,7 @@ namespace config { bool_f(vars, "native_pen_touch", input.native_pen_touch); bool_f(vars, "hide_tray_controls", sunshine.hide_tray_controls); + bool_f(vars, "enable_pairing", sunshine.enable_pairing); bool_f(vars, "notify_pre_releases", sunshine.notify_pre_releases); int port = sunshine.port; diff --git a/src/config.h b/src/config.h index b6d7a687..2d71fc03 100644 --- a/src/config.h +++ b/src/config.h @@ -171,8 +171,10 @@ namespace config { std::string cmd_val; bool elevated; }; + struct sunshine_t { bool hide_tray_controls; + bool enable_pairing; std::string locale; int min_log_level; std::bitset flags; diff --git a/src/nvhttp.cpp b/src/nvhttp.cpp index 6afb4f2a..d27d66af 100644 --- a/src/nvhttp.cpp +++ b/src/nvhttp.cpp @@ -570,6 +570,13 @@ namespace nvhttp { response->close_connection_after_response = true; }); + if (!config::sunshine.enable_pairing) { + tree.put("root..status_code", 403); + tree.put("root..status_message", "Pairing is disabled for this instance"); + + return; + } + auto args = request->parse_query_string(); if (args.find("uniqueid"s) == std::end(args)) { tree.put("root..status_code", 400); diff --git a/src_assets/common/assets/web/configs/tabs/General.vue b/src_assets/common/assets/web/configs/tabs/General.vue index d3d7c3f0..8b3815fe 100644 --- a/src_assets/common/assets/web/configs/tabs/General.vue +++ b/src_assets/common/assets/web/configs/tabs/General.vue @@ -1,5 +1,5 @@