mirror of
https://github.com/moonlight-stream/moonlight-chrome.git
synced 2025-08-17 16:46:31 +00:00
added backend support for storing varios addressing methods of hosts
This commit is contained in:
parent
a09b5e7ea9
commit
853d061acb
@ -211,7 +211,7 @@ function addHostToGrid(host) {
|
||||
|
||||
function continueAddHost() {
|
||||
var inputHost = $('#dialogInputHost').val();
|
||||
var nvhttpHost = new NvHTTP(inputHost, myUniqueid);
|
||||
var nvhttpHost = new NvHTTP(inputHost, myUniqueid, inputHost);
|
||||
pairTo(nvhttpHost,
|
||||
function() {
|
||||
addHostToGrid(nvhttpHost);
|
||||
@ -603,11 +603,11 @@ function onWindowLoad(){
|
||||
storeData('uniqueid', myUniqueid, null);
|
||||
}
|
||||
});
|
||||
// load previously connected hosts, and revive them back into a class
|
||||
// load previously connected hosts, which have been killed into an object, and revive them back into a class
|
||||
chrome.storage.sync.get('hosts', function(previousValue) {
|
||||
hosts = previousValue.hosts != null ? previousValue.hosts : {};
|
||||
for(hostUID in hosts) { // programmatically add each new host.
|
||||
var revivedHost = new NvHTTP(hosts[hostUID].address, myUniqueid);
|
||||
var revivedHost = new NvHTTP(hosts[hostUID].address, myUniqueid, hosts[hostUID].userEnteredAddress);
|
||||
revivedHost.serverUid = hosts[hostUID].serverUid;
|
||||
revivedHost.externalIP = hosts[hostUID].externalIP;
|
||||
revivedHost.hostname = hosts[hostUID].hostname;
|
||||
@ -621,7 +621,13 @@ function onWindowLoad(){
|
||||
var ips = Object.keys(finder.byService_['_nvstream._tcp']);
|
||||
for (var ip in ips) {
|
||||
if (finder.byService_['_nvstream._tcp'][ip]) {
|
||||
addHostToGrid(new NvHTTP(ip, myUniqueid));
|
||||
var mDnsDiscoveredHost = new NvHTTP(ip, myUniqueid);
|
||||
if(hosts[mDnsDiscoveredHost.serverUid] != null) {
|
||||
// if we're seeing a host we've already seen before, update it for the current local IP.
|
||||
hosts[mDnsDiscoveredHost.serverUid].localIp = mDnsDiscoveredHost.localIp;
|
||||
} else {
|
||||
addHostToGrid(mDnsDiscoveredHost);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,10 +31,9 @@ String.prototype.toHex = function() {
|
||||
return hex;
|
||||
}
|
||||
|
||||
function NvHTTP(address, clientUid) {
|
||||
function NvHTTP(address, clientUid, userEnteredAddress = '') {
|
||||
this.address = address;
|
||||
this.paired = false;
|
||||
this.supports4K = false;
|
||||
this.currentGame = 0;
|
||||
this.serverMajorVersion = 0;
|
||||
this.clientUid = clientUid;
|
||||
@ -42,6 +41,7 @@ function NvHTTP(address, clientUid) {
|
||||
this._baseUrlHttp = 'http://' + address + ':47989';
|
||||
this._memCachedBoxArtArray = {};
|
||||
|
||||
this.userEnteredAddress = userEnteredAddress; // if the user entered an address, we keep it on hand to try when polling
|
||||
this.serverUid = '';
|
||||
this.GfeVersion = '';
|
||||
this.supportedDisplayModes = {}; // key: y-resolution:x-resolution, value: array of supported framerates (only ever seen 30 or 60, here)
|
||||
@ -90,7 +90,6 @@ NvHTTP.prototype = {
|
||||
string += 'server address: ' + _self.address + '\r\n';
|
||||
string += 'server UID: ' + _self.serverUid + '\r\n';
|
||||
string += 'is paired: ' + _self.paired + '\r\n';
|
||||
string += 'supports 4K: ' + _self.supports4K + '\r\n';
|
||||
string += 'current game: ' + _self.currentGame + '\r\n';
|
||||
string += 'server major version: ' + _self.serverMajorVersion + '\r\n';
|
||||
string += 'GFE version: ' + _self.GfeVersion + '\r\n';
|
||||
|
Loading…
x
Reference in New Issue
Block a user