deploying the blogs

This commit is contained in:
Paul Schneider 2026-06-19 23:09:43 +01:00
commit 86c268eebd
9 changed files with 52 additions and 54 deletions

View file

@ -16,10 +16,15 @@ insert_final_newline = true
charset = utf-8 charset = utf-8
# 4 space indentation # 4 space indentation
[*.py] [*.py,*.xml,*.csproj]
indent_style = space indent_style = space
indent_size = 4 indent_size = 4
# 2 space indentation
[*.xml,*.csproj,*.axaml]
indent_style = space
indent_size = 2
# Tab indentation (no size specified) # Tab indentation (no size specified)
[Makefile] [Makefile]
indent_style = tab indent_style = tab

View file

@ -74,6 +74,7 @@ install: build_publish copy-binaries copy-services
done done
reinstall: copy-binaries reinstall: copy-binaries
@sync
@for project in $(APP_PROJECT_NAMES); do \ @for project in $(APP_PROJECT_NAMES); do \
sudo systemctl start yavsc$${project} ; done sudo systemctl start yavsc$${project} ; done

View file

@ -1,16 +1,16 @@
<ContentPage xmlns="https://github.com/avaloniaui" <ContentPage xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="PostIt.Views.HomePage" x:Class="PostIt.Views.HomePage"
Header="Home"> Header="Home">
<StackPanel HorizontalAlignment="Center" <StackPanel HorizontalAlignment="Center"
VerticalAlignment="Center" VerticalAlignment="Center"
Spacing="12"> Spacing="12">
<TextBlock Text="Welcome to the Home Page" <TextBlock Text="Welcome to the Home Page"
FontSize="22" FontSize="22"
FontWeight="SemiBold" FontWeight="SemiBold"
HorizontalAlignment="Center"/> HorizontalAlignment="Center"/>
<Button Content="Login" <Button Content="Login"
Click="OnLoginClick" Click="OnLoginClick"
HorizontalAlignment="Center"/> HorizontalAlignment="Center"/>
</StackPanel> </StackPanel>
</ContentPage> </ContentPage>

View file

@ -61,7 +61,7 @@ internal class Program
{ {
policy policy
.RequireAuthenticatedUser() .RequireAuthenticatedUser()
.RequireClaim(JwtClaimTypes.Scope, new string[] { "com" }); .RequireClaim(JwtClaimTypes.Scope, new string[] { "api" });
}); });
}) })
.AddYavscCors(builder.Configuration) .AddYavscCors(builder.Configuration)

View file

@ -18,6 +18,7 @@ using Yavsc.Interface;
using Yavsc.Models; using Yavsc.Models;
using Yavsc.Services; using Yavsc.Services;
using Yavsc.Server.Helpers; using Yavsc.Server.Helpers;
using Microsoft.AspNetCore.Identity;
namespace Yavsc.Blogs; namespace Yavsc.Blogs;
internal class Program internal class Program
@ -32,52 +33,48 @@ internal class Program
var services = builder.Services; var services = builder.Services;
// builder.Services.AddDistributedMemoryCache(); // MvcBuilder
builder.Services
// accepts any access token issued by identity server
// adds an authorization policy for scope 'scope1'
services
.AddAuthorization(options => .AddAuthorization(options =>
{ {
options.AddPolicy("BlogScope", policy => options.AddPolicy("BlogScope", policy =>
{ {
policy policy
.RequireAuthenticatedUser() .RequireAuthenticatedUser()
.RequireClaim(JwtClaimTypes.Scope, new string[] { "blogs" }); .RequireClaim(JwtClaimTypes.Scope, new string[] { "blog" });
}); });
}) })
.AddYavscCors(builder.Configuration) .AddYavscCors(builder.Configuration)
.AddControllers(); .AddControllers();
// accepts any access token issued by identity server // AuthenticationBuilder
services.AddAuthentication("Bearer") services.AddAuthentication("Bearer")
.AddYavscJwtBearer(builder.Configuration); .AddYavscJwtBearer(builder.Configuration);
// DbContextBuilder
services.AddDbContext<ApplicationDbContext>(options => services.AddDbContext<ApplicationDbContext>(options =>
options.UseNpgsql(builder.Configuration.GetConnectionString(YavscConstants.YavscConnectionStringName))); options.UseNpgsql(builder.Configuration.GetConnectionString(YavscConstants.YavscConnectionStringName)));
services.AddTransient<ITrueEmailSender, MailSender>() // other services
.AddTransient<IBillingService, BillingService>() services
.AddTransient<ICalendarManager, CalendarManager>(); .AddTransient<ITrueEmailSender, MailSender>()
services.AddTransient<IFileSystemAuthManager, FileSystemAuthManager>(); .AddTransient<IEmailSender<ApplicationUser>, MailSender>()
services.AddTransient<BlogSpotService>(); .AddTransient<IBillingService, BillingService>()
services.AddScoped<IAuthorizationHandler, PermissionHandler>(); .AddTransient<ICalendarManager, CalendarManager>()
.AddTransient<IFileSystemAuthManager, FileSystemAuthManager>()
services.AddLocalization(options => .AddTransient<BlogSpotService>()
.AddScoped<IAuthorizationHandler, PermissionHandler>()
.AddLocalization(options =>
{ {
options.ResourcesPath = "Resources"; options.ResourcesPath = "Resources";
}); })
services.AddDistributedMemoryCache(); .AddDistributedMemoryCache()
.AddSession(options =>
services.AddSession(options =>
{ {
options.IdleTimeout = TimeSpan.FromMinutes(30); options.IdleTimeout = TimeSpan.FromMinutes(30);
options.Cookie.HttpOnly = true; options.Cookie.HttpOnly = true;
options.Cookie.IsEssential = false; options.Cookie.IsEssential = false;
}); }).Configure<RequestLocalizationOptions>(options =>
services.Configure<RequestLocalizationOptions>(options =>
{ {
var supportedCultures = new[] { "fr", "en", "pt" }; var supportedCultures = new[] { "fr", "en", "pt" };
options.SetDefaultCulture(supportedCultures[0]) options.SetDefaultCulture(supportedCultures[0])
@ -85,9 +82,9 @@ internal class Program
.AddSupportedUICultures(supportedCultures); .AddSupportedUICultures(supportedCultures);
}); });
// App startup
using (var app = builder.Build()) using (var app = builder.Build())
{ {
if (app.Environment.IsDevelopment()) if (app.Environment.IsDevelopment())
app.UseDeveloperExceptionPage(); app.UseDeveloperExceptionPage();
@ -103,7 +100,7 @@ internal class Program
new JsonResult(context?.User?.Claims.Select(c => new { c.Type, c.Value })) new JsonResult(context?.User?.Claims.Select(c => new { c.Type, c.Value }))
); );
// app.UseSession(); app.UseSession();
await app.RunAsync(); await app.RunAsync();
} }
} }

View file

@ -6,7 +6,7 @@
<ItemGroup> <ItemGroup>
<PackageVersion Include="AsciiDocSharp" Version="0.2.0" /> <PackageVersion Include="AsciiDocSharp" Version="0.2.0" />
<PackageVersion Include="AsciiDocSharp.Converters.Html" Version="0.2.0" /> <PackageVersion Include="AsciiDocSharp.Converters.Html" Version="0.2.0" />
<PackageVersion Include="Google.Apis.Compute.v1" Version="1.75.0.4167" /> <PackageVersion Include="Google.Apis.Compute.v1" Version="1.74.0.4138" />
<PackageVersion Include="HigginsSoft.IdentityServer8.AspNetIdentity" Version="8.0.5-preview-net9" /> <PackageVersion Include="HigginsSoft.IdentityServer8.AspNetIdentity" Version="8.0.5-preview-net9" />
<PackageVersion Include="HigginsSoft.IdentityServer8.EntityFramework.Storage" Version="8.0.5-preview-net9" /> <PackageVersion Include="HigginsSoft.IdentityServer8.EntityFramework.Storage" Version="8.0.5-preview-net9" />
<PackageVersion Include="HigginsSoft.IdentityServer8.Security" Version="8.0.5-preview-net9" /> <PackageVersion Include="HigginsSoft.IdentityServer8.Security" Version="8.0.5-preview-net9" />
@ -17,7 +17,7 @@
<PackageVersion Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="10.0.9" /> <PackageVersion Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="10.0.9" />
<PackageVersion Include="Microsoft.AspNetCore.SignalR" Version="1.2.11" /> <PackageVersion Include="Microsoft.AspNetCore.SignalR" Version="1.2.11" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Tools" Version="10.0.9" /> <PackageVersion Include="Microsoft.EntityFrameworkCore.Tools" Version="10.0.9" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="10.2.1" /> <PackageVersion Include="Swashbuckle.AspNetCore" Version="10.2.2" />
<PackageVersion Include="System.Security.Cryptography.Pkcs" Version="10.0.9" /> <PackageVersion Include="System.Security.Cryptography.Pkcs" Version="10.0.9" />
<PackageVersion Include="YamlDotNet" Version="18.0.0" /> <PackageVersion Include="YamlDotNet" Version="18.0.0" />
</ItemGroup> </ItemGroup>

View file

@ -18,10 +18,7 @@
// //
// You should have received a copy of the GNU Lesser General Public License // You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Google.Apis.Auth.OAuth2; using Google.Apis.Auth.OAuth2;
@ -32,7 +29,6 @@ using Google.Apis.Util.Store;
using Google.Apis.Auth.OAuth2.Responses; using Google.Apis.Auth.OAuth2.Responses;
using Google.Apis.Util; using Google.Apis.Util;
using Yavsc.Models; using Yavsc.Models;
using Yavsc.Models.Calendar;
using Yavsc.Services; using Yavsc.Services;
using Yavsc.Server.Helpers; using Yavsc.Server.Helpers;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;

View file

@ -19,7 +19,6 @@
// You should have received a copy of the GNU Lesser General Public License // You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using Google.Apis.Calendar.v3.Data; using Google.Apis.Calendar.v3.Data;
namespace Yavsc.Services namespace Yavsc.Services