diff --git a/.vscode/launch.json b/.vscode/launch.json
index d8a9f1c8c..1c2776c6f 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -56,7 +56,6 @@
"request": "launch",
"projectPath": "${workspaceFolder}/src/Yavsc.Blogs/Yavsc.Blogs.csproj"
},
-
{
"name": "Test PostIt.Android launch (Xamarin.UITest)",
"type": "coreclr",
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
index 5684b6c7b..3721b437f 100644
--- a/.vscode/tasks.json
+++ b/.vscode/tasks.json
@@ -1,7 +1,6 @@
{
"version": "2.0.0",
"isRoot": true,
-
"tasks": [
{
"label": "build-debug-android",
@@ -136,6 +135,22 @@
"group": {
"kind": "build"
}
+ },
+ {
+ "label": "build-postit-browser",
+ "type": "process",
+ "problemMatcher": ["$msCompile"],
+ "isBuildCommand": true,
+ "isTestCommand": false,
+ "isBackground": true,
+ "command": "dotnet",
+ "args": ["build", "/property:GenerateFullPaths=true"],
+ "options": {
+ "cwd": "src/PostIt/PostIt.Browser"
+ },
+ "group": {
+ "kind": "build"
+ },
}
]
}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ff4698aa0..7df6ba171 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,8 @@
### Added
+* [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.
* [Podcasts/OBS/PostIt] Replace the MediaMTX relay with direct encrypted SRT ingestion managed by [FFmpeg.NET](https://github.com/cmxl/FFmpeg.NET). Reserve bounded UDP listeners on activation, display a secret SRT URL with an empty OBS stream-key field, start on received media, preserve revocation/expiry/quotas and authenticated replay, and invalidate in-memory activations after restart. Remove relay configuration and its authentication endpoint; update deployment, privacy and real-media regressions. Use separate request connections to the shared SQLite test database for reliable concurrent podcast requests.
diff --git a/contrib/template.appsettings-org.json b/contrib/template.appsettings-org.json
index abe88244b..26e987234 100644
--- a/contrib/template.appsettings-org.json
+++ b/contrib/template.appsettings-org.json
@@ -29,7 +29,8 @@
"ApiUrl": "https://preprod-api.$DOMAIN",
"CorsAllowedOrigins": [
"https://preprod-blogs.$DOMAIN",
- "https://preprod-api.$DOMAIN"
+ "https://preprod-api.$DOMAIN",
+ "https://postit.$DOMAIN"
],
"Banner": "/images/banner-dewang.jpg",
"Owner": {
diff --git a/src/PostIt/PostIt.Browser/PostIt.Browser.csproj b/src/PostIt/PostIt.Browser/PostIt.Browser.csproj
index b57da6454..6d5f21f82 100644
--- a/src/PostIt/PostIt.Browser/PostIt.Browser.csproj
+++ b/src/PostIt/PostIt.Browser/PostIt.Browser.csproj
@@ -8,6 +8,7 @@
1.1.0.0
1.1.0-feat-calls.1+472.Branch.feat-calls.Sha.d8200cb98ddef152313ef1f102b866c50f107cbd
1.1.0-feat-calls.1
+ false
@@ -15,4 +16,4 @@
-
\ No newline at end of file
+
diff --git a/src/PostIt/PostIt.Desktop/Program.cs b/src/PostIt/PostIt.Desktop/Program.cs
index af8867141..ef8da445d 100644
--- a/src/PostIt/PostIt.Desktop/Program.cs
+++ b/src/PostIt/PostIt.Desktop/Program.cs
@@ -14,6 +14,8 @@ sealed class Program
public static void Main(string[] args)
{
Platform.IsPodcastSupported = true;
+ Platform.CreateBrowser = () => new CustomSchemeBrowser("postit://callback");
+
CLIOptionHandler.HandleArgs(args);
// Short-circuit 2nd-instance launches (OS handing us the
diff --git a/src/PostIt/PostIt/Services/Platform.cs b/src/PostIt/PostIt/Services/Platform.cs
index 20725f6b6..ea6768505 100644
--- a/src/PostIt/PostIt/Services/Platform.cs
+++ b/src/PostIt/PostIt/Services/Platform.cs
@@ -69,7 +69,7 @@ public static class Platform
/// LoginAsync will surface a clear error.
///
public static System.Func? CreateBrowser { get; set; } =
- () => new CustomSchemeBrowser(CustomScheme);
+ () => null;
///
/// Optional platform hook used by the shared billing form to request a
diff --git a/src/PostIt/PostIt/ViewModels/Settings/AuthenticationSettings.cs b/src/PostIt/PostIt/ViewModels/Settings/AuthenticationSettings.cs
index 3c23187e4..08ff45364 100644
--- a/src/PostIt/PostIt/ViewModels/Settings/AuthenticationSettings.cs
+++ b/src/PostIt/PostIt/ViewModels/Settings/AuthenticationSettings.cs
@@ -17,6 +17,8 @@ public partial class AuthenticationSettings : ObservableObject
/// in PostIt.Android/Properties/AndroidManifest.xml must match.
///
public const string AndroidRedirectUri = "android://postit-signin";
+ public const string BrowserRedirectUri = "https://postit.pschneider.fr/callback";
+
public const string DefaultAuthority = "https://yavsc.pschneider.fr";
diff --git a/src/PostIt/PostIt/ViewModels/Settings/Settings.cs b/src/PostIt/PostIt/ViewModels/Settings/Settings.cs
index 260c1f93b..430419483 100644
--- a/src/PostIt/PostIt/ViewModels/Settings/Settings.cs
+++ b/src/PostIt/PostIt/ViewModels/Settings/Settings.cs
@@ -450,7 +450,7 @@ public partial class Settings : ViewModelBase
this.Authentication.ClientId = string.IsNullOrWhiteSpace(settings.Authentication.ClientId) ?
AuthenticationSettings.DefaultClientId : settings.Authentication.ClientId;
this.Authentication.RedirectUri = string.IsNullOrWhiteSpace(settings.Authentication.RedirectUri) ?
- AuthenticationSettings.DesktopRedirectUri : settings.Authentication.RedirectUri;
+ AuthenticationSettings.BrowserRedirectUri : settings.Authentication.RedirectUri;
if (settings.Authentication.Scopes is null || settings.Authentication.Scopes.Length == 0)
{
this.Authentication.Scopes = AuthenticationSettings.DefaultScopes;
@@ -513,7 +513,7 @@ public partial class Settings : ViewModelBase
{
Authority = AuthenticationSettings.DefaultAuthority,
ClientId = AuthenticationSettings.DefaultClientId,
- RedirectUri = AuthenticationSettings.DesktopRedirectUri,
+ RedirectUri = AuthenticationSettings.BrowserRedirectUri,
Scopes = AuthenticationSettings.DefaultScopes
};
this.DarkMode = false;
diff --git a/src/Yavsc.Server/Helpers/ResourceUsageTelemetryMiddleware.cs b/src/Yavsc.Server/Helpers/ResourceUsageTelemetryMiddleware.cs
index 289e659f2..aa2f91b9e 100644
--- a/src/Yavsc.Server/Helpers/ResourceUsageTelemetryMiddleware.cs
+++ b/src/Yavsc.Server/Helpers/ResourceUsageTelemetryMiddleware.cs
@@ -31,6 +31,13 @@ public sealed class ResourceUsageTelemetryMiddleware(
await ResourceUsageTracker.RecordAsync(admissionScope.ServiceProvider.GetRequiredService(),
userId, userName, apiCalls: 1m, bandwidthMb: ToMb(requestBytes), actorUserId: userId);
}
+ else if (context.User.IsInMsRole("Administrator"))
+ {
+ using var admissionScope = scopeFactory.CreateScope();
+ await ResourceUsageTracker.RecordAsync(admissionScope.ServiceProvider.GetRequiredService(),
+ userId, userName, apiCalls: 1m, bandwidthMb: ToMb(requestBytes), actorUserId: userId,
+ cancellationToken: context.RequestAborted);
+ }
else if (!await usage.TryAdmitAsync(userId, userName, 1m, ToMb(requestBytes), 0,
context.RequestAborted))
{
diff --git a/src/test/Yavsc.Server.Tests/ResourceUsageTests.cs b/src/test/Yavsc.Server.Tests/ResourceUsageTests.cs
index e0d37db87..a6c006d7d 100644
--- a/src/test/Yavsc.Server.Tests/ResourceUsageTests.cs
+++ b/src/test/Yavsc.Server.Tests/ResourceUsageTests.cs
@@ -287,6 +287,31 @@ public sealed class ResourceUsageTests
.ResourceUsageRecords.ToListAsync(TestContext.Current.CancellationToken));
}
+ [Fact]
+ public async Task Administrator_request_bypasses_quota_rejection_and_remains_accounted()
+ {
+ using var provider = NewProvider(o => o.DefaultLimit = 0.01m);
+ using var scope = provider.CreateScope();
+ var context = NewContext(scope.ServiceProvider);
+ context.User.AddIdentity(new ClaimsIdentity([
+ new Claim("http://schemas.microsoft.com/ws/2008/06/identity/claims/role", "Administrator")
+ ], "Bearer"));
+ var ran = false;
+ var middleware = new ResourceUsageTelemetryMiddleware(
+ _ => { ran = true; return Task.CompletedTask; },
+ provider.GetRequiredService(),
+ NullLogger.Instance);
+
+ await middleware.InvokeAsync(context, scope.ServiceProvider.GetRequiredService());
+
+ Assert.True(ran);
+ Assert.Equal(StatusCodes.Status200OK, context.Response.StatusCode);
+ var summary = await scope.ServiceProvider.GetRequiredService()
+ .GetCurrentAsync("alice", "alice", TestContext.Current.CancellationToken);
+ Assert.Equal(1m, summary.ApiCalls);
+ Assert.True(summary.IsQuotaReached);
+ }
+
[Fact]
public async Task Tracked_storage_replacement_and_deletion_refund_only_their_original_volume()
{