mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-31 14:33:54 -04:00
fixed plugin assembly downloads as well as debug/release detection with nuget assemblies
This commit is contained in:
parent
b075e0a5b9
commit
364fbb9e0c
@ -12,6 +12,20 @@ namespace MediaBrowser.Common.Implementations
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class BaseApplicationPaths : IApplicationPaths
|
public abstract class BaseApplicationPaths : IApplicationPaths
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The _use debug path
|
||||||
|
/// </summary>
|
||||||
|
private bool _useDebugPath;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="BaseApplicationPaths" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="useDebugPath">if set to <c>true</c> [use debug paths].</param>
|
||||||
|
protected BaseApplicationPaths(bool useDebugPath)
|
||||||
|
{
|
||||||
|
_useDebugPath = useDebugPath;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The _program data path
|
/// The _program data path
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -272,14 +286,9 @@ namespace MediaBrowser.Common.Implementations
|
|||||||
/// Gets the path to the application's ProgramDataFolder
|
/// Gets the path to the application's ProgramDataFolder
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>System.String.</returns>
|
/// <returns>System.String.</returns>
|
||||||
public static string GetProgramDataPath()
|
private string GetProgramDataPath()
|
||||||
{
|
{
|
||||||
#if DEBUG
|
var programDataPath = _useDebugPath ? ConfigurationManager.AppSettings["DebugProgramDataPath"] : Path.Combine(ConfigurationManager.AppSettings["ReleaseProgramDataPath"], ConfigurationManager.AppSettings["ProgramDataFolderName"]);
|
||||||
string programDataPath = ConfigurationManager.AppSettings["DebugProgramDataPath"];
|
|
||||||
|
|
||||||
#else
|
|
||||||
string programDataPath = Path.Combine(ConfigurationManager.AppSettings["ReleaseProgramDataPath"], ConfigurationManager.AppSettings["ProgramDataFolderName"]);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
programDataPath = programDataPath.Replace("%CommonApplicationData%", Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData));
|
programDataPath = programDataPath.Replace("%CommonApplicationData%", Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData));
|
||||||
|
|
||||||
|
@ -312,8 +312,6 @@ namespace MediaBrowser.Common.Kernel
|
|||||||
// Set these to null so that they can be lazy loaded again
|
// Set these to null so that they can be lazy loaded again
|
||||||
Configuration = null;
|
Configuration = null;
|
||||||
|
|
||||||
ReloadLogger();
|
|
||||||
|
|
||||||
Logger.Info("Version {0} initializing", ApplicationVersion);
|
Logger.Info("Version {0} initializing", ApplicationVersion);
|
||||||
|
|
||||||
await OnConfigurationLoaded().ConfigureAwait(false);
|
await OnConfigurationLoaded().ConfigureAwait(false);
|
||||||
|
@ -107,6 +107,7 @@
|
|||||||
<Compile Include="Net\IWebSocket.cs" />
|
<Compile Include="Net\IWebSocket.cs" />
|
||||||
<Compile Include="Net\IWebSocketServer.cs" />
|
<Compile Include="Net\IWebSocketServer.cs" />
|
||||||
<Compile Include="Net\MimeTypes.cs" />
|
<Compile Include="Net\MimeTypes.cs" />
|
||||||
|
<Compile Include="Net\StreamWriter.cs" />
|
||||||
<Compile Include="Net\UdpMessageReceivedEventArgs.cs" />
|
<Compile Include="Net\UdpMessageReceivedEventArgs.cs" />
|
||||||
<Compile Include="Net\WebSocketConnectEventArgs.cs" />
|
<Compile Include="Net\WebSocketConnectEventArgs.cs" />
|
||||||
<Compile Include="Net\WebSocketConnection.cs" />
|
<Compile Include="Net\WebSocketConnection.cs" />
|
||||||
|
@ -241,6 +241,10 @@ namespace MediaBrowser.Common.Net
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (contentType.StartsWith("application/", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -257,7 +261,10 @@ namespace MediaBrowser.Common.Net
|
|||||||
if (!compress || string.IsNullOrEmpty(RequestContext.CompressionType))
|
if (!compress || string.IsNullOrEmpty(RequestContext.CompressionType))
|
||||||
{
|
{
|
||||||
Response.ContentType = contentType;
|
Response.ContentType = contentType;
|
||||||
return await factoryFn().ConfigureAwait(false);
|
|
||||||
|
var stream = await factoryFn().ConfigureAwait(false);
|
||||||
|
|
||||||
|
return new StreamWriter(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
string content;
|
string content;
|
||||||
|
@ -173,7 +173,7 @@ namespace MediaBrowser.Common.Net
|
|||||||
// Misc
|
// Misc
|
||||||
if (ext.Equals(".dll", StringComparison.OrdinalIgnoreCase))
|
if (ext.Equals(".dll", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "application/x-msdownload";
|
return "application/octet-stream";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Web
|
// Web
|
||||||
|
48
MediaBrowser.Common/Net/StreamWriter.cs
Normal file
48
MediaBrowser.Common/Net/StreamWriter.cs
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
using ServiceStack.Service;
|
||||||
|
using System.IO;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Common.Net
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Class StreamWriter
|
||||||
|
/// </summary>
|
||||||
|
public class StreamWriter : IStreamWriter
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the source stream.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The source stream.</value>
|
||||||
|
public Stream SourceStream { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="StreamWriter" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source">The source.</param>
|
||||||
|
public StreamWriter(Stream source)
|
||||||
|
{
|
||||||
|
SourceStream = source;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Writes to.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="responseStream">The response stream.</param>
|
||||||
|
public void WriteTo(Stream responseStream)
|
||||||
|
{
|
||||||
|
var task = WriteToAsync(responseStream);
|
||||||
|
|
||||||
|
Task.WaitAll(task);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Writes to async.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="responseStream">The response stream.</param>
|
||||||
|
/// <returns>Task.</returns>
|
||||||
|
private Task WriteToAsync(Stream responseStream)
|
||||||
|
{
|
||||||
|
return SourceStream.CopyToAsync(responseStream);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -9,6 +9,20 @@ namespace MediaBrowser.Server.Implementations
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ServerApplicationPaths : BaseApplicationPaths, IServerApplicationPaths
|
public class ServerApplicationPaths : BaseApplicationPaths, IServerApplicationPaths
|
||||||
{
|
{
|
||||||
|
#if (DEBUG)
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="ServerApplicationPaths" /> class.
|
||||||
|
/// </summary>
|
||||||
|
public ServerApplicationPaths()
|
||||||
|
: base(true)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#elif (RELEASE)
|
||||||
|
public ServerApplicationPaths()
|
||||||
|
: base(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endif
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The _root folder path
|
/// The _root folder path
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -119,6 +119,7 @@ namespace MediaBrowser.ServerApplication
|
|||||||
_taskManager = new TaskManager(_applicationPaths, _jsonSerializer, Logger);
|
_taskManager = new TaskManager(_applicationPaths, _jsonSerializer, Logger);
|
||||||
|
|
||||||
Kernel = new Kernel(this, _applicationPaths, _xmlSerializer, _taskManager, Logger);
|
Kernel = new Kernel(this, _applicationPaths, _xmlSerializer, _taskManager, Logger);
|
||||||
|
ReloadLogger();
|
||||||
|
|
||||||
RegisterResources();
|
RegisterResources();
|
||||||
|
|
||||||
@ -333,7 +334,7 @@ namespace MediaBrowser.ServerApplication
|
|||||||
/// <exception cref="System.NotImplementedException"></exception>
|
/// <exception cref="System.NotImplementedException"></exception>
|
||||||
public void ReloadLogger()
|
public void ReloadLogger()
|
||||||
{
|
{
|
||||||
LogFilePath = Path.Combine(Kernel.ApplicationPaths.LogDirectoryPath, "Server-" + DateTime.Now.Ticks + ".log");
|
LogFilePath = Path.Combine(_applicationPaths.LogDirectoryPath, "Server-" + DateTime.Now.Ticks + ".log");
|
||||||
|
|
||||||
NlogManager.AddFileTarget(LogFilePath, Kernel.Configuration.EnableDebugLevelLogging);
|
NlogManager.AddFileTarget(LogFilePath, Kernel.Configuration.EnableDebugLevelLogging);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user