mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-21 12:03:02 +00:00
Add UUID to URL queries (like recent Shield Hub version do)
This commit is contained in:
parent
57da68c0e2
commit
c92cae51c8
@ -122,6 +122,10 @@ public class NvHTTP {
|
|||||||
this.pm = new PairingManager(this, cryptoProvider);
|
this.pm = new PairingManager(this, cryptoProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String buildUniqueIdUuidString() {
|
||||||
|
return "uniqueid="+uniqueId+"&uuid="+UUID.randomUUID();
|
||||||
|
}
|
||||||
|
|
||||||
static String getXmlString(Reader r, String tagname) throws XmlPullParserException, IOException {
|
static String getXmlString(Reader r, String tagname) throws XmlPullParserException, IOException {
|
||||||
XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
|
XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
|
||||||
factory.setNamespaceAware(true);
|
factory.setNamespaceAware(true);
|
||||||
@ -498,7 +502,7 @@ public class NvHTTP {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getAppListRaw() throws MalformedURLException, IOException {
|
public String getAppListRaw() throws MalformedURLException, IOException {
|
||||||
return openHttpConnectionToString(baseUrlHttps + "/applist?uniqueid=" + uniqueId, true);
|
return openHttpConnectionToString(baseUrlHttps + "/applist?"+buildUniqueIdUuidString(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LinkedList<NvApp> getAppList() throws GfeHttpResponseException, IOException, XmlPullParserException {
|
public LinkedList<NvApp> getAppList() throws GfeHttpResponseException, IOException, XmlPullParserException {
|
||||||
@ -507,7 +511,7 @@ public class NvHTTP {
|
|||||||
return getAppListByReader(new StringReader(getAppListRaw()));
|
return getAppListByReader(new StringReader(getAppListRaw()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ResponseBody resp = openHttpConnection(baseUrlHttps + "/applist?uniqueid=" + uniqueId, true);
|
ResponseBody resp = openHttpConnection(baseUrlHttps + "/applist?" + buildUniqueIdUuidString(), true);
|
||||||
LinkedList<NvApp> appList = getAppListByReader(new InputStreamReader(resp.byteStream()));
|
LinkedList<NvApp> appList = getAppListByReader(new InputStreamReader(resp.byteStream()));
|
||||||
resp.close();
|
resp.close();
|
||||||
return appList;
|
return appList;
|
||||||
@ -515,11 +519,11 @@ public class NvHTTP {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void unpair() throws IOException {
|
public void unpair() throws IOException {
|
||||||
openHttpConnectionToString(baseUrlHttps + "/unpair?uniqueid=" + uniqueId, true);
|
openHttpConnectionToString(baseUrlHttps + "/unpair?"+buildUniqueIdUuidString(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public InputStream getBoxArt(NvApp app) throws IOException {
|
public InputStream getBoxArt(NvApp app) throws IOException {
|
||||||
ResponseBody resp = openHttpConnection(baseUrlHttps + "/appasset?uniqueid=" + uniqueId +
|
ResponseBody resp = openHttpConnection(baseUrlHttps + "/appasset?"+ buildUniqueIdUuidString() +
|
||||||
"&appid=" + app.getAppId() + "&AssetType=2&AssetIdx=0", true);
|
"&appid=" + app.getAppId() + "&AssetType=2&AssetIdx=0", true);
|
||||||
return resp.byteStream();
|
return resp.byteStream();
|
||||||
}
|
}
|
||||||
@ -537,7 +541,7 @@ public class NvHTTP {
|
|||||||
|
|
||||||
public boolean launchApp(ConnectionContext context, int appId) throws IOException, XmlPullParserException {
|
public boolean launchApp(ConnectionContext context, int appId) throws IOException, XmlPullParserException {
|
||||||
String xmlStr = openHttpConnectionToString(baseUrlHttps +
|
String xmlStr = openHttpConnectionToString(baseUrlHttps +
|
||||||
"/launch?uniqueid=" + uniqueId +
|
"/launch?" + buildUniqueIdUuidString() +
|
||||||
"&appid=" + appId +
|
"&appid=" + appId +
|
||||||
"&mode=" + context.negotiatedWidth + "x" + context.negotiatedHeight + "x" + context.negotiatedFps +
|
"&mode=" + context.negotiatedWidth + "x" + context.negotiatedHeight + "x" + context.negotiatedFps +
|
||||||
"&additionalStates=1&sops=" + (context.streamConfig.getSops() ? 1 : 0) +
|
"&additionalStates=1&sops=" + (context.streamConfig.getSops() ? 1 : 0) +
|
||||||
@ -549,7 +553,7 @@ public class NvHTTP {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean resumeApp(ConnectionContext context) throws IOException, XmlPullParserException {
|
public boolean resumeApp(ConnectionContext context) throws IOException, XmlPullParserException {
|
||||||
String xmlStr = openHttpConnectionToString(baseUrlHttps + "/resume?uniqueid=" + uniqueId +
|
String xmlStr = openHttpConnectionToString(baseUrlHttps + "/resume?" + buildUniqueIdUuidString() +
|
||||||
"&rikey="+bytesToHex(context.riKey.getEncoded()) +
|
"&rikey="+bytesToHex(context.riKey.getEncoded()) +
|
||||||
"&rikeyid="+context.riKeyId, false);
|
"&rikeyid="+context.riKeyId, false);
|
||||||
String resume = getXmlString(xmlStr, "resume");
|
String resume = getXmlString(xmlStr, "resume");
|
||||||
@ -557,7 +561,7 @@ public class NvHTTP {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean quitApp() throws IOException, XmlPullParserException {
|
public boolean quitApp() throws IOException, XmlPullParserException {
|
||||||
String xmlStr = openHttpConnectionToString(baseUrlHttps + "/cancel?uniqueid=" + uniqueId, false);
|
String xmlStr = openHttpConnectionToString(baseUrlHttps + "/cancel?" + buildUniqueIdUuidString(), false);
|
||||||
String cancel = getXmlString(xmlStr, "cancel");
|
String cancel = getXmlString(xmlStr, "cancel");
|
||||||
return Integer.parseInt(cancel) != 0;
|
return Integer.parseInt(cancel) != 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user