Skip to content

Commit 2a9437f

Browse files
authored
Merge pull request #1 from jcdcdev/dev
0.1.0
2 parents 62f3b4f + f8c2ba8 commit 2a9437f

File tree

97 files changed

+15535
-8758
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+15535
-8758
lines changed

.github/README.md

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,44 @@
11
# Umbraco.Community.DataProtection
22

3-
[![Umbraco Version](https://img.shields.io/badge/Umbraco-10.4+-%233544B1?style=flat&logo=umbraco)](https://umbraco.com/products/umbraco-cms/)
3+
[![Umbraco Version](https://img.shields.io/badge/Umbraco-10.4+-%233544B1?style=flat&logo=umbraco)](https://marketplace.umbraco.com/package/umbraco.community.dataprotection)
44
[![NuGet](https://img.shields.io/nuget/vpre/Umbraco.Community.DataProtection?color=0273B3)](https://www.nuget.org/packages/Umbraco.Community.DataProtection)
5-
[![GitHub license](https://img.shields.io/github/license/jcdcdev/Umbraco.Community.DataProtection?color=8AB803)](../LICENSE)
5+
[![GitHub license](https://img.shields.io/github/license/jcdcdev/Umbraco.Community.DataProtection?color=8AB803)](https://github.com/jcdcdev/Umbraco.Community.DataProtection/blob/main/LICENSE)
66
[![Downloads](https://img.shields.io/nuget/dt/Umbraco.Community.DataProtection?color=cc9900)](https://www.nuget.org/packages/Umbraco.Community.DataProtection/)
77

8+
Simple [ASP.NET Core Data Protection](https://learn.microsoft.com/en-us/aspnet/core/security/data-protection/introduction?view=aspnetcore-8.0) for Umbraco CMS.
9+
10+
Data protection keys are stored in the Umbraco database.
11+
12+
## Quick Start
13+
14+
### Install
15+
16+
```csharp
17+
dotnet add package Umbraco.Community.DataProtection
18+
```
19+
20+
### Configure
21+
22+
```csharp
23+
using Umbraco.Cms.Core.Composing;
24+
using Umbraco.Cms.Core.DependencyInjection;
25+
26+
namespace Project.Web;
27+
28+
public class Composer : IComposer
29+
{
30+
public void Compose(IUmbracoBuilder builder)
31+
{
32+
builder.AddUmbracoDataProtection();
33+
}
34+
}
35+
```
36+
837
## Contributing
938

10-
Contributions to this package are most welcome! Please read the [Contributing Guidelines](CONTRIBUTING.md).
39+
Contributions to this package are most welcome! Please read the [Contributing Guidelines](https://github.com/jcdcdev/Umbraco.Community.DataProtection/blob/main/.github/CONTRIBUTING.md).
1140

1241
## Acknowledgments (thanks!)
1342

1443
- LottePitcher - [opinionated-package-starter](https://github.com/LottePitcher/opinionated-package-starter)
15-
- jcdcdev - [jcdcdev.Umbraco.PackageTemplate](https://github.com/jcdcdev/jcdcdev.Umbraco.PackageTemplate)
44+
- jcdcdev - [jcdcdev.Umbraco.PackageTemplate](https://github.com/jcdcdev/jcdcdev.Umbraco.PackageTemplate)

.github/workflows/build.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,4 @@ jobs:
1212
- metadata
1313
with:
1414
project-name: ${{ needs.metadata.outputs.project-name }}
15-
project-path: ${{ needs.metadata.outputs.project-path }}
16-
npm-working-dir: ${{ needs.metadata.outputs.npm-working-dir }}
17-
npm-enabled: true
15+
project-path: ${{ needs.metadata.outputs.project-path }}

.github/workflows/release.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,14 @@ jobs:
55
metadata:
66
uses: jcdcdev/jcdcdev.Github.UmbracoSimpleDeploy/.github/workflows/generate-project-metadata.yml@main
77
build:
8-
uses: jcdcdev/jcdcdev.Github.UmbracoSimpleDeploy/.github/workflows/build-template.yml@main
9-
needs:
8+
uses: jcdcdev/jcdcdev.Github.UmbracoSimpleDeploy/.github/workflows/build-template.yml@main
9+
needs:
1010
- metadata
1111
with:
1212
project-name: ${{ needs.metadata.outputs.project-name }}
1313
project-path: ${{ needs.metadata.outputs.project-path }}
14-
npm-working-dir: ${{ needs.metadata.outputs.npm-working-dir }}
15-
npm-enabled: true
1614
release:
17-
needs:
15+
needs:
1816
- build
1917
permissions:
2018
contents: write

docs/icon.png

51.7 KB
Loading

src/TestSite.10/Composer.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ public class Composer : IComposer
77
{
88
public void Compose(IUmbracoBuilder builder)
99
{
10+
builder.AddUmbracoDataProtection();
1011
}
1112
}

src/TestSite.10/Program.cs

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
namespace TestSite.Ten
1+
namespace TestSite.Ten;
2+
3+
public class Program
24
{
3-
public class Program
4-
{
5-
public static void Main(string[] args)
6-
=> CreateHostBuilder(args)
7-
.Build()
8-
.Run();
5+
public static void Main(string[] args)
6+
=> CreateHostBuilder(args)
7+
.Build()
8+
.Run();
99

10-
public static IHostBuilder CreateHostBuilder(string[] args) =>
11-
Host.CreateDefaultBuilder(args)
12-
.ConfigureUmbracoDefaults()
13-
.ConfigureWebHostDefaults(webBuilder =>
14-
{
15-
webBuilder.UseStaticWebAssets();
16-
webBuilder.UseStartup<Startup>();
17-
});
18-
}
10+
public static IHostBuilder CreateHostBuilder(string[] args) =>
11+
Host.CreateDefaultBuilder(args)
12+
.ConfigureUmbracoDefaults()
13+
.ConfigureWebHostDefaults(webBuilder =>
14+
{
15+
webBuilder.UseStaticWebAssets();
16+
webBuilder.UseStartup<Startup>();
17+
});
1918
}

src/TestSite.10/Startup.cs

Lines changed: 54 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,64 @@
1-
namespace TestSite.Ten
1+
namespace TestSite.Ten;
2+
3+
public class Startup
24
{
3-
public class Startup
5+
private readonly IConfiguration _config;
6+
private readonly IWebHostEnvironment _env;
7+
8+
/// <summary>
9+
/// Initializes a new instance of the <see cref="Startup" /> class.
10+
/// </summary>
11+
/// <param name="webHostEnvironment">The web hosting environment.</param>
12+
/// <param name="config">The configuration.</param>
13+
/// <remarks>
14+
/// Only a few services are possible to be injected here https://github.com/dotnet/aspnetcore/issues/9337.
15+
/// </remarks>
16+
public Startup(IWebHostEnvironment webHostEnvironment, IConfiguration config)
417
{
5-
private readonly IWebHostEnvironment _env;
6-
private readonly IConfiguration _config;
18+
_env = webHostEnvironment ?? throw new ArgumentNullException(nameof(webHostEnvironment));
19+
_config = config ?? throw new ArgumentNullException(nameof(config));
20+
}
721

8-
/// <summary>
9-
/// Initializes a new instance of the <see cref="Startup" /> class.
10-
/// </summary>
11-
/// <param name="webHostEnvironment">The web hosting environment.</param>
12-
/// <param name="config">The configuration.</param>
13-
/// <remarks>
14-
/// Only a few services are possible to be injected here https://github.com/dotnet/aspnetcore/issues/9337.
15-
/// </remarks>
16-
public Startup(IWebHostEnvironment webHostEnvironment, IConfiguration config)
17-
{
18-
_env = webHostEnvironment ?? throw new ArgumentNullException(nameof(webHostEnvironment));
19-
_config = config ?? throw new ArgumentNullException(nameof(config));
20-
}
22+
/// <summary>
23+
/// Configures the services.
24+
/// </summary>
25+
/// <param name="services">The services.</param>
26+
/// <remarks>
27+
/// This method gets called by the runtime. Use this method to add services to the container.
28+
/// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940.
29+
/// </remarks>
30+
public void ConfigureServices(IServiceCollection services)
31+
{
32+
services.AddUmbraco(_env, _config)
33+
.AddBackOffice()
34+
.AddWebsite()
35+
.AddComposers()
36+
.Build();
37+
}
2138

22-
/// <summary>
23-
/// Configures the services.
24-
/// </summary>
25-
/// <param name="services">The services.</param>
26-
/// <remarks>
27-
/// This method gets called by the runtime. Use this method to add services to the container.
28-
/// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940.
29-
/// </remarks>
30-
public void ConfigureServices(IServiceCollection services)
39+
/// <summary>
40+
/// Configures the application.
41+
/// </summary>
42+
/// <param name="app">The application builder.</param>
43+
/// <param name="env">The web hosting environment.</param>
44+
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
45+
{
46+
if (env.IsDevelopment())
3147
{
32-
services.AddUmbraco(_env, _config)
33-
.AddBackOffice()
34-
.AddWebsite()
35-
.AddComposers()
36-
.Build();
48+
app.UseDeveloperExceptionPage();
3749
}
3850

39-
/// <summary>
40-
/// Configures the application.
41-
/// </summary>
42-
/// <param name="app">The application builder.</param>
43-
/// <param name="env">The web hosting environment.</param>
44-
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
45-
{
46-
if (env.IsDevelopment())
51+
app.UseUmbraco()
52+
.WithMiddleware(u =>
4753
{
48-
app.UseDeveloperExceptionPage();
49-
}
50-
51-
app.UseUmbraco()
52-
.WithMiddleware(u =>
53-
{
54-
u.UseBackOffice();
55-
u.UseWebsite();
56-
})
57-
.WithEndpoints(u =>
58-
{
59-
u.UseInstallerEndpoints();
60-
u.UseBackOfficeEndpoints();
61-
u.UseWebsiteEndpoints();
62-
});
63-
}
54+
u.UseBackOffice();
55+
u.UseWebsite();
56+
})
57+
.WithEndpoints(u =>
58+
{
59+
u.UseInstallerEndpoints();
60+
u.UseBackOfficeEndpoints();
61+
u.UseWebsiteEndpoints();
62+
});
6463
}
6564
}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
@using Umbraco.Extensions
2-
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.BlockGridItem>
1+
@inherits UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.BlockGridItem>
32

43
<h2 style="padding: 20px">@Model.Content.Value("headline")</h2>
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
@using Umbraco.Extensions
2-
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.BlockGridItem>
1+
@using Umbraco.Cms.Core.Models
2+
@inherits UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.BlockGridItem>
33

44
@{
5-
var typedMediaPickerSingle = Model.Content.Value<Umbraco.Cms.Core.Models.MediaWithCrops>("image");
5+
var typedMediaPickerSingle = Model.Content.Value<MediaWithCrops>("image");
66
if (typedMediaPickerSingle != null)
77
{
88
<img src="@typedMediaPickerSingle.MediaUrl()" style="object-fit:cover; width:100%; height:100%;"/>
9-
} else {
9+
}
10+
else
11+
{
1012
<p>Missing image</p>
1113
}
1214
}
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
@using Umbraco.Extensions
2-
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.BlockGridItem>
1+
@inherits UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.BlockGridItem>
32

43
<div style="padding: 20px">
5-
@Model.Content.Value("richText")
4+
@Model.Content.Value("richText")
65
</div>

0 commit comments

Comments
 (0)