forked from OrchardCMS/OrchardCore
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds asp-append-version support (OrchardCMS#3581)
* MediaFileStoreVersionProvider and FileVersionHashProvider * WIP. Add IFileVersion to ResourceManager and Tag Helpers * WIP Update ResourceManifest and admin layout to use asp-append-version. AppendVersion remains useful on ResourceManifest that also uses Version as when providing debug-src url's are not versioned * create IModuleStaticFileProvider and provide registration identifiers so UseStaticFiles can resolve correct IFileProvider, in case another IFileProvider registered earlier (no conflict with media or custom registration in Cms.Web for example) * WIP. Media ImageHelper working but needs further testing * add ImageVersionProcessor suggest by jtkech. Tested works well * Fixes OrchardCMS#3434 Setting the right resource key in debug mode - added OrchardCMS#8177 / OrchardCMS#8177 from Orchard V1 * add liquid tag helper for append_version * updated LiquidFilter to work via httpContextAccessor to support media within markdown & html body * implement cache / tidy up mediafilter * remove IFileVersionHashProvider, and Replace, rather than remove and add the OC FileVersionProvider * renamed MediaFileImageProvider to MediaResizingFileProvider * add CdnBaseUrl support for prepending a base cdn url to assets * update documentation, and support append-version with AssertUrl Helper * documentation tweaks * more documentation tweaks * add support for tenant static file provider, and change tenant static file provider manifest to once per tenant = false * Add support for IVirtualPathBaseProvider as a better generic filter to provide additional path base information to IFileProviders if required. * Code cleanup * Refactoring * Minor changes. * Refactoring ShellFileVersionProvider * Refactoring, rename ImageTagHelper Attribute asp-append-version * Also use a shared cache for module static files. * Minor change. * Add support for AppendVersion to Link Tag Helper * Little formatting after merging dev.
- Loading branch information
1 parent
51e2f74
commit 4202864
Showing
45 changed files
with
697 additions
and
76 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
1 change: 0 additions & 1 deletion
1
src/OrchardCore.Modules/OrchardCore.Media/Filters/MediaFilters.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,4 +1,3 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using Fluid; | ||
using Fluid.Values; | ||
|
17 changes: 17 additions & 0 deletions
17
src/OrchardCore.Modules/OrchardCore.Media/Processing/ImageVersionProcessor.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,17 @@ | ||
using System.Collections.Generic; | ||
using Microsoft.Extensions.Logging; | ||
using SixLabors.ImageSharp.Web; | ||
using SixLabors.ImageSharp.Web.Processors; | ||
|
||
namespace OrchardCore.Media.Processing | ||
{ | ||
public class ImageVersionProcessor : IImageWebProcessor | ||
{ | ||
private static readonly IEnumerable<string> VersionCommands = new[] { "v" }; | ||
|
||
public IEnumerable<string> Commands => VersionCommands; | ||
|
||
public FormattedImage Process(FormattedImage image, ILogger logger, IDictionary<string, string> commands) | ||
=> image; | ||
} | ||
} |
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
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
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
21 changes: 21 additions & 0 deletions
21
src/OrchardCore.Modules/OrchardCore.Media/Services/MediaFileProvider.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,21 @@ | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.Extensions.FileProviders; | ||
using Microsoft.Extensions.FileProviders.Physical; | ||
|
||
namespace OrchardCore.Media.Services | ||
{ | ||
public class MediaFileProvider : PhysicalFileProvider, IMediaFileProvider | ||
{ | ||
public MediaFileProvider(PathString virtualPathBase, string root) : base(root) | ||
{ | ||
VirtualPathBase = virtualPathBase; | ||
} | ||
|
||
public MediaFileProvider(PathString virtualPathBase, string root, ExclusionFilters filters) : base(root, filters) | ||
{ | ||
VirtualPathBase = virtualPathBase; | ||
} | ||
|
||
public PathString VirtualPathBase { get; } | ||
} | ||
} |
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
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
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.