From b0f0705f64cf4a6e0fe855c3f6672ff9af8128f4 Mon Sep 17 00:00:00 2001 From: Karthik Raju Date: Tue, 3 Jan 2023 16:45:24 +0530 Subject: [PATCH 1/8] use discord credentials when available --- discord-bot/README.md | 14 ++++++++++++++ package-lock.json | 6 ++++++ website/.env | 3 +++ website/.gitignore | 1 + website/next.config.js | 8 ++++++++ website/src/components/Header/UserMenu.tsx | 2 +- 6 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 package-lock.json diff --git a/discord-bot/README.md b/discord-bot/README.md index 000155ae..371fd001 100644 --- a/discord-bot/README.md +++ b/discord-bot/README.md @@ -51,6 +51,20 @@ Remember to save your changes. https://discord.com/oauth2/authorize?client_id=YOUR_CLIENT_ID_HERE&permissions=8&scope=bot%20applications.commands ``` +## Discord setup for development + +- Create `DISCORD_CLIENT_ID` and `DISCORD_CLIENT_SECRET` keys in the `.env` file + in `website`. +- Go to `https://discord.com/developers/applications` and click on + `New Application` and create a new application. +- Once the new application is created, you will have access to `Client ID` and + `Client Secret` in the `OAuth2` section. Copy those values and paste for the + respective fields in the `.env` file. +- In the `Oauth2` section, there is an field called `Redirects` which has to be + provided with the following URL. This URL is nothing but the discord callback + URL which NextAuth uses - `http://localhost:3000/api/auth/callback/discord` + (The PORT number for the localhost could be different based on your setup) + ### Environment Setup To run the bot: diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..0c313854 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "Open-Assistant", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} diff --git a/website/.env b/website/.env index 9544836b..c2f1c7e0 100644 --- a/website/.env +++ b/website/.env @@ -12,3 +12,6 @@ NEXTAUTH_SECRET=O/M2uIbGj+lDD2oyNa8ax4jEOJqCPJzO53UbWShmq98= EMAIL_SERVER_HOST=localhost EMAIL_SERVER_PORT=1025 EMAIL_FROM=info@example.com + +DISCORD_CLIENT_ID=1058355952459452446 +DISCORD_CLIENT_SECRET=Fz_I1wnexVaCty9zFRscDBQN-gBPcil_ diff --git a/website/.gitignore b/website/.gitignore index 86e167da..5a3cffad 100644 --- a/website/.gitignore +++ b/website/.gitignore @@ -27,6 +27,7 @@ yarn-error.log* # local env files .env*.local +.env # vercel .vercel diff --git a/website/next.config.js b/website/next.config.js index 2c37ebe6..1a713ca6 100644 --- a/website/next.config.js +++ b/website/next.config.js @@ -2,6 +2,14 @@ const nextConfig = { output: "standalone", reactStrictMode: true, + images: { + remotePatterns: [ + { + protocol: 'https', + hostname: '**.discordapp.com', + }, + ], + }, experimental: { /* Disabling this for now only because it causes a warning in the console that cannot be silenced for eslint If this can be resolved, we should re-enable this. diff --git a/website/src/components/Header/UserMenu.tsx b/website/src/components/Header/UserMenu.tsx index 35b71698..280a207b 100644 --- a/website/src/components/Header/UserMenu.tsx +++ b/website/src/components/Header/UserMenu.tsx @@ -30,7 +30,7 @@ export function UserMenu() {
Profile Picture Date: Tue, 3 Jan 2023 16:46:22 +0530 Subject: [PATCH 2/8] use discord credentials when avaialble --- website/next.config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/next.config.js b/website/next.config.js index 1a713ca6..28da824f 100644 --- a/website/next.config.js +++ b/website/next.config.js @@ -5,8 +5,8 @@ const nextConfig = { images: { remotePatterns: [ { - protocol: 'https', - hostname: '**.discordapp.com', + protocol: "https", + hostname: "**.discordapp.com", }, ], }, From 1f26d4f2aa0eff6b24b6c29609a5d3c232189620 Mon Sep 17 00:00:00 2001 From: Karthik Raju Date: Tue, 3 Jan 2023 16:59:38 +0530 Subject: [PATCH 3/8] update .env to remove sensitive details --- website/.env | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/website/.env b/website/.env index c2f1c7e0..bcd39d12 100644 --- a/website/.env +++ b/website/.env @@ -11,7 +11,4 @@ NEXTAUTH_SECRET=O/M2uIbGj+lDD2oyNa8ax4jEOJqCPJzO53UbWShmq98= # The SMTP host and port found by running the jobs in /scripts/frontend-development/docker-compose.yaml EMAIL_SERVER_HOST=localhost EMAIL_SERVER_PORT=1025 -EMAIL_FROM=info@example.com - -DISCORD_CLIENT_ID=1058355952459452446 -DISCORD_CLIENT_SECRET=Fz_I1wnexVaCty9zFRscDBQN-gBPcil_ +EMAIL_FROM=info@example.com \ No newline at end of file From 4cdec519449b5303bb7fda42f30b5701404f80e5 Mon Sep 17 00:00:00 2001 From: Karthik Raju Date: Tue, 3 Jan 2023 17:01:20 +0530 Subject: [PATCH 4/8] update .gitignore file --- website/.gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/website/.gitignore b/website/.gitignore index 5a3cffad..86e167da 100644 --- a/website/.gitignore +++ b/website/.gitignore @@ -27,7 +27,6 @@ yarn-error.log* # local env files .env*.local -.env # vercel .vercel From 73178898352772fd690b7e4861b2e6b8dd2e8b8d Mon Sep 17 00:00:00 2001 From: Karthik Raju Date: Tue, 3 Jan 2023 21:39:39 +0530 Subject: [PATCH 5/8] move discord setup to website readme --- discord-bot/README.md | 15 --------------- website/README.md | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/discord-bot/README.md b/discord-bot/README.md index 371fd001..80f6c490 100644 --- a/discord-bot/README.md +++ b/discord-bot/README.md @@ -50,21 +50,6 @@ Remember to save your changes. ``` https://discord.com/oauth2/authorize?client_id=YOUR_CLIENT_ID_HERE&permissions=8&scope=bot%20applications.commands ``` - -## Discord setup for development - -- Create `DISCORD_CLIENT_ID` and `DISCORD_CLIENT_SECRET` keys in the `.env` file - in `website`. -- Go to `https://discord.com/developers/applications` and click on - `New Application` and create a new application. -- Once the new application is created, you will have access to `Client ID` and - `Client Secret` in the `OAuth2` section. Copy those values and paste for the - respective fields in the `.env` file. -- In the `Oauth2` section, there is an field called `Redirects` which has to be - provided with the following URL. This URL is nothing but the discord callback - URL which NextAuth uses - `http://localhost:3000/api/auth/callback/discord` - (The PORT number for the localhost could be different based on your setup) - ### Environment Setup To run the bot: diff --git a/website/README.md b/website/README.md index 5198a820..fb59c5d7 100644 --- a/website/README.md +++ b/website/README.md @@ -75,6 +75,20 @@ OAuth. 1. You should see a section for debug credentials. Enter any username you wish, you will be logged in as that user. +## Discord setup to enable discord authentication + +- Create `DISCORD_CLIENT_ID` and `DISCORD_CLIENT_SECRET` keys in the `.env` file + in `website`. +- Go to `https://discord.com/developers/applications` and click on + `New Application` and create a new application. +- Once the new application is created, you will have access to `Client ID` and + `Client Secret` in the `OAuth2` section. Copy those values and paste for the + respective fields in the `.env` file. +- In the `Oauth2` section, there is an field called `Redirects` which has to be + provided with the following URL. This URL is nothing but the discord callback + URL which NextAuth uses - `http://localhost:3000/api/auth/callback/discord` + (The PORT number for the localhost could be different based on your setup) + ### Using Storybook To develop components using [Storybook](https://storybook.js.org/) run From a2adfd45515cf01bd7708dae5a1ab3c74b538e73 Mon Sep 17 00:00:00 2001 From: Karthik Raju Date: Wed, 4 Jan 2023 17:37:55 +0530 Subject: [PATCH 6/8] update readme --- discord-bot/README.md | 1 + website/README.md | 15 --------------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/discord-bot/README.md b/discord-bot/README.md index 80f6c490..000155ae 100644 --- a/discord-bot/README.md +++ b/discord-bot/README.md @@ -50,6 +50,7 @@ Remember to save your changes. ``` https://discord.com/oauth2/authorize?client_id=YOUR_CLIENT_ID_HERE&permissions=8&scope=bot%20applications.commands ``` + ### Environment Setup To run the bot: diff --git a/website/README.md b/website/README.md index fb59c5d7..d861f552 100644 --- a/website/README.md +++ b/website/README.md @@ -74,21 +74,6 @@ OAuth. 1. Use the `Login` button in the top right to go to the login page. 1. You should see a section for debug credentials. Enter any username you wish, you will be logged in as that user. - -## Discord setup to enable discord authentication - -- Create `DISCORD_CLIENT_ID` and `DISCORD_CLIENT_SECRET` keys in the `.env` file - in `website`. -- Go to `https://discord.com/developers/applications` and click on - `New Application` and create a new application. -- Once the new application is created, you will have access to `Client ID` and - `Client Secret` in the `OAuth2` section. Copy those values and paste for the - respective fields in the `.env` file. -- In the `Oauth2` section, there is an field called `Redirects` which has to be - provided with the following URL. This URL is nothing but the discord callback - URL which NextAuth uses - `http://localhost:3000/api/auth/callback/discord` - (The PORT number for the localhost could be different based on your setup) - ### Using Storybook To develop components using [Storybook](https://storybook.js.org/) run From dda5514baebe7cf9a32fecafe32ca0743fcc7d1a Mon Sep 17 00:00:00 2001 From: Karthik Raju Date: Wed, 4 Jan 2023 17:38:55 +0530 Subject: [PATCH 7/8] update readme file --- website/.env | 2 +- website/README.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/website/.env b/website/.env index bcd39d12..9544836b 100644 --- a/website/.env +++ b/website/.env @@ -11,4 +11,4 @@ NEXTAUTH_SECRET=O/M2uIbGj+lDD2oyNa8ax4jEOJqCPJzO53UbWShmq98= # The SMTP host and port found by running the jobs in /scripts/frontend-development/docker-compose.yaml EMAIL_SERVER_HOST=localhost EMAIL_SERVER_PORT=1025 -EMAIL_FROM=info@example.com \ No newline at end of file +EMAIL_FROM=info@example.com diff --git a/website/README.md b/website/README.md index d861f552..5198a820 100644 --- a/website/README.md +++ b/website/README.md @@ -74,6 +74,7 @@ OAuth. 1. Use the `Login` button in the top right to go to the login page. 1. You should see a section for debug credentials. Enter any username you wish, you will be logged in as that user. + ### Using Storybook To develop components using [Storybook](https://storybook.js.org/) run From ab434ee79b0c2fac5a7fd6e27a0ea348a3dea4a8 Mon Sep 17 00:00:00 2001 From: Karthik Raju Date: Thu, 5 Jan 2023 12:46:07 +0530 Subject: [PATCH 8/8] remove package-lock.json file from the root folder --- package-lock.json | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 package-lock.json diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 0c313854..00000000 --- a/package-lock.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Open-Assistant", - "lockfileVersion": 3, - "requires": true, - "packages": {} -}