Fetch device name and uniqueid from connection (require Moonlight Noir)
This commit is contained in:
@@ -130,6 +130,7 @@ namespace nvhttp {
|
||||
struct pair_session_t {
|
||||
struct {
|
||||
std::string uniqueID;
|
||||
std::string deviceName;
|
||||
std::string cert;
|
||||
} client;
|
||||
|
||||
@@ -325,6 +326,7 @@ namespace nvhttp {
|
||||
if (x == 2) launch_session->fps = atoi(segment.c_str());
|
||||
x++;
|
||||
}
|
||||
launch_session->device_name = (get_arg(args, "devicename", "unknown"));
|
||||
launch_session->unique_id = (get_arg(args, "uniqueid", "unknown"));
|
||||
launch_session->appid = util::from_view(get_arg(args, "appid", "unknown"));
|
||||
launch_session->enable_sops = util::from_view(get_arg(args, "sops", "0"));
|
||||
@@ -557,14 +559,20 @@ namespace nvhttp {
|
||||
}
|
||||
|
||||
auto uniqID { get_arg(args, "uniqueid") };
|
||||
auto deviceName { get_arg(args, "devicename") };
|
||||
auto sess_it = map_id_sess.find(uniqID);
|
||||
|
||||
if (deviceName == "roth"sv) {
|
||||
deviceName = "Legacy Moonlight Client";
|
||||
}
|
||||
|
||||
args_t::const_iterator it;
|
||||
if (it = args.find("phrase"); it != std::end(args)) {
|
||||
if (it->second == "getservercert"sv) {
|
||||
pair_session_t sess;
|
||||
|
||||
sess.client.uniqueID = std::move(uniqID);
|
||||
sess.client.deviceName = std::move(deviceName);
|
||||
sess.client.cert = util::from_hex_vec(get_arg(args, "clientcert"), true);
|
||||
|
||||
BOOST_LOG(debug) << sess.client.cert;
|
||||
@@ -639,7 +647,7 @@ namespace nvhttp {
|
||||
// set up named cert
|
||||
client_t &client = client_root;
|
||||
named_cert_t named_cert;
|
||||
named_cert.name = name;
|
||||
named_cert.name = name.empty() ? sess.client.deviceName : name;
|
||||
named_cert.cert = sess.client.cert;
|
||||
named_cert.uuid = uuid_util::uuid_t::generate().string();
|
||||
client.named_devices.emplace_back(named_cert);
|
||||
|
||||
@@ -155,6 +155,8 @@ namespace proc {
|
||||
// Add Stream-specific environment variables
|
||||
_env["SUNSHINE_APP_ID"] = std::to_string(_app_id);
|
||||
_env["SUNSHINE_APP_NAME"] = _app.name;
|
||||
_env["SUNSHINE_CLIENT_UID"] = launch_session->unique_id;
|
||||
_env["SUNSHINE_CLIENT_NAME"] = launch_session->device_name;
|
||||
_env["SUNSHINE_CLIENT_WIDTH"] = std::to_string(launch_session->width);
|
||||
_env["SUNSHINE_CLIENT_HEIGHT"] = std::to_string(launch_session->height);
|
||||
_env["SUNSHINE_CLIENT_FPS"] = std::to_string(launch_session->fps);
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace rtsp_stream {
|
||||
uint32_t control_connect_data;
|
||||
|
||||
bool host_audio;
|
||||
std::string device_name;
|
||||
std::string unique_id;
|
||||
int width;
|
||||
int height;
|
||||
|
||||
Reference in New Issue
Block a user