add admin page, fix no legs infinite load on dashboard
All checks were successful
Release / meta (push) Successful in 8s
Release / linux-build (push) Successful in 6m49s
Release / web-build (push) Successful in 6m23s
Release / android-build (push) Successful in 16m56s
Release / release-master (push) Successful in 30s
Release / release-dev (push) Successful in 32s

This commit is contained in:
2026-01-02 18:49:14 +00:00
parent 29cecf0ded
commit 2fa66ff9c6
11 changed files with 691 additions and 89 deletions

View File

@@ -104,24 +104,64 @@ class DestinationObject {
}
class UserData {
const UserData(this.username, this.fullName, this.userId, this.email);
const UserData({
required this.username,
required this.fullName,
required this.userId,
required this.email,
bool? elevated,
bool? disabled,
}) : elevated = elevated ?? false,
disabled = disabled ?? false;
final String userId;
final String username;
final String fullName;
final String email;
final bool elevated;
final bool disabled;
}
class AuthenticatedUserData extends UserData {
const AuthenticatedUserData({
required String userId,
required String username,
required String fullName,
required String email,
required super.userId,
required super.username,
required super.fullName,
required super.email,
bool? elevated,
bool? isElevated,
bool? disabled,
bool? isDisabled,
required this.accessToken,
}) : super(username, fullName, userId, email);
}) : super(
elevated: (elevated ?? false) || (isElevated ?? false),
disabled: (disabled ?? false) || (isDisabled ?? false),
);
final String accessToken;
bool get isElevated => elevated;
}
class UserSummary extends UserData {
const UserSummary({
required super.username,
required super.fullName,
required super.userId,
required super.email,
super.elevated = false,
super.disabled = false,
});
String get displayName => fullName.isNotEmpty ? fullName : username;
factory UserSummary.fromJson(Map<String, dynamic> json) => UserSummary(
username: _asString(json['username'] ?? json['user_name']),
fullName: _asString(json['full_name'] ?? json['name']),
userId: _asString(json['user_id'] ?? json['id']),
email: _asString(json['email']),
elevated: _asBool(json['elevated'] ?? json['is_elevated'], false),
disabled: _asBool(json['disabled'], false),
);
}
class HomepageStats {
@@ -170,10 +210,13 @@ class HomepageStats {
user: userData == null
? null
: UserData(
userData['username'] ?? '',
userData['full_name'] ?? '',
userData['user_id'] ?? '',
userData['email'] ?? '',
username: userData['username'] ?? '',
fullName: userData['full_name'] ?? '',
userId: userData['user_id'] ?? '',
email: userData['email'] ?? '',
elevated:
_asBool(userData['elevated'] ?? userData['is_elevated'], false),
disabled: _asBool(userData['disabled'], false),
),
);
}
@@ -1179,6 +1222,7 @@ class UserNotification {
final int id;
final String title;
final String body;
final String channel;
final DateTime? createdAt;
final bool dismissed;
@@ -1186,6 +1230,7 @@ class UserNotification {
required this.id,
required this.title,
required this.body,
required this.channel,
required this.createdAt,
required this.dismissed,
});
@@ -1202,6 +1247,7 @@ class UserNotification {
id: _asInt(json['notification_id'] ?? json['id']),
title: _asString(json['title']),
body: _asString(json['body']),
channel: _asString(json['channel']),
createdAt: createdAt,
dismissed: _asBool(json['dismissed'] ?? false, false),
);