mirror of
https://github.com/EpinelPS/EpinelPS.git
synced 2025-12-14 07:55:01 +01:00
fix video
This commit is contained in:
@@ -246,7 +246,8 @@ namespace nksrv
|
|||||||
Logger.Info("Download " + fs);
|
Logger.Info("Download " + fs);
|
||||||
|
|
||||||
// TODO: Ip might change
|
// TODO: Ip might change
|
||||||
var requestUri = new Uri("https://43.132.66.200/prdenv/" + ctx.RequestedPath);
|
string @base = ctx.RequestedPath.StartsWith("/prdenv") ? "prdenv" : "media";
|
||||||
|
var requestUri = new Uri("https://43.132.66.200/" + @base + ctx.RequestedPath);
|
||||||
using var request = new HttpRequestMessage(HttpMethod.Get, requestUri);
|
using var request = new HttpRequestMessage(HttpMethod.Get, requestUri);
|
||||||
request.Headers.TryAddWithoutValidation("host", "cloud.nikke-kr.com");
|
request.Headers.TryAddWithoutValidation("host", "cloud.nikke-kr.com");
|
||||||
using var response = await hs.SendAsync(request);
|
using var response = await hs.SendAsync(request);
|
||||||
@@ -266,15 +267,30 @@ namespace nksrv
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
try
|
||||||
using (var fss = new FileStream(fs, FileMode.Open))
|
|
||||||
{
|
{
|
||||||
using (var responseStream = ctx.OpenResponseStream())
|
|
||||||
|
|
||||||
|
|
||||||
|
using (var fss = new FileStream(fs, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
|
||||||
{
|
{
|
||||||
fss.CopyTo(responseStream);
|
using (var responseStream = ctx.OpenResponseStream())
|
||||||
fss.Close();
|
{
|
||||||
|
if (ctx.RequestedPath.EndsWith(".mp4"))
|
||||||
|
{
|
||||||
|
ctx.Response.ContentType = "video/mp4";
|
||||||
|
}
|
||||||
|
ctx.Response.ContentLength64 = fss.Length;
|
||||||
|
fss.CopyTo(responseStream);
|
||||||
|
fss.Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.Error(ex.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void WriteData<T>(IHttpContext ctx, T data, bool encrypted = false) where T : IMessage, new()
|
private static void WriteData<T>(IHttpContext ctx, T data, bool encrypted = false) where T : IMessage, new()
|
||||||
|
|||||||
Reference in New Issue
Block a user