From cd31fbeb39e0d4ec37083298d19553124afb128f Mon Sep 17 00:00:00 2001 From: loki Date: Thu, 26 Dec 2019 00:01:06 +0100 Subject: [PATCH] Add configuration option for name of the server --- assets/sunshine.conf | 4 +++- sunshine/config.cpp | 2 ++ sunshine/config.h | 2 ++ sunshine/nvhttp.cpp | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/assets/sunshine.conf b/assets/sunshine.conf index 5281d0fd..dbdbaac7 100644 --- a/assets/sunshine.conf +++ b/assets/sunshine.conf @@ -1,4 +1,3 @@ -# Pretty self-explanatory # If no external IP address is given, the local IP address is used # external_ip = 123.456.789.12 @@ -8,6 +7,9 @@ # The certificate must be signed with a 2048 bit key # cert = /dir/cert.pem +# The name displayed by Moonlight +# sunshine_name = sunshine + # Pretty self-explanatory unique_id = 03904e64-51da-4fb3-9afd-a9f7ff70fea4 diff --git a/sunshine/config.cpp b/sunshine/config.cpp index c3b1e938..2472500c 100644 --- a/sunshine/config.cpp +++ b/sunshine/config.cpp @@ -39,6 +39,7 @@ nvhttp_t nvhttp { PRIVATE_KEY_FILE, CERTIFICATE_FILE, + "sunshine", // sunshine_name "03904e64-51da-4fb3-9afd-a9f7ff70fea4", // unique_id "devices.json" // file_devices }; @@ -136,6 +137,7 @@ void parse_file(const char *file) { string_f(vars, "pkey", nvhttp.pkey); string_f(vars, "cert", nvhttp.cert); + string_f(vars, "sunshine_name", nvhttp.sunshine_name); string_f(vars, "unique_id", nvhttp.unique_id); string_f(vars, "file_devices", nvhttp.file_devices); string_f(vars, "external_ip", nvhttp.external_ip); diff --git a/sunshine/config.h b/sunshine/config.h index 97e20805..9b0e870c 100644 --- a/sunshine/config.h +++ b/sunshine/config.h @@ -31,6 +31,8 @@ struct nvhttp_t { std::string pkey; // must be 2048 bits std::string cert; // must be signed with a key of 2048 bits + std::string sunshine_name; + std::string unique_id; //UUID std::string file_devices; diff --git a/sunshine/nvhttp.cpp b/sunshine/nvhttp.cpp index 25ec6a95..72bb77e9 100644 --- a/sunshine/nvhttp.cpp +++ b/sunshine/nvhttp.cpp @@ -395,7 +395,7 @@ void serverinfo(std::shared_ptr::Response> res pt::ptree tree; tree.put("root..status_code", 200); - tree.put("root.hostname", "loki-pc"); + tree.put("root.hostname", config::nvhttp.sunshine_name); tree.put("root.appversion", VERSION); tree.put("root.GfeVersion", GFE_VERSION);