diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9e0db885b..04d0e3902 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,16 +1,23 @@
# Changelog
+
+## [1.0.8-rc36] - unstable
+
+### Added
+
+* [PostIt/Administration] Add an administrator-only consumption relief page reachable from Administration: select a user at their limit, preview and confirm an arbitrary point erasure up to current consumption. Protect the quota-exempt API with the Administrator policy, serialize adjustments with accounting, reject stale confirmations, preserve technical counters and disk quotas, and audit the actor. Add API, service, client and responsive-page regressions.
+
+* [PostIt] Upgrade Avalonia to 12.1.6 and align the headless and native Skia test rendering packages.
+
+* [PostIt/Calls] Replace the chat's direct VLC/SRTP call panel with native WebRTC on Android and Linux: official libwebrtc/Camera2 and GStreamer webrtcbin, existing consent/SignalR signaling, ICE/STUN/coturn, and fail-closed relay-only IP masking. Cancel pending startup and release media on hangup, navigation, interruption and backgrounding. Add privacy/lifecycle, real Linux media/rendering and debug Android interoperability regressions, coturn deployment instructions and a protected-server-secret configuration example.
+
+* [PostIt/PayPal] Add a native subscription page reachable from Home, profile and About: load server-priced Discovery/Premium offers, prepare or resume checkout with the current bearer session, open only PayPal for approval, reconcile confirmed payments and balances, and cancel with confirmation. Add quota-exempt bearer-only endpoints on Yavsc.Org, sharing checkout/cancellation logic with the existing web flow, and regression coverage. Browser return never confirms payment.
+
## [1.0.8-rc35] - unstable
### Added
-* [PostIt/Calls] Replace the chat's direct VLC/SRTP call panel with native WebRTC on Android and Linux: official libwebrtc/Camera2 and GStreamer webrtcbin, existing consent/SignalR signaling, ICE/STUN/coturn, and fail-closed relay-only IP masking. Cancel pending startup and release media on hangup, navigation, interruption and backgrounding. Add privacy/lifecycle, real Linux media/rendering and debug Android interoperability regressions, coturn deployment instructions and a protected-server-secret configuration example.
-
-* [PostIt] Upgrade Avalonia to 12.1.6 and align the headless and native Skia test rendering packages.
-
-* [PostIt/PayPal] Add a native subscription page reachable from Home, profile and About: load server-priced Discovery/Premium offers, prepare or resume checkout with the current bearer session, open only PayPal for approval, reconcile confirmed payments and balances, and cancel with confirmation. Add quota-exempt bearer-only endpoints on Yavsc.Org, sharing checkout/cancellation logic with the existing web flow, and regression coverage. Browser return never confirms payment.
-
* [Resource usage] Let users with the `Administrator` role continue making requests after reaching their consumption quota, while still recording their usage.
* [PostIt.Android/Podcasts] Add an optional persisted background blur for camera preview and broadcasting. Run the bundled PPHumanSeg model locally with ONNX Runtime and composite with OpenGL before encoding; preserve the unfiltered pipeline for calls and OBS.
diff --git a/INSTALL.md b/INSTALL.md
index 46e10165c..f9dc3f123 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -242,6 +242,21 @@ footer and PostIt's **About** page, using the configured authentication
authority. PostIt displays consumption and remaining points in **My profile**
and the administration usage views.
+PostIt **Administration > Effacer des points de consommation** lets an
+`Administrator` select an account whose consumption limit is reached, enter
+a positive amount (up to eight decimal places), preview the remaining
+consumption and explicitly confirm. An amount exceeding current consumption
+is rejected: this action grants neither future credit nor additional disk
+space, and preserves the technical counters and payment history.
+`POST /api/v1/resource-usage/admin/{userId}/erase` accepts `points` and
+`expectedCredits` (the displayed `AppliedCredits + CreditBalance`). The
+Administrator-only endpoint is quota-exempt, rechecks eligibility under the
+shared accounting lock and rejects stale credit snapshots with HTTP 409.
+Refresh and confirm again after a conflict or uncertain request outcome.
+Successful adjustments record the administrator as the modifying actor and
+log the target, amount and remaining consumption. No new migration is needed
+beyond the existing resource-subscription credit column.
+
### Monthly resource subscriptions (PayPal REST)
The free registration keeps the configured cumulative quota without a
diff --git a/Makefile b/Makefile
index 04efba0be..788c98927 100644
--- a/Makefile
+++ b/Makefile
@@ -29,6 +29,7 @@ test-postit:
--report-xunit-html \
--results-directory "test-reports" \
--report-xunit-html-filename "postit-test-results.html" \
+ --no-progress \
--project src/PostIt/PostIt.Tests/PostIt.Tests.csproj
backend-tests: Blogs-backend-test Org-backend-test Api-backend-test
diff --git a/src/PostIt/PostIt.Android/MainActivity.cs b/src/PostIt/PostIt.Android/MainActivity.cs
index d1ac390a5..46b386454 100644
--- a/src/PostIt/PostIt.Android/MainActivity.cs
+++ b/src/PostIt/PostIt.Android/MainActivity.cs
@@ -16,7 +16,8 @@ namespace PostIt.Android;
Theme = "@style/MyTheme.NoActionBar",
Icon = "@drawable/icon",
MainLauncher = true,
- ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.UiMode)
+ ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.UiMode
+ )
]
public class MainActivity : AvaloniaMainActivity
{
diff --git a/src/PostIt/PostIt.Android/Properties/AndroidManifest.xml b/src/PostIt/PostIt.Android/Properties/AndroidManifest.xml
index e81f64590..e64ee989f 100644
--- a/src/PostIt/PostIt.Android/Properties/AndroidManifest.xml
+++ b/src/PostIt/PostIt.Android/Properties/AndroidManifest.xml
@@ -1,25 +1,26 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ xmlns:tools="http://schemas.android.com/tools" android:installLocation="auto"
+>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/PostIt/PostIt.Tests/ResourceUsageApiClientTests.cs b/src/PostIt/PostIt.Tests/ResourceUsageApiClientTests.cs
index 963577d69..e1e5c3696 100644
--- a/src/PostIt/PostIt.Tests/ResourceUsageApiClientTests.cs
+++ b/src/PostIt/PostIt.Tests/ResourceUsageApiClientTests.cs
@@ -7,6 +7,19 @@ namespace PostIt.Tests;
public class ResourceUsageApiClientTests
{
+ [Fact]
+ public async Task Erase_sends_amount_and_expected_credits_to_escaped_user_endpoint()
+ {
+ var fake = new FakeYavscApiClient();
+ var client = new ResourceUsageApiClient(fake, "https://example.invalid/api/v1/");
+ var request = new EraseResourceUsageRequest { Points = 125.5m, ExpectedCredits = 12m };
+ await client.EraseAsync("user/name ?#", request, TestContext.Current.CancellationToken);
+ Assert.Equal("POST", fake.LastMethod);
+ Assert.Equal("https://example.invalid/api/v1/resource-usage/admin/user%2Fname%20%3F%23/erase", fake.LastPath);
+ Assert.Same(request, fake.LastBody);
+ Assert.Equal(TestContext.Current.CancellationToken, fake.LastToken);
+ }
+
[Fact]
public async Task Usage_remains_visible_when_the_rest_of_the_profile_is_unavailable()
{
@@ -56,11 +69,15 @@ public class ResourceUsageApiClientTests
public HttpClient Http { get; } = new();
public string? LastPath { get; private set; }
public string? LastMethod { get; private set; }
+ public object? LastBody { get; private set; }
+ public CancellationToken LastToken { get; private set; }
public Task CallAsync(HttpMethod method, string path, object? body = null, CancellationToken ct = default)
{
LastMethod = method.Method;
LastPath = path;
+ LastBody = body;
+ LastToken = ct;
if (typeof(T) == typeof(ResourceUsageSummary))
{
diff --git a/src/PostIt/PostIt.Tests/ResourceUsageReliefPageTests.cs b/src/PostIt/PostIt.Tests/ResourceUsageReliefPageTests.cs
new file mode 100644
index 000000000..d406634e5
--- /dev/null
+++ b/src/PostIt/PostIt.Tests/ResourceUsageReliefPageTests.cs
@@ -0,0 +1,241 @@
+using System.Net;
+using System.Net.Http;
+using Avalonia.Controls;
+using Avalonia.Headless.XUnit;
+using Avalonia.Threading;
+using PostIt.ViewModels;
+using PostIt.Views;
+using Yavsc.Abstract.Resources;
+using Yavsc.Api.Client;
+
+namespace PostIt.Tests;
+
+public sealed class ResourceUsageReliefPageTests
+{
+ private static ResourceUsageSummary Usage(string id, decimal consumption, decimal credits = 0m) => new()
+ {
+ UserId = id, UserName = id + "-name", Consumption = consumption, GrossConsumption = consumption + credits,
+ AppliedCredits = credits, ConsumptionLimit = 1000m, IsQuotaReached = consumption >= 1000m,
+ RemainingConsumption = Math.Max(0m, 1000m - consumption)
+ };
+
+ [AvaloniaTheory]
+ [InlineData("Moderator")]
+ [InlineData("administrator")]
+ [InlineData("Performer")]
+ public async Task Nonadministrators_cannot_load_or_erase_or_open_the_page(string role)
+ {
+ await using var profile = new AdministrationAccessTests.ProfileTransport(role);
+ var session = new SessionStatusViewModel { Api = profile };
+ await session.RefreshAsync();
+ await using var transport = new Transport();
+ using var vm = new ResourceUsageReliefPageViewModel(new(transport, "https://example.invalid/api/v1/"), session);
+ await vm.InitializeAsync();
+ Assert.False(vm.IsAdministrator);
+ Assert.Empty(transport.Requests);
+ Assert.Empty(vm.Users);
+ Assert.False(vm.RefreshCommand.CanExecute(null));
+ Assert.False(vm.EraseCommand.CanExecute(null));
+ var administration = new AdministrationPageViewModel(null, session: session);
+ await administration.OpenResourceUsageReliefCommand.ExecuteAsync(null);
+ Assert.Contains("Administrator", administration.StatusMessage);
+ }
+
+ [AvaloniaFact]
+ public async Task Page_loads_only_exhausted_users_and_confirmed_remission_updates_the_result()
+ {
+ await using var profile = new AdministrationAccessTests.ProfileTransport("Administrator");
+ var session = new SessionStatusViewModel { Api = profile };
+ await session.RefreshAsync();
+ await using var transport = new Transport();
+ using var vm = new ResourceUsageReliefPageViewModel(new(transport, "https://example.invalid/api/v1/"), session);
+ await vm.InitializeAsync("alice");
+ Assert.Equal(2, vm.Users.Count);
+ Assert.Equal("alice", vm.SelectedUsage?.UserId);
+ vm.SearchText = "BOB";
+ Assert.Equal("bob", Assert.Single(vm.FilteredUsers).UserId);
+ vm.SearchText = "";
+ vm.PointsText = "125,50";
+ Assert.Equal(974.5m, vm.ConsumptionAfter);
+ Assert.False(vm.EraseCommand.CanExecute(null));
+ await vm.EraseCommand.ExecuteAsync(null);
+ Assert.Null(transport.Erasure);
+ vm.ConfirmErasure = true;
+ Assert.True(vm.EraseCommand.CanExecute(null));
+ ResourceUsageSummary? updated = null;
+ vm.UsageUpdated += result => updated = result;
+ await vm.EraseCommand.ExecuteAsync(null);
+ Assert.Equal(125.5m, transport.Erasure?.Points);
+ Assert.Equal(20m, transport.Erasure?.ExpectedCredits);
+ Assert.Same(updated, vm.SelectedUsage);
+ Assert.Equal(974.5m, vm.SelectedUsage!.Consumption);
+ Assert.False(vm.SelectedUsage.IsQuotaReached);
+ Assert.False(vm.ConfirmErasure);
+ Assert.False(vm.EraseCommand.CanExecute(null));
+ Assert.Contains("n’est plus atteinte", vm.StatusMessage);
+ Assert.Contains("alice", vm.StatusMessage);
+ Assert.Contains("GET https://example.invalid/api/v1/resource-usage/admin", transport.Requests);
+ Assert.Contains("POST https://example.invalid/api/v1/resource-usage/admin/alice/erase", transport.Requests);
+ }
+
+ [AvaloniaTheory]
+ [InlineData("")]
+ [InlineData("0")]
+ [InlineData("-1")]
+ [InlineData("1100.00000001")]
+ [InlineData("0.000000001")]
+ [InlineData("1,000.00")]
+ [InlineData("NaN")]
+ [InlineData("1e2")]
+ public async Task Invalid_amounts_never_reach_the_API(string amount)
+ {
+ await using var profile = new AdministrationAccessTests.ProfileTransport("Administrator");
+ var session = new SessionStatusViewModel { Api = profile };
+ await session.RefreshAsync();
+ await using var transport = new Transport();
+ using var vm = new ResourceUsageReliefPageViewModel(new(transport, "https://example.invalid/api/v1/"), session);
+ await vm.InitializeAsync("alice");
+ vm.PointsText = amount;
+ vm.ConfirmErasure = true;
+ Assert.False(vm.EraseCommand.CanExecute(null));
+ Assert.NotEmpty(vm.AmountError);
+ await vm.EraseCommand.ExecuteAsync(null);
+ Assert.Null(transport.Erasure);
+ }
+
+ [AvaloniaFact]
+ public async Task Changing_target_or_amount_or_refreshing_invalidates_confirmation()
+ {
+ await using var profile = new AdministrationAccessTests.ProfileTransport("Administrator");
+ var session = new SessionStatusViewModel { Api = profile };
+ await session.RefreshAsync();
+ await using var transport = new Transport();
+ using var vm = new ResourceUsageReliefPageViewModel(new(transport, "https://example.invalid/api/v1/"), session);
+ await vm.InitializeAsync("alice");
+ vm.PointsText = "10";
+ vm.ConfirmErasure = true;
+ vm.PointsText = "20";
+ Assert.False(vm.ConfirmErasure);
+ vm.ConfirmErasure = true;
+ vm.SelectedUsage = vm.Users.Single(u => u.UserId == "bob");
+ Assert.False(vm.ConfirmErasure);
+ Assert.Empty(vm.PointsText);
+ vm.PointsText = "20";
+ vm.ConfirmErasure = true;
+ await vm.RefreshCommand.ExecuteAsync(null);
+ Assert.False(vm.ConfirmErasure);
+ Assert.Empty(vm.PointsText);
+ Assert.Equal("bob", vm.SelectedUsage?.UserId);
+ }
+
+ [AvaloniaFact]
+ public async Task Failure_requires_a_fresh_snapshot_before_retry()
+ {
+ await using var profile = new AdministrationAccessTests.ProfileTransport("Administrator");
+ var session = new SessionStatusViewModel { Api = profile };
+ await session.RefreshAsync();
+ await using var transport = new Transport { FailErase = true };
+ using var vm = new ResourceUsageReliefPageViewModel(new(transport, "https://example.invalid/api/v1/"), session);
+ await vm.InitializeAsync("alice");
+ vm.PointsText = "100";
+ vm.ConfirmErasure = true;
+ await vm.EraseCommand.ExecuteAsync(null);
+ Assert.Contains("Actualisez", vm.StatusMessage);
+ Assert.False(vm.ConfirmErasure);
+ vm.ConfirmErasure = true;
+ Assert.False(vm.EraseCommand.CanExecute(null));
+ transport.FailErase = false;
+ await vm.EraseCommand.ExecuteAsync(null);
+ Assert.Single(transport.Requests, r => r.StartsWith("POST"));
+ await vm.RefreshCommand.ExecuteAsync(null);
+ vm.PointsText = "100";
+ vm.ConfirmErasure = true;
+ Assert.True(vm.EraseCommand.CanExecute(null));
+ }
+
+ [AvaloniaFact]
+ public async Task Logout_clears_private_data_and_a_late_response_cannot_restore_it()
+ {
+ await using var profile = new AdministrationAccessTests.ProfileTransport("Administrator");
+ var session = new SessionStatusViewModel { Api = profile };
+ await session.RefreshAsync();
+ await using var transport = new Transport { Pending = new(TaskCreationOptions.RunContinuationsAsynchronously) };
+ using var vm = new ResourceUsageReliefPageViewModel(new(transport, "https://example.invalid/api/v1/"), session);
+ var loading = vm.InitializeAsync("alice");
+ session.Api = null;
+ session.Refresh();
+ transport.Pending.SetResult([Usage("alice", 1100m)]);
+ await loading;
+ Assert.Empty(vm.Users);
+ Assert.Null(vm.SelectedUsage);
+ Assert.False(vm.IsAdministrator);
+ Assert.False(vm.EraseCommand.CanExecute(null));
+ }
+
+ [AvaloniaTheory]
+ [InlineData(400, 800)]
+ [InlineData(800, 400)]
+ public async Task Page_displays_target_preview_and_explicit_confirmation_and_disposes_on_exit(int width, int height)
+ {
+ await using var profile = new AdministrationAccessTests.ProfileTransport("Administrator");
+ var session = new SessionStatusViewModel { Api = profile };
+ await session.RefreshAsync();
+ await using var transport = new Transport();
+ using var vm = new ResourceUsageReliefPageViewModel(new(transport, "https://example.invalid/api/v1/"), session);
+ await vm.InitializeAsync("alice");
+ vm.PointsText = "100";
+ var page = new ResourceUsageReliefPage { DataContext = vm };
+ var window = new Window { Content = page, Width = width, Height = height };
+ try
+ {
+ window.Show();
+ Dispatcher.UIThread.RunJobs();
+ Assert.Equal("Compte cible : alice", page.FindControl("ReliefTarget")!.Text);
+ Assert.Contains("1000", page.FindControl("ReliefPreview")!.Text);
+ Assert.Same(vm.EraseCommand, page.FindControl