|
|
@ -556,36 +556,98 @@ public class Startup |
|
|
|
|
|
|
|
|
|
|
|
app.UseResponseCompression(); |
|
|
|
app.UseResponseCompression(); |
|
|
|
|
|
|
|
|
|
|
|
app.MapWhen( |
|
|
|
if (Settings.StreamingPort == Settings.UiPort) |
|
|
|
ctx => !ctx.Request.Path.StartsWithSegments("/iptv"), |
|
|
|
{ |
|
|
|
blazor => |
|
|
|
app.MapWhen( |
|
|
|
{ |
|
|
|
ctx => !ctx.Request.Path.StartsWithSegments("/iptv"), |
|
|
|
blazor.UseRouting(); |
|
|
|
blazor => |
|
|
|
|
|
|
|
|
|
|
|
if (OidcHelper.IsEnabled) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
blazor.UseAuthentication(); |
|
|
|
blazor.UseRouting(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (OidcHelper.IsEnabled) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
blazor.UseAuthentication(); |
|
|
|
#pragma warning disable ASP0001
|
|
|
|
#pragma warning disable ASP0001
|
|
|
|
blazor.UseAuthorization(); |
|
|
|
blazor.UseAuthorization(); |
|
|
|
#pragma warning restore ASP0001
|
|
|
|
#pragma warning restore ASP0001
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
blazor.UseEndpoints( |
|
|
|
|
|
|
|
endpoints => |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
endpoints.MapControllers(); |
|
|
|
|
|
|
|
endpoints.MapBlazorHub(); |
|
|
|
|
|
|
|
endpoints.MapFallbackToPage("/_Host"); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.MapWhen( |
|
|
|
|
|
|
|
ctx => ctx.Request.Path.StartsWithSegments("/iptv"), |
|
|
|
|
|
|
|
iptv => |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
iptv.UseRouting(); |
|
|
|
|
|
|
|
iptv.UseEndpoints(endpoints => endpoints.MapControllers()); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
app.MapWhen( |
|
|
|
|
|
|
|
ctx => ctx.Request.Host.Port == Settings.UiPort, |
|
|
|
|
|
|
|
uiApp => |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
uiApp.UseRouting(); |
|
|
|
|
|
|
|
|
|
|
|
blazor.UseEndpoints( |
|
|
|
uiApp.UseWhen( |
|
|
|
endpoints => |
|
|
|
c => c.Request.Path.StartsWithSegments("/iptv"), // && !IPAddress.IsLoopback(c.Connection.RemoteIpAddress ?? IPAddress.None),
|
|
|
|
|
|
|
|
a => |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
a.Run( |
|
|
|
|
|
|
|
c => |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
c.Response.StatusCode = 404; |
|
|
|
|
|
|
|
return Task.CompletedTask; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (OidcHelper.IsEnabled) |
|
|
|
{ |
|
|
|
{ |
|
|
|
endpoints.MapControllers(); |
|
|
|
uiApp.UseAuthentication(); |
|
|
|
endpoints.MapBlazorHub(); |
|
|
|
#pragma warning disable ASP0001
|
|
|
|
endpoints.MapFallbackToPage("/_Host"); |
|
|
|
uiApp.UseAuthorization(); |
|
|
|
}); |
|
|
|
#pragma warning restore ASP0001
|
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
app.MapWhen( |
|
|
|
uiApp.UseEndpoints( |
|
|
|
ctx => ctx.Request.Path.StartsWithSegments("/iptv"), |
|
|
|
endpoints => |
|
|
|
iptv => |
|
|
|
{ |
|
|
|
{ |
|
|
|
endpoints.MapControllers(); |
|
|
|
iptv.UseRouting(); |
|
|
|
endpoints.MapBlazorHub(); |
|
|
|
iptv.UseEndpoints(endpoints => endpoints.MapControllers()); |
|
|
|
endpoints.MapFallbackToPage("/_Host"); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.MapWhen( |
|
|
|
|
|
|
|
ctx => ctx.Request.Host.Port == Settings.StreamingPort, |
|
|
|
|
|
|
|
streamingApp => |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
streamingApp.UseRouting(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
streamingApp.UseWhen( |
|
|
|
|
|
|
|
c => !c.Request.Path.StartsWithSegments("/iptv"), |
|
|
|
|
|
|
|
a => |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
a.Run( |
|
|
|
|
|
|
|
c => |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
c.Response.StatusCode = 404; |
|
|
|
|
|
|
|
return Task.CompletedTask; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
streamingApp.UseEndpoints(endpoints => endpoints.MapControllers()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static void CustomServices(IServiceCollection services) |
|
|
|
private static void CustomServices(IServiceCollection services) |
|
|
|