π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
File URL
Manav Rathi9edbdfdd4928
diff --git a/web/apps/photos/src/services/download/clients/photos.ts b/web/apps/photos/src/services/download/clients/photos.tsindex 5990f46c04..b4aa0ca954 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 { getFileURL, getThumbnailURL } from "@ente/shared/network/api";+import { fileURL, getThumbnailURL } from "@ente/shared/network/api";import { retryAsyncFunction } from "@ente/shared/utils";import { DownloadClient } from "services/download";import { EnteFile } from "types/file";@@ -45,7 +45,7 @@ export class PhotosDownloadClient implements DownloadClient {const params = new URLSearchParams({ token });const getFile = () =>HTTPService.get(- `${getFileURL(file.id)}?${params.toString()}`,+ `${fileURL(file.id)}?${params.toString()}`,undefined,undefined,{@@ -101,8 +101,7 @@ export class PhotosDownloadClient implements DownloadClient {// signed URL and stream back the response.const params = new URLSearchParams({ token });- const getFile = () =>- fetch(`${getFileURL(file.id)}?${params.toString()}`);+ const getFile = () => fetch(`${fileURL(file.id)}?${params.toString()}`);return retryAsyncFunction(getFile);}diff --git a/web/packages/shared/network/api.ts b/web/packages/shared/network/api.tsindex c279c8cb05..01bcd56833 100644--- a/web/packages/shared/network/api.ts+++ b/web/packages/shared/network/api.ts@@ -6,8 +6,10 @@* overridden when self hosting by setting the `NEXT_PUBLIC_ENTE_ENDPOINT`* environment variable.*/-export const apiOrigin = () => getEndpoint();+export const apiOrigin = () =>+ process.env.NEXT_PUBLIC_ENTE_ENDPOINT || "https://api.ente.io";+/** Deprecated, use {@link apiOrigin} instead. */export const getEndpoint = () => {const endpoint = process.env.NEXT_PUBLIC_ENTE_ENDPOINT;if (endpoint) {@@ -17,16 +19,13 @@ export const getEndpoint = () => {};/**- * Return the origin that should be used for fetching files.+ * Return the URL that should be used for fetching a file with the given+ * {@link id}.*- * This defaults to "https://files.ente.io", Ente's own servers, but can be- * overridden when self hosting by setting the `NEXT_PUBLIC_ENTE_ENDPOINT`- * environment variable.+ * 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 filesOrigin = () =>- process.env.NEXT_PUBLIC_ENTE_ENDPOINT || "https://files.ente.io"--export const getFileURL = (id: number) => {+export const fileURL = (id: number) => {const endpoint = process.env.NEXT_PUBLIC_ENTE_ENDPOINT;if (endpoint) {return `${endpoint}/files/download/${id}`;