plugin security fixes and other abstractions

This commit is contained in:
LukePulverenti
2013-02-25 22:43:04 -05:00
parent 364fbb9e0c
commit 2d06095447
79 changed files with 1271 additions and 1388 deletions

View File

@@ -40,9 +40,6 @@ namespace MediaBrowser.Common.Kernel
internal void OnConfigurationUpdated()
{
EventHelper.QueueEventIfNotNull(ConfigurationUpdated, this, EventArgs.Empty, Logger);
// Notify connected clients
TcpManager.SendWebSocketMessage("ConfigurationUpdated", Configuration);
}
#endregion
@@ -140,12 +137,6 @@ namespace MediaBrowser.Common.Kernel
}
}
/// <summary>
/// Gets a value indicating whether this instance is first run.
/// </summary>
/// <value><c>true</c> if this instance is first run; otherwise, <c>false</c>.</value>
public bool IsFirstRun { get; private set; }
/// <summary>
/// Gets or sets a value indicating whether this instance has changes that require the entire application to restart.
/// </summary>
@@ -176,12 +167,6 @@ namespace MediaBrowser.Common.Kernel
/// <value>The TCP manager.</value>
public TcpManager TcpManager { get; private set; }
/// <summary>
/// Gets the rest services.
/// </summary>
/// <value>The rest services.</value>
public IEnumerable<IRestfulService> RestServices { get; private set; }
/// <summary>
/// Gets the UDP server port number.
/// This can't be configurable because then the user would have to configure their client to discover the server.
@@ -280,19 +265,7 @@ namespace MediaBrowser.Common.Kernel
/// Initializes the Kernel
/// </summary>
/// <returns>Task.</returns>
public Task Init()
{
IsFirstRun = !File.Exists(ApplicationPaths.SystemConfigurationFilePath);
// Performs initializations that can be reloaded at anytime
return Reload();
}
/// <summary>
/// Performs initializations that can be reloaded at anytime
/// </summary>
/// <returns>Task.</returns>
public async Task Reload()
public async Task Init()
{
OnReloadBeginning();
@@ -312,8 +285,6 @@ namespace MediaBrowser.Common.Kernel
// Set these to null so that they can be lazy loaded again
Configuration = null;
Logger.Info("Version {0} initializing", ApplicationVersion);
await OnConfigurationLoaded().ConfigureAwait(false);
FindParts();
@@ -348,7 +319,6 @@ namespace MediaBrowser.Common.Kernel
/// </summary>
protected virtual void FindParts()
{
RestServices = ApplicationHost.GetExports<IRestfulService>();
WebSocketListeners = ApplicationHost.GetExports<IWebSocketListener>();
Plugins = ApplicationHost.GetExports<IPlugin>();
}
@@ -425,18 +395,6 @@ namespace MediaBrowser.Common.Kernel
}
}
/// <summary>
/// Gets the current application version
/// </summary>
/// <value>The application version.</value>
public Version ApplicationVersion
{
get
{
return GetType().Assembly.GetName().Version;
}
}
/// <summary>
/// Performs the pending restart.
/// </summary>
@@ -445,7 +403,9 @@ namespace MediaBrowser.Common.Kernel
{
if (HasPendingRestart)
{
RestartApplication();
Logger.Info("Restarting the application");
ApplicationHost.Restart();
}
else
{
@@ -453,16 +413,6 @@ namespace MediaBrowser.Common.Kernel
}
}
/// <summary>
/// Restarts the application.
/// </summary>
protected void RestartApplication()
{
Logger.Info("Restarting the application");
ApplicationHost.Restart();
}
/// <summary>
/// Gets the system status.
/// </summary>
@@ -472,7 +422,7 @@ namespace MediaBrowser.Common.Kernel
return new SystemInfo
{
HasPendingRestart = HasPendingRestart,
Version = ApplicationVersion.ToString(),
Version = ApplicationHost.ApplicationVersion.ToString(),
IsNetworkDeployed = ApplicationHost.CanSelfUpdate,
WebSocketPortNumber = TcpManager.WebSocketPortNumber,
SupportsNativeWebSocket = TcpManager.SupportsNativeWebSocket,