Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Reuse

Manav Rathi33ed4a8dffad
diff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsx
index 67337c39ba..0a612bac4a 100644
--- a/web/apps/photos/src/pages/shared-albums.tsx
+++ b/web/apps/photos/src/pages/shared-albums.tsx
@@ -243,10 +243,9 @@ export default function PublicCollectionGallery() {
? await cryptoWorker.toB64(bs58.decode(ck))
: await cryptoWorker.fromHex(ck);
token.current = t;
- downloadManager.setPublicAlbumsCredentials(
- token.current,
- undefined,
- );
+ downloadManager.setPublicAlbumsCredentials({
+ accessToken: token.current,
+ });
await updateShouldDisableCFUploadProxy();
collectionKey.current = dck;
url.current = window.location.href;
@@ -270,10 +269,10 @@ export default function PublicCollectionGallery() {
setPublicFiles(localPublicFiles);
passwordJWTToken.current =
await getLocalPublicCollectionPassword(collectionUID);
- downloadManager.setPublicAlbumsCredentials(
- token.current,
- passwordJWTToken.current,
- );
+ downloadManager.setPublicAlbumsCredentials({
+ accessToken: token.current,
+ accessTokenJWT: passwordJWTToken.current,
+ });
}
await syncWithRemote();
} finally {
@@ -406,10 +405,10 @@ export default function PublicCollectionGallery() {
token.current,
);
passwordJWTToken.current = jwtToken;
- downloadManager.setPublicAlbumsCredentials(
- token.current,
- passwordJWTToken.current,
- );
+ downloadManager.setPublicAlbumsCredentials({
+ accessToken: token.current,
+ accessTokenJWT: passwordJWTToken.current,
+ });
const collectionUID = getPublicCollectionUID(token.current);
await savePublicCollectionPassword(collectionUID, jwtToken);
} catch (e) {
diff --git a/web/packages/base/http.ts b/web/packages/base/http.ts
index 721aa74f4b..f1f11d56fb 100644
--- a/web/packages/base/http.ts
+++ b/web/packages/base/http.ts
@@ -27,7 +27,7 @@ export const publicRequestHeaders = () => ({
/**
* A set of credentials needed to make public collections related API requests.
*/
-interface PublicAlbumsCredentials {
+export interface PublicAlbumsCredentials {
/**
* An access token that does the same job as the "X-Auth-Token" for usual
* authenticated API requests, except it will be passed as the
diff --git a/web/packages/gallery/services/download.ts b/web/packages/gallery/services/download.ts
index 44243932a3..0b1fb67fb8 100644
--- a/web/packages/gallery/services/download.ts
+++ b/web/packages/gallery/services/download.ts
@@ -21,6 +21,7 @@ import {
import type { EnteFile } from "@/media/file";
import { FileType } from "@/media/file-type";
import { decodeLivePhoto } from "@/media/live-photo";
+import { type PublicAlbumsCredentials }from "@/base/http";
export interface LivePhotoSourceURL {
image: () => Promise<string | undefined>;
@@ -145,14 +146,8 @@ class DownloadManager {
* Set the credentials that should be used for download files when we're
* running in the context of the public albums app.
*/
- setPublicAlbumsCredentials(
- token: string,
- passwordToken: string | undefined,
- ) {
- this.publicAlbumsCredentials = {
- accessToken: token,
- accessTokenJWT: passwordToken,
- };
+ setPublicAlbumsCredentials(credentials: PublicAlbumsCredentials) {
+ this.publicAlbumsCredentials = credentials;
}
/**
@@ -689,11 +684,6 @@ const photos_downloadFile = async (file: EnteFile): Promise<Response> => {
return retryEnsuringHTTPOk(getFile);
};
-interface PublicAlbumsCredentials {
- accessToken: string;
- accessTokenJWT: string | undefined;
-}
-
/**
* The various publicAlbums_* functions are used for the actual downloads when
* we're running in the context of the the public albums app.