diff --git a/_administration_controller_8cs_source.html b/_administration_controller_8cs_source.html index adfd9c8216..ccc10188f0 100644 --- a/_administration_controller_8cs_source.html +++ b/_administration_controller_8cs_source.html @@ -523,7 +523,7 @@ $(document).ready(function() { init_codefold(0); });
Tgstation.Server.Host.Core
Definition Application.cs:77
Tgstation.Server.Host.Core.ServerUpdateResult
ServerUpdateResult
The result of a call to start a server update.
Definition ServerUpdateResult.cs:7
Tgstation.Server.Host.Database
Definition DatabaseCollection.cs:11
-
Tgstation.Server.Host.Extensions
Definition ApplicationBuilderExtensions.cs:21
+
Tgstation.Server.Host.Extensions
Definition ApplicationBuilderExtensions.cs:22
Tgstation.Server.Host.IO
Definition BufferedFileStreamProvider.cs:9
Tgstation.Server.Host.Security
Definition AuthenticationContext.cs:8
Tgstation.Server.Host.System
Definition AssemblyInformationProvider.cs:9
diff --git a/_api_client_8cs_source.html b/_api_client_8cs_source.html index cb1c5be702..be711fbfca 100644 --- a/_api_client_8cs_source.html +++ b/_api_client_8cs_source.html @@ -687,9 +687,9 @@ $(document).ready(function() { init_codefold(0); });
Stream
Tgstation.Server.Api.ApiHeaders
Represents the header that must be present for every server request.
Definition ApiHeaders.cs:25
Tgstation.Server.Api.ApiHeaders.UserAgent
ProductHeaderValue? UserAgent
The client's user agent as a ProductHeaderValue if valid.
Definition ApiHeaders.cs:89
-
Tgstation.Server.Api.ApiHeaders.SetHubConnectionHeaders
void SetHubConnectionHeaders(IDictionary< string, string > headers)
Adds the headers necessary for a SignalR hub connection.
Definition ApiHeaders.cs:401
+
Tgstation.Server.Api.ApiHeaders.SetHubConnectionHeaders
void SetHubConnectionHeaders(IDictionary< string, string > headers)
Adds the headers necessary for a SignalR hub connection.
Definition ApiHeaders.cs:402
Tgstation.Server.Api.ApiHeaders.Token
TokenResponse? Token
The client's TokenResponse.
Definition ApiHeaders.cs:104
-
Tgstation.Server.Api.ApiHeaders.SetRequestHeaders
void SetRequestHeaders(HttpRequestHeaders headers, long? instanceId=null)
Set HttpRequestHeaders using the ApiHeaders. This initially clears headers .
Definition ApiHeaders.cs:369
+
Tgstation.Server.Api.ApiHeaders.SetRequestHeaders
void SetRequestHeaders(HttpRequestHeaders headers, long? instanceId=null)
Set HttpRequestHeaders using the ApiHeaders. This initially clears headers .
Definition ApiHeaders.cs:370
Tgstation.Server.Api.ApiHeaders.ApplicationJsonMime
const string ApplicationJsonMime
Added to MediaTypeNames.Application in netstandard2.1. Can't use because of lack of ....
Definition ApiHeaders.cs:59
Tgstation.Server.Api.Models.Response.ErrorMessageResponse
Represents an error message returned by the server.
Definition ErrorMessageResponse.cs:12
Tgstation.Server.Api.Models.Response.FileTicketResponse
Response for when file transfers are necessary.
Definition FileTicketResponse.cs:7
diff --git a/_api_controller_8cs_source.html b/_api_controller_8cs_source.html index bbbee6c639..51cab1247c 100644 --- a/_api_controller_8cs_source.html +++ b/_api_controller_8cs_source.html @@ -421,7 +421,7 @@ $(document).ready(function() { init_codefold(0); });
Tgstation.Server.Host.Controllers.Results
Definition LimitedStreamResult.cs:14
Tgstation.Server.Host.Controllers
Definition AdministrationController.cs:34
Tgstation.Server.Host.Database
Definition DatabaseCollection.cs:11
-
Tgstation.Server.Host.Extensions
Definition ApplicationBuilderExtensions.cs:21
+
Tgstation.Server.Host.Extensions
Definition ApplicationBuilderExtensions.cs:22
Tgstation.Server.Host.Models
Definition ChatBot.cs:9
Tgstation.Server.Host.Security
Definition AuthenticationContext.cs:8
Tgstation.Server.Host.Utils
Definition AbstractHttpClientFactory.cs:10
diff --git a/_api_headers_8cs_source.html b/_api_headers_8cs_source.html index 9d61c824b2..9390e153c5 100644 --- a/_api_headers_8cs_source.html +++ b/_api_headers_8cs_source.html @@ -212,7 +212,7 @@ $(document).ready(function() { init_codefold(0); });
214
215 var jsonAccept = new Microsoft.Net.Http.Headers.MediaTypeHeaderValue(ApplicationJsonMime);
216 var eventStreamAccept = new Microsoft.Net.Http.Headers.MediaTypeHeaderValue(TextEventStreamMime);
-
217 if (!requestHeaders.Accept.Any(jsonAccept.IsSubsetOf))
+
217 if (!requestHeaders.Accept.Any(accept => accept.IsSubsetOf(jsonAccept)))
218 if (!allowEventStreamAccept)
219 AddError(HeaderErrorTypes.Accept, $"Client does not accept {ApplicationJsonMime}!");
220 else if (!requestHeaders.Accept.Any(eventStreamAccept.IsSubsetOf))
@@ -349,71 +349,71 @@ $(document).ready(function() { init_codefold(0); });
356 }
357
-
362 public bool Compatible() => CheckCompatibility(ApiVersion);
-
363
-
-
369 public void SetRequestHeaders(HttpRequestHeaders headers, long? instanceId = null)
-
370 {
-
371 if (headers == null)
-
372 throw new ArgumentNullException(nameof(headers));
-
373 if (instanceId.HasValue && InstanceId.HasValue && instanceId != InstanceId)
-
374 throw new InvalidOperationException("Specified different instance IDs in constructor and SetRequestHeaders!");
-
375
-
376 headers.Clear();
-
377 headers.Accept.Add(new MediaTypeWithQualityHeaderValue(ApplicationJsonMime));
-
378 headers.UserAgent.Add(new ProductInfoHeaderValue(UserAgent));
-
379 headers.Add(ApiVersionHeader, CreateApiVersionHeader());
-
380 if (OAuthProvider.HasValue)
-
381 {
-
382 headers.Authorization = new AuthenticationHeaderValue(OAuthAuthenticationScheme, OAuthCode!);
-
383 headers.Add(OAuthProviderHeader, OAuthProvider.ToString());
-
384 }
-
385 else if (!IsTokenAuthentication)
-
386 headers.Authorization = new AuthenticationHeaderValue(
-
387 BasicAuthenticationScheme,
-
388 Convert.ToBase64String(Encoding.UTF8.GetBytes($"{Username}:{Password}")));
-
389 else
-
390 headers.Authorization = new AuthenticationHeaderValue(BearerAuthenticationScheme, Token!.Bearer);
-
391
-
392 instanceId ??= InstanceId;
-
393 if (instanceId.HasValue)
-
394 headers.Add(InstanceIdHeader, instanceId.Value.ToString(CultureInfo.InvariantCulture));
-
395 }
+
363 public bool Compatible(Version? alternateApiVersion = null) => CheckCompatibility(ApiVersion) || (alternateApiVersion != null && alternateApiVersion.Major == ApiVersion.Major);
+
364
+
+
370 public void SetRequestHeaders(HttpRequestHeaders headers, long? instanceId = null)
+
371 {
+
372 if (headers == null)
+
373 throw new ArgumentNullException(nameof(headers));
+
374 if (instanceId.HasValue && InstanceId.HasValue && instanceId != InstanceId)
+
375 throw new InvalidOperationException("Specified different instance IDs in constructor and SetRequestHeaders!");
+
376
+
377 headers.Clear();
+
378 headers.Accept.Add(new MediaTypeWithQualityHeaderValue(ApplicationJsonMime));
+
379 headers.UserAgent.Add(new ProductInfoHeaderValue(UserAgent));
+ +
381 if (OAuthProvider.HasValue)
+
382 {
+
383 headers.Authorization = new AuthenticationHeaderValue(OAuthAuthenticationScheme, OAuthCode!);
+
384 headers.Add(OAuthProviderHeader, OAuthProvider.ToString());
+
385 }
+
386 else if (!IsTokenAuthentication)
+
387 headers.Authorization = new AuthenticationHeaderValue(
+ +
389 Convert.ToBase64String(Encoding.UTF8.GetBytes($"{Username}:{Password}")));
+
390 else
+
391 headers.Authorization = new AuthenticationHeaderValue(BearerAuthenticationScheme, Token!.Bearer);
+
392
+
393 instanceId ??= InstanceId;
+
394 if (instanceId.HasValue)
+
395 headers.Add(InstanceIdHeader, instanceId.Value.ToString(CultureInfo.InvariantCulture));
+
396 }
-
396
-
-
401 public void SetHubConnectionHeaders(IDictionary<string, string> headers)
-
402 {
-
403 if (headers == null)
-
404 throw new ArgumentNullException(nameof(headers));
-
405
-
406 headers.Add(HeaderNames.UserAgent, RawUserAgent ?? throw new InvalidOperationException("Missing UserAgent!"));
-
407 headers.Add(HeaderNames.Accept, ApplicationJsonMime);
- -
409 }
+
397
+
+
402 public void SetHubConnectionHeaders(IDictionary<string, string> headers)
+
403 {
+
404 if (headers == null)
+
405 throw new ArgumentNullException(nameof(headers));
+
406
+
407 headers.Add(HeaderNames.UserAgent, RawUserAgent ?? throw new InvalidOperationException("Missing UserAgent!"));
+
408 headers.Add(HeaderNames.Accept, ApplicationJsonMime);
+ +
410 }
-
410
- -
416 => new ProductHeaderValue(AssemblyName.Name, ApiVersion.ToString()).ToString();
-
417 }
+
411
+ +
417 => new ProductHeaderValue(AssemblyName.Name, ApiVersion.ToString()).ToString();
+
418 }
-
418}
+
419}
Tgstation.Server.Api.ApiHeaders
Represents the header that must be present for every server request.
Definition ApiHeaders.cs:25
Tgstation.Server.Api.ApiHeaders.UserAgent
ProductHeaderValue? UserAgent
The client's user agent as a ProductHeaderValue if valid.
Definition ApiHeaders.cs:89
Tgstation.Server.Api.ApiHeaders.ApiHeaders
ApiHeaders(ProductHeaderValue userAgent, TokenResponse token)
Initializes a new instance of the ApiHeaders class. Used for token authentication.
Definition ApiHeaders.cs:143
Tgstation.Server.Api.ApiHeaders.OAuthAuthenticationScheme
const string OAuthAuthenticationScheme
The JWT authentication header scheme.
Definition ApiHeaders.cs:54
Tgstation.Server.Api.ApiHeaders.RawUserAgent
string? RawUserAgent
The client's raw user agent.
Definition ApiHeaders.cs:94
+
Tgstation.Server.Api.ApiHeaders.Compatible
bool Compatible(Version? alternateApiVersion=null)
Checks if the ApiVersion is compatible with Version.
Tgstation.Server.Api.ApiHeaders.InstanceIdHeader
const string InstanceIdHeader
The InstanceId header key.
Definition ApiHeaders.cs:34
-
Tgstation.Server.Api.ApiHeaders.SetHubConnectionHeaders
void SetHubConnectionHeaders(IDictionary< string, string > headers)
Adds the headers necessary for a SignalR hub connection.
Definition ApiHeaders.cs:401
+
Tgstation.Server.Api.ApiHeaders.SetHubConnectionHeaders
void SetHubConnectionHeaders(IDictionary< string, string > headers)
Adds the headers necessary for a SignalR hub connection.
Definition ApiHeaders.cs:402
Tgstation.Server.Api.ApiHeaders.IsTokenAuthentication
bool IsTokenAuthentication
If the header uses OAuth or TGS JWT authentication.
Definition ApiHeaders.cs:129
-
Tgstation.Server.Api.ApiHeaders.Compatible
bool Compatible()
Checks if the ApiVersion is compatible with Version.
Tgstation.Server.Api.ApiHeaders.CheckCompatibility
static bool CheckCompatibility(Version otherVersion)
Checks if a given otherVersion is compatible with our own.
Tgstation.Server.Api.ApiHeaders.Username
string? Username
The client's username.
Definition ApiHeaders.cs:109
Tgstation.Server.Api.ApiHeaders.ColonSeparator
static readonly char[] ColonSeparator
A char Array containing the ':' char.
Definition ApiHeaders.cs:79
Tgstation.Server.Api.ApiHeaders.ApiVersion
Version ApiVersion
The client's API version.
Definition ApiHeaders.cs:99
Tgstation.Server.Api.ApiHeaders.Token
TokenResponse? Token
The client's TokenResponse.
Definition ApiHeaders.cs:104
-
Tgstation.Server.Api.ApiHeaders.SetRequestHeaders
void SetRequestHeaders(HttpRequestHeaders headers, long? instanceId=null)
Set HttpRequestHeaders using the ApiHeaders. This initially clears headers .
Definition ApiHeaders.cs:369
+
Tgstation.Server.Api.ApiHeaders.SetRequestHeaders
void SetRequestHeaders(HttpRequestHeaders headers, long? instanceId=null)
Set HttpRequestHeaders using the ApiHeaders. This initially clears headers .
Definition ApiHeaders.cs:370
Tgstation.Server.Api.ApiHeaders.InstanceId
long? InstanceId
The instance EntityId.Id being accessed.
Definition ApiHeaders.cs:84
Tgstation.Server.Api.ApiHeaders.Version
static readonly Version Version
Get the version of the Api the caller is using.
Definition ApiHeaders.cs:69
Tgstation.Server.Api.ApiHeaders.BasicAuthenticationScheme
const string BasicAuthenticationScheme
The JWT authentication header scheme.
Definition ApiHeaders.cs:49
diff --git a/_api_root_controller_8cs_source.html b/_api_root_controller_8cs_source.html index c6ffc2cb75..ff61d9e967 100644 --- a/_api_root_controller_8cs_source.html +++ b/_api_root_controller_8cs_source.html @@ -222,7 +222,7 @@ $(document).ready(function() { init_codefold(0); });
186 return ValueTask.FromResult(HeadersIssue(ApiHeadersProvider.HeadersException!));
187 }
188
-
189 return loginAuthority.InvokeTransformable<LoginPayload, TokenResponse>(this, authority => authority.AttemptLogin(cancellationToken));
+
189 return loginAuthority.InvokeTransformable<LoginResult, TokenResponse>(this, authority => authority.AttemptLogin(cancellationToken));
190 }
191 }
@@ -258,7 +258,7 @@ $(document).ready(function() { init_codefold(0); });
Tgstation.Server.Host.Controllers.ApiRootController.ApiRootController
ApiRootController(IDatabaseContext databaseContext, IAuthenticationContext authenticationContext, IAssemblyInformationProvider assemblyInformationProvider, IOAuthProviders oAuthProviders, IPlatformIdentifier platformIdentifier, ISwarmService swarmService, IServerControl serverControl, IOptions< GeneralConfiguration > generalConfigurationOptions, ILogger< ApiRootController > logger, IApiHeadersProvider apiHeadersProvider, IRestAuthorityInvoker< ILoginAuthority > loginAuthority)
Initializes a new instance of the ApiRootController class.
Definition ApiRootController.cs:87
Tgstation.Server.Host.Controllers.ApiRootController.oAuthProviders
readonly IOAuthProviders oAuthProviders
The IOAuthProviders for the ApiRootController.
Definition ApiRootController.cs:46
Tgstation.Server.Host.Controllers.ApiRootController.swarmService
readonly ISwarmService swarmService
The ISwarmService for the ApiRootController.
Definition ApiRootController.cs:56
-
Tgstation.Server.Host.GraphQL.Mutations.Payloads.LoginPayload
Success response for a login attempt.
Definition LoginPayload.cs:12
+
Tgstation.Server.Host.GraphQL.Mutations.Payloads.LoginResult
Success response for a login attempt.
Definition LoginResult.cs:12
Tgstation.Server.Host.Security.AuthenticationContext
Definition AuthenticationContext.cs:11
Tgstation.Server.Host.Security.AuthenticationContext.Valid
bool Valid
If the IAuthenticationContext is for a valid login.
Definition AuthenticationContext.cs:13
Tgstation.Server.Host.Utils.ApiHeadersProvider
Definition ApiHeadersProvider.cs:11
@@ -287,7 +287,7 @@ $(document).ready(function() { init_codefold(0); });
Tgstation.Server.Host.Core
Definition Application.cs:77
Tgstation.Server.Host.Core.ServerUpdateResult.UpdateInProgress
@ UpdateInProgress
Another update is already in progress.
Tgstation.Server.Host.Database
Definition DatabaseCollection.cs:11
-
Tgstation.Server.Host.GraphQL.Mutations.Payloads
Definition LoginPayload.cs:7
+
Tgstation.Server.Host.GraphQL.Mutations.Payloads
Definition LoginResult.cs:7
Tgstation.Server.Host.Models
Definition ChatBot.cs:9
Tgstation.Server.Host.Security.OAuth
Definition DiscordOAuthValidator.cs:10
Tgstation.Server.Host.Security
Definition AuthenticationContext.cs:8
diff --git a/_application_8cs_source.html b/_application_8cs_source.html index 3a16dbbf05..ff84963514 100644 --- a/_application_8cs_source.html +++ b/_application_8cs_source.html @@ -1033,7 +1033,7 @@ $(document).ready(function() { init_codefold(0); });
Tgstation.Server.Host.Controllers
Definition AdministrationController.cs:34
Tgstation.Server.Host.Core
Definition Application.cs:77
Tgstation.Server.Host.Database
Definition DatabaseCollection.cs:11
-
Tgstation.Server.Host.Extensions
Definition ApplicationBuilderExtensions.cs:21
+
Tgstation.Server.Host.Extensions
Definition ApplicationBuilderExtensions.cs:22
Tgstation.Server.Host.GraphQL.Interceptors
Definition RightsTypeInterceptor.cs:13
Tgstation.Server.Host.GraphQL.Scalars
Definition JwtType.cs:7
Tgstation.Server.Host.GraphQL.Subscriptions
Definition ITopicEventReceiver.cs:2
diff --git a/_application_builder_extensions_8cs_source.html b/_application_builder_extensions_8cs_source.html index 2f1542eadf..634928fff8 100644 --- a/_application_builder_extensions_8cs_source.html +++ b/_application_builder_extensions_8cs_source.html @@ -98,186 +98,192 @@ $(document).ready(function() { init_codefold(0); });
14using Tgstation.Server.Api.Models;
15using Tgstation.Server.Api.Models.Response;
16using Tgstation.Server.Host.Configuration;
-
17using Tgstation.Server.Host.System;
-
18using Tgstation.Server.Host.Utils;
-
19
-
-
20namespace Tgstation.Server.Host.Extensions
-
21{
-
- -
26 {
-
30 internal static bool LogSwarmIdentifier { get; set; }
-
31
-
-
36 public static void UseDbConflictHandling(this IApplicationBuilder applicationBuilder)
-
37 {
-
38 ArgumentNullException.ThrowIfNull(applicationBuilder);
-
39
-
40 applicationBuilder.Use(async (context, next) =>
-
41 {
-
42 var logger = GetLogger(context);
-
43 try
-
44 {
-
45 await next();
-
46 }
-
47 catch (DbUpdateException e)
-
48 {
-
49 if (e.InnerException is OperationCanceledException)
-
50 {
-
51 logger.LogTrace(e, "Rethrowing DbUpdateException as OperationCanceledException");
-
52 throw e.InnerException;
-
53 }
-
54
-
55 logger.LogDebug(e, "Database conflict!");
-
56 await new ConflictObjectResult(new ErrorMessageResponse(ErrorCode.DatabaseIntegrityConflict)
-
57 {
-
58 AdditionalData = String.Format(CultureInfo.InvariantCulture, (e.InnerException ?? e).Message),
-
59 }).ExecuteResultAsync(new ActionContext
-
60 {
-
61 HttpContext = context,
-
62 });
-
63 }
-
64 });
-
65 }
+ + + +
20
+
+ +
22{
+
+ +
27 {
+
31 internal static bool LogSwarmIdentifier { get; set; }
+
32
+
+
37 public static void UseDbConflictHandling(this IApplicationBuilder applicationBuilder)
+
38 {
+
39 ArgumentNullException.ThrowIfNull(applicationBuilder);
+
40
+
41 applicationBuilder.Use(async (context, next) =>
+
42 {
+
43 var logger = GetLogger(context);
+
44 try
+
45 {
+
46 await next();
+
47 }
+
48 catch (DbUpdateException e)
+
49 {
+
50 if (e.InnerException is OperationCanceledException)
+
51 {
+
52 logger.LogTrace(e, "Rethrowing DbUpdateException as OperationCanceledException");
+
53 throw e.InnerException;
+
54 }
+
55
+
56 logger.LogDebug(e, "Database conflict!");
+
57 await new ConflictObjectResult(new ErrorMessageResponse(ErrorCode.DatabaseIntegrityConflict)
+
58 {
+
59 AdditionalData = String.Format(CultureInfo.InvariantCulture, (e.InnerException ?? e).Message),
+
60 }).ExecuteResultAsync(new ActionContext
+
61 {
+
62 HttpContext = context,
+
63 });
+
64 }
+
65 });
+
66 }
-
66
-
-
71 public static void UseCancelledRequestSuppression(this IApplicationBuilder applicationBuilder)
-
72 {
-
73 ArgumentNullException.ThrowIfNull(applicationBuilder);
-
74 applicationBuilder.Use(async (context, next) =>
-
75 {
-
76 var logger = GetLogger(context);
-
77 try
-
78 {
-
79 await next();
-
80 }
-
81 catch (OperationCanceledException ex)
-
82 {
-
83 logger.LogDebug(ex, "Request cancelled!");
-
84 }
-
85 });
-
86 }
+
67
+
+
72 public static void UseCancelledRequestSuppression(this IApplicationBuilder applicationBuilder)
+
73 {
+
74 ArgumentNullException.ThrowIfNull(applicationBuilder);
+
75 applicationBuilder.Use(async (context, next) =>
+
76 {
+
77 var logger = GetLogger(context);
+
78 try
+
79 {
+
80 await next();
+
81 }
+
82 catch (OperationCanceledException ex)
+
83 {
+
84 logger.LogDebug(ex, "Request cancelled!");
+
85 }
+
86 });
+
87 }
-
87
-
-
92 public static void UseServerErrorHandling(this IApplicationBuilder applicationBuilder)
-
93 {
-
94 ArgumentNullException.ThrowIfNull(applicationBuilder);
-
95
-
96 applicationBuilder.Use(async (context, next) =>
-
97 {
-
98 var logger = GetLogger(context);
-
99 try
-
100 {
-
101 await next();
-
102 }
-
103 catch (Exception e)
-
104 {
-
105 logger.LogError(e, "Failed request!");
-
106 await new JsonResult(
-
107 new ErrorMessageResponse(ErrorCode.InternalServerError)
-
108 {
-
109 AdditionalData = e.ToString(),
-
110 })
-
111 {
-
112 StatusCode = (int)HttpStatusCode.InternalServerError,
-
113 }
-
114 .ExecuteResultAsync(new ActionContext
-
115 {
-
116 HttpContext = context,
-
117 });
-
118 }
-
119 });
-
120 }
+
88
+
+
93 public static void UseServerErrorHandling(this IApplicationBuilder applicationBuilder)
+
94 {
+
95 ArgumentNullException.ThrowIfNull(applicationBuilder);
+
96
+
97 applicationBuilder.Use(async (context, next) =>
+
98 {
+
99 var logger = GetLogger(context);
+
100 try
+
101 {
+
102 await next();
+
103 }
+
104 catch (Exception e)
+
105 {
+
106 logger.LogError(e, "Failed request!");
+
107 await new JsonResult(
+
108 new ErrorMessageResponse(ErrorCode.InternalServerError)
+
109 {
+
110 AdditionalData = e.ToString(),
+
111 })
+
112 {
+
113 StatusCode = (int)HttpStatusCode.InternalServerError,
+
114 }
+
115 .ExecuteResultAsync(new ActionContext
+
116 {
+
117 HttpContext = context,
+
118 });
+
119 }
+
120 });
+
121 }
-
121
-
-
126 public static void UseApiCompatibility(this IApplicationBuilder applicationBuilder)
-
127 {
-
128 ArgumentNullException.ThrowIfNull(applicationBuilder);
-
129
-
130 applicationBuilder.Use(async (context, next) =>
-
131 {
-
132 var apiHeadersProvider = context.RequestServices.GetRequiredService<IApiHeadersProvider>();
-
133 if (apiHeadersProvider.ApiHeaders?.Compatible() == false)
-
134 {
-
135 await new BadRequestObjectResult(
-
136 new ErrorMessageResponse(ErrorCode.ApiMismatch))
-
137 .ExecuteResultAsync(new ActionContext
-
138 {
-
139 HttpContext = context,
-
140 });
-
141 return;
-
142 }
-
143
-
144 await next();
-
145 });
-
146 }
+
122
+
+
127 public static void UseApiCompatibility(this IApplicationBuilder applicationBuilder)
+
128 {
+
129 ArgumentNullException.ThrowIfNull(applicationBuilder);
+
130
+
131 applicationBuilder.Use(async (context, next) =>
+
132 {
+
133 var apiHeadersProvider = context.RequestServices.GetRequiredService<IApiHeadersProvider>();
+
134 if (apiHeadersProvider.ApiHeaders?.Compatible(
+
135 Version.Parse(
+ +
137 {
+
138 await new BadRequestObjectResult(
+
139 new ErrorMessageResponse(ErrorCode.ApiMismatch))
+
140 .ExecuteResultAsync(new ActionContext
+
141 {
+
142 HttpContext = context,
+
143 });
+
144 return;
+
145 }
+
146
+
147 await next();
+
148 });
+
149 }
-
147
-
-
153 public static void UseServerBranding(this IApplicationBuilder applicationBuilder, IAssemblyInformationProvider assemblyInformationProvider)
-
154 {
-
155 ArgumentNullException.ThrowIfNull(applicationBuilder);
-
156 ArgumentNullException.ThrowIfNull(assemblyInformationProvider);
-
157
-
158 applicationBuilder.Use((context, next) =>
-
159 {
-
160 context.Response.Headers.Add("X-Powered-By", assemblyInformationProvider.VersionPrefix);
-
161 return next();
-
162 });
-
163 }
+
150
+
+
156 public static void UseServerBranding(this IApplicationBuilder applicationBuilder, IAssemblyInformationProvider assemblyInformationProvider)
+
157 {
+
158 ArgumentNullException.ThrowIfNull(applicationBuilder);
+
159 ArgumentNullException.ThrowIfNull(assemblyInformationProvider);
+
160
+
161 applicationBuilder.Use((context, next) =>
+
162 {
+
163 context.Response.Headers.Add("X-Powered-By", assemblyInformationProvider.VersionPrefix);
+
164 return next();
+
165 });
+
166 }
-
164
-
-
170 public static void UseDisabledNginxProxyBuffering(this IApplicationBuilder applicationBuilder)
-
171 {
-
172 ArgumentNullException.ThrowIfNull(applicationBuilder);
-
173
-
174 // https://www.nginx.com/resources/wiki/start/topics/examples/x-accel/#x-accel-buffering
-
175 applicationBuilder.Use((context, next) =>
-
176 {
-
177 context.Response.Headers.Add("X-Accel-Buffering", "no");
-
178 return next();
-
179 });
-
180 }
+
167
+
+
173 public static void UseDisabledNginxProxyBuffering(this IApplicationBuilder applicationBuilder)
+
174 {
+
175 ArgumentNullException.ThrowIfNull(applicationBuilder);
+
176
+
177 // https://www.nginx.com/resources/wiki/start/topics/examples/x-accel/#x-accel-buffering
+
178 applicationBuilder.Use((context, next) =>
+
179 {
+
180 context.Response.Headers.Add("X-Accel-Buffering", "no");
+
181 return next();
+
182 });
+
183 }
-
181
-
-
187 public static void UseAdditionalRequestLoggingContext(this IApplicationBuilder applicationBuilder, SwarmConfiguration swarmConfiguration)
-
188 {
-
189 ArgumentNullException.ThrowIfNull(applicationBuilder);
-
190 ArgumentNullException.ThrowIfNull(swarmConfiguration);
-
191
-
192 if (LogSwarmIdentifier && swarmConfiguration.Identifier != null)
-
193 applicationBuilder.Use(async (context, next) =>
-
194 {
-
195 using (LogContext.PushProperty(SerilogContextHelper.SwarmIdentifierContextProperty, swarmConfiguration.Identifier))
-
196 await next();
-
197 });
-
198 }
+
184
+
+
190 public static void UseAdditionalRequestLoggingContext(this IApplicationBuilder applicationBuilder, SwarmConfiguration swarmConfiguration)
+
191 {
+
192 ArgumentNullException.ThrowIfNull(applicationBuilder);
+
193 ArgumentNullException.ThrowIfNull(swarmConfiguration);
+
194
+
195 if (LogSwarmIdentifier && swarmConfiguration.Identifier != null)
+
196 applicationBuilder.Use(async (context, next) =>
+
197 {
+
198 using (LogContext.PushProperty(SerilogContextHelper.SwarmIdentifierContextProperty, swarmConfiguration.Identifier))
+
199 await next();
+
200 });
+
201 }
-
199
-
205 static ILogger GetLogger(HttpContext httpContext) => httpContext.RequestServices.GetRequiredService<ILoggerFactory>().CreateLogger(typeof(ApplicationBuilderExtensions));
-
206 }
+
202
+
208 static ILogger GetLogger(HttpContext httpContext) => httpContext.RequestServices.GetRequiredService<ILoggerFactory>().CreateLogger(typeof(ApplicationBuilderExtensions));
+
209 }
-
207}
+
210}
string? Identifier
The server's identifier.
Represents an error message returned by the server.
Configuration for the server swarm system.
- -
static void UseServerBranding(this IApplicationBuilder applicationBuilder, IAssemblyInformationProvider assemblyInformationProvider)
Add the X-Powered-By response header.
-
static void UseDisabledNginxProxyBuffering(this IApplicationBuilder applicationBuilder)
Add the X-Accel-Buffering response header.
-
static void UseServerErrorHandling(this IApplicationBuilder applicationBuilder)
Suppress all in flight Exceptions for the request with error 500.
+ +
static void UseServerBranding(this IApplicationBuilder applicationBuilder, IAssemblyInformationProvider assemblyInformationProvider)
Add the X-Powered-By response header.
+
static void UseDisabledNginxProxyBuffering(this IApplicationBuilder applicationBuilder)
Add the X-Accel-Buffering response header.
+
static void UseServerErrorHandling(this IApplicationBuilder applicationBuilder)
Suppress all in flight Exceptions for the request with error 500.
static ILogger GetLogger(HttpContext httpContext)
Gets a ILogger from a given httpContext .
-
static void UseDbConflictHandling(this IApplicationBuilder applicationBuilder)
Return a ConflictObjectResult for DbUpdateExceptions.
-
static void UseCancelledRequestSuppression(this IApplicationBuilder applicationBuilder)
Suppress global::System.Threading.Tasks.TaskCanceledException warnings when a user aborts a request.
-
static void UseAdditionalRequestLoggingContext(this IApplicationBuilder applicationBuilder, SwarmConfiguration swarmConfiguration)
Adds additional global LogContext to the request pipeline.
-
static void UseApiCompatibility(this IApplicationBuilder applicationBuilder)
Check that the API version is the current major version if it's present in the headers.
+
static void UseDbConflictHandling(this IApplicationBuilder applicationBuilder)
Return a ConflictObjectResult for DbUpdateExceptions.
+
static void UseCancelledRequestSuppression(this IApplicationBuilder applicationBuilder)
Suppress global::System.Threading.Tasks.TaskCanceledException warnings when a user aborts a request.
+
static void UseAdditionalRequestLoggingContext(this IApplicationBuilder applicationBuilder, SwarmConfiguration swarmConfiguration)
Adds additional global LogContext to the request pipeline.
+
static void UseApiCompatibility(this IApplicationBuilder applicationBuilder)
Check that the API version is the current major version if it's present in the headers.
+
Attribute for bringing in the master versions list from MSBuild that aren't embedded into assemblies ...
+
string RawGraphQLVersion
The Version string of the TGS GraphQL API.
+
static MasterVersionsAttribute Instance
Return the Assembly's instance of the MasterVersionsAttribute.
Helpers for manipulating the Serilog.Context.LogContext.
const string SwarmIdentifierContextProperty
The Serilog.Context.LogContext property name for Api.Models.Internal.SwarmServer.Identifiers.
@@ -287,7 +293,8 @@ $(document).ready(function() { init_codefold(0); });
ErrorCode
Types of Response.ErrorMessageResponses that the API may return.
Definition ErrorCode.cs:12
- + +
diff --git a/_authenticated_graph_q_l_server_client_8cs_source.html b/_authenticated_graph_q_l_server_client_8cs_source.html index 6ca5cb8f63..09ca151cbf 100644 --- a/_authenticated_graph_q_l_server_client_8cs_source.html +++ b/_authenticated_graph_q_l_server_client_8cs_source.html @@ -134,7 +134,7 @@ $(document).ready(function() { init_codefold(0); });
70 loginResult)
71 {
72 this.getRestClientForToken = getRestClientForToken ?? throw new ArgumentNullException(nameof(getRestClientForToken));
-
73 restClient = getRestClientForToken(loginResult.Data!.Login.Bearer!.EncodedToken);
+
73 restClient = getRestClientForToken(loginResult.Data!.Login.LoginResult!.Bearer.EncodedToken);
74 }
75
diff --git a/_chat_channel_extensions_8cs_source.html b/_chat_channel_extensions_8cs_source.html index 82915589a7..44beca5db6 100644 --- a/_chat_channel_extensions_8cs_source.html +++ b/_chat_channel_extensions_8cs_source.html @@ -125,7 +125,7 @@ $(document).ready(function() { init_codefold(0); });
static IReadOnlyCollection< string > GetIrcChannelSplits(ChatChannel chatChannel)
Split a given chatChannel 's ChatChannel.IrcChannel.
string? IrcChannel
The IRC channel name.
- +
diff --git a/_chat_controller_8cs_source.html b/_chat_controller_8cs_source.html index ff736af4ca..d3d5a91365 100644 --- a/_chat_controller_8cs_source.html +++ b/_chat_controller_8cs_source.html @@ -505,7 +505,7 @@ $(document).ready(function() { init_codefold(0); }); - + diff --git a/_configuration_8cs_source.html b/_configuration_8cs_source.html index 907648eb46..b93af02b01 100644 --- a/_configuration_8cs_source.html +++ b/_configuration_8cs_source.html @@ -894,7 +894,7 @@ $(document).ready(function() { init_codefold(0); });
EventType
Types of events. Mirror in tgs.dm. Prefer last listed name for script.
Definition EventType.cs:7
- + diff --git a/_configuration_controller_8cs_source.html b/_configuration_controller_8cs_source.html index 3fa3c601bc..dbe3f3f29b 100644 --- a/_configuration_controller_8cs_source.html +++ b/_configuration_controller_8cs_source.html @@ -434,7 +434,7 @@ $(document).ready(function() { init_codefold(0); }); - + diff --git a/_control_panel_controller_8cs_source.html b/_control_panel_controller_8cs_source.html index 5c1695dc7d..3decc6eaec 100644 --- a/_control_panel_controller_8cs_source.html +++ b/_control_panel_controller_8cs_source.html @@ -229,7 +229,7 @@ $(document).ready(function() { init_codefold(0); }); - +