Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Minor fixes

Neeraj Gupta53ea9c96f317
diff --git a/mobile/apps/photos/lib/models/social/anon_profile.dart b/mobile/apps/photos/lib/models/social/anon_profile.dart
index 5f1ba2a4e1..bcc5fa0ef8 100644
--- a/mobile/apps/photos/lib/models/social/anon_profile.dart
+++ b/mobile/apps/photos/lib/models/social/anon_profile.dart
@@ -1,9 +1,7 @@
-import 'dart:convert';
-
/// Decrypted anonymous user profile stored locally.
///
-/// Stores the decrypted profile data (JSON) for anonymous users who interact
-/// via shared album links. The raw JSON is preserved for forward compatibility.
+/// Stores the decrypted display name payload for anonymous users who interact
+/// via shared album links.
class AnonProfile {
/// The anonymous user ID (e.g., "anon_abc123")
final String anonUserID;
@@ -11,9 +9,7 @@ class AnonProfile {
/// The collection this profile belongs to
final int collectionID;
- /// The decrypted profile data as raw JSON string.
- /// Format: {"userName": "..."}
- /// May contain additional fields in future versions.
+ /// The decrypted display name payload as raw string.
final String data;
/// When the profile was created (microseconds since epoch)
@@ -30,16 +26,9 @@ class AnonProfile {
required this.updatedAt,
});
- /// Extracts the display name from the JSON data.
- ///
- /// Returns the userName field if present, otherwise returns null.
+ /// Extracts the trimmed display name from the payload.
String? get displayName {
- if (data.isEmpty) return null;
- try {
- final json = jsonDecode(data) as Map<String, dynamic>;
- return json['userName'] as String?;
- } catch (_) {
- return null;
- }
+ final trimmed = data.trim();
+ return trimmed.isEmpty ? null : trimmed;
}
}
diff --git a/mobile/apps/photos/lib/services/social_service.dart b/mobile/apps/photos/lib/services/social_service.dart
index 16da09b68e..6d7c82eec8 100644
--- a/mobile/apps/photos/lib/services/social_service.dart
+++ b/mobile/apps/photos/lib/services/social_service.dart
@@ -502,8 +502,8 @@ class SocialService {
/// Decrypts anonymous profile data.
///
- /// Returns the decrypted JSON string, or empty string if decryption fails.
- /// The payload is JSON: {"userName": "..."} (may have more fields in future).
+ /// Returns the decrypted display-name string, or empty string if decryption
+ /// fails.
String decryptAnonProfile(String? cipher, String? nonce, int collectionID) {
if (cipher == null || nonce == null || cipher.isEmpty || nonce.isEmpty) {
return '';