mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-07-12 18:03:52 +00:00
Send the real client UID for non-GFE hosts
This allows non-GFE hosts to perform their own custom session management while allowing all clients to share the same session with GFE.
This commit is contained in:
@@ -31,7 +31,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
bool tryPollComputer(QNetworkAccessManager* nam, NvAddress address, bool& changed)
|
bool tryPollComputer(QNetworkAccessManager* nam, NvAddress address, bool& changed)
|
||||||
{
|
{
|
||||||
NvHTTP http(address, 0, m_Computer->serverCert, nam);
|
NvHTTP http(address, 0, m_Computer->serverCert, !m_Computer->isNvidiaServerSoftware, nam);
|
||||||
|
|
||||||
QString serverInfo;
|
QString serverInfo;
|
||||||
try {
|
try {
|
||||||
@@ -825,7 +825,8 @@ private:
|
|||||||
|
|
||||||
void run()
|
void run()
|
||||||
{
|
{
|
||||||
NvHTTP http(m_Address, 0, QSslCertificate());
|
// Use the placeholder UID for the initial poll, then we'll switch to the real one if it's not GFE
|
||||||
|
NvHTTP http(m_Address, 0, QSslCertificate(), false);
|
||||||
|
|
||||||
if (m_Mdns) {
|
if (m_Mdns) {
|
||||||
if (m_MdnsIpv6Address.isNull()) {
|
if (m_MdnsIpv6Address.isNull()) {
|
||||||
@@ -853,6 +854,7 @@ private:
|
|||||||
|
|
||||||
// Create initial newComputer using HTTP serverinfo with no pinned cert
|
// Create initial newComputer using HTTP serverinfo with no pinned cert
|
||||||
NvComputer* newComputer = new NvComputer(http, serverInfo);
|
NvComputer* newComputer = new NvComputer(http, serverInfo);
|
||||||
|
http.setTrueUid(!newComputer->isNvidiaServerSoftware);
|
||||||
|
|
||||||
// Check if we have a record of this host UUID to pull the pinned cert
|
// Check if we have a record of this host UUID to pull the pinned cert
|
||||||
NvComputer* existingComputer;
|
NvComputer* existingComputer;
|
||||||
|
|||||||
+13
-9
@@ -24,9 +24,10 @@
|
|||||||
#define XML_NAME_EQUALS(x, y) ((x) == (u##y))
|
#define XML_NAME_EQUALS(x, y) ((x) == (u##y))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NvHTTP::NvHTTP(NvAddress address, uint16_t httpsPort, QSslCertificate serverCert, QNetworkAccessManager* nam) :
|
NvHTTP::NvHTTP(NvAddress address, uint16_t httpsPort, QSslCertificate serverCert, bool useTrueUid, QNetworkAccessManager* nam) :
|
||||||
m_Nam(nam ? nam : new QNetworkAccessManager(this)),
|
m_Nam(nam ? nam : new QNetworkAccessManager(this)),
|
||||||
m_ServerCert(serverCert)
|
m_ServerCert(serverCert),
|
||||||
|
m_UseTrueUid(useTrueUid)
|
||||||
{
|
{
|
||||||
m_BaseUrlHttp.setScheme("http");
|
m_BaseUrlHttp.setScheme("http");
|
||||||
m_BaseUrlHttps.setScheme("https");
|
m_BaseUrlHttps.setScheme("https");
|
||||||
@@ -40,9 +41,8 @@ NvHTTP::NvHTTP(NvAddress address, uint16_t httpsPort, QSslCertificate serverCert
|
|||||||
}
|
}
|
||||||
|
|
||||||
NvHTTP::NvHTTP(NvComputer* computer, QNetworkAccessManager* nam) :
|
NvHTTP::NvHTTP(NvComputer* computer, QNetworkAccessManager* nam) :
|
||||||
NvHTTP(computer->activeAddress, computer->activeHttpsPort, computer->serverCert, nam)
|
NvHTTP(computer->activeAddress, computer->activeHttpsPort, computer->serverCert, !computer->isNvidiaServerSoftware, nam)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NvHTTP::setServerCert(QSslCertificate serverCert)
|
void NvHTTP::setServerCert(QSslCertificate serverCert)
|
||||||
@@ -67,6 +67,11 @@ void NvHTTP::setHttpsPort(uint16_t port)
|
|||||||
m_BaseUrlHttps.setPort(port);
|
m_BaseUrlHttps.setPort(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NvHTTP::setTrueUid(bool useTrueUid)
|
||||||
|
{
|
||||||
|
m_UseTrueUid = useTrueUid;
|
||||||
|
}
|
||||||
|
|
||||||
NvAddress NvHTTP::address()
|
NvAddress NvHTTP::address()
|
||||||
{
|
{
|
||||||
return m_Address;
|
return m_Address;
|
||||||
@@ -478,11 +483,10 @@ NvHTTP::openConnection(QUrl baseUrl,
|
|||||||
QUrl url(baseUrl);
|
QUrl url(baseUrl);
|
||||||
url.setPath("/" + command);
|
url.setPath("/" + command);
|
||||||
|
|
||||||
// Use a common UID for Moonlight clients to allow them to quit
|
// Use a placeholder UID for GFE allow them to quit games for each other.
|
||||||
// games for each other (otherwise GFE gets screwed up and it requires
|
// We also use this placeholder UID for previously paired Sunshine hosts for backwards compatibility.
|
||||||
// manual intervention to solve).
|
url.setQuery("uniqueid=" + (m_UseTrueUid ? IdentityManager::get()->getUniqueId() : "0123456789ABCDEF") +
|
||||||
url.setQuery("uniqueid=0123456789ABCDEF&uuid=" +
|
"&uuid=" + QUuid::createUuid().toRfc4122().toHex() +
|
||||||
QUuid::createUuid().toRfc4122().toHex() +
|
|
||||||
((arguments != nullptr) ? ("&" + arguments) : ""));
|
((arguments != nullptr) ? ("&" + arguments) : ""));
|
||||||
|
|
||||||
QNetworkRequest request(url);
|
QNetworkRequest request(url);
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ public:
|
|||||||
NVLL_VERBOSE
|
NVLL_VERBOSE
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit NvHTTP(NvAddress address, uint16_t httpsPort, QSslCertificate serverCert, QNetworkAccessManager* nam = nullptr);
|
explicit NvHTTP(NvAddress address, uint16_t httpsPort, QSslCertificate serverCert, bool useTrueUid, QNetworkAccessManager* nam = nullptr);
|
||||||
|
|
||||||
explicit NvHTTP(NvComputer* computer, QNetworkAccessManager* nam = nullptr);
|
explicit NvHTTP(NvComputer* computer, QNetworkAccessManager* nam = nullptr);
|
||||||
|
|
||||||
@@ -142,9 +142,9 @@ public:
|
|||||||
NvLogLevel logLevel = NvLogLevel::NVLL_VERBOSE);
|
NvLogLevel logLevel = NvLogLevel::NVLL_VERBOSE);
|
||||||
|
|
||||||
void setServerCert(QSslCertificate serverCert);
|
void setServerCert(QSslCertificate serverCert);
|
||||||
|
|
||||||
void setAddress(NvAddress address);
|
void setAddress(NvAddress address);
|
||||||
void setHttpsPort(uint16_t port);
|
void setHttpsPort(uint16_t port);
|
||||||
|
void setTrueUid(bool useTrueUid);
|
||||||
|
|
||||||
NvAddress address();
|
NvAddress address();
|
||||||
|
|
||||||
@@ -198,4 +198,5 @@ private:
|
|||||||
NvAddress m_Address;
|
NvAddress m_Address;
|
||||||
QNetworkAccessManager* m_Nam;
|
QNetworkAccessManager* m_Nam;
|
||||||
QSslCertificate m_ServerCert;
|
QSslCertificate m_ServerCert;
|
||||||
|
bool m_UseTrueUid;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user