implemented a new telemetry heartbeat and client-side error reporting system for MarianumConnect; replaced legacy mhsl.eu user index updates with a POST me/telemetry heartbeat using stable, securely-stored device identifiers; integrated global Flutter and platform error handlers to report uncaught exceptions with session-based deduplication and rate limiting.

This commit is contained in:
2026-07-06 22:11:23 +02:00
parent 2be5051d12
commit ddbb3fbc19
9 changed files with 238 additions and 97 deletions
@@ -1,24 +0,0 @@
import 'package:json_annotation/json_annotation.dart';
part 'update_user_index_params.g.dart';
@JsonSerializable()
class UpdateUserIndexParams {
String user;
String username;
String device;
int appVersion;
String deviceInfo;
UpdateUserIndexParams({
required this.user,
required this.username,
required this.device,
required this.appVersion,
required this.deviceInfo,
});
factory UpdateUserIndexParams.fromJson(Map<String, dynamic> json) =>
_$UpdateUserIndexParamsFromJson(json);
Map<String, dynamic> toJson() => _$UpdateUserIndexParamsToJson(this);
}
@@ -1,27 +0,0 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'update_user_index_params.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
UpdateUserIndexParams _$UpdateUserIndexParamsFromJson(
Map<String, dynamic> json,
) => UpdateUserIndexParams(
user: json['user'] as String,
username: json['username'] as String,
device: json['device'] as String,
appVersion: (json['appVersion'] as num).toInt(),
deviceInfo: json['deviceInfo'] as String,
);
Map<String, dynamic> _$UpdateUserIndexParamsToJson(
UpdateUserIndexParams instance,
) => <String, dynamic>{
'user': instance.user,
'username': instance.username,
'device': instance.device,
'appVersion': instance.appVersion,
'deviceInfo': instance.deviceInfo,
};
@@ -1,42 +0,0 @@
import 'dart:async';
import 'dart:convert';
import 'dart:developer';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:http/http.dart' as http;
import 'package:package_info_plus/package_info_plus.dart';
import '../../../../../model/account_data.dart';
import '../../../mhsl_api.dart';
import 'update_user_index_params.dart';
class UpdateUserIndex extends MhslApi<void> {
UpdateUserIndexParams params;
UpdateUserIndex(this.params) : super('server/userIndex/update');
@override
void assemble(String raw) {}
@override
Future<http.Response> request(Uri uri) {
var data = jsonEncode(params.toJson());
log('Updating userindex: ${data.length}');
return http.post(uri, body: data);
}
static Future<void> index() async {
unawaited(
UpdateUserIndex(
UpdateUserIndexParams(
username: AccountData().getUsername(),
user: AccountData().getUserSecret(),
device: await AccountData().getDeviceId(),
appVersion: int.parse((await PackageInfo.fromPlatform()).buildNumber),
deviceInfo: jsonEncode(
(await DeviceInfoPlugin().deviceInfo).data,
).toString(),
),
).run(),
);
}
}