Skip to content

armgit / ente

Public Imported from GitHub
0

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

Fix API endpoint path for public collection

Manav Rathi2bd7df3660ac
diff --git a/web/apps/embed/src/components/EmbedFileListWithViewer.tsx b/web/apps/embed/src/components/EmbedFileListWithViewer.tsx
index 9ddee1078e..edc3f7e83a 100644
--- a/web/apps/embed/src/components/EmbedFileListWithViewer.tsx
+++ b/web/apps/embed/src/components/EmbedFileListWithViewer.tsx
@@ -1,4 +1,4 @@
-import { Link, styled, Typography } from "@mui/material";
+import { styled, Typography } from "@mui/material";
import { EnteLogo } from "ente-base/components/EnteLogo";
import { SpacedRow } from "ente-base/components/containers";
import { isSameDay } from "ente-base/date";
@@ -65,8 +65,41 @@ export const EmbedFileListWithViewer: React.FC<
name={publicCollection.name}
fileCount={files.length}
/>
- <Typography sx={{ color: "text.muted" }}>
- <EnteLogo height={16} />
+ <Typography
+ variant="small"
+ sx={{
+ color: "text.muted",
+ display: "flex",
+ flexDirection: "column",
+ alignItems: "flex-end",
+ marginRight: "16px",
+ fontSize: "0.8em",
+ "&:hover .powered-text": {
+ color: "text.base",
+ cursor: "pointer"
+ },
+ "&:hover .ente-logo": {
+ color: "#1db954",
+ cursor: "pointer"
+ }
+ }}
+ >
+ <span
+ className="powered-text"
+ style={{
+ transition: "color 0.2s ease"
+ }}
+ >
+ powered by
+ </span>
+ <span
+ className="ente-logo"
+ style={{
+ transition: "color 0.2s ease"
+ }}
+ >
+ <EnteLogo height={14} />
+ </span>
</Typography>
</SpacedRow>
</GalleryItemsHeaderAdapter>
@@ -74,27 +107,7 @@ export const EmbedFileListWithViewer: React.FC<
[publicCollection.name, files.length],
);
- const footer = useMemo(
- () => (
- <FooterContainer>
- <Link
- color="text.muted"
- sx={{
- textAlign: "right",
- alignSelf: "flex-end",
- "&:hover": { color: "inherit" },
- }}
- target="_blank"
- href="https://ente.io"
- >
- <Typography variant="small">
- powered by ente.io
- </Typography>
- </Link>
- </FooterContainer>
- ),
- [],
- );
+ const footer = null;
return (
<Container>
@@ -129,12 +142,6 @@ export const EmbedFileListWithViewer: React.FC<
const Container = styled("div")({ flex: 1, width: "100%" });
-const FooterContainer = styled("div")({
- display: "flex",
- justifyContent: "flex-end",
- padding: "16px",
- minHeight: "50px",
-});
const fileTimelineDateString = (file: EnteFile) => {
const date = new Date(fileCreationTime(file) / 1000);
diff --git a/web/apps/embed/src/services/public-collection.ts b/web/apps/embed/src/services/public-collection.ts
index c69c17f57d..cb64db1791 100644
--- a/web/apps/embed/src/services/public-collection.ts
+++ b/web/apps/embed/src/services/public-collection.ts
@@ -106,13 +106,16 @@ export const pullCollection = async (
accessToken: string,
collectionKey: string,
) => {
- const res = await fetch(await apiURL("/public-collection"), {
+ const res = await fetch(await apiURL("/public-collection/info"), {
method: "GET",
headers: authenticatedPublicAlbumsRequestHeaders({ accessToken }),
});
ensureOk(res);
- const remoteCollection = RemoteCollection.parse(await res.json());
+ const data = await res.json();
+ const remoteCollection = RemoteCollection.parse(data.collection);
+ const referralCode = data.referralCode || "";
+
const collection = await decryptRemoteCollection(
remoteCollection,
collectionKey,
@@ -120,7 +123,7 @@ export const pullCollection = async (
await savePublicCollection(collection);
- return { collection };
+ return { collection, referralCode };
};
/**
@@ -149,14 +152,12 @@ export const pullPublicCollectionFiles = async (
let hasMore = true;
while (hasMore) {
- const res = await fetch(await apiURL("/public-collection/diff"), {
- method: "POST",
- headers: authenticatedPublicAlbumsRequestHeaders(credentials),
- body: JSON.stringify({
- collectionID: collection.id,
- sinceTime: time,
- }),
- });
+ const res = await fetch(
+ await apiURL("/public-collection/diff", { sinceTime: time ?? 0 }),
+ {
+ headers: authenticatedPublicAlbumsRequestHeaders(credentials),
+ },
+ );
ensureOk(res);
const { diff, hasMore: hasMoreRemote } = FileDiffResponse.parse(