mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-05 13:23:03 +02:00
Renaming variable and refactoring IF statement
This commit is contained in:
parent
b737301c70
commit
d7b2c2a176
|
@ -1,3 +1,5 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations
|
namespace Emby.Server.Implementations
|
||||||
{
|
{
|
||||||
public interface IStartupOptions
|
public interface IStartupOptions
|
||||||
|
@ -40,6 +42,6 @@ namespace Emby.Server.Implementations
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the value of the --auto-discover-publish-url command line option.
|
/// Gets the value of the --auto-discover-publish-url command line option.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string AutoDiscoverPublishUrl { get; }
|
Uri PublishedServerUrl { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace Emby.Server.Implementations.Udp
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Address Override Configuration Key
|
/// Address Override Configuration Key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string AddressOverrideConfigKey = "AutoDiscoverAddressOverride";
|
public const string AddressOverrideConfigKey = "PublishedServerUrl";
|
||||||
|
|
||||||
private Socket _udpSocket;
|
private Socket _udpSocket;
|
||||||
private IPEndPoint _endpoint;
|
private IPEndPoint _endpoint;
|
||||||
|
@ -47,17 +47,9 @@ namespace Emby.Server.Implementations.Udp
|
||||||
|
|
||||||
private async Task RespondToV2Message(string messageText, EndPoint endpoint, CancellationToken cancellationToken)
|
private async Task RespondToV2Message(string messageText, EndPoint endpoint, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
string localUrl;
|
string localUrl = !string.IsNullOrEmpty(_config[AddressOverrideConfigKey])
|
||||||
|
? _config[AddressOverrideConfigKey]
|
||||||
if (!string.IsNullOrEmpty(_config[AddressOverrideConfigKey]))
|
: await _appHost.GetLocalApiUrl(cancellationToken).ConfigureAwait(false);
|
||||||
{
|
|
||||||
localUrl = _config[AddressOverrideConfigKey];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
localUrl = await _appHost.GetLocalApiUrl(cancellationToken).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(localUrl))
|
if (!string.IsNullOrEmpty(localUrl))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using CommandLine;
|
using CommandLine;
|
||||||
using Emby.Server.Implementations;
|
using Emby.Server.Implementations;
|
||||||
|
@ -83,8 +84,8 @@ namespace Jellyfin.Server
|
||||||
public string? PluginManifestUrl { get; set; }
|
public string? PluginManifestUrl { get; set; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
[Option("auto-discover-publish-url", Required = false, HelpText = "Jellyfin Server URL to publish via auto discover process")]
|
[Option("published-server-url", Required = false, HelpText = "Jellyfin Server URL to publish via auto discover process")]
|
||||||
public string? AutoDiscoverPublishUrl { get; set; }
|
public Uri? PublishedServerUrl { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the command line options as a dictionary that can be used in the .NET configuration system.
|
/// Gets the command line options as a dictionary that can be used in the .NET configuration system.
|
||||||
|
@ -104,9 +105,9 @@ namespace Jellyfin.Server
|
||||||
config.Add(ConfigurationExtensions.HostWebClientKey, bool.FalseString);
|
config.Add(ConfigurationExtensions.HostWebClientKey, bool.FalseString);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AutoDiscoverPublishUrl != null)
|
if (PublishedServerUrl != null)
|
||||||
{
|
{
|
||||||
config.Add(UdpServer.AddressOverrideConfigKey, AutoDiscoverPublishUrl);
|
config.Add(UdpServer.AddressOverrideConfigKey, PublishedServerUrl.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
|
|
Loading…
Reference in a new issue