Skip to content

Commit

Permalink
Merge branch 'support/13.x' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
ronaldbarendse committed Oct 7, 2024
2 parents 6e2153f + b39b180 commit 6974d3c
Show file tree
Hide file tree
Showing 28 changed files with 259 additions and 532 deletions.
10 changes: 5 additions & 5 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<GlobalPackageReference Include="Nerdbank.GitVersioning" Version="3.6.133" />
<GlobalPackageReference Include="Nerdbank.GitVersioning" Version="3.6.143" />
<GlobalPackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
<GlobalPackageReference Include="Umbraco.Code" Version="2.1.0" />
<GlobalPackageReference Include="Umbraco.Code" Version="2.2.0" />
<GlobalPackageReference Include="Umbraco.GitVersioning.Extensions" Version="0.2.0" />
</ItemGroup>
<PropertyGroup>
<UmbracoCmsPackageVersion>[14.0.0, 15)</UmbracoCmsPackageVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Azure.Storage.Blobs" Version="12.20.0" />
<PackageVersion Include="SixLabors.ImageSharp.Web.Providers.Azure" Version="3.1.2" />
<PackageVersion Include="Azure.Storage.Blobs" Version="12.22.1" />
<PackageVersion Include="SixLabors.ImageSharp.Web.Providers.Azure" Version="3.1.3" />
<PackageVersion Include="Umbraco.Cms.Imaging.ImageSharp" Version="$(UmbracoCmsPackageVersion)" />
<PackageVersion Include="Umbraco.Cms.Web.Common" Version="$(UmbracoCmsPackageVersion)" />
</ItemGroup>
</Project>
</Project>
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ This repository contains Umbraco storage providers that can replace the default

> **Note**
> Use the following documentation for previous Umbraco CMS versions:
> * [Umbraco CMS 13 - v13](https://github.com/umbraco/Umbraco.StorageProviders/blob/support/13.0.x/README.md)
> * [Umbraco CMS 13 - v13](https://github.com/umbraco/Umbraco.StorageProviders/blob/support/13.x/README.md)
> * [Umbraco CMS 12 - v12](https://github.com/umbraco/Umbraco.StorageProviders/blob/support/12.0.x/README.md)
> * [Umbraco CMS 11 - v11](https://github.com/umbraco/Umbraco.StorageProviders/blob/support/11.0.x/README.md)
> * [Umbraco CMS 10 - v10](https://github.com/umbraco/Umbraco.StorageProviders/blob/support/10.0.x/README.md)
Expand Down Expand Up @@ -108,6 +108,36 @@ UMBRACO__STORAGE__AZUREBLOB__MEDIA__CONTAINERNAME=sample-container
> **Note**
> You still have to add the provider in the `Program.cs` file when not configuring the options in code.
### Custom blob container options
To override the default blob container options, you can use the following extension methods on `AzureBlobFileSystemOptions`:
```csharp
// Add using default options (overly verbose, but shows how to revert back to the default)
.AddAzureBlobMediaFileSystem(options => options.CreateBlobContainerClientUsingDefault())
// Add using options
.AddAzureBlobMediaFileSystem(options => options.CreateBlobContainerClientUsingOptions(_blobClientOptions))
// If the connection string is parsed to a URI, use the delegate to create a BlobContainerClient
.AddAzureBlobMediaFileSystem(options => options.TryCreateBlobContainerClientUsingUri(uri => new BlobContainerClient(uri, _blobClientOptions)))
```

This can also be used together with the `Azure.Identity` package to authenticate with Azure AD (using managed identities):
```csharp
using Azure.Identity;
using Azure.Storage.Blobs;
using Umbraco.Cms.Core.Composing;
using Umbraco.StorageProviders.AzureBlob.IO;

internal sealed class AzureBlobFileSystemComposer : IComposer
{
public void Compose(IUmbracoBuilder builder)
=> builder.AddAzureBlobMediaFileSystem(options =>
{
options.ConnectionString = "https://[storage-account].blob.core.windows.net";
options.ContainerName = "media";
options.TryCreateBlobContainerClientUsingUri(uri => new BlobContainerClient(uri, new DefaultAzureCredential()));
});
}
```

## Umbraco.StorageProviders.AzureBlob.ImageSharp
Adds ImageSharp support for storing the image cache to a pre-configured Azure Blob Storage provider.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using Azure.Core;
using Azure.Storage.Blobs;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.Events;
Expand All @@ -8,10 +10,25 @@ namespace Umbraco.StorageProviders.AzureBlob.TestSite;

internal sealed class AzureBlobFileSystemComposer : IComposer
{
private static readonly BlobClientOptions _blobClientOptions = new BlobClientOptions
{
Retry = {
Mode = RetryMode.Exponential,
MaxRetries = 3
}
};

public void Compose(IUmbracoBuilder builder)
=> builder
.AddAzureBlobMediaFileSystem()
// Add using default options (overly verbose, but shows how to revert back to the default)
.AddAzureBlobMediaFileSystem(options => options.CreateBlobContainerClientUsingDefault())
// Add using options
.AddAzureBlobMediaFileSystem(options => options.CreateBlobContainerClientUsingOptions(_blobClientOptions))
// If the connection string is parsed to a URI, use the delegate to create a BlobContainerClient
.AddAzureBlobMediaFileSystem(options => options.TryCreateBlobContainerClientUsingUri(uri => new BlobContainerClient(uri, _blobClientOptions)))
// Add the ImageSharp IImageCache implementation using the default media file system and "cache" container root path
.AddAzureBlobImageSharpCache()
// Add notification handler to create the media file system on install if it doesn't exist
.AddNotificationHandler<UnattendedInstallNotification, AzureBlobMediaFileSystemCreateIfNotExistsHandler>();

private sealed class AzureBlobMediaFileSystemCreateIfNotExistsHandler : INotificationHandler<UnattendedInstallNotification>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Umbraco.Cms" Version="14.1.2" />
<!--<PackageReference Include="Umbraco.TheStarterKit" Version="13.0.0" />-->
<PackageReference Include="Umbraco.Cms" Version="14.3.1" />
<PackageReference Include="Umbraco.TheStarterKit" Version="14.0.0" />
</ItemGroup>

<Import Project="..\..\src\Umbraco.StorageProviders\buildTransitive\Umbraco.StorageProviders.props" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,8 @@
<section class="section">

<div class="container">
@await Umbraco.RenderMacroAsync("latestBlogposts",
new
{
numberOfPosts = Model.HowManyPostsShouldBeShown,
startNodeId = Model.Id
})
@await Component.InvokeAsync("LatestBlogPosts",
new { numberOfPosts = Model.HowManyPostsShouldBeShown, startNodeKey = Model.Key })
</div>

</section>
</section>

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
@using Umbraco.Cms.Core.Models.PublishedContent
@using Umbraco.Extensions
@model Umbraco.SampleSite.Models.LatestBlogPostsViewModel;

<div class="blogposts">
@foreach (IPublishedContent post in Model.BlogPosts)
{
<a href="@post.Url()" class="blogpost">
<div class="blogpost-meta">
<small class="blogpost-date">@post.CreateDate.ToShortDateString()</small>
<small class="blogpost-cat">
@await Html.PartialAsync("~/Views/Partials/CategoryLinks.cshtml", post.Value<IEnumerable<string>>("categories"))
</small>
</div>
<h3 class="blogpost-title">@post.Value("pageTitle")</h3>
<div class="blogpost-excerpt">@post.Value("excerpt")</div>
</a>
}

@if (Model.BlogPosts.Count() < Model.Total)
{
<div class="pagination">
<nav class="nav-bar nav-bar--center">
@if (Model.Page <= 1)
{
<span class="nav-link nav-link--black nav-link--disabled">Prev</span>
}
else
{
<a class="nav-link nav-link--black" href="@(Model.Url + "?page=" + (Model.Page - 1))">Prev</a>
}

@for (int i = 1; i <= Model.PageCount; i++)
{
<a class="nav-link nav-link--black @(Model.Page == i ? " nav-link--active" : null)" href="@(Model.Url + "?page=" + i)">@i</a>
}
@if (Model.Page == Model.PageCount)
{
<span class="nav-link nav-link--black nav-link--disabled">Next</span>
}
else
{
<a class="nav-link nav-link--black" href="@(Model.Url + "?page=" + (Model.Page + 1))">Next</a>
}

</nav>
</div>
}
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="blogposts">
<h1>There are no posts at this time, try again later.</h1>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.BlockGridItem<ContentModels.LatestBlogposts>>;
@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels;

@await Component.InvokeAsync("LatestBlogPosts",
new { numberOfPosts = Model.Content.NumberOfPosts, startNodeKey = Model.Content.StartNode?.Key ?? Guid.Empty })
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.BlockListItem>;
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.BlockListItem<Feature>>;
@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels;
@{
var feature = (Feature)Model.Content;
var feature = Model.Content;
}

<div class="product-advantage">
Expand Down
Loading

0 comments on commit 6974d3c

Please sign in to comment.