From 501a9dcfd88d9e4e2877c55eb62b57e7ddaac303 Mon Sep 17 00:00:00 2001 From: Michael Moyo Date: Fri, 31 May 2024 19:06:56 -0700 Subject: [PATCH 1/2] Backend Changes --- docker-compose.dev.yml | 13 +- packages/apps/bitbucket/src/services/oauth.ts | 2 + .../apps/confluence/src/services/oauth.ts | 2 + packages/apps/github/src/services/oauth.ts | 2 + packages/apps/gmail/src/services/oauth.ts | 3 +- packages/apps/jira/src/services/oauth.ts | 2 + packages/apps/notion/src/services/oauth.ts | 2 + packages/apps/slack/src/services/oauth.ts | 2 + .../pages/dashboard/marketplace/[slug].tsx | 469 +++++++++++------- packages/ocular/core-config-dev.js | 196 ++++---- 10 files changed, 415 insertions(+), 278 deletions(-) diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 352a1586..915d5c11 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -30,6 +30,7 @@ services: - ./redis-data:/data zookeeper: + image: "confluentinc/cp-zookeeper:latest" image: "confluentinc/cp-zookeeper:latest" ports: - "2181:2181" @@ -38,24 +39,34 @@ services: - ZOOKEEPER_TICK_TIME=2000 volumes: - ./log4j.properties:/opt/bitnami/zookeeper/conf/log4j.properties + - ZOOKEEPER_CLIENT_PORT=2181 + - ZOOKEEPER_TICK_TIME=2000 + volumes: + - ./log4j.properties:/opt/bitnami/zookeeper/conf/log4j.properties kafka: + image: confluentinc/cp-kafka:latest image: confluentinc/cp-kafka:latest user: root ports: - "9092:9092" depends_on: - zookeeper + depends_on: + - zookeeper environment: - KAFKA_BROKER_ID=1 + - KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1 - KAFKA_LISTENERS=PLAINTEXT://:9092 - KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://127.0.0.1:9092 - KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181 - ALLOW_PLAINTEXT_LISTENER=yes - KAFKA_LOG4J_LOGGERS=org.apache.zookeeper=ERROR,org.apache.kafka=ERROR,kafka=ERROR,kafka.cluster=ERROR,kafka.controller=ERROR,kafka.coordinator=ERROR,kafka.log=ERROR,kafka.server=ERROR,kafka.zookeeper=ERROR,state.change.logger=ERROR + - KAFKA_LOG4J_LOGGERS=org.apache.zookeeper=ERROR,org.apache.kafka=ERROR,kafka=ERROR,kafka.cluster=ERROR,kafka.controller=ERROR,kafka.coordinator=ERROR,kafka.log=ERROR,kafka.server=ERROR,kafka.zookeeper=ERROR,state.change.logger=ERROR volumes: - ./Kafka:/bitnami/kafka - ./log4j.properties:/etc/kafka/log4j.properties + - ./log4j.properties:/etc/kafka/log4j.properties ocular-db: image: postgres:14-alpine @@ -76,7 +87,7 @@ services: environment: - DATABASE_URL=postgresql://ocular:ocular@ocular-db:5432/ocular - DATABASE_NAME=ocular - command: npm run typeorm:local migration:run + command: npm run typeorm:dev migration:run pgadmin: image: dpage/pgadmin4 diff --git a/packages/apps/bitbucket/src/services/oauth.ts b/packages/apps/bitbucket/src/services/oauth.ts index 1c6fe25e..ff25ff5d 100644 --- a/packages/apps/bitbucket/src/services/oauth.ts +++ b/packages/apps/bitbucket/src/services/oauth.ts @@ -25,6 +25,7 @@ class BitBucketOauth extends OauthService { const client_id = options.client_id; const client_secret = options.client_secret; const redirect = options.redirect_uri; + const auth_strategy = options.auth_strategy; return { name: AppNameDefinitions.BITBUCKET, logo: '/bitbucket.svg', @@ -35,6 +36,7 @@ class BitBucketOauth extends OauthService { category: AppCategoryDefinitions.FILE_STORAGE, developer: 'Ocular AI', images: ['/bitbucket.svg'], + auth_strategy: auth_strategy, overview: 'Bitbucket is a Git-based source code repository hosting service owned by Atlassian', docs: 'https://developer.atlassian.com/cloud/bitbucket/rest', diff --git a/packages/apps/confluence/src/services/oauth.ts b/packages/apps/confluence/src/services/oauth.ts index 66ad8ec4..eb46f510 100644 --- a/packages/apps/confluence/src/services/oauth.ts +++ b/packages/apps/confluence/src/services/oauth.ts @@ -25,6 +25,7 @@ class ConfluenceOauth extends OauthService { const client_id = options.client_id; const client_secret = options.client_secret; const redirect = options.redirect_uri; + const auth_strategy = options.auth_strategy; return { name: AppNameDefinitions.CONFLUENCE, @@ -35,6 +36,7 @@ class ConfluenceOauth extends OauthService { redirect )}&response_type=code&prompt=consent`, slug: AppNameDefinitions.CONFLUENCE, + auth_strategy: auth_strategy, category: AppCategoryDefinitions.PRODUCTIVITY, developer: 'Ocular AI', images: ['/confluence.svg'], diff --git a/packages/apps/github/src/services/oauth.ts b/packages/apps/github/src/services/oauth.ts index a5f28d62..0df5d073 100644 --- a/packages/apps/github/src/services/oauth.ts +++ b/packages/apps/github/src/services/oauth.ts @@ -26,12 +26,14 @@ class GithubOauth extends OauthService { const client_id = options.client_id const client_secret = options.client_secret const redirect = options.redirect_uri + const auth_strategy = options.auth_strategy; return { name: AppNameDefinitions.GITHUB, logo: "/github.svg", description: "GitHub is a web code hosting platform for version control and collaboration. It lets you and others work together on projects from anywhere.", oauth_url: `https://github.com/apps/ocular-ai/installations/new`, slug:AppNameDefinitions.GITHUB, + auth_strategy: auth_strategy, category:AppCategoryDefinitions.SOTWARE_DEVELOPMENT, developer:"Ocular AI", images:["/github.svg"], diff --git a/packages/apps/gmail/src/services/oauth.ts b/packages/apps/gmail/src/services/oauth.ts index df43d937..053b82b0 100644 --- a/packages/apps/gmail/src/services/oauth.ts +++ b/packages/apps/gmail/src/services/oauth.ts @@ -37,7 +37,7 @@ class GmailOauth extends OauthService { }); const client_id = options.client_id const client_secret = options.client_secret - + const auth_strategy = options.auth_strategy; return { name: AppNameDefinitions.GMAIL, logo: "/gmail.png", @@ -46,6 +46,7 @@ class GmailOauth extends OauthService { oauth_url: authorizeUrl, slug:AppNameDefinitions.GMAIL, category:AppCategoryDefinitions.FILE_STORAGE, + auth_strategy: auth_strategy, developer:"Ocular AI", images:["/gmail.png"], overview: "Gmail uses industry-leading encryption for all messages you receive and send. We never use your Gmail content to personalize ads.", diff --git a/packages/apps/jira/src/services/oauth.ts b/packages/apps/jira/src/services/oauth.ts index 1ddaa09c..4401b945 100644 --- a/packages/apps/jira/src/services/oauth.ts +++ b/packages/apps/jira/src/services/oauth.ts @@ -25,6 +25,7 @@ class JiarOauth extends OauthService { const client_id = options.client_id; const client_secret = options.client_secret; const redirect = options.redirect_uri; + const auth_strategy = options.auth_strategy; return { name: AppNameDefinitions.JIRA, logo: '/jira.svg', @@ -34,6 +35,7 @@ class JiarOauth extends OauthService { redirect )}&response_type=code&prompt=consent`, slug: AppNameDefinitions.JIRA, + auth_strategy: auth_strategy, category: AppCategoryDefinitions.PRODUCTIVITY, developer: 'Ocular AI', images: ['/jira.svg'], diff --git a/packages/apps/notion/src/services/oauth.ts b/packages/apps/notion/src/services/oauth.ts index b4151ddf..e673ee14 100644 --- a/packages/apps/notion/src/services/oauth.ts +++ b/packages/apps/notion/src/services/oauth.ts @@ -26,6 +26,7 @@ class NotionOauth extends OauthService { const client_id = options.client_id; const client_secret = options.client_secret; const redirect = options.redirect_uri; + const auth_strategy = options.auth_strategy; return { name: AppNameDefinitions.NOTION, logo: '/notion.svg', @@ -37,6 +38,7 @@ class NotionOauth extends OauthService { slug: AppNameDefinitions.NOTION, category: AppCategoryDefinitions.PRODUCTIVITY, developer: 'Ocular AI', + auth_strategy: auth_strategy, images: ['/notion.svg'], overview: 'Notion is a single space where you can think, write, and plan. Capture thoughts, manage projects, or even run an entire company — and do it exactly the way you want.', diff --git a/packages/apps/slack/src/services/oauth.ts b/packages/apps/slack/src/services/oauth.ts index 1d8b8efd..f440098a 100644 --- a/packages/apps/slack/src/services/oauth.ts +++ b/packages/apps/slack/src/services/oauth.ts @@ -25,6 +25,7 @@ class SlackOauth extends OauthService { const client_id = options.client_id; const client_secret = options.client_secret; const redirect = options.redirect_uri; + const auth_strategy = options.auth_strategy; return { name: AppNameDefinitions.SLACK, logo: '/slack.svg', @@ -34,6 +35,7 @@ class SlackOauth extends OauthService { slug: AppNameDefinitions.SLACK, category: AppCategoryDefinitions.PRODUCTIVITY, developer: 'Ocular AI', + auth_strategy: auth_strategy, images: ['/slack.svg'], overview: 'Slack is a new way to communicate with your team. Its faster, better organised and more secure than email.', diff --git a/packages/ocular-ui/pages/dashboard/marketplace/[slug].tsx b/packages/ocular-ui/pages/dashboard/marketplace/[slug].tsx index 6d1f2c0d..11024673 100644 --- a/packages/ocular-ui/pages/dashboard/marketplace/[slug].tsx +++ b/packages/ocular-ui/pages/dashboard/marketplace/[slug].tsx @@ -1,126 +1,150 @@ -import React, { use, useEffect, useState } from 'react'; -import { useRouter } from 'next/router'; import { marked } from 'marked'; import Head from 'next/head'; import Image from 'next/image'; import Link from 'next/link'; +import { useRouter } from 'next/router'; +import React, { use, useEffect, useState } from 'react'; import { Swiper, SwiperSlide } from 'swiper/react'; import 'swiper/css'; import Layout from '@/components/layout'; +import WebConnector from '@/components/marketplace/webConnector'; import SectionContainer from '@/components/section-container'; +import { Button } from '@/components/ui/button'; +import { Card, CardContent } from '@/components/ui/card'; +import { + Form, + FormControl, + FormDescription, + FormField, + FormItem, + FormLabel, + FormMessage, +} from '@/components/ui/form'; +import { Input } from '@/components/ui/input'; +import { formatLabel } from '@/lib/utils'; +import api from '@/services/admin-api'; import { Integration } from '@/types/types'; -import { Button } from "@/components/ui/button"; -import api from "@/services/admin-api"; +import { zodResolver } from '@hookform/resolvers/zod'; import { IconChevronLeft, IconExternalLink } from '@supabase/ui'; -import WebConnector from '@/components/marketplace/webConnector'; -import { formatLabel } from '@/lib/utils'; - +import { useForm } from 'react-hook-form'; +import { z } from 'zod'; interface Link { + id: string; location: string; status: 'processing' | 'success' | 'failed'; -}; + title: string; + description: string; +} -function Integration() { +const formSchema = z.object({ + apiToken: z + .string() + .min(1, { message: 'API Token is required' }) + .describe('The API token for Integration of APP in Ocular'), +}); - const [integration, setIntegration] = useState(null); - const [authorized, setAuthorized] = useState(false); - const [links,setLinks]=useState(null); +const OAUTHTOKEN = 'OAUTHTOKEN'; +const WEBCONNECTOR = 'webConnector'; + +function Integrations() { const router = useRouter(); let { slug, code, installation_id } = router.query; + const [integration, setIntegration] = useState(null); + const [authorized, setAuthorized] = useState(false); + const [links, setLinks] = useState(null); - useEffect(() => { + const form = useForm>({ + resolver: zodResolver(formSchema), + defaultValues: { + apiToken: '', + }, + }); - const fetchIntegration = async () => { + const authorizeApp = async (code: string) => { + if (code == null) return; // If OAuth code is not present, return + try { + const response = await api.apps.authorizeApp({ + code: code as string, + name: slug as string, + installationId: installation_id, + }); // Adjust this to match your actual API call + if (response) { + setAuthorized(true); + router.push(`/dashboard/marketplace/${slug}`); // Redirect to the integration page + } + } catch (error) { + console.error('Failed to authorize integration', error); + } + }; + + async function formSubmit(values: z.infer) { + await authorizeApp(values.apiToken); + } + const updateWebConnectorLinks = (apps: any) => { + const webConnector = apps.find((app: any) => app.name === 'webConnector'); + setLinks(webConnector?.links || []); + }; + + const addWebConnector = async () => { + await authorizeApp('Fake Code'); + }; + + useEffect(() => { + const fetchIntegration = async () => { if (typeof slug !== 'string') return; // Make sure slug is a string try { const response = await api.apps.list(); // Adjust this to match your actual API call - const fetchedIntegration = response.data.apps.find(app => app.name === slug); + const fetchedIntegration = response.data.apps.find( + (app: any) => app.name === slug + ); if (fetchedIntegration) { - fetchedIntegration.overview = marked.parse(fetchedIntegration.overview); // Parse markdown content + fetchedIntegration.overview = marked.parse( + fetchedIntegration.overview + ); // Parse markdown content setIntegration(fetchedIntegration); } } catch (error) { - console.error("Failed to fetch integration details", error); + console.error('Failed to fetch integration details', error); } }; fetchIntegration(); }, [slug]); - useEffect(() => { - const listInstalled = async () => { - try { - const response = await api.apps.listInstalled(); // Adjust this to match your actual API call - if (response) { - - const installed = response.data.apps.some(app => app.name === slug); - setAuthorized(installed); - - if(slug==="webConnector"&&authorized){ - const webConnector=response.data.apps.find((app)=>app.name===slug); - if (webConnector && webConnector.links && webConnector.links.length > 0) { - setLinks(webConnector.links); - }else{ - setLinks([]); - } - } - } - } catch (error) { - console.error("Failed to get installed apps", error); - } - } - listInstalled() - }, [slug,authorized]); - useEffect(() => { - const authorizeApp = async () => { - if (code == null ) return; // If OAuth code is not present, return + const listInstalled = async () => { try { - const response = await api.apps.authorizeApp({ - code: code as string, - name: slug as string, - installationId: installation_id - }); // Adjust this to match your actual API call - if (response) { - setAuthorized(true); - router.push(`/dashboard/marketplace/${slug}`); // Redirect to the integration page - } - } catch (error) { - console.error("Failed to authorize integration", error); - } - } - authorizeApp() - }, [code,installation_id]); - - const addWebConnector=async ()=>{ - try { - const response = await api.apps.authorizeApp({ - code: "Fake Code" as string, - name: slug as string, - installationId: installation_id - }); // Adjust this to match your actual API call + const response = await api.apps.listInstalled(); // Adjust this to match your actual API call if (response) { - setAuthorized(true); - router.push(`/dashboard/marketplace/${slug}`); // Redirect to the integration page + const installed = response.data.apps.some( + (app: any) => app.name === slug + ); + setAuthorized(installed); + if (slug === WEBCONNECTOR && authorized) { + updateWebConnectorLinks(response.data.apps); + } } } catch (error) { - console.error("Failed to authorize integration", error); + console.error('Failed to get installed apps', error); } }; + listInstalled(); + }, [slug, authorized]); - if (!integration) return
Loading...
; + useEffect(() => { + authorizeApp(code as string); + }, [code, installation_id]); - if(slug==="webConnector"&& authorized){ + if (!integration) return
Loading...
; - if(!links){ - console.log("REACHED HERE",links); - return
Loading...
; + if (slug === WEBCONNECTOR && authorized) { + if (!links) { + return
Loading...
; } - - return + return ; } return ( @@ -140,64 +164,117 @@ function Integration() { - {/* Integration header with logo and name */} -
-
- {integration.name} -

{formatLabel(integration.name)}

+ {/* Integration header with logo and name */} +
+
+ {integration.name} +

+ {formatLabel(integration.name)} +

+
+ + {authorized ? ( + + ) : ( +
+ {integration.auth_strategy === OAUTHTOKEN && ( +
+ {slug === WEBCONNECTOR ? ( + + ) : ( + + + + )} +
+ )} +
+ )}
- - {authorized? ( - - ) : ( - - slug === 'webConnector' ? ( - - ) : - ( - - - - ) - ) - } -
- {/* Swiper for images */} - - {integration.images.map((image, i) => ( - -
- {integration.name} + {/* Swiper for images */} +
+ + {integration.images.map((image, i) => ( + +
+ {integration.name} +
+
+ ))} +
+ {integration.auth_strategy === 'APITOKEN' && !authorized && ( +
+ + +
+ +
+ ( +
+ + Service account API token + + + + + + Make sure the token is of service account + + +
+ )} + /> +
+ +
+ +
+
- - ))} - + )} +
@@ -222,67 +299,87 @@ function Integration() { Details -
-
- Developer - {integration.developer} -
+
+
+ + Developer + + + {integration.developer} + +
-
- Category - - - {integration.category} - - -
+
+ + Category + + + + {integration.category} + + +
- + - - -
- {authorized? ( - + {authorized ? ( + ) : ( - - - - ) - } +
+ {integration.auth_strategy === OAUTHTOKEN && ( +
+ {slug === WEBCONNECTOR ? ( + + ) : ( + + + + )} +
+ )} +
+ )} +
-
- +
- ) + ); } - -export default Integration \ No newline at end of file +export default Integrations; diff --git a/packages/ocular/core-config-dev.js b/packages/ocular/core-config-dev.js index 06189e62..712ae67f 100644 --- a/packages/ocular/core-config-dev.js +++ b/packages/ocular/core-config-dev.js @@ -1,8 +1,11 @@ const { PluginNameDefinitions, AppAuthStrategy } = require("@ocular/types"); +const { PluginNameDefinitions, AppAuthStrategy } = require("@ocular/types"); const dotenv = require("dotenv"); let ENV_FILE_NAME = ""; switch (process.env.NODE_ENV) { + case "local": + ENV_FILE_NAME = ".env.local"; case "local": ENV_FILE_NAME = ".env.local"; case "production": @@ -18,6 +21,7 @@ switch (process.env.NODE_ENV) { ENV_FILE_NAME = ".env.dev"; break; default: + ENV_FILE_NAME = ".env.local"; ENV_FILE_NAME = ".env.local"; break; } @@ -57,79 +61,87 @@ module.exports = { scope: "openid email profile", redirect_uri: `${UI_CORS}/dashboard/marketplace/asana`, auth_strategy: AppAuthStrategy.OAUTH_TOKEN_STRATEGY, + auth_strategy: AppAuthStrategy.OAUTH_TOKEN_STRATEGY, rate_limiter_opts: { requests: 1500, // Number of Requests interval: 60, // Interval in Seconds }, + auth_strategy: AppAuthStrategy.OAUTH_TOKEN_STRATEGY, + }, + }, + { + resolve: `confluence`, + options: { + client_id: process.env.CONFLUENCE_CLIENT_ID, + client_secret: process.env.CONFLUENCE_CLIENT_SECRET, + redirect_uri: `${UI_CORS}/dashboard/marketplace/confluence`, + rate_limiter_opts: { + requests: 10, // Number of Requests + interval: 1, // Interval in Seconds + }, + auth_strategy: AppAuthStrategy.OAUTH_TOKEN_STRATEGY, + }, + }, + { + resolve: `jira`, + options: { + client_id: process.env.JIRA_CLIENT_ID, + client_secret: process.env.JIRA_CLIENT_SECRET, + redirect_uri: `${UI_CORS}/dashboard/marketplace/jira`, + rate_limiter_opts: { + requests: 10, // Number of Requests + interval: 1, // Interval in Seconds + }, + auth_strategy: AppAuthStrategy.OAUTH_TOKEN_STRATEGY, + }, + }, + { + resolve: `notion`, + options: { + client_id: process.env.NOTION_CLIENT_ID, + client_secret: process.env.NOTION_CLIENT_SECRET, + redirect_uri: `${UI_CORS}/dashboard/marketplace/notion`, + rate_limiter_opts: { + requests: 3, // Number of Requests + interval: 1, // Interval in Seconds + }, + auth_strategy: AppAuthStrategy.OAUTH_TOKEN_STRATEGY, + }, + }, + { + resolve: `slack`, + options: { + client_id: process.env.SLACK_CLIENT_ID, + client_secret: process.env.SLACK_CLIENT_SECRET, + redirect_uri: `${UI_CORS}/dashboard/marketplace/slack`, + rate_limiter_opts: { + requests: 60, // Number of Requests + interval: 60, // Interval in Seconds + }, + auth_strategy: AppAuthStrategy.OAUTH_TOKEN_STRATEGY, + }, + }, + { + resolve: "bitbucket", + options: { + client_id: process.env.BITBUCKET_CLIENT_ID, + client_secret: process.env.BITBUCKET_CLIENT_SECRET, + redirect_uri: `${UI_CORS}/dashboard/marketplace/bitbucket`, + auth_strategy: AppAuthStrategy.OAUTH_TOKEN_STRATEGY, + }, + }, + { + resolve: `github`, + options: { + client_id: process.env.GITHUB_CLIENT_ID, + client_secret: process.env.GITHUB_CLIENT_SECRET, + redirect_uri: `${UI_CORS}/dashboard/marketplace/github`, + app_id: process.env.GITHUB_APP_ID, + private_key: process.env.GITHUB_PRIVATE_KEY_PATH, + scope: "repo", + auth_strategy: AppAuthStrategy.OAUTH_TOKEN_STRATEGY, }, }, - // { - // resolve: `confluence`, - // options: { - // client_id: process.env.CONFLUENCE_CLIENT_ID, - // client_secret: process.env.CONFLUENCE_CLIENT_SECRET, - // redirect_uri: `${UI_CORS}/dashboard/marketplace/confluence`, - // rate_limiter_opts: { - // requests: 10, // Number of Requests - // interval: 1, // Interval in Seconds - // }, - // }, - // }, - // { - // resolve: `jira`, - // options: { - // client_id: process.env.JIRA_CLIENT_ID, - // client_secret: process.env.JIRA_CLIENT_SECRET, - // redirect_uri: `${UI_CORS}/dashboard/marketplace/jira`, - // rate_limiter_opts: { - // requests: 10, // Number of Requests - // interval: 1, // Interval in Seconds - // }, - // }, - // }, - // { - // resolve: `notion`, - // options: { - // client_id: process.env.NOTION_CLIENT_ID, - // client_secret: process.env.NOTION_CLIENT_SECRET, - // redirect_uri: `${UI_CORS}/dashboard/marketplace/notion`, - // }, - // rate_limiter_opts: { - // requests: 3, // Number of Requests - // interval: 1, // Interval in Seconds - // }, - // }, - // { - // resolve: `slack`, - // options: { - // client_id: process.env.SLACK_CLIENT_ID, - // client_secret: process.env.SLACK_CLIENT_SECRET, - // redirect_uri: `${UI_CORS}/dashboard/marketplace/slack`, - // rate_limiter_opts: { - // requests: 60, // Number of Requests - // interval: 60, // Interval in Seconds - // }, - // }, - // }, - // { - // resolve: "bitbucket", - // options: { - // client_id: process.env.BITBUCKET_CLIENT_ID, - // client_secret: process.env.BITBUCKET_CLIENT_SECRET, - // redirect_uri: `${UI_CORS}/dashboard/marketplace/bitbucket`, - // }, - // }, - // { - // resolve: `github`, - // options: { - // client_id: process.env.GITHUB_CLIENT_ID, - // client_secret: process.env.GITHUB_CLIENT_SECRET, - // redirect_uri: `${UI_CORS}/dashboard/marketplace/github`, - // app_id: process.env.GITHUB_APP_ID, - // private_key: process.env.GITHUB_PRIVATE_KEY_PATH, - // scope: "repo", - // }, - // }, { resolve: `google-drive`, options: { @@ -137,24 +149,27 @@ module.exports = { client_secret: process.env.GOOGLE_CLIENT_SECRET, redirect_uri: `${UI_CORS}/dashboard/marketplace/google-drive`, auth_strategy: AppAuthStrategy.OAUTH_TOKEN_STRATEGY, + auth_strategy: AppAuthStrategy.OAUTH_TOKEN_STRATEGY, rate_limiter_opts: { requests: 60, // Number of Requests interval: 60, // Interval in Seconds }, + auth_strategy: AppAuthStrategy.OAUTH_TOKEN_STRATEGY, + }, + }, + { + resolve: `gmail`, + options: { + client_id: process.env.GOOGLE_CLIENT_ID, + client_secret: process.env.GOOGLE_CLIENT_SECRET, + redirect_uri: `${UI_CORS}/dashboard/marketplace/gmail`, + rate_limiter_opts: { + requests: 60, // Number of Requests + interval: 60, // Interval in Seconds + }, + auth_strategy: AppAuthStrategy.OAUTH_TOKEN_STRATEGY, }, }, - // { - // resolve: `gmail`, - // options: { - // client_id: process.env.GOOGLE_CLIENT_ID, - // client_secret: process.env.GOOGLE_CLIENT_SECRET, - // redirect_uri: `${UI_CORS}/dashboard/marketplace/gmail`, - // rate_limiter_opts: { - // requests: 60, // Number of Requests - // interval: 60, // Interval in Seconds - // }, - // }, - // }, { resolve: `webConnector`, options: { @@ -164,17 +179,18 @@ module.exports = { auth_strategy: AppAuthStrategy.OAUTH_TOKEN_STRATEGY, }, }, - // { - // resolve: `github`, - // options: { - // client_id: process.env.GITHUB_CLIENT_ID, - // client_secret: process.env.GITHUB_CLIENT_SECRET, - // redirect_uri: `${UI_CORS}/dashboard/marketplace/github`, - // app_id: process.env.GITHUB_APP_ID, - // private_key: process.env.GITHUB_PRIVATE_KEY_PATH, - // scope: "repo" - // } - // }, + { + resolve: `github`, + options: { + client_id: process.env.GITHUB_CLIENT_ID, + client_secret: process.env.GITHUB_CLIENT_SECRET, + redirect_uri: `${UI_CORS}/dashboard/marketplace/github`, + app_id: process.env.GITHUB_APP_ID, + private_key: process.env.GITHUB_PRIVATE_KEY_PATH, + scope: "repo", + auth_strategy: AppAuthStrategy.OAUTH_TOKEN_STRATEGY, + } + }, ], plugins: [ { From 866eb0871cb8a431e8038e2df635babe05ebb0af Mon Sep 17 00:00:00 2001 From: Michael Moyo Date: Fri, 31 May 2024 19:13:28 -0700 Subject: [PATCH 2/2] Backend changes --- packages/ocular/core-config-dev.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/ocular/core-config-dev.js b/packages/ocular/core-config-dev.js index 712ae67f..339b25c6 100644 --- a/packages/ocular/core-config-dev.js +++ b/packages/ocular/core-config-dev.js @@ -1,5 +1,4 @@ const { PluginNameDefinitions, AppAuthStrategy } = require("@ocular/types"); -const { PluginNameDefinitions, AppAuthStrategy } = require("@ocular/types"); const dotenv = require("dotenv"); let ENV_FILE_NAME = "";