mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-09 03:04:20 -04:00
Setting no cache values to video files
This commit is contained in:
parent
50aaeff7da
commit
1bb2b27edc
@ -5,13 +5,14 @@ using Microsoft.Extensions.Configuration;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
using Microsoft.AspNetCore.StaticFiles;
|
using Microsoft.AspNetCore.StaticFiles;
|
||||||
|
|
||||||
namespace Kyoo.Api
|
namespace Kyoo.Api
|
||||||
{
|
{
|
||||||
[Route("video")]
|
[Route("video")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
public class VideoApi : ControllerBase
|
public class VideoApi : Controller
|
||||||
{
|
{
|
||||||
private readonly ILibraryManager _libraryManager;
|
private readonly ILibraryManager _libraryManager;
|
||||||
private readonly ITranscoder _transcoder;
|
private readonly ITranscoder _transcoder;
|
||||||
@ -27,6 +28,14 @@ namespace Kyoo.Api
|
|||||||
_transcodePath = config.GetValue<string>("transcodeTempPath");
|
_transcodePath = config.GetValue<string>("transcodeTempPath");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void OnActionExecuted(ActionExecutedContext ctx)
|
||||||
|
{
|
||||||
|
base.OnActionExecuted(ctx);
|
||||||
|
ctx.HttpContext.Response.Headers.Add("Cache-Control", "no-cache, no-store, must-revalidate");
|
||||||
|
ctx.HttpContext.Response.Headers.Add("Pragma", "no-cache");
|
||||||
|
ctx.HttpContext.Response.Headers.Add("Expires", "0");
|
||||||
|
}
|
||||||
|
|
||||||
private string _GetContentType(string path)
|
private string _GetContentType(string path)
|
||||||
{
|
{
|
||||||
if (_provider == null)
|
if (_provider == null)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user