a fork of iceshrimp.net but a tweaked frontend to my personal liking. waow
fediverse social-media social iceshrimp fedi
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[backend/openapi] Improve AuthorizeCheckOperationDocumentFilter performance

+13 -14
+13 -14
Iceshrimp.Backend/Core/Extensions/SwaggerGenOptionsExtensions.cs
··· 151 151 if (context.MethodInfo.DeclaringType is null) 152 152 return; 153 153 154 - var authenticateAttribute = context.MethodInfo.GetCustomAttributes(true) 155 - .OfType<AuthenticateAttribute>() 156 - .FirstOrDefault() ?? 157 - context.MethodInfo.DeclaringType.GetCustomAttributes(true) 158 - .OfType<AuthenticateAttribute>() 159 - .FirstOrDefault(); 154 + var authenticateAttribute = context.MethodInfo 155 + .GetCustomAttributes<AuthenticateAttribute>(true) 156 + .FirstOrDefault() 157 + ?? context.MethodInfo 158 + .DeclaringType 159 + .GetCustomAttributes<AuthenticateAttribute>(true) 160 + .FirstOrDefault(); 160 161 161 162 if (authenticateAttribute == null) return; 162 163 163 - var isMastodonController = context.MethodInfo.DeclaringType.GetCustomAttributes(true) 164 - .OfType<MastodonApiControllerAttribute>() 164 + var isMastodonController = context.MethodInfo.DeclaringType 165 + .GetCustomAttributes<MastodonApiControllerAttribute>(true) 165 166 .Any(); 166 167 167 - var authorizeAttribute = context.MethodInfo.GetCustomAttributes(true) 168 - .OfType<AuthorizeAttribute>() 169 - .FirstOrDefault() ?? 170 - context.MethodInfo.DeclaringType.GetCustomAttributes(true) 171 - .OfType<AuthorizeAttribute>() 172 - .FirstOrDefault(); 168 + var authorizeAttribute = context.MethodInfo.GetCustomAttributes<AuthorizeAttribute>(true) 169 + .FirstOrDefault() 170 + ?? context.MethodInfo.DeclaringType.GetCustomAttributes<AuthorizeAttribute>(true) 171 + .FirstOrDefault(); 173 172 174 173 var securitySchemaName = isMastodonController ? "mastodon" : "iceshrimp"; 175 174 var schema = new OpenApiSecuritySchemeReference(securitySchemaName, context.Document);