From 73860c89c797d32b3bbbd7eff6e0cf81b5d312e9 Mon Sep 17 00:00:00 2001 From: Nate Sawant Date: Thu, 20 Jun 2024 09:29:47 -0400 Subject: [PATCH 1/3] Fix CLI errors --- cli/src/utils/getCredentials.ts | 2 +- cli/src/utils/updateEnv.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cli/src/utils/getCredentials.ts b/cli/src/utils/getCredentials.ts index 4d6d68b..a8857da 100644 --- a/cli/src/utils/getCredentials.ts +++ b/cli/src/utils/getCredentials.ts @@ -1,3 +1,3 @@ export function GetCredentials(sessionToken: string) { - return `next-auth.session-token=${sessionToken}`; + return `__Secure-next-auth.session-token=${sessionToken}`; } diff --git a/cli/src/utils/updateEnv.ts b/cli/src/utils/updateEnv.ts index d3e537d..9d13761 100644 --- a/cli/src/utils/updateEnv.ts +++ b/cli/src/utils/updateEnv.ts @@ -1,3 +1,4 @@ +import { existsSync } from "fs"; import { readFile, writeFile } from "fs/promises"; export default async function updateExistingEnvVariable( @@ -7,7 +8,7 @@ export default async function updateExistingEnvVariable( try { // Path to the .env file const filePath = ".env"; - const content = await readFile(filePath); + const content = existsSync(filePath) ? await readFile(filePath) : ""; // Split the content into lines const lines = content.toString().split("\n"); @@ -32,7 +33,7 @@ export default async function updateExistingEnvVariable( const updatedContent = updatedLines.join("\n"); // Write the updated contents back to the .env.example file - await writeFile(filePath, updatedContent); + await writeFile(filePath, updatedContent, { flag: "w+" }); //potentially add utf8 above if it fails const verifyContent = await readFile(filePath, "utf8"); return verifyContent.includes(`${varName}=${newValue}`); From 1f3705a5f1405019c5ed237a7f134dd37f55d19e Mon Sep 17 00:00:00 2001 From: Nate Sawant Date: Thu, 20 Jun 2024 09:30:15 -0400 Subject: [PATCH 2/3] Update version --- cli/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/package.json b/cli/package.json index dadff21..a09897a 100644 --- a/cli/package.json +++ b/cli/package.json @@ -32,5 +32,5 @@ "parse-github-url": "^1.0.2", "prisma": "^5.14.0" }, - "version": "0.0.2" + "version": "0.0.3" } From 345a50306aee9e05cad32a40dc0759b1b315c03d Mon Sep 17 00:00:00 2001 From: Nate Sawant Date: Thu, 20 Jun 2024 09:37:22 -0400 Subject: [PATCH 3/3] Fix webhook path --- src/server/external/github.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/external/github.ts b/src/server/external/github.ts index cb29316..039b5ef 100644 --- a/src/server/external/github.ts +++ b/src/server/external/github.ts @@ -62,7 +62,7 @@ export async function CreateWebhook(repoUrl: string) { events: ["push", "pull_request"], config: { // to be replaced with actual webhook URL - url: `${process.env.NEXTAUTH_URL}/api/trpc/receive`, + url: `${process.env.NEXTAUTH_URL}/api/github`, content_type: "json", insecure_ssl: "1", },