Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSOE-91: Normalize line endings to auto across all submodules #134

Merged
merged 6 commits into from
Apr 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* -crlf
* text=auto
24 changes: 12 additions & 12 deletions .github/workflows/publish.yml
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 }}
20 changes: 11 additions & 9 deletions .gitignore
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
28 changes: 14 additions & 14 deletions License.md
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.
22 changes: 11 additions & 11 deletions Lombiq.HelpfulLibraries.AspNetCore/Docs/Extensions.md
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.
16 changes: 8 additions & 8 deletions Lombiq.HelpfulLibraries.AspNetCore/Docs/Localization.md
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.
24 changes: 12 additions & 12 deletions Lombiq.HelpfulLibraries.AspNetCore/Docs/Middlewares.md
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.
20 changes: 10 additions & 10 deletions Lombiq.HelpfulLibraries.AspNetCore/Docs/Mvc.md
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.
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);
}
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;
}
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();
}
Loading