-
Notifications
You must be signed in to change notification settings - Fork 10k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove WebView dependency to AspNetCore.App (#31071)
The Blazor Desktop project must not depend on Microsoft.AspNetCore.App because it needs to run on almost any platform, including Android/iOS. But AspNetCore.App doesn't run on those platforms. This changes WebView to not use any packages that are part of AspNetCore.App, such as StaticFiles and Http.Abstractions. Instead, it has copies of those files.
- Loading branch information
Showing
9 changed files
with
1,483 additions
and
4 deletions.
There are no files selected for viewing
473 changes: 473 additions & 0 deletions
473
src/Components/WebView/WebView/src/FileExtensionContentTypeProvider.cs
Large diffs are not rendered by default.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
src/Components/WebView/WebView/src/IContentTypeProvider.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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
// NOTE: This file is copied from src/Middleware/StaticFiles/src/FileExtensionContentTypeProvider.cs | ||
// and made internal with a namespace change. | ||
// It can't be referenced directly from the StaticFiles package because that would cause this package to require | ||
// Microsoft.AspNetCore.App, thus preventing it from being used anywhere ASP.NET Core isn't supported (such as | ||
// various platforms that .NET MAUI runs on, such as Android and iOS). | ||
|
||
using System.Diagnostics.CodeAnalysis; | ||
|
||
namespace Microsoft.AspNetCore.Components.WebView | ||
{ | ||
/// <summary> | ||
/// Used to look up MIME types given a file path | ||
/// </summary> | ||
internal interface IContentTypeProvider | ||
{ | ||
/// <summary> | ||
/// Given a file path, determine the MIME type | ||
/// </summary> | ||
/// <param name="subpath">A file path</param> | ||
/// <param name="contentType">The resulting MIME type</param> | ||
/// <returns>True if MIME type could be determined</returns> | ||
bool TryGetContentType(string subpath, [MaybeNullWhen(false)] out string contentType); | ||
} | ||
} |
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
Oops, something went wrong.