Remove comments from backend and web-player source
Strip //, /* */ and XML doc comments from all backend .cs files, and JS/TS/CSS/HTML comments from web-player source (.ts, .svelte, .css), per the project's no-comments convention.
This commit is contained in:
@@ -41,13 +41,8 @@ public sealed class JwtBearerEventsHandler(
|
||||
if (cache.TryGetValue(cacheKey, out _))
|
||||
return;
|
||||
|
||||
// Access tokens from the IdP are minimal (just sub/scope/aud) — profile attributes live on
|
||||
// the userinfo endpoint, so ask for them there instead of relying on token claims alone.
|
||||
var userInfo = await FetchUserInfoAsync(tokenValidatedContext, tokenValidatedContext.HttpContext.RequestAborted);
|
||||
|
||||
// Zitadel also issues short-form JWT claim names ("name", "given_name", "family_name", "email"),
|
||||
// but the newer JsonWebTokenHandler (default since .NET 8) no longer auto-maps those to the
|
||||
// legacy ClaimTypes.* URIs the way JwtSecurityTokenHandler used to — so check both forms too.
|
||||
var username = userInfo?.Name
|
||||
?? userInfo?.PreferredUsername
|
||||
?? principal.FindFirstValue("name")
|
||||
|
||||
@@ -39,13 +39,6 @@ public sealed class OpenApiOptionsSetup(IOptions<AuthenticationConfiguration> op
|
||||
return Task.CompletedTask;
|
||||
} );
|
||||
|
||||
// Properties annotated with [JsonConverter(typeof(LongAsStringConverter))] (id-shaped
|
||||
// `long` fields — see that converter for why) serialize as a JSON string, but the
|
||||
// schema generator still reflects the declared CLR `long`/`long?` type as a bare
|
||||
// int64 number. Reconcile the declared schema so generated clients (openapi-typescript)
|
||||
// type exactly those properties as `string`, matching what actually goes over the wire —
|
||||
// scoped to the attribute, not the CLR type, so unrelated `long` fields (byte sizes, …)
|
||||
// are left alone.
|
||||
options.AddSchemaTransformer((schema, context, _) =>
|
||||
{
|
||||
if (context.JsonPropertyInfo?.CustomConverter is LongAsStringConverter or NullableLongAsStringConverter)
|
||||
|
||||
@@ -48,6 +48,4 @@ app
|
||||
|
||||
app.Run();
|
||||
|
||||
// Makes the top-level-statements Program class public so
|
||||
// WebApplicationFactory<Program> (Musify.Api.Tests) can see it.
|
||||
public partial class Program;
|
||||
@@ -6,10 +6,6 @@ using Musify.StreamingGateway.Configuration;
|
||||
|
||||
namespace Musify.StreamingGateway.Authentication;
|
||||
|
||||
/// <param name="Prefix">The storage key prefix the ticket authorizes reading from. Empty means the
|
||||
/// ticket was missing, malformed, expired, or otherwise invalid.</param>
|
||||
/// <param name="MaxBytes">When set, the caller is limited to the first <c>MaxBytes</c> bytes of the
|
||||
/// object — the anonymous preview fragment cap carried by the <c>maxBytes</c> claim.</param>
|
||||
public sealed record TicketValidationResult(string Prefix, long? MaxBytes)
|
||||
{
|
||||
public static readonly TicketValidationResult Invalid = new(string.Empty, null);
|
||||
|
||||
@@ -72,12 +72,6 @@ public sealed class TicketValidationMiddleware(
|
||||
await next(context);
|
||||
}
|
||||
|
||||
/// <summary>Rewrites the request's <c>Range</c> header so nothing past <paramref name="maxBytes"/>
|
||||
/// is ever asked of the filer — this is what actually enforces the anonymous preview length,
|
||||
/// downstream of the ticket carrying that cap. A request with no <c>Range</c> header (a plain,
|
||||
/// whole-file GET) gets one synthesized, so the filer always responds with a bounded 206 instead of
|
||||
/// streaming the full object. Returns false when the requested range starts at or past the cap, in
|
||||
/// which case the caller should answer 416 directly instead of proxying anything.</summary>
|
||||
private static bool TryClampRange(HttpContext context, long maxBytes)
|
||||
{
|
||||
var rangeHeader = context.Request.Headers.Range;
|
||||
|
||||
@@ -7,11 +7,6 @@ using Musify.Infrastructure.Services;
|
||||
|
||||
var builder = Host.CreateApplicationBuilder();
|
||||
|
||||
// Registering Mediator pulls in every handler in Musify.Application, including ones
|
||||
// (e.g. CreatePlayList, CreateTrack) that depend on IEventBus, which the Worker never
|
||||
// registers because it only consumes events, it never publishes them. Only the handlers
|
||||
// this process actually dispatches (GenerateMixesForUserCommand) are ever constructed,
|
||||
// so the default eager validate-on-build check is too strict for this host.
|
||||
builder.ConfigureContainer(new DefaultServiceProviderFactory(new ServiceProviderOptions
|
||||
{
|
||||
ValidateOnBuild = false,
|
||||
|
||||
Reference in New Issue
Block a user