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:
|
||||
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;
|
||||
try {
|
||||
@@ -825,7 +825,8 @@ private:
|
||||
|
||||
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_MdnsIpv6Address.isNull()) {
|
||||
@@ -853,6 +854,7 @@ private:
|
||||
|
||||
// Create initial newComputer using HTTP serverinfo with no pinned cert
|
||||
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
|
||||
NvComputer* existingComputer;
|
||||
|
||||
+13
-9
@@ -24,9 +24,10 @@
|
||||
#define XML_NAME_EQUALS(x, y) ((x) == (u##y))
|
||||
#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_ServerCert(serverCert)
|
||||
m_ServerCert(serverCert),
|
||||
m_UseTrueUid(useTrueUid)
|
||||
{
|
||||
m_BaseUrlHttp.setScheme("http");
|
||||
m_BaseUrlHttps.setScheme("https");
|
||||
@@ -40,9 +41,8 @@ NvHTTP::NvHTTP(NvAddress address, uint16_t httpsPort, QSslCertificate serverCert
|
||||
}
|
||||
|
||||
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)
|
||||
@@ -67,6 +67,11 @@ void NvHTTP::setHttpsPort(uint16_t port)
|
||||
m_BaseUrlHttps.setPort(port);
|
||||
}
|
||||
|
||||
void NvHTTP::setTrueUid(bool useTrueUid)
|
||||
{
|
||||
m_UseTrueUid = useTrueUid;
|
||||
}
|
||||
|
||||
NvAddress NvHTTP::address()
|
||||
{
|
||||
return m_Address;
|
||||
@@ -478,11 +483,10 @@ NvHTTP::openConnection(QUrl baseUrl,
|
||||
QUrl url(baseUrl);
|
||||
url.setPath("/" + command);
|
||||
|
||||
// Use a common UID for Moonlight clients to allow them to quit
|
||||
// games for each other (otherwise GFE gets screwed up and it requires
|
||||
// manual intervention to solve).
|
||||
url.setQuery("uniqueid=0123456789ABCDEF&uuid=" +
|
||||
QUuid::createUuid().toRfc4122().toHex() +
|
||||
// Use a placeholder UID for GFE allow them to quit games for each other.
|
||||
// We also use this placeholder UID for previously paired Sunshine hosts for backwards compatibility.
|
||||
url.setQuery("uniqueid=" + (m_UseTrueUid ? IdentityManager::get()->getUniqueId() : "0123456789ABCDEF") +
|
||||
"&uuid=" + QUuid::createUuid().toRfc4122().toHex() +
|
||||
((arguments != nullptr) ? ("&" + arguments) : ""));
|
||||
|
||||
QNetworkRequest request(url);
|
||||
|
||||
@@ -109,7 +109,7 @@ public:
|
||||
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);
|
||||
|
||||
@@ -142,9 +142,9 @@ public:
|
||||
NvLogLevel logLevel = NvLogLevel::NVLL_VERBOSE);
|
||||
|
||||
void setServerCert(QSslCertificate serverCert);
|
||||
|
||||
void setAddress(NvAddress address);
|
||||
void setHttpsPort(uint16_t port);
|
||||
void setTrueUid(bool useTrueUid);
|
||||
|
||||
NvAddress address();
|
||||
|
||||
@@ -198,4 +198,5 @@ private:
|
||||
NvAddress m_Address;
|
||||
QNetworkAccessManager* m_Nam;
|
||||
QSslCertificate m_ServerCert;
|
||||
bool m_UseTrueUid;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user