feat(i18n): apply saved language to shell and profile
Heimdall Gitea / Build and tests (pull_request) Failing after 7m21s
Heimdall Gitea / Build and scan server image (pull_request) Skipped
Heimdall Gitea / Build and scan agent image (pull_request) Skipped
Heimdall Gitea / Publish Docker Hub latest tags (pull_request) Skipped
Heimdall Gitea / Publish versioned release (pull_request) Skipped
Heimdall Gitea / Build and tests (pull_request) Failing after 7m21s
Heimdall Gitea / Build and scan server image (pull_request) Skipped
Heimdall Gitea / Build and scan agent image (pull_request) Skipped
Heimdall Gitea / Publish Docker Hub latest tags (pull_request) Skipped
Heimdall Gitea / Publish versioned release (pull_request) Skipped
This commit is contained in:
1 parent
199a9c24d9
commit
96af711eac
12 files changed
+1048
-191
No files matched your search
@@ -25,6 +25,10 @@ public class UpdateUserHandler : IRequestHandler<UpdateUserCommand, ServiceResul
|
||||
if (user is null)
|
||||
return ServiceResult<UserResponse>.NotFound("User not found");
|
||||
|
||||
var language = command.Language?.Trim().ToLowerInvariant();
|
||||
if (language is not null && language is not ("fr" or "en"))
|
||||
return ServiceResult<UserResponse>.Failure("Langue non prise en charge", 400);
|
||||
|
||||
var oldEmail = user.Email;
|
||||
var oldEmailConfirmed = user.EmailConfirmed;
|
||||
var emailChanged = false;
|
||||
@@ -49,7 +53,7 @@ public class UpdateUserHandler : IRequestHandler<UpdateUserCommand, ServiceResul
|
||||
|
||||
user.DisplayName = command.DisplayName ?? user.DisplayName;
|
||||
user.Theme = command.Theme ?? user.Theme;
|
||||
user.Language = command.Language ?? user.Language;
|
||||
user.Language = language ?? user.Language;
|
||||
|
||||
var result = await _userManager.UpdateAsync(user).ConfigureAwait(false);
|
||||
if (!result.Succeeded)
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
<script src="@Assets["_framework/blazor.web.js"]"></script>
|
||||
<script src="@Assets["_content/MudBlazor/MudBlazor.min.js"]"></script>
|
||||
<script src="@Assets["js/auth.js"]"></script>
|
||||
<script src="@Assets["js/localization.js"]"></script>
|
||||
<script src="@Assets["js/theme.js"]"></script>
|
||||
<script src="@Assets["js/pwa-register.js"]"></script>
|
||||
</body>
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
@inherits LayoutComponentBase
|
||||
@implements IDisposable
|
||||
@inject AuthState Auth
|
||||
@inject NavigationManager Navigation
|
||||
@inject HeimdallApiClient Api
|
||||
@inject HeimdallAuthStateProvider AuthStateProvider
|
||||
@inject UiLanguageService Language
|
||||
@inject UiText Text
|
||||
@inject IJSRuntime JsRuntime
|
||||
@using Heimdall.Web.Theme
|
||||
|
||||
@@ -10,18 +14,18 @@
|
||||
<MudDialogProvider />
|
||||
<MudSnackbarProvider />
|
||||
|
||||
<a href="#main-content" class="skip-link">Aller au contenu principal</a>
|
||||
<a href="#main-content" class="skip-link">@Text["SkipToContent"]</a>
|
||||
|
||||
<MudLayout>
|
||||
<MudAppBar Elevation="1">
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Menu" Color="Color.Inherit" aria-label="Menu"
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Menu" Color="Color.Inherit" aria-label="@Text["Menu"]"
|
||||
@onclick="@(() => _drawerOpen = !_drawerOpen)" />
|
||||
<MudText Typo="Typo.h6" Class="ml-2 d-flex align-center gap-2">
|
||||
<i class="fas fa-eye"></i> Heimdall
|
||||
</MudText>
|
||||
|
||||
@* Global Search *@
|
||||
<MudTextField @bind-Value="_searchQuery" Placeholder="Rechercher..." Variant="Variant.Outlined"
|
||||
<MudTextField @bind-Value="_searchQuery" Placeholder="@Text["Search"]" Variant="Variant.Outlined"
|
||||
Adornment="Adornment.End" AdornmentIcon="@Icons.Material.Filled.Search"
|
||||
OnAdornmentClick="@DoSearch" OnKeyDown="@HandleSearchKey"
|
||||
Class="ml-4" Style="max-width:320px;" Margin="Margin.Dense" />
|
||||
@@ -30,12 +34,12 @@
|
||||
@if (Auth.IsLoggedIn)
|
||||
{
|
||||
<MudIconButton Icon="@(_darkMode ? Icons.Material.Filled.LightMode : Icons.Material.Filled.DarkMode)"
|
||||
Color="Color.Inherit" aria-label="Basculer le thème"
|
||||
Color="Color.Inherit" aria-label="@Text["ToggleTheme"]"
|
||||
OnClick="@ToggleDarkMode" />
|
||||
<NotificationBadge />
|
||||
<MudMenu AnchorOrigin="Origin.BottomRight">
|
||||
<ActivatorContent>
|
||||
<MudIconButton Icon="@Icons.Material.Filled.AccountCircle" Color="Color.Inherit" aria-label="Profil" OnClick="@context.ToggleAsync" />
|
||||
<MudIconButton Icon="@Icons.Material.Filled.AccountCircle" Color="Color.Inherit" aria-label="@Text["Profile"]" OnClick="@context.ToggleAsync" />
|
||||
</ActivatorContent>
|
||||
<ChildContent>
|
||||
<MudMenuItem>
|
||||
@@ -43,10 +47,10 @@
|
||||
<MudText Typo="Typo.body2" Color="Color.Secondary">@Auth.User?.Email</MudText>
|
||||
</MudMenuItem>
|
||||
<MudMenuItem OnClick="@(() => Navigation.NavigateTo("/profile"))">
|
||||
<MudIcon Icon="@Icons.Material.Filled.Person" Size="Size.Small" Class="mr-2" /> Mon profil
|
||||
<MudIcon Icon="@Icons.Material.Filled.Person" Size="Size.Small" Class="mr-2" /> @Text["Profile"]
|
||||
</MudMenuItem>
|
||||
<MudDivider />
|
||||
<MudMenuItem OnClick="@Logout">Déconnexion</MudMenuItem>
|
||||
<MudMenuItem OnClick="@Logout">@Text["Logout"]</MudMenuItem>
|
||||
</ChildContent>
|
||||
</MudMenu>
|
||||
}
|
||||
@@ -57,59 +61,59 @@
|
||||
<MudNavMenu>
|
||||
@if (Auth.IsLoggedIn)
|
||||
{
|
||||
<MudText Typo="Typo.overline" Color="Color.Secondary" Class="px-4 py-2">Navigation</MudText>
|
||||
<MudText Typo="Typo.overline" Color="Color.Secondary" Class="px-4 py-2">@Text["Navigation"]</MudText>
|
||||
|
||||
<MudNavLink Href="/dashboard" Match="NavLinkMatch.Prefix" Icon="@Icons.Material.Filled.Dashboard">
|
||||
Dashboard
|
||||
@Text["Dashboard"]
|
||||
</MudNavLink>
|
||||
<MudNavLink Href="/sites" Match="NavLinkMatch.Prefix" Icon="@Icons.Material.Filled.Videocam">
|
||||
Sites & Caméras
|
||||
@Text["SitesAndCameras"]
|
||||
</MudNavLink>
|
||||
<MudNavLink Href="/events" Match="NavLinkMatch.Prefix" Icon="@Icons.Material.Filled.Notifications">
|
||||
Événements
|
||||
@Text["Events"]
|
||||
</MudNavLink>
|
||||
<MudNavLink Href="/snapshots" Match="NavLinkMatch.Prefix" Icon="@Icons.Material.Filled.PhotoLibrary">
|
||||
Snapshots
|
||||
@Text["Snapshots"]
|
||||
</MudNavLink>
|
||||
<MudNavLink Href="/persons" Match="NavLinkMatch.Prefix" Icon="@Icons.Material.Filled.People">
|
||||
Personnes
|
||||
@Text["People"]
|
||||
</MudNavLink>
|
||||
|
||||
@if (Auth.HasPermission("Admin.Users") || Auth.HasPermission("Admin.Manage"))
|
||||
{
|
||||
<MudText Typo="Typo.overline" Color="Color.Secondary" Class="px-4 py-2 mt-2">Administration</MudText>
|
||||
<MudText Typo="Typo.overline" Color="Color.Secondary" Class="px-4 py-2 mt-2">@Text["Administration"]</MudText>
|
||||
|
||||
<MudNavGroup Title="Gestion des utilisateurs"
|
||||
<MudNavGroup Title="@Text["UserManagement"]"
|
||||
Icon="@Icons.Material.Filled.People"
|
||||
Expanded="_usersMenuOpen" ExpandedChanged="@(v => _usersMenuOpen = v)">
|
||||
@if (Auth.HasPermission("Admin.Users"))
|
||||
{
|
||||
<MudNavLink Href="/users" Match="NavLinkMatch.Prefix" Icon="@Icons.Material.Filled.Person">
|
||||
Utilisateurs
|
||||
@Text["Users"]
|
||||
</MudNavLink>
|
||||
<MudNavLink Href="/admin/groups" Match="NavLinkMatch.Prefix" Icon="@Icons.Material.Filled.Group">
|
||||
Groupes
|
||||
@Text["Groups"]
|
||||
</MudNavLink>
|
||||
<MudNavLink Href="/admin/roles" Match="NavLinkMatch.Prefix" Icon="@Icons.Material.Filled.ManageAccounts">
|
||||
Rôles & Permissions
|
||||
@Text["RolesAndPermissions"]
|
||||
</MudNavLink>
|
||||
}
|
||||
@if (Auth.HasPermission("Admin.Manage"))
|
||||
{
|
||||
<MudNavLink Href="/admin/claims" Match="NavLinkMatch.Prefix" Icon="@Icons.Material.Filled.Policy">
|
||||
Matrice des permissions
|
||||
@Text["PermissionMatrix"]
|
||||
</MudNavLink>
|
||||
}
|
||||
</MudNavGroup>
|
||||
|
||||
<MudNavLink Href="/admin/agents" Match="NavLinkMatch.Prefix" Icon="@Icons.Material.Filled.Memory">
|
||||
Agents
|
||||
@Text["Agents"]
|
||||
</MudNavLink>
|
||||
<MudNavLink Href="/audit-logs" Match="NavLinkMatch.Prefix" Icon="@Icons.Material.Filled.History">
|
||||
Journal d'audit
|
||||
@Text["AuditLog"]
|
||||
</MudNavLink>
|
||||
<MudNavLink Href="/settings" Match="NavLinkMatch.Prefix" Icon="@Icons.Material.Filled.Settings">
|
||||
Configuration
|
||||
@Text["Settings"]
|
||||
</MudNavLink>
|
||||
}
|
||||
|
||||
@@ -118,7 +122,7 @@
|
||||
else
|
||||
{
|
||||
<MudNavLink Href="/login" Match="NavLinkMatch.Prefix">
|
||||
<MudIcon Icon="@Icons.Material.Filled.Login" /> Connexion
|
||||
<MudIcon Icon="@Icons.Material.Filled.Login" /> @Text["Login"]
|
||||
</MudNavLink>
|
||||
}
|
||||
</MudNavMenu>
|
||||
@@ -143,16 +147,34 @@
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
Language.LanguageChanged += OnLanguageChanged;
|
||||
_usersMenuOpen = Navigation.Uri.Contains("/users", StringComparison.OrdinalIgnoreCase)
|
||||
|| Navigation.Uri.Contains("/admin/groups", StringComparison.OrdinalIgnoreCase)
|
||||
|| Navigation.Uri.Contains("/admin/roles", StringComparison.OrdinalIgnoreCase)
|
||||
|| Navigation.Uri.Contains("/admin/claims", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (!Auth.IsLoggedIn) return;
|
||||
try
|
||||
{
|
||||
var profile = await Api.GetMyProfileAsync();
|
||||
if (profile is not null) Language.SetLanguage(profile.Language);
|
||||
}
|
||||
catch { /* Keep the request culture when the profile endpoint is unavailable. */ }
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
try
|
||||
{
|
||||
await JsRuntime.InvokeVoidAsync("heimdallLocalization.setLanguage", Language.Language);
|
||||
}
|
||||
catch { /* UI localization is still applied by the circuit service. */ }
|
||||
|
||||
try
|
||||
{
|
||||
// Restaure la préférence thème persistée (partagée avec les pages
|
||||
@@ -214,4 +236,8 @@
|
||||
if (e.Key == "Enter")
|
||||
await DoSearch();
|
||||
}
|
||||
|
||||
private void OnLanguageChanged() => _ = InvokeAsync(StateHasChanged);
|
||||
|
||||
public void Dispose() => Language.LanguageChanged -= OnLanguageChanged;
|
||||
}
|
||||
@@ -5,51 +5,53 @@
|
||||
@inject HeimdallApiClient Api
|
||||
@inject AuthState Auth
|
||||
@inject ISnackbar Snackbar
|
||||
@inject UiLanguageService Language
|
||||
@inject UiText Text
|
||||
|
||||
<MudText Typo="Typo.h1" Class="mb-1">
|
||||
Dashboard
|
||||
@Text["Dashboard"]
|
||||
</MudText>
|
||||
<MudText Typo="Typo.body1" Class="mb-2">
|
||||
Bienvenue, <strong>@Auth.User?.DisplayName</strong>
|
||||
@Text["WelcomeUser"], <strong>@Auth.User?.DisplayName</strong>
|
||||
</MudText>
|
||||
<MudText Typo="Typo.body2" Color="Color.Secondary" Class="mb-6">
|
||||
<MudIcon Icon="@Icons.Material.Filled.Update" Size="Size.Small" Class="mr-1" />
|
||||
Dernière mise à jour : @_lastRefresh.ToString("T")
|
||||
@Text["LastUpdated"] @_lastRefresh.ToString("T", Language.Culture)
|
||||
</MudText>
|
||||
|
||||
@* Stats Cards Row — tuiles uniformes (StatTile, hauteur 100%) *@
|
||||
<MudGrid>
|
||||
<MudItem xs="12" sm="6" lg="3" Class="d-flex">
|
||||
<StatTile Label="Caméras"
|
||||
<StatTile Label="@Text["CameraCount"]"
|
||||
Value="@(_stats?.TotalCameras.ToString() ?? "—")"
|
||||
Icon="@Icons.Material.Filled.Videocam"
|
||||
IconColor="Color.Primary"
|
||||
Loading="@_loading">
|
||||
<Footer>
|
||||
<MudText Typo="Typo.caption" Color="Color.Success">@(_stats?.CamerasOnline ?? 0) en ligne</MudText>
|
||||
<MudText Typo="Typo.caption" Color="Color.Error">@(_stats?.CamerasOffline ?? 0) hors ligne</MudText>
|
||||
<MudText Typo="Typo.caption" Color="Color.Success">@(_stats?.CamerasOnline ?? 0) @Text["Online"]</MudText>
|
||||
<MudText Typo="Typo.caption" Color="Color.Error">@(_stats?.CamerasOffline ?? 0) @Text["Offline"]</MudText>
|
||||
</Footer>
|
||||
</StatTile>
|
||||
</MudItem>
|
||||
<MudItem xs="12" sm="6" lg="3" Class="d-flex">
|
||||
<StatTile Label="Agents en ligne"
|
||||
<StatTile Label="@Text["OnlineAgents"]"
|
||||
Value="@(_stats?.OnlineAgents.ToString() ?? "—")"
|
||||
Icon="@Icons.Material.Filled.Memory"
|
||||
IconColor="Color.Success"
|
||||
Loading="@_loading">
|
||||
<Footer>
|
||||
<MudText Typo="Typo.caption" Color="Color.Secondary">@(_stats?.TotalAgents ?? 0) total</MudText>
|
||||
<MudText Typo="Typo.caption" Color="Color.Secondary">@(_stats?.TotalAgents ?? 0) @Text["Total"]</MudText>
|
||||
</Footer>
|
||||
</StatTile>
|
||||
</MudItem>
|
||||
<MudItem xs="12" sm="6" lg="3" Class="d-flex">
|
||||
<StatTile Label="Événements (24h)"
|
||||
<StatTile Label="@Text["Events24h"]"
|
||||
Value="@(_eventCount24h.ToString())"
|
||||
Icon="@Icons.Material.Filled.Notifications"
|
||||
IconColor="Color.Warning"
|
||||
Loading="@_loading">
|
||||
<Footer>
|
||||
<MudLink Href="/events" Typo="Typo.caption">Voir tous →</MudLink>
|
||||
<MudLink Href="/events" Typo="Typo.caption">@Text["ViewAll"] →</MudLink>
|
||||
</Footer>
|
||||
</StatTile>
|
||||
</MudItem>
|
||||
@@ -60,7 +62,7 @@
|
||||
IconColor="Color.Info"
|
||||
Loading="@_loading">
|
||||
<Footer>
|
||||
<MudLink Href="/sites" Typo="Typo.caption">Gérer →</MudLink>
|
||||
<MudLink Href="/sites" Typo="Typo.caption">@Text["Manage"] →</MudLink>
|
||||
</Footer>
|
||||
</StatTile>
|
||||
</MudItem>
|
||||
@@ -70,13 +72,13 @@
|
||||
<MudGrid Class="mt-4">
|
||||
@* Camera Status Breakdown *@
|
||||
<MudItem xs="12" md="6">
|
||||
<SectionCard Title="État des caméras" Icon="@Icons.Material.Filled.Videocam">
|
||||
<SectionCard Title="@Text["CameraStatusSection"]" Icon="@Icons.Material.Filled.Videocam">
|
||||
@if (_cameraStatusData is not null)
|
||||
{
|
||||
<MudTable Items="@_cameraStatusData" Hover="false" Elevation="0">
|
||||
<HeaderContent>
|
||||
<MudTh>Statut</MudTh>
|
||||
<MudTh>Nombre</MudTh>
|
||||
<MudTh>@Text["Status"]</MudTh>
|
||||
<MudTh>@Text["Count"]</MudTh>
|
||||
<MudTh></MudTh>
|
||||
</HeaderContent>
|
||||
<RowTemplate>
|
||||
@@ -98,7 +100,7 @@
|
||||
|
||||
@* Recent Events *@
|
||||
<MudItem xs="12" md="6">
|
||||
<SectionCard Title="Derniers événements" Icon="@Icons.Material.Filled.Notifications">
|
||||
<SectionCard Title="@Text["RecentEvents"]" Icon="@Icons.Material.Filled.Notifications">
|
||||
<ChildContent>
|
||||
@if (_recentEventsLoading)
|
||||
{
|
||||
@@ -109,12 +111,12 @@
|
||||
{
|
||||
<MudTable Items="@_recentEvents" Hover="true" Elevation="0">
|
||||
<HeaderContent>
|
||||
<MudTh>Heure</MudTh>
|
||||
<MudTh>Type</MudTh>
|
||||
<MudTh>Confiance</MudTh>
|
||||
<MudTh>@Text["Time"]</MudTh>
|
||||
<MudTh>@Text["Type"]</MudTh>
|
||||
<MudTh>@Text["Confidence"]</MudTh>
|
||||
</HeaderContent>
|
||||
<RowTemplate>
|
||||
<MudTd><MudText Typo="Typo.body2">@context.OccurredAt.ToLocalTime().ToString("HH:mm")</MudText></MudTd>
|
||||
<MudTd><MudText Typo="Typo.body2">@context.OccurredAt.ToLocalTime().ToString("t", Language.Culture)</MudText></MudTd>
|
||||
<MudTd><MudText Color="@GetEventColor(context.Type)">@FormatEventType(context.Type)</MudText></MudTd>
|
||||
<MudTd><MudText>@($"{context.Confidence:P0}")</MudText></MudTd>
|
||||
</RowTemplate>
|
||||
@@ -122,11 +124,11 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudText Typo="Typo.body2" Color="Color.Secondary">Aucun événement récent.</MudText>
|
||||
<MudText Typo="Typo.body2" Color="Color.Secondary">@Text["NoRecentEvents"]</MudText>
|
||||
}
|
||||
</ChildContent>
|
||||
<Actions>
|
||||
<MudLink Href="/events" Typo="Typo.caption">Voir tout →</MudLink>
|
||||
<MudLink Href="/events" Typo="Typo.caption">@Text["ViewAll"] →</MudLink>
|
||||
</Actions>
|
||||
</SectionCard>
|
||||
</MudItem>
|
||||
@@ -136,7 +138,7 @@
|
||||
<MudGrid Class="mt-4">
|
||||
@* Agent Workload *@
|
||||
<MudItem xs="12" md="6">
|
||||
<SectionCard Title="Charge des agents" Icon="@Icons.Material.Filled.Memory">
|
||||
<SectionCard Title="@Text["AgentLoad"]" Icon="@Icons.Material.Filled.Memory">
|
||||
@if (_agentsLoading)
|
||||
{
|
||||
<MudGrid>
|
||||
@@ -160,24 +162,24 @@
|
||||
</MudItem>
|
||||
}
|
||||
</MudGrid>
|
||||
<MudLink Href="/admin/agents" Typo="Typo.caption" Class="mt-2 d-block">Tous les agents →</MudLink>
|
||||
<MudLink Href="/admin/agents" Typo="Typo.caption" Class="mt-2 d-block">@Text["AllAgents"] →</MudLink>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudText Typo="Typo.body2" Color="Color.Secondary">Aucun agent enregistré.</MudText>
|
||||
<MudText Typo="Typo.body2" Color="Color.Secondary">@Text["NoAgentsRegistered"]</MudText>
|
||||
}
|
||||
</SectionCard>
|
||||
</MudItem>
|
||||
|
||||
@* Quick Actions *@
|
||||
<MudItem xs="12" md="6">
|
||||
<SectionCard Title="Actions rapides" Icon="@Icons.Material.Filled.FlashOn">
|
||||
<SectionCard Title="@Text["QuickActions"]" Icon="@Icons.Material.Filled.FlashOn">
|
||||
<MudGrid>
|
||||
<MudItem xs="6">
|
||||
<MudButton FullWidth="true" Variant="Variant.Outlined" Color="Color.Primary" Href="/events" Class="mb-4" Style="height:80px;">
|
||||
<div class="d-flex flex-column align-center">
|
||||
<MudIcon Icon="@Icons.Material.Filled.Notifications" />
|
||||
<MudText Typo="Typo.body2">Événements</MudText>
|
||||
<MudText Typo="Typo.body2">@Text["Events"]</MudText>
|
||||
</div>
|
||||
</MudButton>
|
||||
</MudItem>
|
||||
@@ -185,7 +187,7 @@
|
||||
<MudButton FullWidth="true" Variant="Variant.Outlined" Color="Color.Secondary" Href="/sites" Class="mb-4" Style="height:80px;">
|
||||
<div class="d-flex flex-column align-center">
|
||||
<MudIcon Icon="@Icons.Material.Filled.Add" />
|
||||
<MudText Typo="Typo.body2">Nouveau site</MudText>
|
||||
<MudText Typo="Typo.body2">@Text["NewSite"]</MudText>
|
||||
</div>
|
||||
</MudButton>
|
||||
</MudItem>
|
||||
@@ -193,7 +195,7 @@
|
||||
<MudButton FullWidth="true" Variant="Variant.Outlined" Color="Color.Warning" Href="/admin/agents" Class="mb-4" Style="height:80px;">
|
||||
<div class="d-flex flex-column align-center">
|
||||
<MudIcon Icon="@Icons.Material.Filled.Memory" />
|
||||
<MudText Typo="Typo.body2">Agents</MudText>
|
||||
<MudText Typo="Typo.body2">@Text["Agents"]</MudText>
|
||||
</div>
|
||||
</MudButton>
|
||||
</MudItem>
|
||||
@@ -201,7 +203,7 @@
|
||||
<MudButton FullWidth="true" Variant="Variant.Outlined" Color="Color.Info" Href="/audit-logs" Class="mb-4" Style="height:80px;">
|
||||
<div class="d-flex flex-column align-center">
|
||||
<MudIcon Icon="@Icons.Material.Filled.History" />
|
||||
<MudText Typo="Typo.body2">Audit</MudText>
|
||||
<MudText Typo="Typo.body2">@Text["Audit"]</MudText>
|
||||
</div>
|
||||
</MudButton>
|
||||
</MudItem>
|
||||
@@ -213,23 +215,23 @@
|
||||
@* Sites Table *@
|
||||
<MudGrid Class="mt-4">
|
||||
<MudItem xs="12">
|
||||
<SectionCard Title="Sites" Icon="@Icons.Material.Filled.Business">
|
||||
<SectionCard Title="@Text["Sites"]" Icon="@Icons.Material.Filled.Business">
|
||||
<ChildContent>
|
||||
@if (_loading) { for (int i = 0; i < 3; i++) { <MudSkeleton Width="100%" Height="40px" Class="mt-1" /> } }
|
||||
else if (_sites?.Count > 0)
|
||||
{
|
||||
<MudTable Items="@_sites" Hover="true" Striped="true" Elevation="0">
|
||||
<HeaderContent>
|
||||
<MudTh>Nom</MudTh>
|
||||
<MudTh>Adresse</MudTh>
|
||||
<MudTh>Statut</MudTh>
|
||||
<MudTh>Créé le</MudTh>
|
||||
<MudTh>@Text["Name"]</MudTh>
|
||||
<MudTh>@Text["Address"]</MudTh>
|
||||
<MudTh>@Text["Status"]</MudTh>
|
||||
<MudTh>@Text["CreatedAt"]</MudTh>
|
||||
</HeaderContent>
|
||||
<RowTemplate>
|
||||
<MudTd><MudLink Href="@($"/sites/{context.Id}")">@context.Name</MudLink></MudTd>
|
||||
<MudTd>@(context.Address ?? "—")</MudTd>
|
||||
<MudTd><MudText Color="@(context.Enabled ? Color.Success : Color.Default)">@(context.Enabled ? "Actif" : "Inactif")</MudText></MudTd>
|
||||
<MudTd>@context.CreatedAt.ToString("g")</MudTd>
|
||||
<MudTd><MudText Color="@(context.Enabled ? Color.Success : Color.Default)">@(context.Enabled ? Text["Active"] : Text["Inactive"])</MudText></MudTd>
|
||||
<MudTd>@context.CreatedAt.ToString("g", Language.Culture)</MudTd>
|
||||
</RowTemplate>
|
||||
</MudTable>
|
||||
}
|
||||
@@ -237,19 +239,19 @@
|
||||
{
|
||||
<div class="pa-8 text-center">
|
||||
<MudIcon Icon="@Icons.Material.Filled.Business" Size="Size.Large" Color="Color.Secondary" />
|
||||
<MudText Typo="Typo.h6" Color="Color.Secondary" Class="mt-4">Aucun site configuré</MudText>
|
||||
<MudText Typo="Typo.h6" Color="Color.Secondary" Class="mt-4">@Text["NoSiteConfigured"]</MudText>
|
||||
<MudText Typo="Typo.body2" Color="Color.Secondary" Class="mb-4">
|
||||
Commencez par créer un site pour déployer vos agents de surveillance.
|
||||
@Text["CreateSitePrompt"]
|
||||
</MudText>
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Primary" Href="/sites">
|
||||
<MudIcon Icon="@Icons.Material.Filled.Add" Class="mr-1" /> Créer un site
|
||||
<MudIcon Icon="@Icons.Material.Filled.Add" Class="mr-1" /> @Text["CreateSite"]
|
||||
</MudButton>
|
||||
</div>
|
||||
}
|
||||
</ChildContent>
|
||||
<Actions>
|
||||
<MudTooltip Text="Rafraîchir">
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Refresh" Size="Size.Small" OnClick="@(async () => await LoadData())" aria-label="Actualiser le tableau de bord" />
|
||||
<MudTooltip Text="@Text["Refresh"]">
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Refresh" Size="Size.Small" OnClick="@(async () => await LoadData())" aria-label="@Text["RefreshDashboard"]" />
|
||||
</MudTooltip>
|
||||
</Actions>
|
||||
</SectionCard>
|
||||
@@ -268,15 +270,9 @@
|
||||
private List<AgentItem>? _agents;
|
||||
private List<CameraStatusEntry>? _cameraStatusData;
|
||||
|
||||
private readonly List<CameraStatusEntry> _defaultCameraStatus =
|
||||
[
|
||||
new("En ligne", 0, Color.Success, 0),
|
||||
new("Hors ligne", 0, Color.Error, 0),
|
||||
new("Désactivée", 0, Color.Default, 0),
|
||||
];
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
Language.LanguageChanged += OnLanguageChanged;
|
||||
await LoadData();
|
||||
}
|
||||
|
||||
@@ -333,16 +329,7 @@
|
||||
// Stats
|
||||
_stats = await Api.GetStatsAsync();
|
||||
if (_stats is not null)
|
||||
{
|
||||
var total = _stats.CamerasOnline + _stats.CamerasOffline + (_stats.TotalCameras - _stats.CamerasOnline - _stats.CamerasOffline);
|
||||
total = total > 0 ? total : 1;
|
||||
_cameraStatusData =
|
||||
[
|
||||
new("En ligne", _stats.CamerasOnline, Color.Success, (int)(_stats.CamerasOnline * 100.0 / total)),
|
||||
new("Hors ligne", _stats.CamerasOffline, Color.Error, (int)(_stats.CamerasOffline * 100.0 / total)),
|
||||
new("Autre", _stats.TotalCameras - _stats.CamerasOnline - _stats.CamerasOffline, Color.Default, (int)((_stats.TotalCameras - _stats.CamerasOnline - _stats.CamerasOffline) * 100.0 / total)),
|
||||
];
|
||||
}
|
||||
UpdateCameraStatusData();
|
||||
|
||||
// Sites
|
||||
var sitesResult = await Api.GetSitesAsync(1, 5);
|
||||
@@ -370,13 +357,13 @@
|
||||
finally { _loading = false; }
|
||||
}
|
||||
|
||||
private static string FormatEventType(string type) => type switch
|
||||
private string FormatEventType(string type) => type switch
|
||||
{
|
||||
"MotionDetected" => "Mouvement",
|
||||
"PersonDetected" => "Personne",
|
||||
"VehicleDetected" => "Véhicule",
|
||||
"FaceRecognized" => "Visage",
|
||||
"CameraOffline" => "Hors ligne",
|
||||
"MotionDetected" => Text["MotionDetected"],
|
||||
"PersonDetected" => Text["PersonDetected"],
|
||||
"VehicleDetected" => Text["VehicleDetected"],
|
||||
"FaceRecognized" => Text["FaceRecognized"],
|
||||
"CameraOffline" => Text["CameraOffline"],
|
||||
_ => type
|
||||
};
|
||||
|
||||
@@ -391,9 +378,30 @@
|
||||
|
||||
private record CameraStatusEntry(string Label, int Count, Color Color, int Percent);
|
||||
|
||||
private void UpdateCameraStatusData()
|
||||
{
|
||||
if (_stats is null) return;
|
||||
|
||||
var other = _stats.TotalCameras - _stats.CamerasOnline - _stats.CamerasOffline;
|
||||
var total = Math.Max(_stats.TotalCameras, 1);
|
||||
_cameraStatusData =
|
||||
[
|
||||
new(Text["Online"], _stats.CamerasOnline, Color.Success, (int)(_stats.CamerasOnline * 100.0 / total)),
|
||||
new(Text["Offline"], _stats.CamerasOffline, Color.Error, (int)(_stats.CamerasOffline * 100.0 / total)),
|
||||
new(Text["Other"], other, Color.Default, (int)(other * 100.0 / total)),
|
||||
];
|
||||
}
|
||||
|
||||
private void OnLanguageChanged()
|
||||
{
|
||||
UpdateCameraStatusData();
|
||||
_ = InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_disposed = true;
|
||||
Language.LanguageChanged -= OnLanguageChanged;
|
||||
_refreshCts?.Cancel();
|
||||
_refreshCts?.Dispose();
|
||||
}
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
@page "/profile"
|
||||
@attribute [Authorize]
|
||||
@layout MainLayout
|
||||
@implements IDisposable
|
||||
@using Enable2faResponse = Heimdall.Application.DTOs.Enable2faResponse
|
||||
@inject HeimdallApiClient Api
|
||||
@inject AuthState Auth
|
||||
@inject UiLanguageService Language
|
||||
@inject UiText Text
|
||||
@inject ISnackbar Snackbar
|
||||
@inject HeimdallAuthStateProvider AuthProvider
|
||||
@inject IJSRuntime JS
|
||||
|
||||
<MudText Typo="Typo.h1" Class="mb-6">
|
||||
<i class="fas fa-user-circle mr-2"></i>
|
||||
Mon profil
|
||||
@Text["Profile"]
|
||||
</MudText>
|
||||
|
||||
@if (_loading)
|
||||
@@ -19,9 +23,9 @@
|
||||
else if (_error)
|
||||
{
|
||||
<MudAlert Severity="Severity.Error" Class="mb-4" Variant="Variant.Filled">
|
||||
<MudText>Erreur lors du chargement du profil.</MudText>
|
||||
<MudText>@Text["ProfileLoadFailed"]</MudText>
|
||||
<MudButton Variant="Variant.Text" Color="Color.Inherit" OnClick="@LoadProfile" Class="mt-2">
|
||||
<MudIcon Icon="@Icons.Material.Filled.Refresh" Class="mr-1" Size="Size.Small" /> Réessayer
|
||||
<MudIcon Icon="@Icons.Material.Filled.Refresh" Class="mr-1" Size="Size.Small" /> @Text["Retry"]
|
||||
</MudButton>
|
||||
</MudAlert>
|
||||
}
|
||||
@@ -31,7 +35,7 @@ else if (_profile is not null)
|
||||
<MudPaper Elevation="2" Class="pa-6 mb-6" Style="border-radius: 12px;">
|
||||
<MudText Typo="Typo.h5" Class="mb-4">
|
||||
<MudIcon Icon="@Icons.Material.Filled.Person" Class="mr-1" Size="Size.Small" />
|
||||
Informations personnelles
|
||||
@Text["PersonalInformation"]
|
||||
</MudText>
|
||||
|
||||
@if (!string.IsNullOrEmpty(_profileError))
|
||||
@@ -40,29 +44,29 @@ else if (_profile is not null)
|
||||
}
|
||||
|
||||
<form @onsubmit="SaveProfile">
|
||||
<MudTextField @bind-Value="_displayName" Label="Nom d'affichage" Variant="Variant.Outlined"
|
||||
<MudTextField @bind-Value="_displayName" Label="@Text["DisplayName"]" Variant="Variant.Outlined"
|
||||
Class="mb-4" Required="true" Immediate="true" />
|
||||
|
||||
<MudText Typo="Typo.body2" Color="Color.Secondary" Class="mb-1">Email</MudText>
|
||||
<MudText Typo="Typo.body2" Color="Color.Secondary" Class="mb-1">@Text["Email"]</MudText>
|
||||
<MudText Typo="Typo.body1" Class="mb-4">@_profile.Email</MudText>
|
||||
|
||||
<MudText Typo="Typo.body2" Class="mb-2">Thème</MudText>
|
||||
<MudSelect @bind-Value="_theme" Label="Thème" Variant="Variant.Outlined" Class="mb-4">
|
||||
<MudSelectItem Value="@("Auto")">Auto</MudSelectItem>
|
||||
<MudSelectItem Value="@("Light")">Light</MudSelectItem>
|
||||
<MudSelectItem Value="@("Dark")">Dark</MudSelectItem>
|
||||
<MudText Typo="Typo.body2" Class="mb-2">@Text["Theme"]</MudText>
|
||||
<MudSelect @bind-Value="_theme" Label="@Text["Theme"]" Variant="Variant.Outlined" Class="mb-4">
|
||||
<MudSelectItem Value="@("Auto")">@Text["Auto"]</MudSelectItem>
|
||||
<MudSelectItem Value="@("Light")">@Text["Light"]</MudSelectItem>
|
||||
<MudSelectItem Value="@("Dark")">@Text["Dark"]</MudSelectItem>
|
||||
</MudSelect>
|
||||
|
||||
<MudText Typo="Typo.body2" Class="mb-2">Langue</MudText>
|
||||
<MudSelect @bind-Value="_language" Label="Langue" Variant="Variant.Outlined" Class="mb-4">
|
||||
<MudSelectItem Value="@("fr")">Français</MudSelectItem>
|
||||
<MudSelectItem Value="@("en")">English</MudSelectItem>
|
||||
<MudText Typo="Typo.body2" Class="mb-2">@Text["Language"]</MudText>
|
||||
<MudSelect @bind-Value="_language" Label="@Text["Language"]" Variant="Variant.Outlined" Class="mb-4">
|
||||
<MudSelectItem Value="@("fr")">@Text["French"]</MudSelectItem>
|
||||
<MudSelectItem Value="@("en")">@Text["English"]</MudSelectItem>
|
||||
</MudSelect>
|
||||
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Primary" ButtonType="ButtonType.Submit"
|
||||
Disabled="@_saving" FullWidth="true">
|
||||
@if (_saving) { <MudProgressCircular Size="Size.Small" Class="mr-1" /> }
|
||||
<MudIcon Icon="@Icons.Material.Filled.Save" Class="mr-1" /> Enregistrer
|
||||
<MudIcon Icon="@Icons.Material.Filled.Save" Class="mr-1" /> @Text["Save"]
|
||||
</MudButton>
|
||||
</form>
|
||||
</MudPaper>
|
||||
@@ -76,30 +80,30 @@ else if (_profile is not null)
|
||||
|
||||
<MudGrid>
|
||||
<MudItem xs="12" sm="6">
|
||||
<MudText Typo="Typo.body2" Color="Color.Secondary">Date d'inscription</MudText>
|
||||
<MudText Typo="Typo.body1" Class="mb-3">@_profile.CreatedAt.ToString("g")</MudText>
|
||||
<MudText Typo="Typo.body2" Color="Color.Secondary">@Text["RegisteredAt"]</MudText>
|
||||
<MudText Typo="Typo.body1" Class="mb-3">@_profile.CreatedAt.ToString("g", Language.Culture)</MudText>
|
||||
</MudItem>
|
||||
<MudItem xs="12" sm="6">
|
||||
<MudText Typo="Typo.body2" Color="Color.Secondary">Email confirmé</MudText>
|
||||
<MudText Typo="Typo.body2" Color="Color.Secondary">@Text["EmailConfirmed"]</MudText>
|
||||
<MudText Typo="Typo.body1" Class="mb-3">
|
||||
<MudIcon Icon="@(_profile.EmailConfirmed ? Icons.Material.Filled.CheckCircle : Icons.Material.Filled.Cancel)"
|
||||
Color="@(_profile.EmailConfirmed ? Color.Success : Color.Default)" Size="Size.Small" />
|
||||
@(_profile.EmailConfirmed ? "Oui" : "Non")
|
||||
@(_profile.EmailConfirmed ? Text["Yes"] : Text["No"])
|
||||
</MudText>
|
||||
</MudItem>
|
||||
<MudItem xs="12" sm="6">
|
||||
<MudText Typo="Typo.body2" Color="Color.Secondary">2FA</MudText>
|
||||
<MudText Typo="Typo.body2" Color="Color.Secondary">@Text["TwoFactor"]</MudText>
|
||||
<MudText Typo="Typo.body1" Class="mb-1">
|
||||
<MudIcon Icon="@(_profile.TwoFactorEnabled ? Icons.Material.Filled.CheckCircle : Icons.Material.Filled.Cancel)"
|
||||
Color="@(_profile.TwoFactorEnabled ? Color.Success : Color.Default)" Size="Size.Small" />
|
||||
@(_profile.TwoFactorEnabled ? "Activé" : "Désactivé")
|
||||
@(_profile.TwoFactorEnabled ? Text["TwoFactorEnabled"] : Text["TwoFactorDisabled"])
|
||||
</MudText>
|
||||
@if (_profile.TwoFactorEnabled)
|
||||
{
|
||||
<MudButton Variant="Variant.Outlined" Color="Color.Error" Size="Size.Small" Class="mt-1"
|
||||
OnClick="Disable2fa" Disabled="@_toggling2fa">
|
||||
@if (_toggling2fa) { <MudProgressCircular Size="Size.Small" Class="mr-1" /> }
|
||||
Désactiver la 2FA
|
||||
@Text["DisableTwoFactor"]
|
||||
</MudButton>
|
||||
}
|
||||
else
|
||||
@@ -107,12 +111,12 @@ else if (_profile is not null)
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Primary" Size="Size.Small" Class="mt-1"
|
||||
OnClick="Enable2fa" Disabled="@_toggling2fa">
|
||||
@if (_toggling2fa) { <MudProgressCircular Size="Size.Small" Class="mr-1" /> }
|
||||
Activer la 2FA
|
||||
@Text["EnableTwoFactor"]
|
||||
</MudButton>
|
||||
}
|
||||
</MudItem>
|
||||
<MudItem xs="12" sm="6">
|
||||
<MudText Typo="Typo.body2" Color="Color.Secondary">Rôles</MudText>
|
||||
<MudText Typo="Typo.body2" Color="Color.Secondary">@Text["Roles"]</MudText>
|
||||
<MudText Typo="Typo.body1" Class="mb-3">
|
||||
@if (_profile.Roles is not null && _profile.Roles.Count > 0)
|
||||
{
|
||||
@@ -126,7 +130,7 @@ else if (_profile is not null)
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudText Typo="Typo.body2" Color="Color.Secondary">Aucun rôle</MudText>
|
||||
<MudText Typo="Typo.body2" Color="Color.Secondary">@Text["NoRoles"]</MudText>
|
||||
}
|
||||
</MudText>
|
||||
</MudItem>
|
||||
@@ -137,7 +141,7 @@ else if (_profile is not null)
|
||||
<MudPaper Elevation="2" Class="pa-6 mb-6" Style="border-radius: 12px;">
|
||||
<MudText Typo="Typo.h5" Class="mb-4">
|
||||
<MudIcon Icon="@Icons.Material.Filled.Lock" Class="mr-1" Size="Size.Small" />
|
||||
Changer le mot de passe
|
||||
@Text["ChangePassword"]
|
||||
</MudText>
|
||||
|
||||
@if (!string.IsNullOrEmpty(_passwordError))
|
||||
@@ -146,21 +150,21 @@ else if (_profile is not null)
|
||||
}
|
||||
|
||||
<form @onsubmit="ChangePassword">
|
||||
<MudTextField @bind-Value="_currentPassword" Label="Mot de passe actuel" Variant="Variant.Outlined"
|
||||
<MudTextField @bind-Value="_currentPassword" Label="@Text["CurrentPassword"]" Variant="Variant.Outlined"
|
||||
InputType="InputType.Password" Class="mb-4" Required="true" Immediate="true"
|
||||
Autocomplete="current-password" />
|
||||
<MudTextField @bind-Value="_newPassword" Label="Nouveau mot de passe" Variant="Variant.Outlined"
|
||||
<MudTextField @bind-Value="_newPassword" Label="@Text["NewPassword"]" Variant="Variant.Outlined"
|
||||
InputType="InputType.Password" Class="mb-4" Required="true" Immediate="true"
|
||||
HelperText="Minimum 12 caractères"
|
||||
HelperText="@Text["PasswordMinimum"]"
|
||||
Autocomplete="new-password" />
|
||||
<MudTextField @bind-Value="_confirmPassword" Label="Confirmer le mot de passe" Variant="Variant.Outlined"
|
||||
<MudTextField @bind-Value="_confirmPassword" Label="@Text["ConfirmPassword"]" Variant="Variant.Outlined"
|
||||
InputType="InputType.Password" Class="mb-4" Required="true" Immediate="true"
|
||||
Autocomplete="new-password" />
|
||||
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Warning" ButtonType="ButtonType.Submit"
|
||||
Disabled="@_changingPassword" FullWidth="true">
|
||||
@if (_changingPassword) { <MudProgressCircular Size="Size.Small" Class="mr-1" /> }
|
||||
<MudIcon Icon="@Icons.Material.Filled.LockReset" Class="mr-1" /> Changer le mot de passe
|
||||
<MudIcon Icon="@Icons.Material.Filled.LockReset" Class="mr-1" /> @Text["ChangePassword"]
|
||||
</MudButton>
|
||||
</form>
|
||||
</MudPaper>
|
||||
@@ -169,7 +173,7 @@ else if (_profile is not null)
|
||||
<MudPaper Elevation="2" Class="pa-6 mb-6" Style="border-radius: 12px;">
|
||||
<MudText Typo="Typo.h5" Class="mb-4">
|
||||
<MudIcon Icon="@Icons.Material.Filled.Notifications" Class="mr-1" Size="Size.Small" />
|
||||
Notifications
|
||||
@Text["Notifications"]
|
||||
</MudText>
|
||||
|
||||
@if (!string.IsNullOrEmpty(_notifError))
|
||||
@@ -179,45 +183,43 @@ else if (_profile is not null)
|
||||
|
||||
<MudAlert Severity="Severity.Info" Class="mb-4" Variant="Variant.Outlined">
|
||||
<MudText Typo="Typo.body2" Class="mb-1">
|
||||
Les notifications push utilisent <strong>ntfy</strong> (serveur auto-hébergé).
|
||||
Installez l'app ntfy et abonnez-vous au topic ci-dessous pour recevoir les notifications.
|
||||
@Text["PushSetupInstructions"]
|
||||
</MudText>
|
||||
<MudText Typo="Typo.body2" Class="mb-1">
|
||||
<strong>Votre topic :</strong> <code>@(!string.IsNullOrWhiteSpace(_ntfyTopic) ? _ntfyTopic : $"heimdall_{_profile?.Id}")</code>
|
||||
<strong>@Text["YourTopic"]</strong> <code>@(!string.IsNullOrWhiteSpace(_ntfyTopic) ? _ntfyTopic : $"heimdall_{_profile?.Id}")</code>
|
||||
</MudText>
|
||||
<MudText Typo="Typo.caption" Color="Color.Secondary">
|
||||
Personnalisez le champ "Topic ntfy" ci-dessous pour utiliser un topic différent.
|
||||
@Text["CustomizeTopic"]
|
||||
</MudText>
|
||||
</MudAlert>
|
||||
|
||||
<MudForm @ref="_notifForm">
|
||||
<MudText Typo="Typo.subtitle2" Class="mb-2 mt-4">Canal Email</MudText>
|
||||
<MudSwitch @bind-Value="_emailEnabled" Label="Notifications par email" Color="Color.Primary" Class="mb-2" />
|
||||
<MudTextField @bind-Value="_emailAddress" Label="Adresse email de notification"
|
||||
<MudText Typo="Typo.subtitle2" Class="mb-2 mt-4">@Text["EmailChannel"]</MudText>
|
||||
<MudSwitch @bind-Value="_emailEnabled" Label="@Text["EmailNotifications"]" Color="Color.Primary" Class="mb-2" />
|
||||
<MudTextField @bind-Value="_emailAddress" Label="@Text["NotificationEmailAddress"]"
|
||||
Variant="Variant.Outlined" Class="mb-4" Disabled="@(!_emailEnabled)"
|
||||
Placeholder="notification@exemple.com" />
|
||||
|
||||
<MudText Typo="Typo.subtitle2" Class="mb-2 mt-4">Canal Push (ntfy)</MudText>
|
||||
<MudSwitch @bind-Value="_ntfyEnabled" Label="Notifications push (ntfy)" Color="Color.Secondary" Class="mb-2" />
|
||||
<MudTextField @bind-Value="_ntfyUrl" Label="URL du serveur ntfy (optionnel)"
|
||||
<MudText Typo="Typo.subtitle2" Class="mb-2 mt-4">@Text["PushChannel"]</MudText>
|
||||
<MudSwitch @bind-Value="_ntfyEnabled" Label="@Text["PushNotifications"]" Color="Color.Secondary" Class="mb-2" />
|
||||
<MudTextField @bind-Value="_ntfyUrl" Label="@Text["NtfyServerUrl"]"
|
||||
Variant="Variant.Outlined" Class="mb-4" Disabled="@(!_ntfyEnabled)"
|
||||
Placeholder="http://ntfy:80 (défaut)" HelperText="Laisser vide pour utiliser le serveur global" />
|
||||
<MudTextField @bind-Value="_ntfyTopic" Label="Topic ntfy (optionnel)"
|
||||
Placeholder="@Text["DefaultNtfyUrl"]" HelperText="@Text["UseGlobalServer"]" />
|
||||
<MudTextField @bind-Value="_ntfyTopic" Label="@Text["NtfyTopicOptional"]"
|
||||
Variant="Variant.Outlined" Class="mb-4" Disabled="@(!_ntfyEnabled)"
|
||||
Placeholder="@($"heimdall_{_profile?.Id}")"
|
||||
HelperText="Personnalisez le topic de réception. Défaut : heimdall_{votre-id}" />
|
||||
HelperText="@Text["CustomizeTopicHelper"]" />
|
||||
|
||||
<MudText Typo="Typo.subtitle2" Class="mb-2 mt-4">Résumés</MudText>
|
||||
<MudSwitch @bind-Value="_dailyDigest" Label="Résumé quotidien (8h)" Color="Color.Tertiary" Class="mb-2" />
|
||||
<MudSwitch @bind-Value="_weeklyDigest" Label="Résumé hebdomadaire (lundi 8h)" Color="Color.Tertiary" Class="mb-4" />
|
||||
<MudText Typo="Typo.subtitle2" Class="mb-2 mt-4">@Text["Summaries"]</MudText>
|
||||
<MudSwitch @bind-Value="_dailyDigest" Label="@Text["DailySummary"]" Color="Color.Tertiary" Class="mb-2" />
|
||||
<MudSwitch @bind-Value="_weeklyDigest" Label="@Text["WeeklySummary"]" Color="Color.Tertiary" Class="mb-4" />
|
||||
|
||||
<MudText Typo="Typo.subtitle2" Class="mb-2 mt-4">Types d'événements</MudText>
|
||||
<MudText Typo="Typo.subtitle2" Class="mb-2 mt-4">@Text["EventTypes"]</MudText>
|
||||
<MudText Typo="Typo.body2" Color="Color.Secondary" Class="mb-2">
|
||||
Sélectionnez les types d'événements pour lesquels vous souhaitez recevoir des notifications push et email.
|
||||
Si aucun n'est sélectionné, tous les événements sont notifiés.
|
||||
@Text["SelectNotificationEventTypes"] @Text["AllEventsIfNone"]
|
||||
</MudText>
|
||||
<MudGrid Class="mb-4">
|
||||
@foreach (var et in _eventTypes)
|
||||
@foreach (var et in EventTypes)
|
||||
{
|
||||
<MudItem xs="12" sm="6">
|
||||
<MudCheckBox T="bool"
|
||||
@@ -233,13 +235,13 @@ else if (_profile is not null)
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="@SaveNotificationConfig"
|
||||
Disabled="@_savingNotif" FullWidth="true">
|
||||
@if (_savingNotif) { <MudProgressCircular Size="Size.Small" Class="mr-1" /> }
|
||||
<MudIcon Icon="@Icons.Material.Filled.Save" Class="mr-1" /> Enregistrer
|
||||
<MudIcon Icon="@Icons.Material.Filled.Save" Class="mr-1" /> @Text["Save"]
|
||||
</MudButton>
|
||||
|
||||
<div class="d-flex align-center mt-3">
|
||||
<MudButton Variant="Variant.Outlined" Color="Color.Info" StartIcon="@Icons.Material.Filled.Send"
|
||||
OnClick="TestNtfyForUserAsync" Disabled="@(_testingNtfy || !_ntfyEnabled)">
|
||||
@(_testingNtfy ? "Test en cours…" : "Tester ntfy")
|
||||
@(_testingNtfy ? Text["TestRunning"] : Text["TestNtfy"])
|
||||
</MudButton>
|
||||
</div>
|
||||
@if (_ntfyTestResult is not null)
|
||||
@@ -258,7 +260,7 @@ else if (_profile is not null)
|
||||
<TitleContent>
|
||||
<MudText Typo="Typo.h6">
|
||||
<MudIcon Icon="@Icons.Material.Filled.Security" Class="mr-1" Size="Size.Small" />
|
||||
Activer la double authentification (2FA)
|
||||
@Text["EnableTwoFactor"]
|
||||
</MudText>
|
||||
</TitleContent>
|
||||
<DialogContent>
|
||||
@@ -270,16 +272,15 @@ else if (_profile is not null)
|
||||
{
|
||||
<MudAlert Severity="Severity.Info" Variant="Variant.Outlined" Class="mb-4">
|
||||
<MudText Typo="Typo.body2" Class="mb-1">
|
||||
Scannez le code QR avec votre application d'authentification (Google Authenticator, Authy…)
|
||||
ou saisissez la clé manuellement.
|
||||
@Text["ScanQrInstructions"]
|
||||
</MudText>
|
||||
<MudText Typo="Typo.body2" Class="mb-1">
|
||||
<strong>Clé :</strong> <code>@_2faSetup.SharedKey</code>
|
||||
<strong>@Text["TwoFactorKey"]</strong> <code>@_2faSetup.SharedKey</code>
|
||||
</MudText>
|
||||
@if (!string.IsNullOrEmpty(_2faSetup.QrCodeUri))
|
||||
{
|
||||
<MudText Typo="Typo.caption" Color="Color.Secondary">
|
||||
Lien de configuration : <a href="@_2faSetup.QrCodeUri" target="_blank">ouvrir dans l'app</a>
|
||||
@Text["SetupLink"] <a href="@_2faSetup.QrCodeUri" target="_blank">@Text["OpenInApp"]</a>
|
||||
</MudText>
|
||||
}
|
||||
</MudAlert>
|
||||
@@ -288,9 +289,8 @@ else if (_profile is not null)
|
||||
{
|
||||
<MudAlert Severity="Severity.Warning" Variant="Variant.Outlined" Class="mb-2">
|
||||
<MudText Typo="Typo.body2" Class="mb-1">
|
||||
<strong>Codes de récupération</strong> — conservez-les précieusement.
|
||||
Ils permettent de vous connecter si vous perdez votre application d'authentification.
|
||||
Chaque code ne peut être utilisé qu'une seule fois.
|
||||
<strong>@Text["RecoveryCodes"]</strong> — @Text["KeepRecoveryCodes"]
|
||||
@Text["RecoveryCodesInstructions"] @Text["RecoveryCodeOneUse"]
|
||||
</MudText>
|
||||
</MudAlert>
|
||||
<MudPaper Elevation="0" Class="pa-3 mb-4" Style="border: 1px dashed #f0ad4e; border-radius: 8px;">
|
||||
@@ -303,12 +303,12 @@ else if (_profile is not null)
|
||||
}
|
||||
</div>
|
||||
</MudPaper>
|
||||
<MudCheckBox T="bool" @bind-Value="_recoveryCodesConfirmed" Label="J'ai sauvegardé mes codes de récupération" Class="mb-2" />
|
||||
<MudCheckBox T="bool" @bind-Value="_recoveryCodesConfirmed" Label="@Text["RecoveryCodesSaved"]" Class="mb-2" />
|
||||
}
|
||||
}
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<MudButton Variant="Variant.Text" OnClick="@(() => _show2faDialog = false)">Fermer</MudButton>
|
||||
<MudButton Variant="Variant.Text" OnClick="@(() => _show2faDialog = false)">@Text["Close"]</MudButton>
|
||||
</DialogActions>
|
||||
</MudDialog>
|
||||
|
||||
@@ -340,6 +340,7 @@ else if (_profile is not null)
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
Language.LanguageChanged += OnLanguageChanged;
|
||||
await LoadProfile();
|
||||
await LoadNotificationConfig();
|
||||
}
|
||||
@@ -356,12 +357,13 @@ else if (_profile is not null)
|
||||
_profile = result;
|
||||
_displayName = result.DisplayName;
|
||||
_theme = result.Theme ?? "Auto";
|
||||
_language = result.Language;
|
||||
_language = UiLanguageService.Normalize(result.Language);
|
||||
Language.SetLanguage(_language);
|
||||
}
|
||||
}
|
||||
catch {
|
||||
_error = true;
|
||||
Snackbar.Add(UiErrors.OperationFailed(), Severity.Error);
|
||||
Snackbar.Add(Text["OperationFailed"], Severity.Error);
|
||||
}
|
||||
finally { _loading = false; }
|
||||
}
|
||||
@@ -372,7 +374,7 @@ else if (_profile is not null)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(_displayName))
|
||||
{
|
||||
_profileError = "Le nom d'affichage est requis";
|
||||
_profileError = Text["DisplayNameRequired"];
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -383,15 +385,19 @@ else if (_profile is not null)
|
||||
var success = await Api.UpdateMyProfileAsync(_displayName.Trim(), _theme, _language);
|
||||
if (success)
|
||||
{
|
||||
Snackbar.Add("Profil mis à jour avec succès", Severity.Success);
|
||||
_language = UiLanguageService.Normalize(_language);
|
||||
Language.SetLanguage(_language);
|
||||
try { await JS.InvokeVoidAsync("heimdallLocalization.setLanguage", _language); }
|
||||
catch (JSException) { /* The saved preference still applies to this circuit. */ }
|
||||
Snackbar.Add(Text["ProfileUpdated"], Severity.Success);
|
||||
}
|
||||
else
|
||||
{
|
||||
_profileError = "Erreur lors de la mise à jour du profil";
|
||||
_profileError = Text["ProfileUpdateFailed"];
|
||||
}
|
||||
}
|
||||
catch {
|
||||
_profileError = UiErrors.OperationFailed();
|
||||
_profileError = Text["OperationFailed"];
|
||||
}
|
||||
finally { _saving = false; }
|
||||
}
|
||||
@@ -409,7 +415,7 @@ else if (_profile is not null)
|
||||
var setup = await Api.Enable2faAsync();
|
||||
if (setup is null)
|
||||
{
|
||||
_2faError = "Échec de l'activation de la 2FA. Réessayez.";
|
||||
_2faError = Text["OperationFailed"];
|
||||
_show2faDialog = true;
|
||||
return;
|
||||
}
|
||||
@@ -418,7 +424,7 @@ else if (_profile is not null)
|
||||
}
|
||||
catch
|
||||
{
|
||||
_2faError = UiErrors.OperationFailed();
|
||||
_2faError = Text["OperationFailed"];
|
||||
_show2faDialog = true;
|
||||
}
|
||||
finally
|
||||
@@ -436,16 +442,16 @@ else if (_profile is not null)
|
||||
var ok = await Api.Disable2faAsync();
|
||||
if (ok)
|
||||
{
|
||||
Snackbar.Add("Double authentification désactivée", Severity.Success);
|
||||
Snackbar.Add(Text["TwoFactorDisabled"], Severity.Success);
|
||||
}
|
||||
else
|
||||
{
|
||||
Snackbar.Add("Échec de la désactivation de la 2FA", Severity.Error);
|
||||
Snackbar.Add(Text["TwoFactorDisableFailed"], Severity.Error);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
Snackbar.Add(UiErrors.OperationFailed(), Severity.Error);
|
||||
Snackbar.Add(Text["OperationFailed"], Severity.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -458,22 +464,22 @@ else if (_profile is not null)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(_currentPassword))
|
||||
{
|
||||
_passwordError = "Le mot de passe actuel est requis";
|
||||
_passwordError = Text["CurrentPasswordRequired"];
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(_newPassword))
|
||||
{
|
||||
_passwordError = "Le nouveau mot de passe est requis";
|
||||
_passwordError = Text["NewPasswordRequired"];
|
||||
return;
|
||||
}
|
||||
if (_newPassword.Length < 12)
|
||||
{
|
||||
_passwordError = "Le nouveau mot de passe doit contenir au moins 12 caractères";
|
||||
_passwordError = Text["PasswordTooShort"];
|
||||
return;
|
||||
}
|
||||
if (_newPassword != _confirmPassword)
|
||||
{
|
||||
_passwordError = "Les mots de passe ne correspondent pas";
|
||||
_passwordError = Text["PasswordsMismatch"];
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -487,15 +493,15 @@ else if (_profile is not null)
|
||||
_currentPassword = "";
|
||||
_newPassword = "";
|
||||
_confirmPassword = "";
|
||||
Snackbar.Add("Mot de passe changé avec succès", Severity.Success);
|
||||
Snackbar.Add(Text["PasswordChanged"], Severity.Success);
|
||||
}
|
||||
else
|
||||
{
|
||||
_passwordError = "Erreur lors du changement de mot de passe. Vérifiez votre mot de passe actuel.";
|
||||
_passwordError = Text["PasswordChangeFailed"];
|
||||
}
|
||||
}
|
||||
catch {
|
||||
_passwordError = UiErrors.OperationFailed();
|
||||
_passwordError = Text["OperationFailed"];
|
||||
}
|
||||
finally { _changingPassword = false; }
|
||||
}
|
||||
@@ -516,21 +522,25 @@ else if (_profile is not null)
|
||||
private TestActionResult? _ntfyTestResult;
|
||||
|
||||
// Event type subscription checkboxes
|
||||
private readonly List<EventTypeOption> _eventTypes = new()
|
||||
{
|
||||
new("MotionDetected", "Mouvement détecté", Icons.Material.Filled.NearMe),
|
||||
new("PersonDetected", "Personne détectée", Icons.Material.Filled.Person),
|
||||
new("VehicleDetected", "Véhicule détecté", Icons.Material.Filled.DirectionsCar),
|
||||
new("UnknownPerson", "Personne inconnue", Icons.Material.Filled.HelpOutline),
|
||||
new("FaceRecognized", "Visage reconnu", Icons.Material.Filled.Face),
|
||||
new("LicensePlateDetected", "Plaque détectée", Icons.Material.Filled.Pin),
|
||||
new("CameraOffline", "Caméra hors ligne", Icons.Material.Filled.VideocamOff),
|
||||
new("CameraOnline", "Caméra en ligne", Icons.Material.Filled.Videocam),
|
||||
};
|
||||
private IReadOnlyList<EventTypeOption> EventTypes =>
|
||||
[
|
||||
new("MotionDetected", Text["MotionDetected"], Icons.Material.Filled.NearMe),
|
||||
new("PersonDetected", Text["PersonDetected"], Icons.Material.Filled.Person),
|
||||
new("VehicleDetected", Text["VehicleDetected"], Icons.Material.Filled.DirectionsCar),
|
||||
new("UnknownPerson", Text["UnknownPerson"], Icons.Material.Filled.HelpOutline),
|
||||
new("FaceRecognized", Text["FaceRecognized"], Icons.Material.Filled.Face),
|
||||
new("LicensePlateDetected", Text["LicensePlateDetected"], Icons.Material.Filled.Pin),
|
||||
new("CameraOffline", Text["CameraOffline"], Icons.Material.Filled.VideocamOff),
|
||||
new("CameraOnline", Text["CameraOnline"], Icons.Material.Filled.Videocam),
|
||||
];
|
||||
private HashSet<string> _subscribedEvents = new();
|
||||
|
||||
private sealed record EventTypeOption(string Value, string Label, string Icon);
|
||||
|
||||
private void OnLanguageChanged() => _ = InvokeAsync(StateHasChanged);
|
||||
|
||||
public void Dispose() => Language.LanguageChanged -= OnLanguageChanged;
|
||||
|
||||
private void ToggleEventType(string value, bool selected)
|
||||
{
|
||||
if (selected)
|
||||
@@ -558,9 +568,9 @@ else if (_profile is not null)
|
||||
: new HashSet<string>();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
_notifError = $"Erreur chargement config notifications : {ex.Message}";
|
||||
_notifError = Text["NotificationConfigLoadFailed"];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -583,15 +593,15 @@ else if (_profile is not null)
|
||||
var success = await Api.UpdateNotificationConfigAsync(request);
|
||||
if (success)
|
||||
{
|
||||
Snackbar.Add("Configuration notifications mise à jour", Severity.Success);
|
||||
Snackbar.Add(Text["NotificationConfigUpdated"], Severity.Success);
|
||||
}
|
||||
else
|
||||
{
|
||||
_notifError = "Erreur lors de la mise à jour";
|
||||
_notifError = Text["NotificationConfigUpdateFailed"];
|
||||
}
|
||||
}
|
||||
catch {
|
||||
_notifError = UiErrors.OperationFailed();
|
||||
_notifError = Text["OperationFailed"];
|
||||
}
|
||||
finally { _savingNotif = false; }
|
||||
}
|
||||
@@ -612,11 +622,11 @@ else if (_profile is not null)
|
||||
var topic = ResolveNtfyTopic();
|
||||
var baseUrl = string.IsNullOrWhiteSpace(_ntfyUrl) ? null : _ntfyUrl.Trim();
|
||||
_ntfyTestResult = await Api.TestNtfyAsync(topic, baseUrl)
|
||||
?? new TestActionResult(false, "Test impossible (API indisponible).");
|
||||
?? new TestActionResult(false, Text["TestUnavailable"]);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
_ntfyTestResult = new TestActionResult(false, $"Test impossible : {ex.Message}");
|
||||
_ntfyTestResult = new TestActionResult(false, Text["OperationFailed"]);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
namespace Heimdall.Web;
|
||||
|
||||
/// <summary>Marker type for shared UI localization resources.</summary>
|
||||
public sealed class SharedResources { }
|
||||
@@ -345,4 +345,370 @@
|
||||
<data name="Timestamp">
|
||||
<value>Timestamp</value>
|
||||
</data>
|
||||
<data name="SkipToContent">
|
||||
<value>Skip to main content</value>
|
||||
</data>
|
||||
<data name="Search">
|
||||
<value>Search...</value>
|
||||
</data>
|
||||
<data name="Menu">
|
||||
<value>Menu</value>
|
||||
</data>
|
||||
<data name="ToggleTheme">
|
||||
<value>Toggle theme</value>
|
||||
</data>
|
||||
<data name="Logout">
|
||||
<value>Log out</value>
|
||||
</data>
|
||||
<data name="Navigation">
|
||||
<value>Navigation</value>
|
||||
</data>
|
||||
<data name="SitesAndCameras">
|
||||
<value>Sites and cameras</value>
|
||||
</data>
|
||||
<data name="Snapshots">
|
||||
<value>Snapshots</value>
|
||||
</data>
|
||||
<data name="People">
|
||||
<value>People</value>
|
||||
</data>
|
||||
<data name="Administration">
|
||||
<value>Administration</value>
|
||||
</data>
|
||||
<data name="UserManagement">
|
||||
<value>User management</value>
|
||||
</data>
|
||||
<data name="Groups">
|
||||
<value>Groups</value>
|
||||
</data>
|
||||
<data name="RolesAndPermissions">
|
||||
<value>Roles and permissions</value>
|
||||
</data>
|
||||
<data name="PermissionMatrix">
|
||||
<value>Permission matrix</value>
|
||||
</data>
|
||||
<data name="AuditLog">
|
||||
<value>Audit log</value>
|
||||
</data>
|
||||
<data name="Login">
|
||||
<value>Sign in</value>
|
||||
</data>
|
||||
<data name="ProfileLoadFailed">
|
||||
<value>Error loading the profile.</value>
|
||||
</data>
|
||||
<data name="Retry">
|
||||
<value>Retry</value>
|
||||
</data>
|
||||
<data name="RegisteredAt">
|
||||
<value>Registration date</value>
|
||||
</data>
|
||||
<data name="EmailConfirmed">
|
||||
<value>Email confirmed</value>
|
||||
</data>
|
||||
<data name="Yes">
|
||||
<value>Yes</value>
|
||||
</data>
|
||||
<data name="No">
|
||||
<value>No</value>
|
||||
</data>
|
||||
<data name="NoRoles">
|
||||
<value>No roles</value>
|
||||
</data>
|
||||
<data name="ChangePassword">
|
||||
<value>Change password</value>
|
||||
</data>
|
||||
<data name="CurrentPassword">
|
||||
<value>Current password</value>
|
||||
</data>
|
||||
<data name="NewPassword">
|
||||
<value>New password</value>
|
||||
</data>
|
||||
<data name="ConfirmPassword">
|
||||
<value>Confirm password</value>
|
||||
</data>
|
||||
<data name="PasswordMinimum">
|
||||
<value>Minimum 12 characters</value>
|
||||
</data>
|
||||
<data name="PushSetupInstructions">
|
||||
<value>Push notifications use ntfy (self-hosted server). Install the ntfy app and subscribe to the topic below to receive notifications.</value>
|
||||
</data>
|
||||
<data name="YourTopic">
|
||||
<value>Your topic:</value>
|
||||
</data>
|
||||
<data name="CustomizeTopic">
|
||||
<value>Change the “ntfy topic” field below to use a different topic.</value>
|
||||
</data>
|
||||
<data name="EmailChannel">
|
||||
<value>Email channel</value>
|
||||
</data>
|
||||
<data name="NotificationEmailAddress">
|
||||
<value>Notification email address</value>
|
||||
</data>
|
||||
<data name="PushChannel">
|
||||
<value>Push channel (ntfy)</value>
|
||||
</data>
|
||||
<data name="NtfyServerUrl">
|
||||
<value>ntfy server URL (optional)</value>
|
||||
</data>
|
||||
<data name="DefaultNtfyUrl">
|
||||
<value>http://ntfy:80 (default)</value>
|
||||
</data>
|
||||
<data name="UseGlobalServer">
|
||||
<value>Leave blank to use the global server</value>
|
||||
</data>
|
||||
<data name="NtfyTopicOptional">
|
||||
<value>ntfy topic (optional)</value>
|
||||
</data>
|
||||
<data name="CustomizeTopicHelper">
|
||||
<value>Customize the receiving topic. Default: heimdall_{your-id}</value>
|
||||
</data>
|
||||
<data name="Summaries">
|
||||
<value>Summaries</value>
|
||||
</data>
|
||||
<data name="DailySummary">
|
||||
<value>Daily summary (8 am)</value>
|
||||
</data>
|
||||
<data name="WeeklySummary">
|
||||
<value>Weekly summary (Monday 8 am)</value>
|
||||
</data>
|
||||
<data name="EventTypes">
|
||||
<value>Event types</value>
|
||||
</data>
|
||||
<data name="SelectNotificationEventTypes">
|
||||
<value>Select the event types for which you want to receive push and email notifications.</value>
|
||||
</data>
|
||||
<data name="AllEventsIfNone">
|
||||
<value>If none are selected, all events are notified.</value>
|
||||
</data>
|
||||
<data name="TestRunning">
|
||||
<value>Testing…</value>
|
||||
</data>
|
||||
<data name="TestNtfy">
|
||||
<value>Test ntfy</value>
|
||||
</data>
|
||||
<data name="ProfileUpdated">
|
||||
<value>Profile updated successfully</value>
|
||||
</data>
|
||||
<data name="ProfileUpdateFailed">
|
||||
<value>Error updating the profile</value>
|
||||
</data>
|
||||
<data name="TwoFactor">
|
||||
<value>Two-factor authentication (2FA)</value>
|
||||
</data>
|
||||
<data name="TwoFactorEnabled">
|
||||
<value>Enabled</value>
|
||||
</data>
|
||||
<data name="TwoFactorDisabled">
|
||||
<value>Disabled</value>
|
||||
</data>
|
||||
<data name="DisableTwoFactor">
|
||||
<value>Disable 2FA</value>
|
||||
</data>
|
||||
<data name="EnableTwoFactor">
|
||||
<value>Enable 2FA</value>
|
||||
</data>
|
||||
<data name="TwoFactorDisableFailed">
|
||||
<value>Failed to disable 2FA</value>
|
||||
</data>
|
||||
<data name="PasswordChanged">
|
||||
<value>Password changed successfully</value>
|
||||
</data>
|
||||
<data name="PasswordChangeFailed">
|
||||
<value>Could not change password. Check your current password.</value>
|
||||
</data>
|
||||
<data name="CurrentPasswordRequired">
|
||||
<value>Current password is required</value>
|
||||
</data>
|
||||
<data name="NewPasswordRequired">
|
||||
<value>New password is required</value>
|
||||
</data>
|
||||
<data name="PasswordTooShort">
|
||||
<value>The new password must contain at least 12 characters</value>
|
||||
</data>
|
||||
<data name="PasswordsMismatch">
|
||||
<value>Passwords do not match</value>
|
||||
</data>
|
||||
<data name="NotificationConfigUpdated">
|
||||
<value>Notification settings updated</value>
|
||||
</data>
|
||||
<data name="NotificationConfigUpdateFailed">
|
||||
<value>Error updating notification settings</value>
|
||||
</data>
|
||||
<data name="NotificationConfigLoadFailed">
|
||||
<value>Error loading notification settings</value>
|
||||
</data>
|
||||
<data name="TestUnavailable">
|
||||
<value>Test unavailable (API not available).</value>
|
||||
</data>
|
||||
<data name="TestFailed">
|
||||
<value>Test failed: {0}</value>
|
||||
</data>
|
||||
<data name="ScanQrInstructions">
|
||||
<value>Scan the QR code with your authenticator app (Google Authenticator, Authy…) or enter the key manually.</value>
|
||||
</data>
|
||||
<data name="TwoFactorKey">
|
||||
<value>Key:</value>
|
||||
</data>
|
||||
<data name="SetupLink">
|
||||
<value>Setup link:</value>
|
||||
</data>
|
||||
<data name="OpenInApp">
|
||||
<value>open in app</value>
|
||||
</data>
|
||||
<data name="RecoveryCodes">
|
||||
<value>Recovery codes</value>
|
||||
</data>
|
||||
<data name="KeepRecoveryCodes">
|
||||
<value>Keep them safe.</value>
|
||||
</data>
|
||||
<data name="RecoveryCodesInstructions">
|
||||
<value>They let you sign in if you lose access to your authenticator app.</value>
|
||||
</data>
|
||||
<data name="RecoveryCodeOneUse">
|
||||
<value>Each code can only be used once.</value>
|
||||
</data>
|
||||
<data name="RecoveryCodesSaved">
|
||||
<value>I saved my recovery codes</value>
|
||||
</data>
|
||||
<data name="Close">
|
||||
<value>Close</value>
|
||||
</data>
|
||||
<data name="ProfileLoadErrorTitle">
|
||||
<value>Profile unavailable</value>
|
||||
</data>
|
||||
<data name="WelcomeUser">
|
||||
<value>Welcome,</value>
|
||||
</data>
|
||||
<data name="LastUpdated">
|
||||
<value>Last updated:</value>
|
||||
</data>
|
||||
<data name="CameraCount">
|
||||
<value>Cameras</value>
|
||||
</data>
|
||||
<data name="AgentsOnline">
|
||||
<value>Agents online</value>
|
||||
</data>
|
||||
<data name="Events24h">
|
||||
<value>Events (24 h)</value>
|
||||
</data>
|
||||
<data name="ViewAll">
|
||||
<value>View all →</value>
|
||||
</data>
|
||||
<data name="Manage">
|
||||
<value>Manage →</value>
|
||||
</data>
|
||||
<data name="CameraStatusSection">
|
||||
<value>Camera status</value>
|
||||
</data>
|
||||
<data name="Count">
|
||||
<value>Count</value>
|
||||
</data>
|
||||
<data name="Time">
|
||||
<value>Time</value>
|
||||
</data>
|
||||
<data name="Type">
|
||||
<value>Type</value>
|
||||
</data>
|
||||
<data name="NoRecentEvents">
|
||||
<value>No recent events.</value>
|
||||
</data>
|
||||
<data name="AgentLoad">
|
||||
<value>Agent load</value>
|
||||
</data>
|
||||
<data name="AllAgents">
|
||||
<value>All agents →</value>
|
||||
</data>
|
||||
<data name="NoAgentsRegistered">
|
||||
<value>No agents registered.</value>
|
||||
</data>
|
||||
<data name="QuickActions">
|
||||
<value>Quick actions</value>
|
||||
</data>
|
||||
<data name="NewSite">
|
||||
<value>New site</value>
|
||||
</data>
|
||||
<data name="Audit">
|
||||
<value>Audit</value>
|
||||
</data>
|
||||
<data name="Name">
|
||||
<value>Name</value>
|
||||
</data>
|
||||
<data name="Created">
|
||||
<value>Created</value>
|
||||
</data>
|
||||
<data name="Inactive">
|
||||
<value>Inactive</value>
|
||||
</data>
|
||||
<data name="NoSiteConfigured">
|
||||
<value>No site configured</value>
|
||||
</data>
|
||||
<data name="CreateSitePrompt">
|
||||
<value>Start by creating a site to deploy your monitoring agents.</value>
|
||||
</data>
|
||||
<data name="Refresh">
|
||||
<value>Refresh</value>
|
||||
</data>
|
||||
<data name="MotionDetected">
|
||||
<value>Motion</value>
|
||||
</data>
|
||||
<data name="PersonDetected">
|
||||
<value>Person</value>
|
||||
</data>
|
||||
<data name="VehicleDetected">
|
||||
<value>Vehicle</value>
|
||||
</data>
|
||||
<data name="FaceRecognized">
|
||||
<value>Face</value>
|
||||
</data>
|
||||
<data name="CameraOffline">
|
||||
<value>Offline</value>
|
||||
</data>
|
||||
<data name="Other">
|
||||
<value>Other</value>
|
||||
</data>
|
||||
<data name="OnlineCount">
|
||||
<value>{0} online</value>
|
||||
</data>
|
||||
<data name="OfflineCount">
|
||||
<value>{0} offline</value>
|
||||
</data>
|
||||
<data name="TotalCount">
|
||||
<value>{0} total</value>
|
||||
</data>
|
||||
<data name="Agents">
|
||||
<value>Agents</value>
|
||||
</data>
|
||||
<data name="Events24Hours">
|
||||
<value>Events (24 h)</value>
|
||||
</data>
|
||||
<data name="OnlineAgents">
|
||||
<value>Agents online</value>
|
||||
</data>
|
||||
<data name="Total">
|
||||
<value>total</value>
|
||||
</data>
|
||||
<data name="NoSitesConfigured">
|
||||
<value>No site configured</value>
|
||||
</data>
|
||||
<data name="RefreshDashboard">
|
||||
<value>Refresh dashboard</value>
|
||||
</data>
|
||||
<data name="Auto">
|
||||
<value>Automatic</value>
|
||||
</data>
|
||||
<data name="Light">
|
||||
<value>Light</value>
|
||||
</data>
|
||||
<data name="Dark">
|
||||
<value>Dark</value>
|
||||
</data>
|
||||
<data name="UnknownPerson">
|
||||
<value>Unknown person</value>
|
||||
</data>
|
||||
<data name="LicensePlateDetected">
|
||||
<value>License plate detected</value>
|
||||
</data>
|
||||
<data name="CameraOnline">
|
||||
<value>Camera online</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -345,4 +345,370 @@
|
||||
<data name="Timestamp">
|
||||
<value>Horodatage</value>
|
||||
</data>
|
||||
<data name="SkipToContent">
|
||||
<value>Aller au contenu principal</value>
|
||||
</data>
|
||||
<data name="Search">
|
||||
<value>Rechercher...</value>
|
||||
</data>
|
||||
<data name="Menu">
|
||||
<value>Menu</value>
|
||||
</data>
|
||||
<data name="ToggleTheme">
|
||||
<value>Basculer le thème</value>
|
||||
</data>
|
||||
<data name="Logout">
|
||||
<value>Déconnexion</value>
|
||||
</data>
|
||||
<data name="Navigation">
|
||||
<value>Navigation</value>
|
||||
</data>
|
||||
<data name="SitesAndCameras">
|
||||
<value>Sites et caméras</value>
|
||||
</data>
|
||||
<data name="Snapshots">
|
||||
<value>Captures</value>
|
||||
</data>
|
||||
<data name="People">
|
||||
<value>Personnes</value>
|
||||
</data>
|
||||
<data name="Administration">
|
||||
<value>Administration</value>
|
||||
</data>
|
||||
<data name="UserManagement">
|
||||
<value>Gestion des utilisateurs</value>
|
||||
</data>
|
||||
<data name="Groups">
|
||||
<value>Groupes</value>
|
||||
</data>
|
||||
<data name="RolesAndPermissions">
|
||||
<value>Rôles et permissions</value>
|
||||
</data>
|
||||
<data name="PermissionMatrix">
|
||||
<value>Matrice des permissions</value>
|
||||
</data>
|
||||
<data name="AuditLog">
|
||||
<value>Journal d’audit</value>
|
||||
</data>
|
||||
<data name="Login">
|
||||
<value>Connexion</value>
|
||||
</data>
|
||||
<data name="ProfileLoadFailed">
|
||||
<value>Erreur lors du chargement du profil.</value>
|
||||
</data>
|
||||
<data name="Retry">
|
||||
<value>Réessayer</value>
|
||||
</data>
|
||||
<data name="RegisteredAt">
|
||||
<value>Date d’inscription</value>
|
||||
</data>
|
||||
<data name="EmailConfirmed">
|
||||
<value>Email confirmé</value>
|
||||
</data>
|
||||
<data name="Yes">
|
||||
<value>Oui</value>
|
||||
</data>
|
||||
<data name="No">
|
||||
<value>Non</value>
|
||||
</data>
|
||||
<data name="NoRoles">
|
||||
<value>Aucun rôle</value>
|
||||
</data>
|
||||
<data name="ChangePassword">
|
||||
<value>Changer le mot de passe</value>
|
||||
</data>
|
||||
<data name="CurrentPassword">
|
||||
<value>Mot de passe actuel</value>
|
||||
</data>
|
||||
<data name="NewPassword">
|
||||
<value>Nouveau mot de passe</value>
|
||||
</data>
|
||||
<data name="ConfirmPassword">
|
||||
<value>Confirmer le mot de passe</value>
|
||||
</data>
|
||||
<data name="PasswordMinimum">
|
||||
<value>Minimum 12 caractères</value>
|
||||
</data>
|
||||
<data name="PushSetupInstructions">
|
||||
<value>Les notifications push utilisent ntfy (serveur auto-hébergé). Installez l’app ntfy et abonnez-vous au topic ci-dessous pour recevoir les notifications.</value>
|
||||
</data>
|
||||
<data name="YourTopic">
|
||||
<value>Votre topic :</value>
|
||||
</data>
|
||||
<data name="CustomizeTopic">
|
||||
<value>Personnalisez le champ « Topic ntfy » ci-dessous pour utiliser un topic différent.</value>
|
||||
</data>
|
||||
<data name="EmailChannel">
|
||||
<value>Canal email</value>
|
||||
</data>
|
||||
<data name="NotificationEmailAddress">
|
||||
<value>Adresse email de notification</value>
|
||||
</data>
|
||||
<data name="PushChannel">
|
||||
<value>Canal push (ntfy)</value>
|
||||
</data>
|
||||
<data name="NtfyServerUrl">
|
||||
<value>URL du serveur ntfy (optionnel)</value>
|
||||
</data>
|
||||
<data name="DefaultNtfyUrl">
|
||||
<value>http://ntfy:80 (défaut)</value>
|
||||
</data>
|
||||
<data name="UseGlobalServer">
|
||||
<value>Laisser vide pour utiliser le serveur global</value>
|
||||
</data>
|
||||
<data name="NtfyTopicOptional">
|
||||
<value>Topic ntfy (optionnel)</value>
|
||||
</data>
|
||||
<data name="CustomizeTopicHelper">
|
||||
<value>Personnalisez le topic de réception. Défaut : heimdall_{votre-id}</value>
|
||||
</data>
|
||||
<data name="Summaries">
|
||||
<value>Résumés</value>
|
||||
</data>
|
||||
<data name="DailySummary">
|
||||
<value>Résumé quotidien (8h)</value>
|
||||
</data>
|
||||
<data name="WeeklySummary">
|
||||
<value>Résumé hebdomadaire (lundi 8h)</value>
|
||||
</data>
|
||||
<data name="EventTypes">
|
||||
<value>Types d’événements</value>
|
||||
</data>
|
||||
<data name="SelectNotificationEventTypes">
|
||||
<value>Sélectionnez les types d’événements pour lesquels vous souhaitez recevoir des notifications push et email.</value>
|
||||
</data>
|
||||
<data name="AllEventsIfNone">
|
||||
<value>Si aucun n’est sélectionné, tous les événements sont notifiés.</value>
|
||||
</data>
|
||||
<data name="TestRunning">
|
||||
<value>Test en cours…</value>
|
||||
</data>
|
||||
<data name="TestNtfy">
|
||||
<value>Tester ntfy</value>
|
||||
</data>
|
||||
<data name="ProfileUpdated">
|
||||
<value>Profil mis à jour avec succès</value>
|
||||
</data>
|
||||
<data name="ProfileUpdateFailed">
|
||||
<value>Erreur lors de la mise à jour du profil</value>
|
||||
</data>
|
||||
<data name="TwoFactor">
|
||||
<value>Double authentification (2FA)</value>
|
||||
</data>
|
||||
<data name="TwoFactorEnabled">
|
||||
<value>Activée</value>
|
||||
</data>
|
||||
<data name="TwoFactorDisabled">
|
||||
<value>Désactivée</value>
|
||||
</data>
|
||||
<data name="DisableTwoFactor">
|
||||
<value>Désactiver la 2FA</value>
|
||||
</data>
|
||||
<data name="EnableTwoFactor">
|
||||
<value>Activer la 2FA</value>
|
||||
</data>
|
||||
<data name="TwoFactorDisableFailed">
|
||||
<value>Échec de la désactivation de la 2FA</value>
|
||||
</data>
|
||||
<data name="PasswordChanged">
|
||||
<value>Mot de passe changé avec succès</value>
|
||||
</data>
|
||||
<data name="PasswordChangeFailed">
|
||||
<value>Erreur lors du changement de mot de passe. Vérifiez votre mot de passe actuel.</value>
|
||||
</data>
|
||||
<data name="CurrentPasswordRequired">
|
||||
<value>Le mot de passe actuel est requis</value>
|
||||
</data>
|
||||
<data name="NewPasswordRequired">
|
||||
<value>Le nouveau mot de passe est requis</value>
|
||||
</data>
|
||||
<data name="PasswordTooShort">
|
||||
<value>Le nouveau mot de passe doit contenir au moins 12 caractères</value>
|
||||
</data>
|
||||
<data name="PasswordsMismatch">
|
||||
<value>Les mots de passe ne correspondent pas</value>
|
||||
</data>
|
||||
<data name="NotificationConfigUpdated">
|
||||
<value>Configuration des notifications mise à jour</value>
|
||||
</data>
|
||||
<data name="NotificationConfigUpdateFailed">
|
||||
<value>Erreur lors de la mise à jour</value>
|
||||
</data>
|
||||
<data name="NotificationConfigLoadFailed">
|
||||
<value>Erreur lors du chargement de la configuration des notifications</value>
|
||||
</data>
|
||||
<data name="TestUnavailable">
|
||||
<value>Test impossible (API indisponible).</value>
|
||||
</data>
|
||||
<data name="TestFailed">
|
||||
<value>Échec du test : {0}</value>
|
||||
</data>
|
||||
<data name="ScanQrInstructions">
|
||||
<value>Scannez le code QR avec votre application d’authentification (Google Authenticator, Authy…) ou saisissez la clé manuellement.</value>
|
||||
</data>
|
||||
<data name="TwoFactorKey">
|
||||
<value>Clé :</value>
|
||||
</data>
|
||||
<data name="SetupLink">
|
||||
<value>Lien de configuration :</value>
|
||||
</data>
|
||||
<data name="OpenInApp">
|
||||
<value>ouvrir dans l’app</value>
|
||||
</data>
|
||||
<data name="RecoveryCodes">
|
||||
<value>Codes de récupération</value>
|
||||
</data>
|
||||
<data name="KeepRecoveryCodes">
|
||||
<value>Conservez-les précieusement.</value>
|
||||
</data>
|
||||
<data name="RecoveryCodesInstructions">
|
||||
<value>Ils permettent de vous connecter si vous perdez votre application d’authentification.</value>
|
||||
</data>
|
||||
<data name="RecoveryCodeOneUse">
|
||||
<value>Chaque code ne peut être utilisé qu’une seule fois.</value>
|
||||
</data>
|
||||
<data name="RecoveryCodesSaved">
|
||||
<value>J’ai sauvegardé mes codes de récupération</value>
|
||||
</data>
|
||||
<data name="Close">
|
||||
<value>Fermer</value>
|
||||
</data>
|
||||
<data name="ProfileLoadErrorTitle">
|
||||
<value>Profil indisponible</value>
|
||||
</data>
|
||||
<data name="WelcomeUser">
|
||||
<value>Bienvenue,</value>
|
||||
</data>
|
||||
<data name="LastUpdated">
|
||||
<value>Dernière mise à jour :</value>
|
||||
</data>
|
||||
<data name="CameraCount">
|
||||
<value>Caméras</value>
|
||||
</data>
|
||||
<data name="AgentsOnline">
|
||||
<value>Agents en ligne</value>
|
||||
</data>
|
||||
<data name="Events24h">
|
||||
<value>Événements (24 h)</value>
|
||||
</data>
|
||||
<data name="ViewAll">
|
||||
<value>Voir tout →</value>
|
||||
</data>
|
||||
<data name="Manage">
|
||||
<value>Gérer →</value>
|
||||
</data>
|
||||
<data name="CameraStatusSection">
|
||||
<value>État des caméras</value>
|
||||
</data>
|
||||
<data name="Count">
|
||||
<value>Nombre</value>
|
||||
</data>
|
||||
<data name="Time">
|
||||
<value>Heure</value>
|
||||
</data>
|
||||
<data name="Type">
|
||||
<value>Type</value>
|
||||
</data>
|
||||
<data name="NoRecentEvents">
|
||||
<value>Aucun événement récent.</value>
|
||||
</data>
|
||||
<data name="AgentLoad">
|
||||
<value>Charge des agents</value>
|
||||
</data>
|
||||
<data name="AllAgents">
|
||||
<value>Tous les agents →</value>
|
||||
</data>
|
||||
<data name="NoAgentsRegistered">
|
||||
<value>Aucun agent enregistré.</value>
|
||||
</data>
|
||||
<data name="QuickActions">
|
||||
<value>Actions rapides</value>
|
||||
</data>
|
||||
<data name="NewSite">
|
||||
<value>Nouveau site</value>
|
||||
</data>
|
||||
<data name="Audit">
|
||||
<value>Audit</value>
|
||||
</data>
|
||||
<data name="Name">
|
||||
<value>Nom</value>
|
||||
</data>
|
||||
<data name="Created">
|
||||
<value>Créé le</value>
|
||||
</data>
|
||||
<data name="Inactive">
|
||||
<value>Inactif</value>
|
||||
</data>
|
||||
<data name="NoSiteConfigured">
|
||||
<value>Aucun site configuré</value>
|
||||
</data>
|
||||
<data name="CreateSitePrompt">
|
||||
<value>Commencez par créer un site pour déployer vos agents de surveillance.</value>
|
||||
</data>
|
||||
<data name="Refresh">
|
||||
<value>Rafraîchir</value>
|
||||
</data>
|
||||
<data name="MotionDetected">
|
||||
<value>Mouvement</value>
|
||||
</data>
|
||||
<data name="PersonDetected">
|
||||
<value>Personne</value>
|
||||
</data>
|
||||
<data name="VehicleDetected">
|
||||
<value>Véhicule</value>
|
||||
</data>
|
||||
<data name="FaceRecognized">
|
||||
<value>Visage</value>
|
||||
</data>
|
||||
<data name="CameraOffline">
|
||||
<value>Hors ligne</value>
|
||||
</data>
|
||||
<data name="Other">
|
||||
<value>Autre</value>
|
||||
</data>
|
||||
<data name="OnlineCount">
|
||||
<value>{0} en ligne</value>
|
||||
</data>
|
||||
<data name="OfflineCount">
|
||||
<value>{0} hors ligne</value>
|
||||
</data>
|
||||
<data name="TotalCount">
|
||||
<value>{0} total</value>
|
||||
</data>
|
||||
<data name="Agents">
|
||||
<value>Agents</value>
|
||||
</data>
|
||||
<data name="Events24Hours">
|
||||
<value>Événements (24 h)</value>
|
||||
</data>
|
||||
<data name="OnlineAgents">
|
||||
<value>Agents en ligne</value>
|
||||
</data>
|
||||
<data name="Total">
|
||||
<value>au total</value>
|
||||
</data>
|
||||
<data name="NoSitesConfigured">
|
||||
<value>Aucun site configuré</value>
|
||||
</data>
|
||||
<data name="RefreshDashboard">
|
||||
<value>Actualiser le tableau de bord</value>
|
||||
</data>
|
||||
<data name="Auto">
|
||||
<value>Automatique</value>
|
||||
</data>
|
||||
<data name="Light">
|
||||
<value>Clair</value>
|
||||
</data>
|
||||
<data name="Dark">
|
||||
<value>Sombre</value>
|
||||
</data>
|
||||
<data name="UnknownPerson">
|
||||
<value>Personne inconnue</value>
|
||||
</data>
|
||||
<data name="LicensePlateDetected">
|
||||
<value>Plaque détectée</value>
|
||||
</data>
|
||||
<data name="CameraOnline">
|
||||
<value>Caméra en ligne</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -420,6 +420,8 @@ public partial class Program
|
||||
Console.WriteLine($"[DIAG] Demo seeding: {(builder.Configuration.GetValue<bool>("Seed:DemoOnStartup", false) ? "enabled" : "disabled (set Seed:DemoOnStartup=true to enable)")}");
|
||||
|
||||
builder.Services.AddLocalization(options => options.ResourcesPath = "Localization");
|
||||
builder.Services.AddScoped<UiLanguageService>();
|
||||
builder.Services.AddScoped<UiText>();
|
||||
|
||||
builder.Services.AddRazorComponents()
|
||||
.AddInteractiveServerComponents();
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
using System.Globalization;
|
||||
using Heimdall.Web;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace Heimdall.Web.Services;
|
||||
|
||||
/// <summary>Stores the active UI language for the current Blazor circuit.</summary>
|
||||
public sealed class UiLanguageService
|
||||
{
|
||||
private string _language = Normalize(CultureInfo.CurrentUICulture.Name);
|
||||
|
||||
public event Action? LanguageChanged;
|
||||
|
||||
public string Language => _language;
|
||||
|
||||
public CultureInfo Culture => CultureInfo.GetCultureInfo(_language);
|
||||
|
||||
public void SetLanguage(string? language)
|
||||
{
|
||||
var normalized = Normalize(language);
|
||||
if (string.Equals(_language, normalized, StringComparison.Ordinal)) return;
|
||||
|
||||
_language = normalized;
|
||||
LanguageChanged?.Invoke();
|
||||
}
|
||||
|
||||
public static string Normalize(string? language)
|
||||
{
|
||||
var value = language?.Trim();
|
||||
if (string.IsNullOrEmpty(value)) return "fr";
|
||||
|
||||
if (value.Equals("fr", StringComparison.OrdinalIgnoreCase)
|
||||
|| value.StartsWith("fr-", StringComparison.OrdinalIgnoreCase)) return "fr";
|
||||
if (value.Equals("en", StringComparison.OrdinalIgnoreCase)
|
||||
|| value.StartsWith("en-", StringComparison.OrdinalIgnoreCase)) return "en";
|
||||
|
||||
return "fr";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Resolves shared resources using the current user's saved language.</summary>
|
||||
public sealed class UiText(IStringLocalizer<SharedResources> localizer, UiLanguageService language)
|
||||
{
|
||||
public string this[string key]
|
||||
{
|
||||
get
|
||||
{
|
||||
var previousCulture = CultureInfo.CurrentUICulture;
|
||||
try
|
||||
{
|
||||
CultureInfo.CurrentUICulture = language.Culture;
|
||||
return localizer[key].Value;
|
||||
}
|
||||
finally
|
||||
{
|
||||
CultureInfo.CurrentUICulture = previousCulture;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
window.heimdallLocalization = {
|
||||
setLanguage: function (language) {
|
||||
const normalized = language === "en" ? "en" : "fr";
|
||||
const value = encodeURIComponent(`c=${normalized}|uic=${normalized}`);
|
||||
const secure = window.location.protocol === "https:" ? "; Secure" : "";
|
||||
|
||||
document.documentElement.lang = normalized;
|
||||
document.cookie = `.AspNetCore.Culture=${value}; path=/; SameSite=Lax${secure}`;
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user