Proxy Nzb/Torrent Downloads thru Prowlarr

This commit is contained in:
Qstick
2021-02-15 23:33:13 -05:00
parent da60543c72
commit a080bf1c6c
14 changed files with 435 additions and 6 deletions

View File

@@ -0,0 +1,29 @@
using System.IO;
using Nancy;
namespace NzbDrone.Http.Extensions
{
public static class ResponseExtensions
{
public static Response FromByteArray(this IResponseFormatter formatter, byte[] body, string contentType = null)
{
return new ByteArrayResponse(body, contentType);
}
}
public class ByteArrayResponse : Response
{
public ByteArrayResponse(byte[] body, string contentType = null)
{
this.ContentType = contentType ?? "application/octet-stream";
this.Contents = stream =>
{
using (var writer = new BinaryWriter(stream))
{
writer.Write(body);
}
};
}
}
}