mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
feat: public page to share secrets
This commit is contained in:
@@ -24,7 +24,8 @@ export const publicPaths = [
|
||||
"/login/provider/error", // TODO: change
|
||||
"/login/sso",
|
||||
"/admin/signup",
|
||||
"/shared/secret/[id]"
|
||||
"/shared/secret/[id]",
|
||||
"/shared/secret"
|
||||
];
|
||||
|
||||
export const languageMap = {
|
||||
|
||||
24
frontend/src/pages/shared/secret/index.tsx
Normal file
24
frontend/src/pages/shared/secret/index.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import Head from "next/head";
|
||||
|
||||
import { ShareSecretPublicPage } from "@app/views/ShareSecretPublicPage";
|
||||
|
||||
const SecretApproval = () => {
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>Securely Share Secrets | Infisical</title>
|
||||
<link rel="icon" href="/infisical.ico" />
|
||||
<meta property="og:image" content="/images/message.png" />
|
||||
<meta property="og:title" content="" />
|
||||
<meta name="og:description" content="" />
|
||||
</Head>
|
||||
<div className="h-full">
|
||||
<ShareSecretPublicPage />
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default SecretApproval;
|
||||
|
||||
SecretApproval.requireAuth = false;
|
||||
@@ -17,15 +17,11 @@ import { SecretTable } from "./components";
|
||||
export const ShareSecretPublicPage = () => {
|
||||
const router = useRouter();
|
||||
const { id, key: urlEncodedPublicKey } = router.query;
|
||||
const [hashedHex, key] = urlEncodedPublicKey!.toString().split("-");
|
||||
const [hashedHex, key] = urlEncodedPublicKey
|
||||
? urlEncodedPublicKey.toString().split("-")
|
||||
: ["", ""];
|
||||
|
||||
const publicKey = decodeURIComponent(urlEncodedPublicKey as string);
|
||||
useEffect(() => {
|
||||
if (!id || !publicKey) {
|
||||
router.push("/404");
|
||||
}
|
||||
}, [id, publicKey]);
|
||||
|
||||
const { isLoading, data } = useGetActiveSharedSecretByIdAndHashedHex(
|
||||
id as string,
|
||||
hashedHex as string
|
||||
@@ -82,7 +78,7 @@ export const ShareSecretPublicPage = () => {
|
||||
<div className="flex flex-1 flex-col items-center justify-center px-4">
|
||||
<div className="flex w-full max-w-4xl flex-col items-center gap-4 md:gap-20">
|
||||
<p className="text-center text-xl font-semibold text-gray-200 md:text-3xl">
|
||||
Secret Shared via Infisical
|
||||
{id ? "Secret Shared via Infisical" : "Share Secrets with Infisical"}
|
||||
</p>
|
||||
<div className="flex w-full flex-grow flex-col gap-6 md:flex-row md:gap-12">
|
||||
<div className="flex-1 self-center pt-4 text-center md:pt-0 md:text-left">
|
||||
@@ -95,12 +91,14 @@ export const ShareSecretPublicPage = () => {
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex-1 rounded-lg p-2">
|
||||
<SecretTable
|
||||
isLoading={isLoading}
|
||||
decryptedSecret={decryptedSecret}
|
||||
isUrlCopied={isUrlCopied}
|
||||
copyUrlToClipboard={copyUrlToClipboard}
|
||||
/>
|
||||
{id && (
|
||||
<SecretTable
|
||||
isLoading={isLoading}
|
||||
decryptedSecret={decryptedSecret}
|
||||
isUrlCopied={isUrlCopied}
|
||||
copyUrlToClipboard={copyUrlToClipboard}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex-1 self-center text-center md:text-right">
|
||||
<p className="pb-2 font-semibold text-mineshaft-100 md:pb-4 md:text-xl">
|
||||
|
||||
Reference in New Issue
Block a user