Skip to content

armgit / ente

Public Imported from GitHub
0

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

Remove sensitive/private info from logging statements

ashilkn5e9be9001316
diff --git a/mobile/apps/locker/lib/l10n/app_localizations.dart b/mobile/apps/locker/lib/l10n/app_localizations.dart
index 2bf04d322e..82ac2504c3 100644
--- a/mobile/apps/locker/lib/l10n/app_localizations.dart
+++ b/mobile/apps/locker/lib/l10n/app_localizations.dart
@@ -2233,13 +2233,13 @@ abstract class AppLocalizations {
/// No description provided for @unlockLockerPaidPlanTitle.
///
/// In en, this message translates to:
- /// **'Coming soon!'**
+ /// **'Unlock Locker with a paid plan.'**
String get unlockLockerPaidPlanTitle;
/// No description provided for @unlockLockerPaidPlanBody.
///
/// In en, this message translates to:
- /// **'Locker is currently available only to paid customers of Ente Photos.'**
+ /// **'Locker is available only to Ente photos paid users. Upgrade to a paid plan from Photos to use Locker'**
String get unlockLockerPaidPlanBody;
/// No description provided for @checkoutEntePhotos.
@@ -2496,8 +2496,9 @@ AppLocalizations lookupAppLocalizations(Locale locale) {
}
throw FlutterError(
- 'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely '
- 'an issue with the localizations generation tool. Please file an issue '
- 'on GitHub with a reproducible sample app and the gen-l10n configuration '
- 'that was used.');
+ 'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely '
+ 'an issue with the localizations generation tool. Please file an issue '
+ 'on GitHub with a reproducible sample app and the gen-l10n configuration '
+ 'that was used.',
+ );
}
diff --git a/mobile/apps/locker/lib/l10n/app_localizations_en.dart b/mobile/apps/locker/lib/l10n/app_localizations_en.dart
index d232f45145..2b738e1dc6 100644
--- a/mobile/apps/locker/lib/l10n/app_localizations_en.dart
+++ b/mobile/apps/locker/lib/l10n/app_localizations_en.dart
@@ -1155,7 +1155,10 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String uploadedFilesProgressWithError(
- int completed, int total, String error) {
+ int completed,
+ int total,
+ String error,
+ ) {
return 'Uploaded $completed/$total items... ($error)';
}
@@ -1273,11 +1276,11 @@ class AppLocalizationsEn extends AppLocalizations {
String get loginToEnteAccount => 'Log in to your Ente account';
@override
- String get unlockLockerPaidPlanTitle => 'Coming soon!';
+ String get unlockLockerPaidPlanTitle => 'Unlock Locker with a paid plan.';
@override
String get unlockLockerPaidPlanBody =>
- 'Locker is currently available only to paid customers of Ente Photos.';
+ 'Locker is available only to Ente photos paid users. Upgrade to a paid plan from Photos to use Locker';
@override
String get checkoutEntePhotos => 'Checkout Ente Photos';
diff --git a/mobile/apps/locker/lib/services/collections/collections_service.dart b/mobile/apps/locker/lib/services/collections/collections_service.dart
index a02ed234aa..78e08dd151 100644
--- a/mobile/apps/locker/lib/services/collections/collections_service.dart
+++ b/mobile/apps/locker/lib/services/collections/collections_service.dart
@@ -261,7 +261,8 @@ class CollectionService {
}) async {
try {
await _apiClient.addToCollection(collection, [file]);
- _logger.info("Added file ${file.title} to collection ${collection.id}");
+ _logger.info(
+ "Added file (ID: ${file.uploadedFileID}) to collection ${collection.id}",);
// Update local database immediately
await _db.addFilesToCollection(collection, [file]);
@@ -307,7 +308,7 @@ class CollectionService {
collection,
newName,
);
- _logger.info("Renamed collection ${collection.id} to $newName");
+ _logger.info("Renamed collection ${collection.id}");
// Let sync update the local state
await sync();
} catch (e, s) {
@@ -422,7 +423,7 @@ class CollectionService {
// Add to target collection
await _db.addFilesToCollection(to, files);
-
+
// Let sync update the local state to ensure consistency
if (runSync) {
await sync();
@@ -739,7 +740,7 @@ class CollectionService {
final random = Random();
final randomName = availableNames[random.nextInt(availableNames.length)];
- _logger.info("Selected random unused collection name: $randomName");
+ _logger.info("Selected random unused collection name");
return randomName;
} catch (e) {
_logger.severe("Failed to get random unused collection name: $e");
@@ -773,7 +774,8 @@ class CollectionService {
collectionKey,
);
- _logger.info("Successfully decrypted file key for file ${file.title}");
+ _logger.info(
+ "Successfully decrypted file key for file (ID: ${file.uploadedFileID})",);
return fileKey;
} catch (e) {
_logger.severe("Failed to get file key: $e");
diff --git a/mobile/apps/locker/lib/services/files/upload/file_upload_service.dart b/mobile/apps/locker/lib/services/files/upload/file_upload_service.dart
index d88e98cf20..48c7f40db5 100644
--- a/mobile/apps/locker/lib/services/files/upload/file_upload_service.dart
+++ b/mobile/apps/locker/lib/services/files/upload/file_upload_service.dart
@@ -24,7 +24,6 @@ import 'package:locker/services/files/upload/models/upload_url.dart';
import "package:locker/utils/crypto_helper.dart";
import 'package:locker/utils/data_util.dart';
import 'package:logging/logging.dart';
-import "package:path/path.dart";
import 'package:shared_preferences/shared_preferences.dart';
import "package:uuid/uuid.dart";
@@ -101,7 +100,7 @@ class FileUploader {
Collection collection,
) async {
try {
- _logger.info('Starting upload of info file: ${infoFile.title}');
+ _logger.info('Starting upload of info file');
// Generate a file key for encryption
final fileKey = CryptoUtil.generateKey();
@@ -147,10 +146,11 @@ class FileUploader {
pubMetadataRequest,
);
- _logger.info('Successfully uploaded info file: ${uploadedFile.title}');
+ _logger.info(
+ 'Successfully uploaded info file (ID: ${uploadedFile.uploadedFileID})',);
return uploadedFile;
} catch (e, s) {
- _logger.severe('Failed to upload info file: ${infoFile.title}', e, s);
+ _logger.severe('Failed to upload info file', e, s);
rethrow;
}
}
@@ -239,7 +239,7 @@ class FileUploader {
await _tryToUpload(file, collection, forcedUpload).timeout(
kFileUploadTimeout,
onTimeout: () {
- final message = "Upload timed out for file ${basename(file.path)}";
+ final message = "Upload timed out for file";
_logger.warning(message);
throw TimeoutException(message);
},
@@ -316,10 +316,7 @@ class FileUploader {
// or not.
var uploadHardFailure = false;
try {
- _logger.info(
- 'starting ${forcedUpload ? 'forced' : ''} '
- 'upload of ${basename(file.path)}',
- );
+ _logger.info('starting ${forcedUpload ? 'forced' : ''} upload');
Uint8List? key;
final encryptedFileExists = File(encryptedFilePath).existsSync();
@@ -332,7 +329,7 @@ class FileUploader {
// Validate source file before encryption
final sourceFileSize = await file.length();
if (sourceFileSize == 0) {
- throw Exception('Source file is empty (0 bytes): ${file.path}');
+ throw Exception('Source file is empty (0 bytes)');
}
_logger.info('Source file size: $sourceFileSize bytes');
@@ -454,7 +451,7 @@ class FileUploader {
metadataDecryptionHeader,
pubMetadata: pubMetadataRequest,
);
- _logger.info("File upload complete for $remoteFile");
+ _logger.info("File upload complete for ID: ${remoteFile.uploadedFileID}");
uploadCompleted = true;
return remoteFile;
} catch (e, s) {
@@ -464,10 +461,10 @@ class FileUploader {
e is SilentlyCancelUploadsError ||
e is InvalidFileError ||
e is FileTooLargeForPlanError)) {
- _logger.severe("File upload failed for ${basename(file.path)}", e, s);
+ _logger.severe("File upload failed", e, s);
}
if (e is InvalidFileError) {
- _logger.severe("File upload ignored for ${basename(file.path)}", e);
+ _logger.severe("File upload ignored", e);
}
if ((e is StorageLimitExceededError ||
e is FileTooLargeForPlanError ||
@@ -627,9 +624,7 @@ class FileUploader {
_onStorageLimitExceeded();
} else if (attempt < kMaximumUploadAttempts && statusCode == -1) {
// retry when DioException contains no response/status code
- _logger.info(
- "Upload file (${file.displayName}) failed, will retry in 3 seconds",
- );
+ _logger.info("Upload failed, will retry in 3 seconds");
await Future.delayed(const Duration(seconds: 3));
return _uploadFile(
file,
@@ -648,7 +643,7 @@ class FileUploader {
pubMetadata: pubMetadata,
);
} else {
- _logger.severe("Failed to upload file ${file.displayName}", e);
+ _logger.severe("Failed to upload file", e);
}
rethrow;
}
@@ -701,7 +696,6 @@ class FileUploader {
int attempt = 1,
}) async {
final startTime = DateTime.now().millisecondsSinceEpoch;
- final fileName = basename(file.path);
try {
await _dio.put(
uploadURL.url,
@@ -714,7 +708,7 @@ class FileUploader {
),
);
_logger.info(
- "Uploaded object $fileName of size: ${formatBytes(fileSize)} at speed: ${(fileSize / (DateTime.now().millisecondsSinceEpoch - startTime)).toStringAsFixed(2)} KB/s",
+ "Uploaded object of size: ${formatBytes(fileSize)} at speed: ${(fileSize / (DateTime.now().millisecondsSinceEpoch - startTime)).toStringAsFixed(2)} KB/s",
);
return uploadURL.objectKey;
@@ -722,7 +716,7 @@ class FileUploader {
if (e.message?.startsWith("HttpException: Content size") ?? false) {
rethrow;
} else if (attempt < kMaximumUploadAttempts) {
- _logger.info("Upload failed for $fileName, retrying");
+ _logger.info("Upload failed, retrying");
final newUploadURL = await _getUploadURL(
contentLength: fileSize,
md5: md5,
@@ -735,10 +729,7 @@ class FileUploader {
attempt: attempt + 1,
);
} else {
- _logger.info(
- "Failed to upload file ${basename(file.path)} after $attempt attempts",
- e,
- );
+ _logger.info("Failed to upload file after $attempt attempts", e);
rethrow;
}
}
diff --git a/mobile/apps/locker/lib/services/info_file_service.dart b/mobile/apps/locker/lib/services/info_file_service.dart
index da4b406230..ff64c57534 100644
--- a/mobile/apps/locker/lib/services/info_file_service.dart
+++ b/mobile/apps/locker/lib/services/info_file_service.dart
@@ -45,7 +45,8 @@ class InfoFileService {
// Upload the file using the special info file upload method
final uploadedFile = await _uploadInfoFile(enteFile, collection);
- _logger.info('Successfully uploaded info file: ${uploadedFile.title}');
+ _logger.info(
+ 'Successfully uploaded info file (ID: ${uploadedFile.uploadedFileID})',);
return uploadedFile;
} catch (e, s) {
_logger.severe('Failed to create and upload info file', e, s);
@@ -84,7 +85,8 @@ class InfoFileService {
);
if (success) {
- _logger.info('Successfully updated info file: $updatedTitle');
+ _logger.info(
+ 'Successfully updated info file (ID: ${existingFile.uploadedFileID})',);
return true;
} else {
throw Exception('Failed to update file metadata on server');
diff --git a/mobile/apps/locker/lib/ui/mixins/search_mixin.dart b/mobile/apps/locker/lib/ui/mixins/search_mixin.dart
index 00c282ee1a..5dadbc0af5 100644
--- a/mobile/apps/locker/lib/ui/mixins/search_mixin.dart
+++ b/mobile/apps/locker/lib/ui/mixins/search_mixin.dart
@@ -266,7 +266,7 @@ mixin SearchMixin<T extends StatefulWidget> on State<T> {
files: collectionNameMatches ? files : [],
);
} catch (e) {
- debugPrint('Error searching in collection ${collection.displayName}: $e');
+ debugPrint('Error searching in collection (ID: ${collection.id}): $e');
final collectionNameMatches = _containsQuery(
collection.displayName ?? '',
query,
diff --git a/mobile/apps/locker/lib/ui/pages/home_page.dart b/mobile/apps/locker/lib/ui/pages/home_page.dart
index 757bf870cb..1298e897d0 100644
--- a/mobile/apps/locker/lib/ui/pages/home_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/home_page.dart
@@ -318,7 +318,7 @@ class _HomePageState extends UploaderPageState<HomePage>
_logger
.info('Received shared media files via stream: ${value.length}');
for (var file in value) {
- _logger.info('Shared file: ${file.path}, type: ${file.type}');
+ _logger.info('Shared file received, type: ${file.type}');
}
if (value.isNotEmpty) {
_handleSharedFiles(value);
@@ -349,7 +349,7 @@ class _HomePageState extends UploaderPageState<HomePage>
_logger
.info('Found initial shared media files: ${initialMedia.length}');
for (var file in initialMedia) {
- _logger.info('Initial shared file: ${file.path}, type: ${file.type}');
+ _logger.info('Initial shared file, type: ${file.type}');
}
await _handleSharedFiles(initialMedia);
} else {
@@ -370,14 +370,14 @@ class _HomePageState extends UploaderPageState<HomePage>
try {
for (final sharedFile in sharedFiles) {
- _logger.info('Processing shared file: ${sharedFile.path}');
+ _logger.info('Processing shared file');
if (sharedFile.path.isNotEmpty) {
final file = File(sharedFile.path);
if (await file.exists()) {
- _logger.info('File exists, uploading: ${sharedFile.path}');
+ _logger.info('File exists, uploading');
await uploadFiles([file]);
} else {
- _logger.warning('Shared file does not exist: ${sharedFile.path}');
+ _logger.warning('Shared file does not exist');
}
} else {
_logger.warning('Shared file has empty path');
diff --git a/mobile/apps/locker/lib/ui/viewer/actions/file_selection_overlay_bar.dart b/mobile/apps/locker/lib/ui/viewer/actions/file_selection_overlay_bar.dart
index 62e03ab90a..9428167d66 100644
--- a/mobile/apps/locker/lib/ui/viewer/actions/file_selection_overlay_bar.dart
+++ b/mobile/apps/locker/lib/ui/viewer/actions/file_selection_overlay_bar.dart
@@ -480,8 +480,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {
for (final file in files) {
_logger.fine(
- 'Processing file ${file.uploadedFileID} (${file.displayName}) '
- 'for add-to operation.',
+ 'Processing file ${file.uploadedFileID} for add-to operation',
);
List<Collection> currentCollections;
try {
diff --git a/mobile/apps/locker/lib/utils/file_actions.dart b/mobile/apps/locker/lib/utils/file_actions.dart
index 9c3051d7ee..3fb015aa8d 100644
--- a/mobile/apps/locker/lib/utils/file_actions.dart
+++ b/mobile/apps/locker/lib/utils/file_actions.dart
@@ -137,7 +137,7 @@ class FileActions {
final collection =
updatedAllCollections.firstWhere((c) => c.id == collectionId);
_logger.severe(
- 'Failed to remove file from ${collection.name}: $e',
+ 'Failed to remove file from collection (ID: ${collection.id}): $e',
);
}
}
@@ -154,7 +154,7 @@ class FileActions {
);
} catch (e) {
_logger.severe(
- 'Failed to move file to collection ${collection.name}: $e',
+ 'Failed to move file to collection (ID: ${collection.id}): $e',
);
}
}
diff --git a/mobile/apps/locker/lib/utils/file_util.dart b/mobile/apps/locker/lib/utils/file_util.dart
index e00d80c69d..b0e50c4019 100644
--- a/mobile/apps/locker/lib/utils/file_util.dart
+++ b/mobile/apps/locker/lib/utils/file_util.dart
@@ -139,7 +139,8 @@ class FileUtil {
// Skip info items for now; they are meant to be viewed in-app.
if (InfoFileService.instance.isInfoFile(file)) {
- _logger.fine('Skipping info file download for ${file.displayName}');
+ _logger
+ .fine('Skipping info file download (ID: ${file.uploadedFileID})');
if (!hasShownInfoSkipToast) {
hasShownInfoSkipToast = true;
showToast(
@@ -175,7 +176,7 @@ class FileUtil {
final message = savedNames.length == 1
? '${savedNames.first} saved'
: '${savedNames.length} files saved';
- _logger.info('Files saved: $savedPaths');
+ _logger.info('${savedPaths.length} files saved');
showToast(context, message);
}
@@ -226,7 +227,7 @@ class FileUtil {
);
if (decryptedFile == null) {
- throw Exception('Failed to download ${file.displayName}');
+ throw Exception('Failed to download file (ID: ${file.uploadedFileID})');
}
try {
@@ -283,7 +284,7 @@ class FileUtil {
mimeType: MimeType.other,
);
- _logger.info('File saved: $savedPath');
+ _logger.info('File saved successfully');
return savedPath;
} catch (e, s) {
_logger.severe('Failed to save file', e, s);
diff --git a/mobile/apps/locker/macos/Flutter/GeneratedPluginRegistrant.swift b/mobile/apps/locker/macos/Flutter/GeneratedPluginRegistrant.swift
index 1eca850c4c..44fd18cf7d 100644
--- a/mobile/apps/locker/macos/Flutter/GeneratedPluginRegistrant.swift
+++ b/mobile/apps/locker/macos/Flutter/GeneratedPluginRegistrant.swift
@@ -34,7 +34,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin"))
FlutterLocalAuthenticationPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalAuthenticationPlugin"))
FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin"))
- FLALocalAuthPlugin.register(with: registry.registrar(forPlugin: "FLALocalAuthPlugin"))
+ LocalAuthPlugin.register(with: registry.registrar(forPlugin: "LocalAuthPlugin"))
OpenFilePlugin.register(with: registry.registrar(forPlugin: "OpenFilePlugin"))
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))