From b0f0705f64cf4a6e0fe855c3f6672ff9af8128f4 Mon Sep 17 00:00:00 2001 From: Karthik Raju Date: Tue, 3 Jan 2023 16:45:24 +0530 Subject: [PATCH] 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() {