π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][photos] upload files in web_view for public albums
Aman Raj799cb24c6304
diff --git a/mobile/lib/services/collections_service.dart b/mobile/lib/services/collections_service.dartindex b8a551c1df..a6d284389b 100644--- a/mobile/lib/services/collections_service.dart+++ b/mobile/lib/services/collections_service.dart@@ -71,6 +71,7 @@ class CollectionsService {final _cachedPublicAlbumToken = <int, String>{};final _cachedPublicAlbumJWTToken = <int, String>{};final _cachedPublicCollectionID = <int>[];+ final _cachedPublicAlbumKey = <String, String>{};CollectionsService._privateConstructor() {_db = CollectionsDB.instance;@@ -183,6 +184,7 @@ class CollectionsService {_cachedPublicAlbumJWTToken.clear();_cachedPublicCollectionID.clear();_cachedKeys.clear();+ _cachedPublicAlbumKey.clear();}Future<Map<int, int>> getCollectionIDsToBeSynced() async {@@ -1059,6 +1061,7 @@ class CollectionsService {_cachedKeys[collection.id] = collectionKey;_cachedPublicAlbumToken[collection.id] = authToken!;_cachedPublicCollectionID.add(collection.id);+ _cachedPublicAlbumKey[authToken] = albumKey;collection.setName(_getDecryptedCollectionName(collection));return collection;} catch (e, s) {@@ -1114,6 +1117,13 @@ class CollectionsService {}}+ Future<String> getPublicAlbumKey(String authToken) async {+ if (_cachedPublicAlbumKey.containsKey(authToken)) {+ return _cachedPublicAlbumKey[authToken]!;+ }+ return "";+ }+Future<String?> getPublicAlbumToken(int collectionID) async {if (_cachedPublicAlbumToken.containsKey(collectionID)) {return _cachedPublicAlbumToken[collectionID];diff --git a/mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dart b/mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dartindex 3b2593621c..86a9411f5b 100644--- a/mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dart+++ b/mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dart@@ -33,6 +33,7 @@ import 'package:photos/ui/actions/collection/collection_sharing_actions.dart';import "package:photos/ui/cast/auto.dart";import "package:photos/ui/cast/choose.dart";import "package:photos/ui/common/popup_item.dart";+import "package:photos/ui/common/web_page.dart";import 'package:photos/ui/components/action_sheet_widget.dart';import 'package:photos/ui/components/buttons/button_widget.dart';import 'package:photos/ui/components/models/button_type.dart';@@ -844,7 +845,24 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {Future<void> _showAddPhotoDialog(BuildContext bContext) async {final collection = widget.collection;try {- await showAddPhotosSheet(bContext, collection!);+ if (galleryType == GalleryType.sharedPublicCollection &&+ collection!.isEnableCollect()) {+ final authToken = await CollectionsService.instance+ .getPublicAlbumToken(collection.id);+ final albumKey =+ await CollectionsService.instance.getPublicAlbumKey(authToken!);++ await Navigator.of(context).push(+ MaterialPageRoute(+ builder: (context) => WebPage(+ widget.title ?? "",+ "https://albums.ente.sh/?t=$authToken#$albumKey",+ ),+ ),+ );+ } else {+ await showAddPhotosSheet(bContext, collection!);+ }} catch (e, s) {_logger.severe(e, s);await showGenericErrorDialog(context: bContext, error: e);