π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Thumb
Manav Rathi515c28530e94
diff --git a/web/apps/photos/src/services/download/clients/photos.ts b/web/apps/photos/src/services/download/clients/photos.tsindex b4aa0ca954..5b26625df1 100644--- a/web/apps/photos/src/services/download/clients/photos.ts+++ b/web/apps/photos/src/services/download/clients/photos.ts@@ -1,6 +1,6 @@import { CustomError } from "@ente/shared/error";import HTTPService from "@ente/shared/network/HTTPService";-import { fileURL, getThumbnailURL } from "@ente/shared/network/api";+import { fileURL, thumbnailURL } from "@ente/shared/network/api";import { retryAsyncFunction } from "@ente/shared/utils";import { DownloadClient } from "services/download";import { EnteFile } from "types/file";@@ -23,7 +23,7 @@ export class PhotosDownloadClient implements DownloadClient {const params = new URLSearchParams({ token });const getThumbnail = () =>HTTPService.get(- `${getThumbnailURL(file.id)}?${params.toString()}`,+ `${thumbnailURL(file.id)}?${params.toString()}`,undefined,undefined,{ responseType: "arraybuffer", timeout: this.timeout },diff --git a/web/packages/shared/network/api.ts b/web/packages/shared/network/api.tsindex 01bcd56833..d55eb40813 100644--- a/web/packages/shared/network/api.ts+++ b/web/packages/shared/network/api.ts@@ -33,6 +33,21 @@ export const fileURL = (id: number) => {return `https://files.ente.io/?fileID=${id}`;};+/**+ * Return the URL that should be used for fetching the thumbnail for a file with+ * the given {@link id}.+ *+ * This defaults to a URL on Ente's own servers, but can be overridden when self+ * hosting by setting the `NEXT_PUBLIC_ENTE_ENDPOINT` environment variable.+ */+export const thumbnailURL = (id: number) => {+ const endpoint = process.env.NEXT_PUBLIC_ENTE_ENDPOINT;+ if (endpoint) {+ return `${endpoint}/files/preview/${id}`;+ }+ return `https://thumbnails.ente.io/?fileID=${id}`;+};+export const getPublicCollectionFileURL = (id: number) => {const endpoint = process.env.NEXT_PUBLIC_ENTE_ENDPOINT;if (endpoint) {@@ -57,14 +72,6 @@ export const getCastThumbnailURL = (id: number) => {return `https://cast-albums.ente.io/preview/?fileID=${id}`;};-export const getThumbnailURL = (id: number) => {- const endpoint = process.env.NEXT_PUBLIC_ENTE_ENDPOINT;- if (endpoint) {- return `${endpoint}/files/preview/${id}`;- }- return `https://thumbnails.ente.io/?fileID=${id}`;-};-export const getPublicCollectionThumbnailURL = (id: number) => {const endpoint = process.env.NEXT_PUBLIC_ENTE_ENDPOINT;if (endpoint) {