Add option to configure auto discovery(mDNS)

resolves #539
potentially resolves #611
This commit is contained in:
Yukino Song
2025-04-15 00:11:29 +08:00
parent 26b8446ba1
commit 56646c2a81
7 changed files with 19 additions and 1 deletions

View File

@@ -580,6 +580,7 @@ namespace config {
sunshine_t sunshine {
false, // hide_tray_controls
true, // enable_pairing
true, // enable_discovery
"en", // locale
2, // min_log_level
0, // flags
@@ -1280,6 +1281,7 @@ namespace config {
bool_f(vars, "hide_tray_controls", sunshine.hide_tray_controls);
bool_f(vars, "enable_pairing", sunshine.enable_pairing);
bool_f(vars, "enable_discovery", sunshine.enable_discovery);
bool_f(vars, "notify_pre_releases", sunshine.notify_pre_releases);
int port = sunshine.port;

View File

@@ -254,6 +254,7 @@ namespace config {
struct sunshine_t {
bool hide_tray_controls;
bool enable_pairing;
bool enable_discovery;
std::string locale;
int min_log_level;
std::bitset<flag::FLAG_SIZE> flags;

View File

@@ -325,7 +325,9 @@ int main(int argc, char *argv[]) {
std::unique_ptr<platf::deinit_t> mDNS;
auto sync_mDNS = std::async(std::launch::async, [&mDNS]() {
mDNS = platf::publish::start();
if (config::sunshine.enable_discovery) {
mDNS = platf::publish::start();
}
});
std::unique_ptr<platf::deinit_t> upnp_unmap;

View File

@@ -151,6 +151,7 @@
"notify_pre_releases": "disabled",
"hide_tray_controls": "disabled",
"enable_pairing": "enabled",
"enable_discovery": "enabled",
},
},
{

View File

@@ -201,6 +201,14 @@ onMounted(() => {
default="true"
></Checkbox>
<!-- Enable Discovery -->
<Checkbox class="mb-3"
id="enable_discovery"
locale-prefix="config"
v-model="config.enable_discovery"
default="true"
></Checkbox>
<!-- Hide Tray Controls -->
<Checkbox class="mb-3"
id="hide_tray_controls"

View File

@@ -229,6 +229,8 @@
"double_refreshrate_desc": "Double the requested refresh rate when creating virtual displays, streamed refresh rate still remain the same. Can potentially improve stutter problem on some systems.",
"ds4_back_as_touchpad_click": "Map Back/Select to Touchpad Click",
"ds4_back_as_touchpad_click_desc": "When forcing DS4 emulation, map Back/Select to Touchpad Click",
"enable_discovery": "Enable Auto Discovery",
"enable_discovery_desc": "When disabled, you'll need to manually enter host IP on the client to pair.",
"enable_input_only_mode": "Enable Input Only Mode",
"enable_input_only_mode_desc": "Add an Input Only app entry. When enabled, the app list will only show the current running app and the Input Only entry when streaming. The Input Only entry will not receive any image or audio. Useful for operating the desktop on TV or connecting peripherals which the TV doesn't support with a phone.",
"enable_pairing": "Enable Pairing",

View File

@@ -224,6 +224,8 @@
"double_refreshrate_desc": "创建虚拟显示器时刷新率翻倍,串流的视频刷新率不受影响。可能可以缓解某些电脑上出现的画面卡顿现象。",
"ds4_back_as_touchpad_click": "映射回/选择触摸板点击",
"ds4_back_as_touchpad_click_desc": "强制使用 DS4 模拟时,将“返回”/“选择”映射到触摸板点击",
"enable_discovery": "启用自动发现",
"enable_discovery_desc": "禁用后,你将只能通过输入服务端 IP 进行配对。",
"enable_input_only_mode": "启用仅输入模式",
"enable_input_only_mode_desc": "新增一个仅输入APP。启用时应用列表在串流时将只显示当前正在运行的APP和仅输入APP。仅输入APP不会接收到任何画面/音频。可以用于用手机更方便地操作电视大屏串流或连接电视不支持的外设。",
"enable_pairing": "启用配对",