diff --git a/backend/src/controllers/integrationController.ts b/backend/src/controllers/integrationController.ts index 665343bd4..bf218f457 100644 --- a/backend/src/controllers/integrationController.ts +++ b/backend/src/controllers/integrationController.ts @@ -22,31 +22,6 @@ interface PushSecret { type: 'shared' | 'personal'; } -/** - * Return list of all available integrations on Infisical - * @param req - * @param res - * @returns - */ -export const getIntegrations = async (req: Request, res: Response) => { - let integrations; - try { - integrations = JSON.parse( - readFileSync('./src/json/integrations.json').toString() - ); - } catch (err) { - Sentry.setUser(null); - Sentry.captureException(err); - return res.status(400).send({ - message: 'Failed to get integrations' - }); - } - - return res.status(200).send({ - integrations - }); -}; - /** * Change environment or name of integration with id [integrationId] * @param req diff --git a/backend/src/json/integrations.json b/backend/src/json/integrations.json deleted file mode 100644 index 16b09ebf4..000000000 --- a/backend/src/json/integrations.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "heroku": { - "name": "Heroku", - "type": "oauth2", - "clientId": "bc132901-935a-4590-b010-f1857efc380d", - "docsLink": "" - }, - "netlify": { - "name": "Netlify", - "type": "oauth2", - "clientId": "", - "docsLink": "" - }, - "digitalocean": { - "name": "Digital Ocean", - "type": "oauth2", - "clientId": "", - "docsLink": "" - }, - "gcp": { - "name": "Google Cloud Platform", - "type": "oauth2", - "clientId": "", - "docsLink": "" - }, - "aws": { - "name": "Amazon Web Services", - "type": "oauth2", - "clientId": "", - "docsLink": "" - }, - "azure": { - "name": "Microsoft Azure", - "type": "oauth2", - "clientId": "", - "docsLink": "" - }, - "travisci": { - "name": "Travis CI", - "type": "oauth2", - "clientId": "", - "docsLink": "" - }, - "circleci": { - "name": "Circle CI", - "type": "oauth2", - "clientId": "", - "docsLink": "" - } -} diff --git a/backend/src/routes/integration.ts b/backend/src/routes/integration.ts index 4d025b1e8..88eebaa5f 100644 --- a/backend/src/routes/integration.ts +++ b/backend/src/routes/integration.ts @@ -9,8 +9,6 @@ import { ADMIN, MEMBER, GRANTED } from '../variables'; import { body, param } from 'express-validator'; import { integrationController } from '../controllers'; -router.get('/integrations', requireAuth, integrationController.getIntegrations); - router.patch( '/:integrationId', requireAuth, diff --git a/frontend/components/integrations/CloudIntegration.tsx b/frontend/components/integrations/CloudIntegration.tsx index e59d58a50..4fb53d145 100644 --- a/frontend/components/integrations/CloudIntegration.tsx +++ b/frontend/components/integrations/CloudIntegration.tsx @@ -28,7 +28,7 @@ const CloudIntegration = ({ deleteIntegrationAuth, authorizations }: Props) => { - return ( + return authorizations ? (
)}
- ); + ) :
} export default CloudIntegration; \ No newline at end of file diff --git a/frontend/components/integrations/CloudIntegrationSection.tsx b/frontend/components/integrations/CloudIntegrationSection.tsx index 51b2b5d95..75391275f 100644 --- a/frontend/components/integrations/CloudIntegrationSection.tsx +++ b/frontend/components/integrations/CloudIntegrationSection.tsx @@ -28,21 +28,22 @@ const CloudIntegrationSection = ({ return ( <>
0 ? 'mt-12' : 'mt-6'} text-xl max-w-5xl px-2`}> -

Cloud Integrations

-

- Click on an integration to begin syncing secrets to it. -

+

Cloud Integrations

+

+ Click on an integration to begin syncing secrets to it. +

- {integrations.map((integration) => ( - - ))} + {integrations.map((integration) => ( + + ))}
); diff --git a/frontend/components/integrations/FrameworkIntegration.tsx b/frontend/components/integrations/FrameworkIntegration.tsx index 2f33c0023..432dbad51 100644 --- a/frontend/components/integrations/FrameworkIntegration.tsx +++ b/frontend/components/integrations/FrameworkIntegration.tsx @@ -3,8 +3,9 @@ import Image from "next/image"; interface Framework { name: string; - link: string; + slug: string; image: string; + docsLink: string; } const FrameworkIntegration = ({ @@ -13,13 +14,12 @@ const FrameworkIntegration = ({ framework: Framework; }) => { return ( -
-
1 ? "text-sm px-1" : "text-xl px-2"} text-center w-full max-w-xs`}> +
1 ? "text-sm px-1" : "text-xl px-2"} text-center w-full max-w-xs`}> {framework?.image && -
); } diff --git a/frontend/components/integrations/FrameworkIntegrationSection.tsx b/frontend/components/integrations/FrameworkIntegrationSection.tsx index 0884d9705..c83599dc1 100644 --- a/frontend/components/integrations/FrameworkIntegrationSection.tsx +++ b/frontend/components/integrations/FrameworkIntegrationSection.tsx @@ -22,7 +22,10 @@ const FrameworkIntegrationSection = ({ frameworks }: Props) => {
{frameworks.map((framework) => ( - + ))}
diff --git a/frontend/pages/api/integrations/GetIntegrations.ts b/frontend/pages/api/integrations/GetIntegrations.ts deleted file mode 100644 index c189010a4..000000000 --- a/frontend/pages/api/integrations/GetIntegrations.ts +++ /dev/null @@ -1,18 +0,0 @@ -import SecurityClient from '~/utilities/SecurityClient'; - -const getIntegrations = () => { - return SecurityClient.fetchCall('/api/v1/integration/integrations', { - method: 'GET', - headers: { - 'Content-Type': 'application/json' - } - }).then(async (res) => { - if (res && res.status == 200) { - return (await res.json()).integrations; - } else { - console.log('Failed to get project integrations'); - } - }); -}; - -export default getIntegrations; diff --git a/frontend/pages/heroku.js b/frontend/pages/heroku.js index 42e915ba4..298fee08f 100644 --- a/frontend/pages/heroku.js +++ b/frontend/pages/heroku.js @@ -5,7 +5,6 @@ const queryString = require("query-string"); import AuthorizeIntegration from "./api/integrations/authorizeIntegration"; export default function Heroku() { - console.log('HEROKU PAGE'); const router = useRouter(); const parsedUrl = queryString.parse(router.asPath.split("?")[1]); const code = parsedUrl.code; @@ -17,11 +16,7 @@ export default function Heroku() { // eslint-disable-next-line react-hooks/exhaustive-deps useEffect(async () => { try { - console.log('A'); - console.log(state); - console.log(localStorage.getItem('latestCSRFToken')); if (state == localStorage.getItem("latestCSRFToken")) { - console.log('B'); await AuthorizeIntegration({ workspaceId: localStorage.getItem("projectData.id"), code, diff --git a/frontend/pages/integrations/[id].js b/frontend/pages/integrations/[id].js index a6b06321d..6ffccac90 100644 --- a/frontend/pages/integrations/[id].js +++ b/frontend/pages/integrations/[id].js @@ -7,12 +7,9 @@ import Integration from "~/components/integrations/Integration"; import FrameworkIntegrationSection from "~/components/integrations/FrameworkIntegrationSection"; import CloudIntegrationSection from "~/components/integrations/CloudIntegrationSection"; import ProjectIntegrationSection from "~/components/integrations/ProjectIntegrationSection"; -import guidGenerator from "~/utilities/randomId"; -import { - frameworks -} from "../../public/data/frequentConstants"; +import frameworkIntegrations from "../../public/json/frameworkIntegrations.json"; +import cloudIntegrations from "../../public/json/cloudIntegrations.json"; import deleteIntegrationAuth from "../api/integrations/DeleteIntegrationAuth"; -import getIntegrations from "../api/integrations/GetIntegrations"; import getWorkspaceAuthorizations from "../api/integrations/getWorkspaceAuthorizations"; import getWorkspaceIntegrations from "../api/integrations/getWorkspaceIntegrations"; import getBot from "../api/bot/getBot"; @@ -26,7 +23,6 @@ const { const crypto = require("crypto"); export default function Integrations() { - const [integrations, setIntegrations] = useState([]); const [projectIntegrations, setProjectIntegrations] = useState([]); const [authorizations, setAuthorizations] = useState(); const [bot, setBot] = useState(null); @@ -54,14 +50,7 @@ export default function Integrations() { workspaceId: router.query.id }); setBot(bot.bot); - - // get cloud integration options - let integrationOptions = await getIntegrations(); - integrationOptions = Object - .keys(integrationOptions) - .map(integrationOption => integrationOptions[integrationOption]); - setIntegrations(integrationOptions); } catch (err) { console.log(err); } @@ -160,7 +149,7 @@ export default function Integrations() { } } - return integrations ? ( + return (
Dashboard @@ -181,7 +170,6 @@ export default function Integrations() { handleBotActivate={handleBotActivate} handleIntegrationOption={handleIntegrationOption} /> - {projectIntegrations.length > 0 && ( - +
- ) : ( -
-
- loading animation -
); } diff --git a/frontend/pages/vercel.js b/frontend/pages/vercel.js new file mode 100644 index 000000000..cf317ec0f --- /dev/null +++ b/frontend/pages/vercel.js @@ -0,0 +1,29 @@ +import React, { useEffect } from "react"; +import Head from "next/head"; +import { useRouter } from "next/router"; +const queryString = require("query-string"); +import AuthorizeIntegration from "./api/integrations/authorizeIntegration"; + +export default function Vercel() { + const router = useRouter(); + const parsedUrl = queryString.parse(router.asPath.split("?")[1]); + + /** + * Here we forward to the default workspace if a user opens this url + */ + // eslint-disable-next-line react-hooks/exhaustive-deps + useEffect(async () => { + console.log('parsedUrl, xxx', parsedUrl); + try { + + } catch (err) { + + } + + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + + return
; +} + +Vercel.requireAuth = true; diff --git a/frontend/public/data/frequentConstants.ts b/frontend/public/data/frequentConstants.ts index fbc0034d3..d44706660 100644 --- a/frontend/public/data/frequentConstants.ts +++ b/frontend/public/data/frequentConstants.ts @@ -12,71 +12,7 @@ const reverseEnvMapping = { test: "Testing", }; -const frameworks = [{ - "name": "Docker", - "image": "Docker", - "link": "https://infisical.com/docs/integrations/platforms/docker" - }, { - "name": "Docker Compose", - "image": "Docker Compose", - "link": "https://infisical.com/docs/integrations/platforms/docker-compose" - }, { - "name": "React", - "image": "React", - "link": "https://infisical.com/docs/integrations/frameworks/react" - }, { - "name": "Vue", - "image": "Vue", - "link": "https://infisical.com/docs/integrations/frameworks/vue" - }, { - "image": "Express", - "link": "https://infisical.com/docs/integrations/frameworks/express" - },{ - "image": "Next.js", - "link": "https://infisical.com/docs/integrations/frameworks/nextjs" - }, { - "name": "Django", - "image": "Django", - "link": "https://infisical.com/docs/integrations/frameworks/django" - }, { - "name": "NestJS", - "image": "NestJS", - "link": "https://infisical.com/docs/integrations/frameworks/nestjs" - }, { - "name": "Nuxt", - "image": "Nuxt", - "link": "https://infisical.com/docs/integrations/frameworks/nuxt" - }, { - "name": "Gatsby", - "image": "Gatsby", - "link": "https://infisical.com/docs/integrations/frameworks/gatsby" - }, { - "name": "Remix", - "image": "Remix", - "link": "https://infisical.com/docs/integrations/frameworks/remix" - }, { - "name": "Vite", - "image": "Vite", - "link": "https://infisical.com/docs/integrations/frameworks/vite" - }, { - "image": "Fiber", - "link": "https://infisical.com/docs/integrations/frameworks/fiber" - }, { - "name": "Flask", - "image": "Flask", - "link": "https://infisical.com/docs/integrations/frameworks/flask" - }, { - "name": "Laravel", - "image": "Laravel", - "link": "https://infisical.com/docs/integrations/frameworks/laravel" - }, { - "image": "Rails", - "link": "https://infisical.com/docs/integrations/frameworks/rails" - } -] - export { envMapping, - frameworks, reverseEnvMapping }; diff --git a/frontend/public/json/cloudIntegrations.json b/frontend/public/json/cloudIntegrations.json new file mode 100644 index 000000000..7d11b3b51 --- /dev/null +++ b/frontend/public/json/cloudIntegrations.json @@ -0,0 +1,58 @@ +[ + { + "name": "Heroku", + "slug": "heroku", + "image": "Heroku", + "type": "oauth2", + "clientId": "bc132901-935a-4590-b010-f1857efc380d" + }, + { + "name": "Netlify", + "slug": "netlify", + "image": "Netlify", + "type": "oauth2", + "clientId": "" + }, + { + "name": "Digital Ocean", + "slug": "digital-ocean", + "image": "Digital Ocean", + "type": "", + "clientId": "" + }, + { + "name": "Google Cloud Platform", + "slug": "gcp", + "image": "Google Cloud Platform", + "type": "", + "clientId": "" + }, + { + "name": "Amazon Web Services", + "slug": "aws", + "image": "Amazon Web Services", + "type": "", + "clientId": "" + }, + { + "name": "Microsoft Azure", + "slug": "azure", + "image": "Microsoft Azure", + "type": "", + "clientId": "" + }, + { + "name": "Travis CI", + "slug": "travisci", + "image": "Travis CI", + "type": "", + "clientId": "" + }, + { + "name": "Circle CI", + "slug": "circleci", + "image": "Circle CI", + "type": "", + "clientId": "" + } +] \ No newline at end of file diff --git a/frontend/public/json/frameworkIntegrations.json b/frontend/public/json/frameworkIntegrations.json new file mode 100644 index 000000000..fb8b30c9e --- /dev/null +++ b/frontend/public/json/frameworkIntegrations.json @@ -0,0 +1,98 @@ +[ + { + "name": "Docker", + "slug": "docker", + "image": "Docker", + "docsLink": "https://infisical.com/docs/integrations/platforms/docker" + }, + { + "name": "Docker Compose", + "slug": "docker-compose", + "image": "Docker Compose", + "docsLink": "https://infisical.com/docs/integrations/platforms/docker-compose" + }, + { + "name": "React", + "slug": "react", + "image": "React", + "docsLink": "https://infisical.com/docs/integrations/frameworks/react" + }, + { + "name": "Vue", + "slug": "vue", + "image": "Vue", + "docsLink": "https://infisical.com/docs/integrations/frameworks/vue" + }, + { + "name": "Express", + "slug": "express", + "image": "Express", + "docsLink": "https://infisical.com/docs/integrations/frameworks/express" + }, + { + "name": "Next.js", + "slug": "nextjs", + "image": "Next.js", + "docsLink": "https://infisical.com/docs/integrations/frameworks/nextjs" + }, + { + "name": "Django", + "slug": "django", + "image": "Django", + "docsLink": "https://infisical.com/docs/integrations/frameworks/django" + }, + { + "name": "NestJS", + "slug": "nestjs", + "image": "NestJS", + "docsLink": "https://infisical.com/docs/integrations/frameworks/nestjs" + }, + { + "name": "Nuxt", + "slug": "nuxt", + "image": "Nuxt", + "docsLink": "https://infisical.com/docs/integrations/frameworks/nuxt" + }, + { + "name": "Gatsby", + "slug": "gatsby", + "image": "Gatsby", + "docsLink": "https://infisical.com/docs/integrations/frameworks/gatsby" + }, + { + "name": "Remix", + "slug": "remix", + "image": "Remix", + "docsLink": "https://infisical.com/docs/integrations/frameworks/remix" + }, + { + "name": "Vite", + "slug": "vite", + "image": "Vite", + "docsLink": "https://infisical.com/docs/integrations/frameworks/vite" + }, + { + "name": "Fiber", + "slug": "fiber", + "image": "Fiber", + "docsLink": "https://infisical.com/docs/integrations/frameworks/fiber" + }, + { + "name": "Flask", + "slug": "flask", + "image": "Flask", + "docsLink": "https://infisical.com/docs/integrations/frameworks/flask" + }, + { + "name": "Laravel", + "slug": "laravel", + "image": "Laravel", + "docsLink": "https://infisical.com/docs/integrations/frameworks/laravel" + }, + { + "name": "Rails", + "slug": "rails", + "image": "Rails", + "docsLink": "https://infisical.com/docs/integrations/frameworks/rails" + } +] \ No newline at end of file