From 2ddd058579c70209da82724d3f5532e826f9d1d7 Mon Sep 17 00:00:00 2001
From: mbaharip <62494292+mbahArip@users.noreply.github.com>
Date: Thu, 6 Jun 2024 18:57:41 +0700
Subject: [PATCH] Add issues
---
src/app/api/internal/encrypt/route.ts | 5 ++++-
src/components/Guide/Configuration/Layout.tsx | 20 +++++++++++++++++++
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/src/app/api/internal/encrypt/route.ts b/src/app/api/internal/encrypt/route.ts
index 7fdbe39..3e65fe2 100644
--- a/src/app/api/internal/encrypt/route.ts
+++ b/src/app/api/internal/encrypt/route.ts
@@ -8,13 +8,16 @@ export async function GET(request: NextRequest) {
try {
const sp = new URL(request.nextUrl).searchParams;
const query = sp.get("q");
+ const key = sp.get("key");
if (!query) return new NextResponse("Add query parameter 'q' with the value to encrypt", { status: 400 });
- const encrypted = await encryptData(query);
+ const encrypted = await encryptData(query, key || process.env.ENCRYPTION_KEY);
return NextResponse.json(
{
+ message: key ? "Encrypted with provided key" : "Encrypted with environment key",
value: encrypted,
+ key,
},
{ status: 200 },
);
diff --git a/src/components/Guide/Configuration/Layout.tsx b/src/components/Guide/Configuration/Layout.tsx
index 789ad4a..c0189c0 100644
--- a/src/components/Guide/Configuration/Layout.tsx
+++ b/src/components/Guide/Configuration/Layout.tsx
@@ -8,6 +8,7 @@ import { generateConfig } from "~/data/template";
import { ButtonLoading, Loader, Markdown } from "~/components/Global";
import { ConfigAPI, ConfigEnvironment, ConfigSite } from "~/components/Guide/Configuration";
+import { Alert, AlertDescription, AlertTitle } from "~/components/ui/alert";
import { Button } from "~/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "~/components/ui/card";
@@ -268,6 +269,25 @@ If you're migrating from previous version, you can load your old environment and
onReset={onReset}
/>
+ {`After some report, it seems that the config will generate incorrect encrypted ID, and somehow it only happen on deployment.
+I'm sorry for the inconvenience, but you need to re-encrypt the id using the encryption endpoint.
+I'll try to fix this issue as soon as possible`}
+ {`Replace Configuration Issue
+ {`https://drive-demo.mbaharip.com/api/internal/encrypt?q=
+ {`https://
+