mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 19:08:18 -07:00
fixed sync menu not displaying options
This commit is contained in:
parent
6ba570e062
commit
77578c185f
@ -592,14 +592,15 @@
|
||||
function findServers() {
|
||||
|
||||
var deferred = DeferredBuilder.Deferred();
|
||||
ServerDiscovery.findServers().done(function (foundServers) {
|
||||
ServerDiscovery.findServers(2000).done(function (foundServers) {
|
||||
|
||||
var servers = foundServers.map(function (foundServer) {
|
||||
|
||||
return {
|
||||
Id: foundServer.Id,
|
||||
LocalAddress: foundServer.Address,
|
||||
Name: foundServer.Name
|
||||
Name: foundServer.Name,
|
||||
ManualAddress: convertEndpointAddressToManualAddress(foundServer)
|
||||
};
|
||||
});
|
||||
deferred.resolveWith(null, [servers]);
|
||||
@ -607,6 +608,27 @@
|
||||
return deferred.promise();
|
||||
}
|
||||
|
||||
function convertEndpointAddressToManualAddress(info) {
|
||||
|
||||
if (info.Address && info.EndpointAddress) {
|
||||
var address = info.EndpointAddress.split(":")[0];
|
||||
|
||||
// Determine the port, if any
|
||||
var parts = info.Address.split(":");
|
||||
if (parts.length > 1) {
|
||||
var portString = parts[parts.length - 1];
|
||||
|
||||
if (!isNaN(parseInt(portString))) {
|
||||
address += ":" + portString;
|
||||
}
|
||||
}
|
||||
|
||||
return normalizeAddress(address);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
self.connect = function () {
|
||||
|
||||
logger.log('Begin connect');
|
||||
@ -876,12 +898,19 @@
|
||||
}
|
||||
};
|
||||
|
||||
self.connectToAddress = function (address) {
|
||||
function normalizeAddress(address) {
|
||||
|
||||
if (address.toLowerCase().indexOf('http') != 0) {
|
||||
address = "http://" + address;
|
||||
}
|
||||
|
||||
return address;
|
||||
}
|
||||
|
||||
self.connectToAddress = function (address) {
|
||||
|
||||
address = normalizeAddress(address);
|
||||
|
||||
var deferred = DeferredBuilder.Deferred();
|
||||
|
||||
tryConnect(address, 15000).done(function (publicInfo) {
|
||||
|
@ -2,9 +2,14 @@
|
||||
|
||||
globalScope.ServerDiscovery = {
|
||||
|
||||
findServers: function () {
|
||||
findServers: function (timeoutMs) {
|
||||
|
||||
var deferred = DeferredBuilder.Deferred();
|
||||
var servers = [];
|
||||
|
||||
// Expected server properties
|
||||
// Name, Id, Address, EndpointAddress (optional)
|
||||
|
||||
deferred.resolveWith(null, [servers]);
|
||||
return deferred.promise();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user