mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-14 00:12:19 -06:00
fix: Enable logging in production
This commit is contained in:
22
lib/features/logging/utils/redaction_utils.dart
Normal file
22
lib/features/logging/utils/redaction_utils.dart
Normal file
@@ -0,0 +1,22 @@
|
||||
(String username, String obscuredUrl) splitRedactUserId(String userId) {
|
||||
final parts = userId.split('@');
|
||||
if (parts.length != 2) {
|
||||
return ('unknown', 'unknown');
|
||||
}
|
||||
|
||||
final username = parts.first;
|
||||
final serverUrl = parts.last;
|
||||
final uri = Uri.parse(serverUrl);
|
||||
final hostLen = uri.host.length;
|
||||
final obscuredUrl = uri.scheme +
|
||||
"://" +
|
||||
uri.host.substring(0, 2) +
|
||||
List.filled(hostLen - 4, '*').join() +
|
||||
uri.host.substring(uri.host.length - 2, uri.host.length);
|
||||
return (username, obscuredUrl);
|
||||
}
|
||||
|
||||
String redactUserId(String userId) {
|
||||
final (username, obscuredUrl) = splitRedactUserId(userId);
|
||||
return '$username@$obscuredUrl';
|
||||
}
|
||||
Reference in New Issue
Block a user