feat(auth): deprecate API keys and enforce JWT token usage

This commit is contained in:
cogwheel0
2025-12-05 13:50:26 +05:30
parent 58c6fcba1c
commit bb64633e57
14 changed files with 108 additions and 34 deletions

View File

@@ -62,6 +62,14 @@ class RouterNotifier extends ChangeNotifier {
final reviewerMode = ref.read(reviewerModeProvider);
final activeServerAsync = ref.read(activeServerProvider);
// Check for API key forced logout first - redirect to authentication
final authSnapshot = ref
.read(authStateManagerProvider)
.maybeWhen(data: (s) => s, orElse: () => null);
if (authSnapshot?.error?.contains('apiKey') == true) {
return location == Routes.authentication ? null : Routes.authentication;
}
if (reviewerMode) {
// Stay on whatever route if already in chat; otherwise go to chat
if (location == Routes.chat) return null;