π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob] Remove hardcoded urls for public collection
Neeraj Gupta79e059ccc270
diff --git a/mobile/lib/models/file/file.dart b/mobile/lib/models/file/file.dartindex a11d2071a9..937bee0cb1 100644--- a/mobile/lib/models/file/file.dart+++ b/mobile/lib/models/file/file.dart@@ -265,6 +265,36 @@ class EnteFile {}}+ String get publicDownloadUrl {+ if (localFileServer.isNotEmpty) {+ return "$localFileServer/$uploadedFileID";+ }+ final endpoint = Configuration.instance.getHttpEndpoint();+ if (endpoint != kDefaultProductionEndpoint || flagService.disableCFWorker) {+ return endpoint ++ "/public-collection/files/download/" ++ uploadedFileID.toString();+ } else {+ return "https://public-albums.ente.io/download/?fileID=" ++ uploadedFileID.toString();+ }+ }++ String get pubPreviewUrl {+ if (localFileServer.isNotEmpty) {+ return "$localFileServer/thumb/$uploadedFileID";+ }+ final endpoint = Configuration.instance.getHttpEndpoint();+ if (endpoint != kDefaultProductionEndpoint || flagService.disableCFWorker) {+ return endpoint ++ "/public-collection/files/preview/" ++ uploadedFileID.toString();+ } else {+ return "https://public-albums.ente.io/preview/?fileID=" ++ uploadedFileID.toString();+ }+ }+String? get caption {return pubMagicMetadata?.caption;}diff --git a/mobile/lib/utils/file_download_util.dart b/mobile/lib/utils/file_download_util.dartindex bb5fbeb323..3b6842a740 100644--- a/mobile/lib/utils/file_download_util.dart+++ b/mobile/lib/utils/file_download_util.dart@@ -48,7 +48,7 @@ Future<File?> downloadAndDecryptPublicFile(if (authJWTToken != null) "X-Auth-Access-Token-JWT": authJWTToken,};final response = (await NetworkClient.instance.getDio().download(- "https://public-albums.ente.io/download/?fileID=${file.uploadedFileID}",+ file.publicDownloadUrl,encryptedFilePath,options: Options(headers: headers,@@ -203,8 +203,8 @@ Future<void> downloadToGallery(EnteFile file) async {savedAsset = await PhotoManager.editor.saveImageWithPath(fileToSave!.path, title: file.title!);} else if (type == FileType.video) {- savedAsset =- await PhotoManager.editor.saveVideo(fileToSave!, title: file.title!);+ savedAsset = await PhotoManager.editor+ .saveVideo(fileToSave!, title: file.title!);} else if (type == FileType.livePhoto) {final File? liveVideoFile =await getFileFromServer(file, liveVideo: true);@@ -313,4 +313,4 @@ class DownloadQueue {task();}}-}\ No newline at end of file+}diff --git a/mobile/lib/utils/thumbnail_util.dart b/mobile/lib/utils/thumbnail_util.dartindex 2209a28bfd..c8db830735 100644--- a/mobile/lib/utils/thumbnail_util.dart+++ b/mobile/lib/utils/thumbnail_util.dart@@ -173,7 +173,7 @@ Future<void> _downloadAndDecryptThumbnail(FileDownloadItem item) async {};encryptedThumbnail = (await NetworkClient.instance.getDio().get(- "https://public-albums.ente.io/preview/?fileID=${file.uploadedFileID}",+ file.pubPreviewUrl,options: Options(headers: headers,responseType: ResponseType.bytes,