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;
|
||||
|
||||
@@ -292,6 +292,14 @@
|
||||
<td style="font-family: monospace">SUNSHINE_APP_NAME</td>
|
||||
<td>{{ $t('apps.env_app_name') }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="font-family: monospace">SUNSHINE_CLIENT_UID</td>
|
||||
<td>{{ $t('apps.env_client_uid') }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="font-family: monospace">SUNSHINE_CLIENT_NAME</td>
|
||||
<td>{{ $t('apps.env_client_name') }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="font-family: monospace">SUNSHINE_CLIENT_WIDTH</td>
|
||||
<td>{{ $t('apps.env_client_width') }}</td>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<form class="form d-flex flex-column align-items-center" id="form" @submit.prevent="registerDevice">
|
||||
<div class="card flex-column d-flex p-4 mb-4">
|
||||
<input type="text" pattern="\d*" :placeholder="`${$t('navbar.pin')}`" autofocus id="pin-input" class="form-control mt-2" required />
|
||||
<input type="text" :placeholder="`${$t('pin.device_name')}`" id="name-input" class="form-control my-4" required />
|
||||
<input type="text" :placeholder="`${$t('pin.device_name')}`" id="name-input" class="form-control my-4" />
|
||||
<button class="btn btn-primary">{{ $t('pin.send') }}</button>
|
||||
</div>
|
||||
<div class="alert alert-warning">
|
||||
|
||||
@@ -55,6 +55,8 @@
|
||||
"env_client_height": "The Height requested by the client (int)",
|
||||
"env_client_host_audio": "The client has requested host audio (true/false)",
|
||||
"env_client_width": "The Width requested by the client (int)",
|
||||
"env_client_uid": "UID of the client starting the stream (string)",
|
||||
"env_client_name": "Name of the client starting the stream (string)",
|
||||
"env_displayplacer_example": "Example - displayplacer for Resolution Automation:",
|
||||
"env_qres_example": "Example - QRes for Resolution Automation:",
|
||||
"env_qres_path": "qres path",
|
||||
@@ -356,7 +358,7 @@
|
||||
"success_msg": "Password has been changed successfully! This page will reload soon, your browser will ask you for the new credentials."
|
||||
},
|
||||
"pin": {
|
||||
"device_name": "Device Name",
|
||||
"device_name": "Optional: Device Name",
|
||||
"pair_failure": "Pairing Failed: Check if the PIN is typed correctly",
|
||||
"pair_success": "Success! Please check Moonlight to continue",
|
||||
"pin_pairing": "PIN Pairing",
|
||||
|
||||
Reference in New Issue
Block a user