mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 17:27:40 +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/provider/error", // TODO: change
|
||||||
"/login/sso",
|
"/login/sso",
|
||||||
"/admin/signup",
|
"/admin/signup",
|
||||||
"/shared/secret/[id]"
|
"/shared/secret/[id]",
|
||||||
|
"/shared/secret"
|
||||||
];
|
];
|
||||||
|
|
||||||
export const languageMap = {
|
export const languageMap = {
|
||||||
|
|||||||
@@ -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 = () => {
|
export const ShareSecretPublicPage = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { id, key: urlEncodedPublicKey } = router.query;
|
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);
|
const publicKey = decodeURIComponent(urlEncodedPublicKey as string);
|
||||||
useEffect(() => {
|
|
||||||
if (!id || !publicKey) {
|
|
||||||
router.push("/404");
|
|
||||||
}
|
|
||||||
}, [id, publicKey]);
|
|
||||||
|
|
||||||
const { isLoading, data } = useGetActiveSharedSecretByIdAndHashedHex(
|
const { isLoading, data } = useGetActiveSharedSecretByIdAndHashedHex(
|
||||||
id as string,
|
id as string,
|
||||||
hashedHex 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 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">
|
<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">
|
<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>
|
</p>
|
||||||
<div className="flex w-full flex-grow flex-col gap-6 md:flex-row md:gap-12">
|
<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">
|
<div className="flex-1 self-center pt-4 text-center md:pt-0 md:text-left">
|
||||||
@@ -95,12 +91,14 @@ export const ShareSecretPublicPage = () => {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex-1 rounded-lg p-2">
|
<div className="flex-1 rounded-lg p-2">
|
||||||
<SecretTable
|
{id && (
|
||||||
isLoading={isLoading}
|
<SecretTable
|
||||||
decryptedSecret={decryptedSecret}
|
isLoading={isLoading}
|
||||||
isUrlCopied={isUrlCopied}
|
decryptedSecret={decryptedSecret}
|
||||||
copyUrlToClipboard={copyUrlToClipboard}
|
isUrlCopied={isUrlCopied}
|
||||||
/>
|
copyUrlToClipboard={copyUrlToClipboard}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="flex-1 self-center text-center md:text-right">
|
<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">
|
<p className="pb-2 font-semibold text-mineshaft-100 md:pb-4 md:text-xl">
|
||||||
|
|||||||
Reference in New Issue
Block a user