Skip to content

armgit / ente

Public Imported from GitHub
0

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

Use query parameter for share app token instead of path segment

anandbaburajan0ad655386519
diff --git a/web/apps/share/src/hooks/useFileShare.ts b/web/apps/share/src/hooks/useFileShare.ts
index 5e0795a5b5..a7d61f1243 100644
--- a/web/apps/share/src/hooks/useFileShare.ts
+++ b/web/apps/share/src/hooks/useFileShare.ts
@@ -36,7 +36,7 @@ export const useFileShare = (): UseFileShareResult => {
useEffect(() => {
const loadFileInfo = async () => {
try {
- const { token } = router.query;
+ const { t: token } = router.query;
if (!token || typeof token !== "string") {
setError("Invalid file link. Missing access token.");
diff --git a/web/apps/share/src/pages/[token].tsx b/web/apps/share/src/pages/[token].tsx
deleted file mode 100644
index dd0082ed43..0000000000
--- a/web/apps/share/src/pages/[token].tsx
+++ /dev/null
@@ -1,8 +0,0 @@
-import React from "react";
-import { FileShareView } from "../components/file-share/FileShareView";
-
-const FilePage: React.FC = () => {
- return <FileShareView />;
-};
-
-export default FilePage;
diff --git a/web/apps/share/src/pages/index.tsx b/web/apps/share/src/pages/index.tsx
index 59ad467846..222a7c4e50 100644
--- a/web/apps/share/src/pages/index.tsx
+++ b/web/apps/share/src/pages/index.tsx
@@ -1,27 +1,24 @@
-import { Stack, Typography } from "@mui/material";
-import React from "react";
+import { useRouter } from "next/router";
+import React, { useEffect } from "react";
+import { FileShareView } from "../components/file-share/FileShareView";
const Page: React.FC = () => {
- return (
- <Stack
- sx={{
- justifyContent: "center",
- minHeight: "100vh",
- gap: 2,
- bgcolor: "white",
- textAlign: "center",
- }}
- >
- <img
- src="/images/ente-locker.svg"
- alt="Ente Locker"
- style={{ height: "100px", alignSelf: "center" }}
- />
- <Typography variant="small" sx={{ color: "#a2a2a2", mt: 4 }}>
- β€” Coming soon β€”
- </Typography>
- </Stack>
- );
+ const router = useRouter();
+ const { t } = router.query;
+
+ useEffect(() => {
+ // Redirect to ente.io/locker if no token parameter
+ if (router.isReady && !t) {
+ window.location.href = "https://ente.io/locker";
+ }
+ }, [router.isReady, t]);
+
+ // Don't render anything if redirecting
+ if (!t) {
+ return null;
+ }
+
+ return <FileShareView />;
};
export default Page;