π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
EP 1
Manav Rathi764add95c8ca
diff --git a/web/packages/gallery/components/viewer/data-source.ts b/web/packages/gallery/components/viewer/data-source.tsindex e8f588b0fe..c04ef79258 100644--- a/web/packages/gallery/components/viewer/data-source.ts+++ b/web/packages/gallery/components/viewer/data-source.ts@@ -9,6 +9,8 @@ import {import type { EnteFile } from "@/media/file";import { FileType } from "@/media/file-type";import { ensureString } from "@/utils/ensure";+// TODO:+import { extractRawExif, parseExif } from "@/new/photos/services/exif";// TODO(PS)://import { type SlideData } from "./ps5/dist/types/slide/"@@ -304,3 +306,40 @@ const withDimensions = (imageURL: string): Promise<ItemData> =>image.onerror = reject;image.src = imageURL;});++/**+ * Return the Exif data for the given {@link file}, caching it appropriately.+ *+ * The shape of the returned data is such that it can directly be used by the+ * {@link FileInfo} sidebar.+ *+ * @see {@link forgetExif}.+ */+export const exifForItemData = async (itemData: ItemData) => {+ // Determine the (object) URL corresponding to the image portion, if any,+ // associated with the given itemData.+ //+ // - For images, this will be the object URL of the renderable image itself.+ // - For videos, this will not be defined.+ // - For live photos, this will be the object URL of the image portion of+ // the live photo.+ const { src: associatedImageURL } = itemData;++ if (!associatedImageURL) {+ // This is a video. Use a placeholder.+ return { tags: undefined, parsed: undefined };+ }++ try {+ console.time("exif");+ const blob = await (await fetch(associatedImageURL)).blob();+ const file = new File([blob], "");+ const tags = await extractRawExif(file);+ const parsed = parseExif(tags);+ console.timeEnd("exif");+ return { tags, parsed };+ } catch (e) {+ log.error("Failed to extract exif", e);+ return { tags: undefined, parsed: undefined };+ }+};diff --git a/web/packages/gallery/components/viewer/photoswipe.ts b/web/packages/gallery/components/viewer/photoswipe.tsindex 62bc367e38..09829a35cc 100644--- a/web/packages/gallery/components/viewer/photoswipe.ts+++ b/web/packages/gallery/components/viewer/photoswipe.ts@@ -5,6 +5,7 @@ import log from "@/base/log";import type { EnteFile } from "@/media/file";import { t } from "i18next";import {+ exifForItemData,forgetFailedItemDataForFile,forgetFailedItems,itemDataForFile,@@ -323,6 +324,17 @@ export class FileViewerPhotoSwipe {});});+ pswp.on("loadComplete", (e) => {+ console.log("xxx loadComplete", e);+ });++ pswp.on("change", (e) => {+ const itemData = pswp.currSlide.content.data;+ exifForItemData(itemData).then((data) =>+ console.log("exif data", data),+ );+ });+// Modify the default UI elements.pswp.addFilter("uiElement", (element, data) => {if (element.name == "preloader") {