Get device UUID from local assigned value
This commit is contained in:
+14
-6
@@ -336,7 +336,7 @@ namespace nvhttp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<rtsp_stream::launch_session_t>
|
std::shared_ptr<rtsp_stream::launch_session_t>
|
||||||
make_launch_session(bool host_audio, const args_t &args) {
|
make_launch_session(bool host_audio, const args_t &args, const std::string& uuid) {
|
||||||
auto launch_session = std::make_shared<rtsp_stream::launch_session_t>();
|
auto launch_session = std::make_shared<rtsp_stream::launch_session_t>();
|
||||||
|
|
||||||
launch_session->id = ++session_id_counter;
|
launch_session->id = ++session_id_counter;
|
||||||
@@ -356,7 +356,7 @@ namespace nvhttp {
|
|||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
launch_session->device_name = (get_arg(args, "devicename", "unknown"));
|
launch_session->device_name = (get_arg(args, "devicename", "unknown"));
|
||||||
launch_session->unique_id = (get_arg(args, "uniqueid", "unknown"));
|
launch_session->unique_id = uuid;
|
||||||
launch_session->appid = util::from_view(get_arg(args, "appid", "unknown"));
|
launch_session->appid = util::from_view(get_arg(args, "appid", "unknown"));
|
||||||
launch_session->enable_sops = util::from_view(get_arg(args, "sops", "0"));
|
launch_session->enable_sops = util::from_view(get_arg(args, "sops", "0"));
|
||||||
launch_session->surround_info = util::from_view(get_arg(args, "surroundAudioInfo", "196610"));
|
launch_session->surround_info = util::from_view(get_arg(args, "surroundAudioInfo", "196610"));
|
||||||
@@ -533,6 +533,11 @@ namespace nvhttp {
|
|||||||
static auto constexpr to_string = "NONE"sv;
|
static auto constexpr to_string = "NONE"sv;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline crypto::named_cert_t*
|
||||||
|
get_verified_cert(req_https_t request) {
|
||||||
|
return (crypto::named_cert_t*)request->userp.get();
|
||||||
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
void
|
void
|
||||||
print_req(std::shared_ptr<typename SimpleWeb::ServerBase<T>::Request> request) {
|
print_req(std::shared_ptr<typename SimpleWeb::ServerBase<T>::Request> request) {
|
||||||
@@ -757,10 +762,9 @@ namespace nvhttp {
|
|||||||
serverinfo(std::shared_ptr<typename SimpleWeb::ServerBase<T>::Response> response, std::shared_ptr<typename SimpleWeb::ServerBase<T>::Request> request) {
|
serverinfo(std::shared_ptr<typename SimpleWeb::ServerBase<T>::Response> response, std::shared_ptr<typename SimpleWeb::ServerBase<T>::Request> request) {
|
||||||
print_req<T>(request);
|
print_req<T>(request);
|
||||||
|
|
||||||
|
|
||||||
int pair_status = 0;
|
int pair_status = 0;
|
||||||
if constexpr (std::is_same_v<SunshineHTTPS, T>) {
|
if constexpr (std::is_same_v<SunshineHTTPS, T>) {
|
||||||
BOOST_LOG(info) << "Device " << ((crypto::named_cert_t*)request->userp.get())->name << " getting server info!!!";
|
BOOST_LOG(info) << "Device " << get_verified_cert(request)->name << " getting server info!!!";
|
||||||
|
|
||||||
auto args = request->parse_query_string();
|
auto args = request->parse_query_string();
|
||||||
auto clientID = args.find("uniqueid"s);
|
auto clientID = args.find("uniqueid"s);
|
||||||
@@ -914,6 +918,8 @@ namespace nvhttp {
|
|||||||
launch(bool &host_audio, resp_https_t response, req_https_t request) {
|
launch(bool &host_audio, resp_https_t response, req_https_t request) {
|
||||||
print_req<SunshineHTTPS>(request);
|
print_req<SunshineHTTPS>(request);
|
||||||
|
|
||||||
|
auto named_cert_p = get_verified_cert(request);
|
||||||
|
|
||||||
pt::ptree tree;
|
pt::ptree tree;
|
||||||
auto g = util::fail_guard([&]() {
|
auto g = util::fail_guard([&]() {
|
||||||
std::ostringstream data;
|
std::ostringstream data;
|
||||||
@@ -954,7 +960,7 @@ namespace nvhttp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
host_audio = util::from_view(get_arg(args, "localAudioPlayMode"));
|
host_audio = util::from_view(get_arg(args, "localAudioPlayMode"));
|
||||||
auto launch_session = make_launch_session(host_audio, args);
|
auto launch_session = make_launch_session(host_audio, args, named_cert_p->uuid);
|
||||||
|
|
||||||
auto encryption_mode = net::encryption_mode_for_address(request->remote_endpoint().address());
|
auto encryption_mode = net::encryption_mode_for_address(request->remote_endpoint().address());
|
||||||
if (!launch_session->rtsp_cipher && encryption_mode == config::ENCRYPTION_MODE_MANDATORY) {
|
if (!launch_session->rtsp_cipher && encryption_mode == config::ENCRYPTION_MODE_MANDATORY) {
|
||||||
@@ -1011,6 +1017,8 @@ namespace nvhttp {
|
|||||||
resume(bool &host_audio, resp_https_t response, req_https_t request) {
|
resume(bool &host_audio, resp_https_t response, req_https_t request) {
|
||||||
print_req<SunshineHTTPS>(request);
|
print_req<SunshineHTTPS>(request);
|
||||||
|
|
||||||
|
auto named_cert_p = get_verified_cert(request);
|
||||||
|
|
||||||
pt::ptree tree;
|
pt::ptree tree;
|
||||||
auto g = util::fail_guard([&]() {
|
auto g = util::fail_guard([&]() {
|
||||||
std::ostringstream data;
|
std::ostringstream data;
|
||||||
@@ -1071,7 +1079,7 @@ namespace nvhttp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto launch_session = make_launch_session(host_audio, args);
|
auto launch_session = make_launch_session(host_audio, args, named_cert_p->uuid);
|
||||||
|
|
||||||
auto encryption_mode = net::encryption_mode_for_address(request->remote_endpoint().address());
|
auto encryption_mode = net::encryption_mode_for_address(request->remote_endpoint().address());
|
||||||
if (!launch_session->rtsp_cipher && encryption_mode == config::ENCRYPTION_MODE_MANDATORY) {
|
if (!launch_session->rtsp_cipher && encryption_mode == config::ENCRYPTION_MODE_MANDATORY) {
|
||||||
|
|||||||
@@ -294,7 +294,7 @@ std::wstring createVirtualDisplay(
|
|||||||
uint32_t width,
|
uint32_t width,
|
||||||
uint32_t height,
|
uint32_t height,
|
||||||
uint32_t fps,
|
uint32_t fps,
|
||||||
GUID& guid
|
const GUID& guid
|
||||||
) {
|
) {
|
||||||
if (SUDOVDA_DRIVER_HANDLE == INVALID_HANDLE_VALUE) {
|
if (SUDOVDA_DRIVER_HANDLE == INVALID_HANDLE_VALUE) {
|
||||||
return std::wstring();
|
return std::wstring();
|
||||||
@@ -308,16 +308,6 @@ std::wstring createVirtualDisplay(
|
|||||||
s_client_name = s_app_name;
|
s_client_name = s_app_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s_client_uid && strcmp(s_client_uid, "unknown")) {
|
|
||||||
size_t len = strlen(s_client_uid);
|
|
||||||
if (len > sizeof(GUID)) {
|
|
||||||
len = sizeof(GUID);
|
|
||||||
}
|
|
||||||
memcpy((void*)&guid, (void*)s_client_uid, len);
|
|
||||||
} else {
|
|
||||||
s_client_uid = "unknown";
|
|
||||||
}
|
|
||||||
|
|
||||||
VIRTUAL_DISPLAY_ADD_OUT output;
|
VIRTUAL_DISPLAY_ADD_OUT output;
|
||||||
if (!AddVirtualDisplay(SUDOVDA_DRIVER_HANDLE, width, height, fps, guid, s_client_name, s_client_uid, output)) {
|
if (!AddVirtualDisplay(SUDOVDA_DRIVER_HANDLE, width, height, fps, guid, s_client_name, s_client_uid, output)) {
|
||||||
printf("[SUDOVDA] Failed to add virtual display.\n");
|
printf("[SUDOVDA] Failed to add virtual display.\n");
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace VDISPLAY {
|
|||||||
uint32_t width,
|
uint32_t width,
|
||||||
uint32_t height,
|
uint32_t height,
|
||||||
uint32_t fps,
|
uint32_t fps,
|
||||||
GUID& guid
|
const GUID& guid
|
||||||
);
|
);
|
||||||
bool removeVirtualDisplay(const GUID& guid);
|
bool removeVirtualDisplay(const GUID& guid);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -29,6 +29,7 @@
|
|||||||
#include "system_tray.h"
|
#include "system_tray.h"
|
||||||
#include "utility.h"
|
#include "utility.h"
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
|
#include "uuid.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// from_utf8() string conversion function
|
// from_utf8() string conversion function
|
||||||
@@ -205,7 +206,9 @@ namespace proc {
|
|||||||
VDISPLAY::setRenderAdapterByName(platf::from_utf8(config::video.adapter_name));
|
VDISPLAY::setRenderAdapterByName(platf::from_utf8(config::video.adapter_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(&launch_session->display_guid, &http::uuid, sizeof(GUID));
|
auto device_uuid = uuid_util::uuid_t::parse(launch_session->unique_id);
|
||||||
|
|
||||||
|
memcpy(&launch_session->display_guid, &device_uuid, sizeof(GUID));
|
||||||
|
|
||||||
std::wstring vdisplayName = VDISPLAY::createVirtualDisplay(
|
std::wstring vdisplayName = VDISPLAY::createVirtualDisplay(
|
||||||
launch_session->unique_id.c_str(),
|
launch_session->unique_id.c_str(),
|
||||||
|
|||||||
Reference in New Issue
Block a user