-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
OSOE-91: Normalize line endings to auto across all submodules
- Loading branch information
Showing
201 changed files
with
7,717 additions
and
7,715 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
* -crlf | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
name: publish | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
call-publish-workflow: | ||
uses: Lombiq/GitHub-Actions/.github/workflows/publish.yml@dev | ||
secrets: | ||
API_KEY: ${{ secrets.DEFAULT_NUGET_PUBLISH_API_KEY }} | ||
name: publish | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
call-publish-workflow: | ||
uses: Lombiq/GitHub-Actions/.github/workflows/publish.yml@dev | ||
secrets: | ||
API_KEY: ${{ secrets.DEFAULT_NUGET_PUBLISH_API_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
.vs/ | ||
obj/ | ||
bin/ | ||
artifacts/ | ||
wwwroot/ | ||
node_modules/ | ||
*.user | ||
.pnpm-debug.log | ||
.editorconfig | ||
.vs/ | ||
.idea/ | ||
.vscode/ | ||
obj/ | ||
bin/ | ||
artifacts/ | ||
wwwroot/ | ||
node_modules/ | ||
*.user | ||
.pnpm-debug.log | ||
.editorconfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
Copyright © 2011, [Lombiq Technologies Ltd.](https://lombiq.com) | ||
|
||
All rights reserved. | ||
|
||
For more information and requests about licensing please [contact us through our website](https://lombiq.com/contact-us). | ||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
||
* Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. | ||
|
||
Copyright © 2011, [Lombiq Technologies Ltd.](https://lombiq.com) | ||
|
||
All rights reserved. | ||
|
||
For more information and requests about licensing please [contact us through our website](https://lombiq.com/contact-us). | ||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
||
* Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
# Lombiq Helpful Libraries - ASP.NET Core Libraries - Extensions | ||
|
||
|
||
|
||
- `CookieHttpContextExtensions`: Provides shortcuts for some cookie-related operations. | ||
- `DateTimeHttpContextExtensions`: Makes it possible to set or get IANA time-zone IDs in the HTTP context. | ||
- `EnvironmentHttpContextExtensions`: Provides shortcuts to determine information about the current hosting environment, like whether the app is running in Development mode. | ||
- `ForwardedHeadersApplicationBuilderExtensions`: Provides `UseForwardedHeadersForCloudflareAndAzure()` that forwards proxied headers onto the current request with settings suitable for an app behind Cloudflare and hosted in an Azure App Service. | ||
- `JsonStringExtensions`: Adds JSON related extensions for the `string` type. (E.g. `JsonHtmlContent` which safely serializes a string for use in `<script>` elements.) | ||
- `NonEmptyTagHelper`: An attribute tag helper that conditionally hides its element if the provided collection is null or empty. This eliminates a bulky wrapping `@if(collection?.Count > 1) { ... }` expression that would needlessly increase the document's indentation too. | ||
- `TemporaryResponseWrapper`: An `IAsyncDisposable` that replaces the `HttpContext`'s response stream at creation with a `MemoryStream` and copies its content back into the real response stream during disposal. | ||
# Lombiq Helpful Libraries - ASP.NET Core Libraries - Extensions | ||
|
||
|
||
|
||
- `CookieHttpContextExtensions`: Provides shortcuts for some cookie-related operations. | ||
- `DateTimeHttpContextExtensions`: Makes it possible to set or get IANA time-zone IDs in the HTTP context. | ||
- `EnvironmentHttpContextExtensions`: Provides shortcuts to determine information about the current hosting environment, like whether the app is running in Development mode. | ||
- `ForwardedHeadersApplicationBuilderExtensions`: Provides `UseForwardedHeadersForCloudflareAndAzure()` that forwards proxied headers onto the current request with settings suitable for an app behind Cloudflare and hosted in an Azure App Service. | ||
- `JsonStringExtensions`: Adds JSON related extensions for the `string` type. (E.g. `JsonHtmlContent` which safely serializes a string for use in `<script>` elements.) | ||
- `NonEmptyTagHelper`: An attribute tag helper that conditionally hides its element if the provided collection is null or empty. This eliminates a bulky wrapping `@if(collection?.Count > 1) { ... }` expression that would needlessly increase the document's indentation too. | ||
- `TemporaryResponseWrapper`: An `IAsyncDisposable` that replaces the `HttpContext`'s response stream at creation with a `MemoryStream` and copies its content back into the real response stream during disposal. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
# Lombiq Helpful Libraries - ASP.NET Core Libraries - Localization | ||
|
||
|
||
|
||
## Extensions | ||
|
||
- `HttpContext` extensions: Adds extension methods to `HttpContext` objects that can be used to fetch localization-specific values such as the current request's UI culture. | ||
- `LocalizedHtmlString` extensions: Adds extension methods to `LocalizedHtmlString` objects to make view localization more convenient. | ||
# Lombiq Helpful Libraries - ASP.NET Core Libraries - Localization | ||
|
||
|
||
|
||
## Extensions | ||
|
||
- `HttpContext` extensions: Adds extension methods to `HttpContext` objects that can be used to fetch localization-specific values such as the current request's UI culture. | ||
- `LocalizedHtmlString` extensions: Adds extension methods to `LocalizedHtmlString` objects to make view localization more convenient. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
# Lombiq Helpful Libraries - ASP.NET Core Libraries - Middlewares | ||
|
||
|
||
Contains ASP.NET Core middlewares and middleware-related services. | ||
|
||
## Deferred Task | ||
|
||
Implement the `IDeferredTask` interface if you want to create a service that executes near the end of the middleware pipeline where all filters and most other middlewares have already finished. You need to register it as a _Scoped_ service. | ||
|
||
Also use the `app.UseDeferredTasks()` extension method to enable the necessary `DeferredTaskMiddleware`. You only have to do that once. | ||
|
||
Note that deferred tasks won't execute on calls that aren't part of the middleware pipeline, such as deployment and setup tasks in Orchard Core. You can use the `IDeferredTask.IsScheduled` property to check if you can expect the deferred task to execute in the current scope. | ||
# Lombiq Helpful Libraries - ASP.NET Core Libraries - Middlewares | ||
|
||
|
||
Contains ASP.NET Core middlewares and middleware-related services. | ||
|
||
## Deferred Task | ||
|
||
Implement the `IDeferredTask` interface if you want to create a service that executes near the end of the middleware pipeline where all filters and most other middlewares have already finished. You need to register it as a _Scoped_ service. | ||
|
||
Also use the `app.UseDeferredTasks()` extension method to enable the necessary `DeferredTaskMiddleware`. You only have to do that once. | ||
|
||
Note that deferred tasks won't execute on calls that aren't part of the middleware pipeline, such as deployment and setup tasks in Orchard Core. You can use the `IDeferredTask.IsScheduled` property to check if you can expect the deferred task to execute in the current scope. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
# Lombiq Helpful Libraries - ASP.NET Core Libraries - MVC | ||
|
||
|
||
|
||
- `ActionResultHelpers`: For returning common specialized `IActionResult`s from `Controller`s, such as `ZipFile`. | ||
- Attributes for controllers: | ||
- `DevelopmentOnlyAttribute`: Enforces the Development environment on controllers. | ||
- `DevelopmentAndLocalhostOnlyAttribute`: Enforces the Development environment as well as localhost. | ||
- `Controller` extensions: Adds extension methods to `Controller` objects like `.RedirectToLocal(redirectUrl)`. | ||
- `ResultExecutingContextExtensions` to get some shortcuts to usual context operations in `IAsyncResultFilter`s. | ||
# Lombiq Helpful Libraries - ASP.NET Core Libraries - MVC | ||
|
||
|
||
|
||
- `ActionResultHelpers`: For returning common specialized `IActionResult`s from `Controller`s, such as `ZipFile`. | ||
- Attributes for controllers: | ||
- `DevelopmentOnlyAttribute`: Enforces the Development environment on controllers. | ||
- `DevelopmentAndLocalhostOnlyAttribute`: Enforces the Development environment as well as localhost. | ||
- `Controller` extensions: Adds extension methods to `Controller` objects like `.RedirectToLocal(redirectUrl)`. | ||
- `ResultExecutingContextExtensions` to get some shortcuts to usual context operations in `IAsyncResultFilter`s. |
46 changes: 23 additions & 23 deletions
46
Lombiq.HelpfulLibraries.AspNetCore/Extensions/CookieHttpContextExtensions .cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
using System; | ||
|
||
namespace Microsoft.AspNetCore.Http; | ||
|
||
public static class CookieHttpContextExtensions | ||
{ | ||
/// <summary> | ||
/// Sets the cookie with the given name with a maximal expiration time. | ||
/// </summary> | ||
public static void SetCookieForever(this HttpContext httpContext, string name, string value) => | ||
httpContext.Response.Cookies.Append(name, value, new CookieOptions | ||
{ | ||
Expires = DateTimeOffset.MaxValue, | ||
Secure = true, | ||
HttpOnly = true, | ||
}); | ||
|
||
/// <summary> | ||
/// Sets the cookie with the given name with a maximal expiration time. | ||
/// </summary> | ||
public static void SetCookieForever(this IHttpContextAccessor httpContextAccessor, string name, string value) => | ||
httpContextAccessor.HttpContext.SetCookieForever(name, value); | ||
} | ||
using System; | ||
|
||
namespace Microsoft.AspNetCore.Http; | ||
|
||
public static class CookieHttpContextExtensions | ||
{ | ||
/// <summary> | ||
/// Sets the cookie with the given name with a maximal expiration time. | ||
/// </summary> | ||
public static void SetCookieForever(this HttpContext httpContext, string name, string value) => | ||
httpContext.Response.Cookies.Append(name, value, new CookieOptions | ||
{ | ||
Expires = DateTimeOffset.MaxValue, | ||
Secure = true, | ||
HttpOnly = true, | ||
}); | ||
|
||
/// <summary> | ||
/// Sets the cookie with the given name with a maximal expiration time. | ||
/// </summary> | ||
public static void SetCookieForever(this IHttpContextAccessor httpContextAccessor, string name, string value) => | ||
httpContextAccessor.HttpContext.SetCookieForever(name, value); | ||
} |
54 changes: 27 additions & 27 deletions
54
Lombiq.HelpfulLibraries.AspNetCore/Extensions/DateTimeHttpContextExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
using Lombiq.HelpfulLibraries.AspNetCore.DateTime; | ||
|
||
namespace Microsoft.AspNetCore.Http; | ||
|
||
public static class DateTimeHttpContextExtensions | ||
{ | ||
/// <summary> | ||
/// Sets the time-zone in the HTTP context. | ||
/// </summary> | ||
/// <param name="timeZoneId">IANA time-zone ID.</param> | ||
public static void SetTimeZoneId(this HttpContext httpContext, string timeZoneId) => | ||
httpContext.Items[HttpContextKeys.TimeZoneIdKey] = timeZoneId; | ||
|
||
/// <summary> | ||
/// Gets the time-zone set in the HTTP context. | ||
/// </summary> | ||
/// <remarks> | ||
/// <para> | ||
/// It returns null if the HTTP context doesn't contain any time-zone data which doesn't mean that no time-zone | ||
/// information is provided by other providers. | ||
/// </para> | ||
/// </remarks> | ||
/// <returns>IANA time-zone ID.</returns> | ||
public static string GetTimeZoneId(this HttpContext httpContext) => | ||
httpContext.Items.ContainsKey(HttpContextKeys.TimeZoneIdKey) ? | ||
(string)httpContext.Items[HttpContextKeys.TimeZoneIdKey] : null; | ||
} | ||
using Lombiq.HelpfulLibraries.AspNetCore.DateTime; | ||
|
||
namespace Microsoft.AspNetCore.Http; | ||
|
||
public static class DateTimeHttpContextExtensions | ||
{ | ||
/// <summary> | ||
/// Sets the time-zone in the HTTP context. | ||
/// </summary> | ||
/// <param name="timeZoneId">IANA time-zone ID.</param> | ||
public static void SetTimeZoneId(this HttpContext httpContext, string timeZoneId) => | ||
httpContext.Items[HttpContextKeys.TimeZoneIdKey] = timeZoneId; | ||
|
||
/// <summary> | ||
/// Gets the time-zone set in the HTTP context. | ||
/// </summary> | ||
/// <remarks> | ||
/// <para> | ||
/// It returns null if the HTTP context doesn't contain any time-zone data which doesn't mean that no time-zone | ||
/// information is provided by other providers. | ||
/// </para> | ||
/// </remarks> | ||
/// <returns>IANA time-zone ID.</returns> | ||
public static string GetTimeZoneId(this HttpContext httpContext) => | ||
httpContext.Items.ContainsKey(HttpContextKeys.TimeZoneIdKey) ? | ||
(string)httpContext.Items[HttpContextKeys.TimeZoneIdKey] : null; | ||
} |
72 changes: 36 additions & 36 deletions
72
Lombiq.HelpfulLibraries.AspNetCore/Extensions/EnvironmentHttpContextExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Hosting; | ||
|
||
namespace Microsoft.AspNetCore.Http; | ||
|
||
public static class EnvironmentHttpContextExtensions | ||
{ | ||
/// <summary> | ||
/// Returns <see langword="true"/> if the current <see cref="IHostEnvironment.EnvironmentName"/> is <see | ||
/// cref="Environments.Development"/>. | ||
/// </summary> | ||
/// <returns> | ||
/// <see langword="true"/> if the current <see cref="IHostEnvironment.EnvironmentName"/> is <see | ||
/// cref="Environments.Development"/>. | ||
/// </returns> | ||
public static bool IsDevelopment(this HttpContext httpContext) => | ||
httpContext.RequestServices.GetRequiredService<IHostEnvironment>().IsDevelopment(); | ||
|
||
/// <summary> | ||
/// Returns <see langword="true"/> if the current host is localhost. | ||
/// </summary> | ||
/// <returns><see langword="true"/> if the current host is localhost.</returns> | ||
public static bool IsLocalhost(this HttpContext httpContext) => | ||
httpContext.Request.Host.Host == "localhost"; | ||
|
||
/// <summary> | ||
/// Returns <see langword="true"/> if the current <see cref="IHostEnvironment.EnvironmentName"/> is <see | ||
/// cref="Environments.Development"/> and the host is localhost. | ||
/// </summary> | ||
/// <returns> | ||
/// <see langword="true"/> if the current <see cref="IHostEnvironment.EnvironmentName"/> is <see | ||
/// cref="Environments.Development"/> and the host is localhost. | ||
/// </returns> | ||
public static bool IsDevelopmentAndLocalhost(this HttpContext httpContext) => | ||
httpContext.IsDevelopment() && httpContext.IsLocalhost(); | ||
} | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Hosting; | ||
|
||
namespace Microsoft.AspNetCore.Http; | ||
|
||
public static class EnvironmentHttpContextExtensions | ||
{ | ||
/// <summary> | ||
/// Returns <see langword="true"/> if the current <see cref="IHostEnvironment.EnvironmentName"/> is <see | ||
/// cref="Environments.Development"/>. | ||
/// </summary> | ||
/// <returns> | ||
/// <see langword="true"/> if the current <see cref="IHostEnvironment.EnvironmentName"/> is <see | ||
/// cref="Environments.Development"/>. | ||
/// </returns> | ||
public static bool IsDevelopment(this HttpContext httpContext) => | ||
httpContext.RequestServices.GetRequiredService<IHostEnvironment>().IsDevelopment(); | ||
|
||
/// <summary> | ||
/// Returns <see langword="true"/> if the current host is localhost. | ||
/// </summary> | ||
/// <returns><see langword="true"/> if the current host is localhost.</returns> | ||
public static bool IsLocalhost(this HttpContext httpContext) => | ||
httpContext.Request.Host.Host == "localhost"; | ||
|
||
/// <summary> | ||
/// Returns <see langword="true"/> if the current <see cref="IHostEnvironment.EnvironmentName"/> is <see | ||
/// cref="Environments.Development"/> and the host is localhost. | ||
/// </summary> | ||
/// <returns> | ||
/// <see langword="true"/> if the current <see cref="IHostEnvironment.EnvironmentName"/> is <see | ||
/// cref="Environments.Development"/> and the host is localhost. | ||
/// </returns> | ||
public static bool IsDevelopmentAndLocalhost(this HttpContext httpContext) => | ||
httpContext.IsDevelopment() && httpContext.IsLocalhost(); | ||
} |
Oops, something went wrong.