mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
rework dialog
This commit is contained in:
parent
a586d98ac3
commit
d27cd521b5
@ -84,7 +84,7 @@ namespace MediaBrowser.Common.Implementations.Networking
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsInPrivateAddressSpace(string endpoint)
|
public bool IsInPrivateAddressSpace(string endpoint)
|
||||||
{
|
{
|
||||||
if (string.Equals(endpoint, "::1", StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(endpoint, "::1", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
|
@ -25,6 +25,13 @@ namespace MediaBrowser.Common.Net
|
|||||||
/// <returns>[string] MAC Address</returns>
|
/// <returns>[string] MAC Address</returns>
|
||||||
string GetMacAddress();
|
string GetMacAddress();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether [is in private address space] [the specified endpoint].
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="endpoint">The endpoint.</param>
|
||||||
|
/// <returns><c>true</c> if [is in private address space] [the specified endpoint]; otherwise, <c>false</c>.</returns>
|
||||||
|
bool IsInPrivateAddressSpace(string endpoint);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the network shares.
|
/// Gets the network shares.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -19,6 +19,7 @@ using System.Linq;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Common.Security;
|
using MediaBrowser.Common.Security;
|
||||||
|
|
||||||
namespace MediaBrowser.Server.Implementations.HttpServer
|
namespace MediaBrowser.Server.Implementations.HttpServer
|
||||||
@ -46,6 +47,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
|||||||
public string CertificatePath { get; private set; }
|
public string CertificatePath { get; private set; }
|
||||||
|
|
||||||
private readonly IServerConfigurationManager _config;
|
private readonly IServerConfigurationManager _config;
|
||||||
|
private readonly INetworkManager _networkManager;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the local end points.
|
/// Gets the local end points.
|
||||||
@ -69,10 +71,11 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
|||||||
ILogManager logManager,
|
ILogManager logManager,
|
||||||
IServerConfigurationManager config,
|
IServerConfigurationManager config,
|
||||||
string serviceName,
|
string serviceName,
|
||||||
string defaultRedirectPath, params Assembly[] assembliesWithServices)
|
string defaultRedirectPath, INetworkManager networkManager, params Assembly[] assembliesWithServices)
|
||||||
: base(serviceName, assembliesWithServices)
|
: base(serviceName, assembliesWithServices)
|
||||||
{
|
{
|
||||||
DefaultRedirectPath = defaultRedirectPath;
|
DefaultRedirectPath = defaultRedirectPath;
|
||||||
|
_networkManager = networkManager;
|
||||||
_config = config;
|
_config = config;
|
||||||
|
|
||||||
_logger = logManager.GetLogger("HttpServer");
|
_logger = logManager.GetLogger("HttpServer");
|
||||||
@ -175,11 +178,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
|||||||
|
|
||||||
private void OnRequestReceived(string localEndPoint)
|
private void OnRequestReceived(string localEndPoint)
|
||||||
{
|
{
|
||||||
var ignore = localEndPoint.IndexOf("::", StringComparison.OrdinalIgnoreCase) != -1 ||
|
var ignore = _networkManager.IsInPrivateAddressSpace(localEndPoint);
|
||||||
|
|
||||||
localEndPoint.StartsWith("127.", StringComparison.OrdinalIgnoreCase) ||
|
|
||||||
localEndPoint.StartsWith("localhost", StringComparison.OrdinalIgnoreCase) ||
|
|
||||||
localEndPoint.StartsWith("169.", StringComparison.OrdinalIgnoreCase);
|
|
||||||
|
|
||||||
if (ignore)
|
if (ignore)
|
||||||
{
|
{
|
||||||
@ -188,7 +187,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
|||||||
|
|
||||||
if (_localEndpointLock.TryEnterWriteLock(100))
|
if (_localEndpointLock.TryEnterWriteLock(100))
|
||||||
{
|
{
|
||||||
var list = _localEndpoints.ToList();
|
var list = _localEndpoints;
|
||||||
|
|
||||||
list.Remove(localEndPoint);
|
list.Remove(localEndPoint);
|
||||||
list.Insert(0, localEndPoint);
|
list.Insert(0, localEndPoint);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using MediaBrowser.Common;
|
using MediaBrowser.Common;
|
||||||
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Controller.Net;
|
using MediaBrowser.Controller.Net;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
@ -17,18 +18,20 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
|||||||
/// <param name="applicationHost">The application host.</param>
|
/// <param name="applicationHost">The application host.</param>
|
||||||
/// <param name="logManager">The log manager.</param>
|
/// <param name="logManager">The log manager.</param>
|
||||||
/// <param name="config">The configuration.</param>
|
/// <param name="config">The configuration.</param>
|
||||||
|
/// <param name="_networkmanager">The _networkmanager.</param>
|
||||||
/// <param name="serverName">Name of the server.</param>
|
/// <param name="serverName">Name of the server.</param>
|
||||||
/// <param name="defaultRedirectpath">The default redirectpath.</param>
|
/// <param name="defaultRedirectpath">The default redirectpath.</param>
|
||||||
/// <returns>IHttpServer.</returns>
|
/// <returns>IHttpServer.</returns>
|
||||||
public static IHttpServer CreateServer(IApplicationHost applicationHost,
|
public static IHttpServer CreateServer(IApplicationHost applicationHost,
|
||||||
ILogManager logManager,
|
ILogManager logManager,
|
||||||
IServerConfigurationManager config,
|
IServerConfigurationManager config,
|
||||||
|
INetworkManager _networkmanager,
|
||||||
string serverName,
|
string serverName,
|
||||||
string defaultRedirectpath)
|
string defaultRedirectpath)
|
||||||
{
|
{
|
||||||
LogManager.LogFactory = new ServerLogFactory(logManager);
|
LogManager.LogFactory = new ServerLogFactory(logManager);
|
||||||
|
|
||||||
return new HttpListenerHost(applicationHost, logManager, config, serverName, defaultRedirectpath);
|
return new HttpListenerHost(applicationHost, logManager, config, serverName, defaultRedirectpath, _networkmanager);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -436,7 +436,7 @@ namespace MediaBrowser.Server.Startup.Common
|
|||||||
|
|
||||||
RegisterSingleInstance<ISearchEngine>(() => new SearchEngine(LogManager, LibraryManager, UserManager));
|
RegisterSingleInstance<ISearchEngine>(() => new SearchEngine(LogManager, LibraryManager, UserManager));
|
||||||
|
|
||||||
HttpServer = ServerFactory.CreateServer(this, LogManager, ServerConfigurationManager, "Emby", "web/index.html");
|
HttpServer = ServerFactory.CreateServer(this, LogManager, ServerConfigurationManager, NetworkManager, "Emby", "web/index.html");
|
||||||
HttpServer.GlobalResponse = LocalizationManager.GetLocalizedString("StartupEmbyServerIsLoading");
|
HttpServer.GlobalResponse = LocalizationManager.GetLocalizedString("StartupEmbyServerIsLoading");
|
||||||
RegisterSingleInstance(HttpServer, false);
|
RegisterSingleInstance(HttpServer, false);
|
||||||
progress.Report(10);
|
progress.Report(10);
|
||||||
|
@ -310,6 +310,7 @@ namespace MediaBrowser.WebDashboard.Api
|
|||||||
DeleteFilesByExtension(bowerPath, ".md");
|
DeleteFilesByExtension(bowerPath, ".md");
|
||||||
DeleteFilesByExtension(bowerPath, ".json");
|
DeleteFilesByExtension(bowerPath, ".json");
|
||||||
DeleteFilesByExtension(bowerPath, ".gz");
|
DeleteFilesByExtension(bowerPath, ".gz");
|
||||||
|
DeleteFilesByExtension(bowerPath, ".bat");
|
||||||
DeleteFilesByName(bowerPath, "copying", true);
|
DeleteFilesByName(bowerPath, "copying", true);
|
||||||
DeleteFilesByName(bowerPath, "license", true);
|
DeleteFilesByName(bowerPath, "license", true);
|
||||||
DeleteFilesByName(bowerPath, "license-mit", true);
|
DeleteFilesByName(bowerPath, "license-mit", true);
|
||||||
@ -330,6 +331,8 @@ namespace MediaBrowser.WebDashboard.Api
|
|||||||
DeleteFoldersByName(bowerPath, "grunt");
|
DeleteFoldersByName(bowerPath, "grunt");
|
||||||
DeleteFoldersByName(bowerPath, "rollups");
|
DeleteFoldersByName(bowerPath, "rollups");
|
||||||
|
|
||||||
|
DeleteCryptoFiles(Path.Combine(bowerPath, "cryptojslib", "components"));
|
||||||
|
|
||||||
DeleteFoldersByName(Path.Combine(bowerPath, "jquery"), "src");
|
DeleteFoldersByName(Path.Combine(bowerPath, "jquery"), "src");
|
||||||
DeleteFoldersByName(Path.Combine(bowerPath, "jstree"), "src");
|
DeleteFoldersByName(Path.Combine(bowerPath, "jstree"), "src");
|
||||||
DeleteFoldersByName(Path.Combine(bowerPath, "Sortable"), "meteor");
|
DeleteFoldersByName(Path.Combine(bowerPath, "Sortable"), "meteor");
|
||||||
@ -357,6 +360,22 @@ namespace MediaBrowser.WebDashboard.Api
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DeleteCryptoFiles(string path)
|
||||||
|
{
|
||||||
|
var files = _fileSystem.GetFiles(path)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
var keepFiles = new[] { "core-min.js", "md5-min.js", "sha1-min.js" };
|
||||||
|
|
||||||
|
foreach (var file in files)
|
||||||
|
{
|
||||||
|
if (!keepFiles.Contains(file.Name, StringComparer.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
_fileSystem.DeleteFile(file.FullName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void DeleteFilesByExtension(string path, string extension)
|
private void DeleteFilesByExtension(string path, string extension)
|
||||||
{
|
{
|
||||||
var files = _fileSystem.GetFiles(path, true)
|
var files = _fileSystem.GetFiles(path, true)
|
||||||
|
@ -116,15 +116,12 @@
|
|||||||
<Content Include="dashboard-ui\apiclient\sync\serversync.js">
|
<Content Include="dashboard-ui\apiclient\sync\serversync.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="dashboard-ui\components\buttonenabled.js">
|
<Content Include="dashboard-ui\legacy\buttonenabled.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="dashboard-ui\components\collectioneditor\collectioneditor.js">
|
<Content Include="dashboard-ui\components\collectioneditor\collectioneditor.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="dashboard-ui\components\dialog.js">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="dashboard-ui\components\directorybrowser\directorybrowser.js">
|
<Content Include="dashboard-ui\components\directorybrowser\directorybrowser.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user