mirror of
https://github.com/moonlight-stream/moonlight-chrome.git
synced 2025-08-17 16:46:31 +00:00
Uniqueid should be a 64-bit hex number, not a UUID
This commit is contained in:
parent
baa3a1a68c
commit
8ce558f701
@ -1,7 +1,7 @@
|
|||||||
var target = "";
|
var target = "";
|
||||||
var hosts = [];
|
var hosts = [];
|
||||||
var pairingCert;
|
var pairingCert;
|
||||||
var myGuuid;
|
var myUniqueid;
|
||||||
|
|
||||||
// Called by the common.js module.
|
// Called by the common.js module.
|
||||||
function attachListeners() {
|
function attachListeners() {
|
||||||
@ -31,10 +31,10 @@ function moduleDidLoad() {
|
|||||||
console.log("Generated new cert.")
|
console.log("Generated new cert.")
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if(!myGuuid) {
|
if(!myUniqueid) {
|
||||||
console.log("Failed to get guuid. Generating new one");
|
console.log("Failed to get uniqueId. Generating new one");
|
||||||
myGuuid = guuid();
|
myUniqueid = uniqueid();
|
||||||
storeData('guuid', myGuuid, null);
|
storeData('uniqueid', myUniqueid, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ function pairPushed() {
|
|||||||
target = e.options[e.selectedIndex].value;
|
target = e.options[e.selectedIndex].value;
|
||||||
}
|
}
|
||||||
console.log("Attempting to pair to: " + target);
|
console.log("Attempting to pair to: " + target);
|
||||||
sendMessage('httpInit', [pairingCert.cert, pairingCert.privateKey, myGuuid]).then(function (ret) {
|
sendMessage('httpInit', [pairingCert.cert, pairingCert.privateKey, myUniqueid]).then(function (ret) {
|
||||||
console.log('httpInit function completed. it returned: ' + ret);
|
console.log('httpInit function completed. it returned: ' + ret);
|
||||||
sendMessage('pair', [target, "1233"]).then(function (ret2) {
|
sendMessage('pair', [target, "1233"]).then(function (ret2) {
|
||||||
console.log("pair attempt to to " + target + " has returned.");
|
console.log("pair attempt to to " + target + " has returned.");
|
||||||
@ -107,8 +107,8 @@ function startPushed() {
|
|||||||
|
|
||||||
console.log('startRequest:' + target + ":" + streamWidth + ":" + streamHeight + ":" + frameRate + ":" + bitrate);
|
console.log('startRequest:' + target + ":" + streamWidth + ":" + streamHeight + ":" + frameRate + ":" + bitrate);
|
||||||
|
|
||||||
sendMessage('httpInit', [pairingCert.cert, pairingCert.privateKey, myGuuid]).then(function (ret) {
|
|
||||||
sendMessage('startRequest', [target, streamWidth, streamHeight, frameRate, bitrate.toString()]);
|
sendMessage('startRequest', [target, streamWidth, streamHeight, frameRate, bitrate.toString()]);
|
||||||
|
sendMessage('httpInit', [pairingCert.cert, pairingCert.privateKey, myUniqueid]).then(function (ret) {
|
||||||
});
|
});
|
||||||
|
|
||||||
// we just finished the gameSelection section. only expose the NaCl section
|
// we just finished the gameSelection section. only expose the NaCl section
|
||||||
@ -233,9 +233,9 @@ function onWindowLoad(){
|
|||||||
pairingCert = savedCert.cert;
|
pairingCert = savedCert.cert;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
chrome.storage.sync.get('guuid', function(savedGuuid) {
|
chrome.storage.sync.get('uniqueid', function(savedUniqueid) {
|
||||||
if (savedGuuid.guuid != null) { // we have a saved guuid
|
if (savedUniqueid.uniqueid != null) { // we have a saved uniqueid
|
||||||
myGuuid = savedGuuid.guuid;
|
myUniqueid = savedUniqueid.uniqueid;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,13 @@ function guuid() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function uniqueid() {
|
||||||
|
return 'xxxxxxxxxxxxxxxx'.replace(/[x]/g, function(c) {
|
||||||
|
var r = Math.random()*16|0;
|
||||||
|
return r.toString(16);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
String.prototype.toHex = function() {
|
String.prototype.toHex = function() {
|
||||||
var hex = '';
|
var hex = '';
|
||||||
for(var i = 0; i < this.length; i++) {
|
for(var i = 0; i < this.length; i++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user