diff --git a/.circleci/config.yml b/.circleci/config.yml index af8bc8196..b1717e1ce 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -62,7 +62,7 @@ jobs: command: dockerize -wait tcp://localhost:3000 -timeout 30s - run: name: lint, typecheck, test, build - command: npx nx run-many --targets=lint,typecheck,test,build + command: npx nx run-many --targets=lint,typecheck,test,build --output-style=static push_backend: resource_class: large docker: diff --git a/nx.json b/nx.json index a0c551cf7..975432a86 100644 --- a/nx.json +++ b/nx.json @@ -39,7 +39,7 @@ "libsDir": "packages" }, "useDaemonProcess": false, - "nxCloudAccessToken": "OGY4NDE3OTItYWViMS00YWM0LTk4ODgtYmI2ZWNhYjY1OGMyfHJlYWQtb25seQ==", + "neverConnectToCloud": true, "useInferencePlugins": false, "defaultBase": "master" } diff --git a/packages/trpc/src/procedures/labels/createLabel.spec.ts b/packages/trpc/src/procedures/labels/createLabel.spec.ts index 99d912851..72d1888cd 100644 --- a/packages/trpc/src/procedures/labels/createLabel.spec.ts +++ b/packages/trpc/src/procedures/labels/createLabel.spec.ts @@ -6,14 +6,15 @@ import type { AppRouter } from "../../index"; describe("create Label", () => { let user: User; + let user2: User; let trpc: CreateTRPCProxyClient; beforeAll(async () => { - ({ user, trpc } = await trpcSetup()); + ({ user, user2, trpc } = await trpcSetup()); }); afterAll(() => { - return tearDown(user.id); + return tearDown(user.id, user2.id); }); describe("success", () => { diff --git a/packages/trpc/src/procedures/labels/deleteLabel.spec.ts b/packages/trpc/src/procedures/labels/deleteLabel.spec.ts index 956a0673e..f732a8519 100644 --- a/packages/trpc/src/procedures/labels/deleteLabel.spec.ts +++ b/packages/trpc/src/procedures/labels/deleteLabel.spec.ts @@ -8,14 +8,15 @@ import { faker } from "@faker-js/faker"; describe("deleteLabel", () => { let user: User; + let user2: User; let trpc: CreateTRPCProxyClient; beforeAll(async () => { - ({ user, trpc } = await trpcSetup()); + ({ user, user2, trpc } = await trpcSetup()); }); afterAll(() => { - return tearDown(user.id); + return tearDown(user.id, user2.id); }); describe("success", () => { diff --git a/packages/trpc/src/procedures/labels/getLabels.spec.ts b/packages/trpc/src/procedures/labels/getLabels.spec.ts index ec8ce0c31..0051e23b2 100644 --- a/packages/trpc/src/procedures/labels/getLabels.spec.ts +++ b/packages/trpc/src/procedures/labels/getLabels.spec.ts @@ -6,14 +6,15 @@ import type { AppRouter } from "../../index"; describe("getLabels", () => { let user: User; + let user2: User; let trpc: CreateTRPCProxyClient; beforeEach(async () => { - ({ user, trpc } = await trpcSetup()); + ({ user, user2, trpc } = await trpcSetup()); }); afterEach(() => { - return tearDown(user.id); + return tearDown(user.id, user2.id); }); describe("success", () => { diff --git a/packages/trpc/src/procedures/labels/getLabelsByUserId.spec.ts b/packages/trpc/src/procedures/labels/getLabelsByUserId.spec.ts index 9460be398..898273a03 100644 --- a/packages/trpc/src/procedures/labels/getLabelsByUserId.spec.ts +++ b/packages/trpc/src/procedures/labels/getLabelsByUserId.spec.ts @@ -6,14 +6,15 @@ import type { AppRouter } from "../../index"; describe("getLabelsByUserId", () => { let user: User; + let user2: User; let trpc: CreateTRPCProxyClient; beforeAll(async () => { - ({ user, trpc } = await trpcSetup()); + ({ user, user2, trpc } = await trpcSetup()); }); afterAll(() => { - return tearDown(user.id); + return tearDown(user.id, user2.id); }); describe("success", () => { diff --git a/packages/trpc/src/procedures/labels/updateLabel.spec.ts b/packages/trpc/src/procedures/labels/updateLabel.spec.ts index 0d404048c..aa74fefe1 100644 --- a/packages/trpc/src/procedures/labels/updateLabel.spec.ts +++ b/packages/trpc/src/procedures/labels/updateLabel.spec.ts @@ -6,14 +6,15 @@ import type { AppRouter } from "../../index"; describe("updates label", () => { let user: User; + let user2: User; let trpc: CreateTRPCProxyClient; beforeEach(async () => { - ({ user, trpc } = await trpcSetup()); + ({ user, user2, trpc } = await trpcSetup()); }); afterEach(() => { - return tearDown(user.id); + return tearDown(user.id, user2.id); }); describe("success", () => { diff --git a/packages/trpc/src/procedures/recipes/getUniqueRecipeTitle.spec.ts b/packages/trpc/src/procedures/recipes/getUniqueRecipeTitle.spec.ts index 01334e501..ed70d65d7 100644 --- a/packages/trpc/src/procedures/recipes/getUniqueRecipeTitle.spec.ts +++ b/packages/trpc/src/procedures/recipes/getUniqueRecipeTitle.spec.ts @@ -7,14 +7,15 @@ import type { AppRouter } from "../../index"; describe("getRecipe", () => { let user: User; + let user2: User; let trpc: CreateTRPCProxyClient; beforeAll(async () => { - ({ user, trpc } = await trpcSetup()); + ({ user, user2, trpc } = await trpcSetup()); }); afterAll(() => { - return tearDown(user.id); + return tearDown(user.id, user2.id); }); describe("success", () => { @@ -67,7 +68,7 @@ describe("getRecipe", () => { }); it("seperate recipies by user", async () => { - const { user: user2 } = await trpcSetup(); + const { user: user2, user2: user3 } = await trpcSetup(); await prisma.recipe.create({ data: { ...recipeFactory(user2.id), @@ -80,6 +81,6 @@ describe("getRecipe", () => { }); expect(response).toEqual("Spagetti with tomatos"); - return tearDown(user2.id); + return tearDown(user2.id, user3.id); }); }); diff --git a/packages/webextension-v3/src/action/action.html b/packages/webextension-v3/src/action/action.html index fc7342d86..b511bb06a 100644 --- a/packages/webextension-v3/src/action/action.html +++ b/packages/webextension-v3/src/action/action.html @@ -94,7 +94,10 @@
-

+ + + +

Import Site

  diff --git a/packages/webextension-v3/src/action/action.js b/packages/webextension-v3/src/action/action.js index c12b15e25..84a4dc988 100644 --- a/packages/webextension-v3/src/action/action.js +++ b/packages/webextension-v3/src/action/action.js @@ -209,15 +209,13 @@ const saveClip = async (clipData) => { case 401: chrome.storage.local.set({ token: null }, () => { window.alert( - "Please Login. It looks like you're logged out. Please click the\ - RecipeSage icon to login again.", + "Please Login. It looks like you're logged out. Please close and re-open the clip tool to login.", ); }); break; default: window.alert( - "Could Not Save Recipe. An error occurred while saving the recipe.\ - Please try again.", + "An error occurred while saving the recipe. Please try again.", ); break; } diff --git a/packages/webextension-v3/src/inject/inject.js b/packages/webextension-v3/src/inject/inject.js index e29ceb1b6..b929f687a 100644 --- a/packages/webextension-v3/src/inject/inject.js +++ b/packages/webextension-v3/src/inject/inject.js @@ -186,6 +186,7 @@ if (window[extensionContainerId]) { let logoLink = document.createElement("a"); logoLink.href = "https://recipesage.com"; + logoLink.target = "_blank"; logoLink.onmousedown = (e) => e.stopPropagation(); leftHeadline.appendChild(logoLink); @@ -427,28 +428,29 @@ if (window[extensionContainerId]) { const token = await fetchToken(); let imageId; - try { - const imageResponse = await fetch(currentSnip.imageURL); - const imageBlob = await imageResponse.blob(); - - const formData = new FormData(); - formData.append("image", imageBlob); - - const imageCreateResponse = await fetch( - `https://api.recipesage.com/images?token=${token}`, - { - method: "POST", - body: formData, - }, - ); - - if (!imageCreateResponse.ok) return; - - const imageData = await imageCreateResponse.json(); + if (currentSnip.imageURL?.trim().length) { + try { + const imageResponse = await fetch(currentSnip.imageURL); + const imageBlob = await imageResponse.blob(); + + const formData = new FormData(); + formData.append("image", imageBlob); + + const imageCreateResponse = await fetch( + `https://api.recipesage.com/images?token=${token}`, + { + method: "POST", + body: formData, + }, + ); - imageId = imageData.id; - } catch (e) { - console.error("Error creating image", e); + if (imageCreateResponse.ok) { + const imageData = await imageCreateResponse.json(); + imageId = imageData.id; + } + } catch (e) { + console.error("Error creating image", e); + } } const recipeCreateResponse = await fetch(