rework dialog

This commit is contained in:
Luke Pulverenti 2015-12-14 09:45:42 -05:00
parent a586d98ac3
commit d27cd521b5
7 changed files with 39 additions and 14 deletions

View File

@ -84,7 +84,7 @@ namespace MediaBrowser.Common.Implementations.Networking
return true;
}
private bool IsInPrivateAddressSpace(string endpoint)
public bool IsInPrivateAddressSpace(string endpoint)
{
if (string.Equals(endpoint, "::1", StringComparison.OrdinalIgnoreCase))
{

View File

@ -25,6 +25,13 @@ namespace MediaBrowser.Common.Net
/// <returns>[string] MAC Address</returns>
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>
/// Gets the network shares.
/// </summary>

View File

@ -19,6 +19,7 @@ using System.Linq;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.Net;
using MediaBrowser.Common.Security;
namespace MediaBrowser.Server.Implementations.HttpServer
@ -46,6 +47,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
public string CertificatePath { get; private set; }
private readonly IServerConfigurationManager _config;
private readonly INetworkManager _networkManager;
/// <summary>
/// Gets the local end points.
@ -69,10 +71,11 @@ namespace MediaBrowser.Server.Implementations.HttpServer
ILogManager logManager,
IServerConfigurationManager config,
string serviceName,
string defaultRedirectPath, params Assembly[] assembliesWithServices)
string defaultRedirectPath, INetworkManager networkManager, params Assembly[] assembliesWithServices)
: base(serviceName, assembliesWithServices)
{
DefaultRedirectPath = defaultRedirectPath;
_networkManager = networkManager;
_config = config;
_logger = logManager.GetLogger("HttpServer");
@ -175,11 +178,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
private void OnRequestReceived(string localEndPoint)
{
var ignore = localEndPoint.IndexOf("::", StringComparison.OrdinalIgnoreCase) != -1 ||
localEndPoint.StartsWith("127.", StringComparison.OrdinalIgnoreCase) ||
localEndPoint.StartsWith("localhost", StringComparison.OrdinalIgnoreCase) ||
localEndPoint.StartsWith("169.", StringComparison.OrdinalIgnoreCase);
var ignore = _networkManager.IsInPrivateAddressSpace(localEndPoint);
if (ignore)
{
@ -188,7 +187,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
if (_localEndpointLock.TryEnterWriteLock(100))
{
var list = _localEndpoints.ToList();
var list = _localEndpoints;
list.Remove(localEndPoint);
list.Insert(0, localEndPoint);

View File

@ -1,4 +1,5 @@
using MediaBrowser.Common;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Logging;
@ -17,18 +18,20 @@ namespace MediaBrowser.Server.Implementations.HttpServer
/// <param name="applicationHost">The application host.</param>
/// <param name="logManager">The log manager.</param>
/// <param name="config">The configuration.</param>
/// <param name="_networkmanager">The _networkmanager.</param>
/// <param name="serverName">Name of the server.</param>
/// <param name="defaultRedirectpath">The default redirectpath.</param>
/// <returns>IHttpServer.</returns>
public static IHttpServer CreateServer(IApplicationHost applicationHost,
ILogManager logManager,
IServerConfigurationManager config,
INetworkManager _networkmanager,
string serverName,
string defaultRedirectpath)
{
LogManager.LogFactory = new ServerLogFactory(logManager);
return new HttpListenerHost(applicationHost, logManager, config, serverName, defaultRedirectpath);
return new HttpListenerHost(applicationHost, logManager, config, serverName, defaultRedirectpath, _networkmanager);
}
}
}

View File

@ -436,7 +436,7 @@ namespace MediaBrowser.Server.Startup.Common
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");
RegisterSingleInstance(HttpServer, false);
progress.Report(10);

View File

@ -310,6 +310,7 @@ namespace MediaBrowser.WebDashboard.Api
DeleteFilesByExtension(bowerPath, ".md");
DeleteFilesByExtension(bowerPath, ".json");
DeleteFilesByExtension(bowerPath, ".gz");
DeleteFilesByExtension(bowerPath, ".bat");
DeleteFilesByName(bowerPath, "copying", true);
DeleteFilesByName(bowerPath, "license", true);
DeleteFilesByName(bowerPath, "license-mit", true);
@ -330,6 +331,8 @@ namespace MediaBrowser.WebDashboard.Api
DeleteFoldersByName(bowerPath, "grunt");
DeleteFoldersByName(bowerPath, "rollups");
DeleteCryptoFiles(Path.Combine(bowerPath, "cryptojslib", "components"));
DeleteFoldersByName(Path.Combine(bowerPath, "jquery"), "src");
DeleteFoldersByName(Path.Combine(bowerPath, "jstree"), "src");
DeleteFoldersByName(Path.Combine(bowerPath, "Sortable"), "meteor");
@ -357,6 +360,22 @@ namespace MediaBrowser.WebDashboard.Api
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)
{
var files = _fileSystem.GetFiles(path, true)

View File

@ -116,15 +116,12 @@
<Content Include="dashboard-ui\apiclient\sync\serversync.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\components\buttonenabled.js">
<Content Include="dashboard-ui\legacy\buttonenabled.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\components\collectioneditor\collectioneditor.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\components\dialog.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\components\directorybrowser\directorybrowser.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>