Browse Source

Merge remote-tracking branch 'origin/mobile_face' into mobile_face

laurenspriem 1 year ago
parent
commit
acb3e05fc8

+ 3 - 0
mobile/lib/core/constants.dart

@@ -98,3 +98,6 @@ const blackThumbnailBase64 = '/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQEBAQEB' +
     'KACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAo' +
     'AKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAo' +
     'AKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgD/9k=';
+
+const localFileServer =
+    String.fromEnvironment("localFileServer", defaultValue: "");

+ 1 - 1
mobile/lib/db/entities_db.dart

@@ -9,7 +9,7 @@ extension EntitiesDB on FilesDB {
     List<LocalEntityData> data, {
     ConflictAlgorithm conflictAlgorithm = ConflictAlgorithm.replace,
   }) async {
-    debugPrint("Inserting missing PathIDToLocalIDMapping");
+    debugPrint("entitiesDB: upsertEntities ${data.length} entities");
     final db = await database;
     var batch = db.batch();
     int batchCounter = 0;

+ 6 - 0
mobile/lib/models/file/file.dart

@@ -233,6 +233,9 @@ class EnteFile {
   }
 
   String get downloadUrl {
+    if (localFileServer.isNotEmpty) {
+      return "$localFileServer/$uploadedFileID";
+    }
     final endpoint = Configuration.instance.getHttpEndpoint();
     if (endpoint != kDefaultProductionEndpoint ||
         FeatureFlagService.instance.disableCFWorker()) {
@@ -247,6 +250,9 @@ class EnteFile {
   }
 
   String get thumbnailUrl {
+    if (localFileServer.isNotEmpty) {
+      return "$localFileServer/thumb/$uploadedFileID";
+    }
     final endpoint = Configuration.instance.getHttpEndpoint();
     if (endpoint != kDefaultProductionEndpoint ||
         FeatureFlagService.instance.disableCFWorker()) {