Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
9c0c60ebe7 |
|||
|
0e9f61bd24 |
10 changed files with 69 additions and 4 deletions
19
CHANGELOG.md
19
CHANGELOG.md
|
|
@ -1,5 +1,16 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [1.0.8-rc30] - unstable
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
* Podcast availability from Android
|
||||||
|
* avoid NRE in MailSender on rdv query notifications
|
||||||
|
|
||||||
## [1.0.8-rc29] - unstable
|
## [1.0.8-rc29] - unstable
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
@ -19,6 +30,14 @@
|
||||||
|
|
||||||
* [PostIt] Mise a jour d'Avalonia vers 12.1.4.
|
* [PostIt] Mise a jour d'Avalonia vers 12.1.4.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
* [Yavsc.Api, Yavsc.Server] Une demande de rendez-vous ne provoque plus
|
||||||
|
d'erreur 500 (NullReferenceException dans MailSender) : l'API lie
|
||||||
|
desormais la section Smtp, le modele appsettings-api fournit Site.Owner
|
||||||
|
et Smtp, et un envoi sans configuration mail complete est journalise
|
||||||
|
puis ignore.
|
||||||
|
|
||||||
|
|
||||||
## [1.0.8-rc28] - unstable
|
## [1.0.8-rc28] - unstable
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,17 @@
|
||||||
"https://preprod-blogs.$DOMAIN"
|
"https://preprod-blogs.$DOMAIN"
|
||||||
],
|
],
|
||||||
"Bills": "bills",
|
"Bills": "bills",
|
||||||
"TempDir": "temp"
|
"TempDir": "temp",
|
||||||
|
"Owner": {
|
||||||
|
"Name": "Paul Schneider",
|
||||||
|
"EMail": "paul@pschneider.fr"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Smtp": {
|
||||||
|
"Host": "mercure.pschneider.fr",
|
||||||
|
"Port": 465,
|
||||||
|
"UserName": "paul",
|
||||||
|
"Password": "$SMTP_PASSWORD"
|
||||||
},
|
},
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ using Microsoft.Extensions.DependencyInjection;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Styling;
|
using Avalonia.Styling;
|
||||||
using Yavsc.Api.Client;
|
using Yavsc.Api.Client;
|
||||||
|
using PostIt.Services;
|
||||||
|
|
||||||
[assembly: UsesPermission(Manifest.Permission.AccessFineLocation)]
|
[assembly: UsesPermission(Manifest.Permission.AccessFineLocation)]
|
||||||
[assembly: UsesPermission(Manifest.Permission.AccessCoarseLocation)]
|
[assembly: UsesPermission(Manifest.Permission.AccessCoarseLocation)]
|
||||||
|
|
@ -20,6 +21,7 @@ namespace PostIt.Android
|
||||||
{
|
{
|
||||||
protected Application(nint javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
|
protected Application(nint javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
|
||||||
{
|
{
|
||||||
|
Platform.IsPodcastSupported = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
|
protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,21 @@
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Browser;
|
using Avalonia.Browser;
|
||||||
using PostIt;
|
using PostIt;
|
||||||
|
using PostIt.Services;
|
||||||
|
|
||||||
internal sealed partial class Program
|
internal sealed partial class Program
|
||||||
{
|
{
|
||||||
private static Task Main(string[] args) => BuildAvaloniaApp()
|
private static Task Main(string[] args)
|
||||||
|
{
|
||||||
|
Platform.IsPodcastSupported = false;
|
||||||
|
|
||||||
|
return BuildAvaloniaApp()
|
||||||
.WithInterFont()
|
.WithInterFont()
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
.WithDeveloperTools()
|
.WithDeveloperTools()
|
||||||
#endif
|
#endif
|
||||||
.StartBrowserAppAsync("out");
|
.StartBrowserAppAsync("out");
|
||||||
|
}
|
||||||
|
|
||||||
public static AppBuilder BuildAvaloniaApp()
|
public static AppBuilder BuildAvaloniaApp()
|
||||||
=> AppBuilder.Configure<App>();
|
=> AppBuilder.Configure<App>();
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ sealed class Program
|
||||||
[STAThread]
|
[STAThread]
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
|
Platform.IsPodcastSupported = true;
|
||||||
CLIOptionHandler.HandleArgs(args);
|
CLIOptionHandler.HandleArgs(args);
|
||||||
|
|
||||||
// Short-circuit 2nd-instance launches (OS handing us the
|
// Short-circuit 2nd-instance launches (OS handing us the
|
||||||
|
|
|
||||||
|
|
@ -57,4 +57,6 @@ public static class Platform
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Func<CancellationToken, Task<CurrentLocationResult>> TryGetCurrentLocationAsync { get; set; } =
|
public static Func<CancellationToken, Task<CurrentLocationResult>> TryGetCurrentLocationAsync { get; set; } =
|
||||||
_ => Task.FromResult(CurrentLocationResult.Unavailable());
|
_ => Task.FromResult(CurrentLocationResult.Unavailable());
|
||||||
|
|
||||||
|
public static bool IsPodcastSupported { get; set; } = false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ using PostIt.ViewModels.Chat;
|
||||||
using Yavsc.Abstract.Models.Messaging;
|
using Yavsc.Abstract.Models.Messaging;
|
||||||
using Yavsc.Api.Client;
|
using Yavsc.Api.Client;
|
||||||
|
|
||||||
|
|
||||||
namespace PostIt.ViewModels;
|
namespace PostIt.ViewModels;
|
||||||
|
|
||||||
public class HomePageViewModel : ViewModelBase
|
public class HomePageViewModel : ViewModelBase
|
||||||
|
|
@ -86,7 +87,7 @@ public class HomePageViewModel : ViewModelBase
|
||||||
|
|
||||||
public IAsyncRelayCommand OpenChat { get; }
|
public IAsyncRelayCommand OpenChat { get; }
|
||||||
public IAsyncRelayCommand OpenPodcasts { get; }
|
public IAsyncRelayCommand OpenPodcasts { get; }
|
||||||
public bool SupportsPodcasts => OperatingSystem.IsWindows() || OperatingSystem.IsLinux();
|
public bool SupportsPodcasts => Platform.IsPodcastSupported;
|
||||||
public IAsyncRelayCommand OpenBlogs { get; }
|
public IAsyncRelayCommand OpenBlogs { get; }
|
||||||
public IAsyncRelayCommand OpenProfile { get; }
|
public IAsyncRelayCommand OpenProfile { get; }
|
||||||
public IAsyncRelayCommand OpenPerformerConfiguration { get; }
|
public IAsyncRelayCommand OpenPerformerConfiguration { get; }
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ using Yavsc.Models;
|
||||||
using Yavsc;
|
using Yavsc;
|
||||||
using Yavsc.Server.Helpers;
|
using Yavsc.Server.Helpers;
|
||||||
using Yavsc.Services;
|
using Yavsc.Services;
|
||||||
|
using Yavsc.Settings;
|
||||||
using Yavsc.Server.Hubs;
|
using Yavsc.Server.Hubs;
|
||||||
using Yavsc.Api.Services;
|
using Yavsc.Api.Services;
|
||||||
|
|
||||||
|
|
@ -71,6 +72,7 @@ internal class Program
|
||||||
// Binds the "Site" section (Bills, TempDir, Avatars, …) used by
|
// Binds the "Site" section (Bills, TempDir, Avatars, …) used by
|
||||||
// the document-generation flow and BillingController.
|
// the document-generation flow and BillingController.
|
||||||
services.Configure<SiteSettings>(builder.Configuration.GetSection("Site"));
|
services.Configure<SiteSettings>(builder.Configuration.GetSection("Site"));
|
||||||
|
services.Configure<SmtpSettings>(builder.Configuration.GetSection("Smtp"));
|
||||||
services.AddPodcasts(builder.Configuration);
|
services.AddPodcasts(builder.Configuration);
|
||||||
services.AddInvoicing(builder.Configuration);
|
services.AddInvoicing(builder.Configuration);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,12 @@ namespace Yavsc.Services
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
logger.LogInformation($"SendEmail for {email} : {subject}");
|
logger.LogInformation($"SendEmail for {email} : {subject}");
|
||||||
|
if (string.IsNullOrWhiteSpace(siteSettings?.Owner?.EMail)
|
||||||
|
|| string.IsNullOrWhiteSpace(smtpSettings?.Host))
|
||||||
|
{
|
||||||
|
logger.LogError("Email not sent: mail configuration is incomplete (Site:Owner:EMail and Smtp:Host are required). To={To}, Subject={Subject}", email, subject);
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
MimeMessage msg = new();
|
MimeMessage msg = new();
|
||||||
msg.From.Add(BuildMailboxAddress(siteSettings.Owner.Name, siteSettings.Owner.EMail));
|
msg.From.Add(BuildMailboxAddress(siteSettings.Owner.Name, siteSettings.Owner.EMail));
|
||||||
msg.To.Add(BuildMailboxAddress(name, email));
|
msg.To.Add(BuildMailboxAddress(name, email));
|
||||||
|
|
@ -139,7 +145,7 @@ namespace Yavsc.Services
|
||||||
}
|
}
|
||||||
catch (FormatException ex)
|
catch (FormatException ex)
|
||||||
{
|
{
|
||||||
logger.LogError(ex, "Refusing to send email because the recipient or sender address is malformed. To={To}, From={From}", email, siteSettings.Owner.EMail);
|
logger.LogError(ex, "Refusing to send email because the recipient or sender address is malformed. To={To}, From={From}", email, siteSettings?.Owner?.EMail);
|
||||||
logger.LogError(ex.Message);
|
logger.LogError(ex.Message);
|
||||||
if (ex.InnerException!=null)
|
if (ex.InnerException!=null)
|
||||||
logger.LogError(ex.InnerException.Message);
|
logger.LogError(ex.InnerException.Message);
|
||||||
|
|
|
||||||
|
|
@ -121,6 +121,22 @@ namespace Yavsc.Org.Tests
|
||||||
Assert.Equal(string.Empty, result);
|
Assert.Equal(string.Empty, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task SendEmailAsync_skips_when_owner_is_not_configured()
|
||||||
|
{
|
||||||
|
var factory = new RejectingSmtpClientFactory();
|
||||||
|
var sender = new MailSender(
|
||||||
|
Options.Create(new SiteSettings { Authority = "example.com" }),
|
||||||
|
Options.Create(new SmtpSettings()),
|
||||||
|
NullLoggerFactory.Instance,
|
||||||
|
new TestStringLocalizer(),
|
||||||
|
factory);
|
||||||
|
|
||||||
|
var result = await sender.SendEmailAsync("Alice", "alice@example.com", "Rdv", "hello");
|
||||||
|
|
||||||
|
Assert.Equal(string.Empty, result);
|
||||||
|
}
|
||||||
|
|
||||||
private sealed class RejectingSmtpClientFactory : ISmtpClientFactory
|
private sealed class RejectingSmtpClientFactory : ISmtpClientFactory
|
||||||
{
|
{
|
||||||
public Yavsc.Interfaces.ISmtpClient CreateClient() => new RejectingSmtpClient();
|
public Yavsc.Interfaces.ISmtpClient CreateClient() => new RejectingSmtpClient();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue