mirror of
				https://github.com/zoriya/Kyoo.git
				synced 2025-11-04 03:27:14 -05:00 
			
		
		
		
	Format code
This commit is contained in:
		
							parent
							
								
									68c28ed358
								
							
						
					
					
						commit
						f65e4bc417
					
				@ -34,11 +34,18 @@ namespace Kyoo.Core.Api
 | 
			
		||||
	[ApiController]
 | 
			
		||||
	public class ProxyApi : Controller
 | 
			
		||||
	{
 | 
			
		||||
		private readonly HttpProxyOptions _proxyOptions = HttpProxyOptionsBuilder.Instance.WithHandleFailure(async (context, exception) =>
 | 
			
		||||
		private readonly HttpProxyOptions _proxyOptions = HttpProxyOptionsBuilder
 | 
			
		||||
			.Instance
 | 
			
		||||
			.WithHandleFailure(
 | 
			
		||||
				async (context, exception) =>
 | 
			
		||||
				{
 | 
			
		||||
					context.Response.StatusCode = StatusCodes.Status503ServiceUnavailable;
 | 
			
		||||
			await context.Response.WriteAsJsonAsync(new RequestError("Service unavailable"));
 | 
			
		||||
		}).Build();
 | 
			
		||||
					await context
 | 
			
		||||
						.Response
 | 
			
		||||
						.WriteAsJsonAsync(new RequestError("Service unavailable"));
 | 
			
		||||
				}
 | 
			
		||||
			)
 | 
			
		||||
			.Build();
 | 
			
		||||
 | 
			
		||||
		/// <summary>
 | 
			
		||||
		/// Transcoder proxy
 | 
			
		||||
@ -53,7 +60,10 @@ namespace Kyoo.Core.Api
 | 
			
		||||
		public Task Proxy(string rest, [FromQuery] Dictionary<string, string> query)
 | 
			
		||||
		{
 | 
			
		||||
			// TODO: Use an env var to configure transcoder:7666.
 | 
			
		||||
			return this.HttpProxyAsync($"http://transcoder:7666/{rest}" + query.ToQueryString(), _proxyOptions);
 | 
			
		||||
			return this.HttpProxyAsync(
 | 
			
		||||
				$"http://transcoder:7666/{rest}" + query.ToQueryString(),
 | 
			
		||||
				_proxyOptions
 | 
			
		||||
			);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user