De actie krijgt [PublicSiteEndpoint] (en [AllowAnonymous]), zodat een gast op de loginpagina geen 503 meer krijgt; de lijst van publieke acties in de route-table-test en een pipelinetest (CMS in onderhoud) zijn bijgewerkt. Besluit van Bryan: de beschikbaarheidsstatussen blokkeren alleen het CMS, nooit de publieke site. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
44 lines
1.5 KiB
C#
44 lines
1.5 KiB
C#
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.Extensions.Options;
|
|
using SlpModularCms.Core.Availability;
|
|
using SlpModularCms.Core.Email;
|
|
|
|
namespace SlpModularCms.Core.Hosting;
|
|
|
|
/// <summary>
|
|
/// Exposes which optional modules are loaded on this instance, so clients (e.g. the
|
|
/// frontend) can tell a master-only feature apart from an instance without that module
|
|
/// (see the local master/slave dev setup) without guessing from a 404.
|
|
/// </summary>
|
|
[ApiController]
|
|
[Route("[controller]")]
|
|
public class SystemController : ControllerBase
|
|
{
|
|
private readonly ModuleOrchestrator _orchestrator;
|
|
private readonly IMailAvailability _mail;
|
|
private readonly IOptions<AppMailOptions> _app;
|
|
|
|
public SystemController(ModuleOrchestrator orchestrator, IMailAvailability mail, IOptions<AppMailOptions> app)
|
|
{
|
|
_orchestrator = orchestrator;
|
|
_mail = mail;
|
|
_app = app;
|
|
}
|
|
|
|
[HttpGet("capabilities")]
|
|
[AllowAnonymous]
|
|
[PublicSiteEndpoint]
|
|
public IActionResult GetCapabilities()
|
|
{
|
|
// EmailEnabled tells the UI whether mail actions exist on this site; DefaultLanguage is the
|
|
// site's mail language fallback. Neither exposes configuration values beyond that.
|
|
return Ok(new
|
|
{
|
|
Modules = _orchestrator.ModuleNames,
|
|
EmailEnabled = _mail.IsEnabled,
|
|
DefaultLanguage = MailLanguages.Normalize(_app.Value.DefaultLanguage) ?? MailLanguages.Dutch
|
|
});
|
|
}
|
|
}
|