diff --git a/.env.example b/.env.example index fb669c3..20ddef1 100644 --- a/.env.example +++ b/.env.example @@ -7,12 +7,15 @@ POSTGRES_PASSWORD=password POSTGRES_DATABASE=chessh WEB_PORT=8080 -REACT_APP_GITHUB_OAUTH=https://github.com/login/oauth/authorize?client_id=CLIENT_ID_HERE&redirect_uri=http://127.0.0.1:3000/api/oauth/redirect + +REACT_APP_DISCORD_INVITE=https://discord.gg/ajsdlkfjaskldjf +REACT_APP_DISCORD_OAUTH=https://discord.com/api/oauth2/authorize?client_id=CLIENT_ID&redirect_uri=FRONTEND_REDIRECT_PORT_FROM_BELOW&response_type=code&scope=identify + CLIENT_REDIRECT_AFTER_OAUTH=http://127.0.0.1:3000/auth-successful -GITHUB_CLIENT_ID= -GITHUB_CLIENT_SECRET= -GITHUB_USER_AGENT= +DISCORD_CLIENT_ID= +DISCORD_CLIENT_SECRET= +DISCORD_USER_AGENT= JWT_SECRET=aVerySecretJwtSigningSecret diff --git a/build.sh b/build.sh index 1cf7f4e..5781727 100755 --- a/build.sh +++ b/build.sh @@ -8,7 +8,7 @@ docker build . -t chessh/server cd front docker build \ - --build-arg REACT_APP_GITHUB_OAUTH=${REACT_APP_GITHUB_OAUTH} \ + --build-arg REACT_APP_DISCORD_OAUTH=${REACT_APP_DISCORD_OAUTH} \ --build-arg REACT_APP_SSH_SERVER=${REACT_APP_SSH_SERVER} \ --build-arg REACT_APP_SSH_PORT=${REACT_APP_SSH_PORT} \ . -t chessh/frontend diff --git a/config/config.exs b/config/config.exs index e9fca38..44230ae 100644 --- a/config/config.exs +++ b/config/config.exs @@ -17,8 +17,9 @@ config :chessh, RateLimits, create_game_rate: 2 config :chessh, Web, - github_oauth_login_url: "https://github.com/login/oauth/access_token", - github_user_api_url: "https://api.github.com/user" + discord_oauth_login_url: "https://discord.com/api/oauth2/token", + discord_user_api_url: "https://discord.com/api/users/@me", + discord_scope: "identify" config :joken, default_signer: "secret" diff --git a/config/runtime.exs b/config/runtime.exs index dfd8427..2be7431 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -1,14 +1,14 @@ import Config config :chessh, - ssh_port: String.to_integer(System.get_env("SSH_PORT", "42069")) + ssh_port: String.to_integer(System.get_env("SSH_PORT", "34355")) config :chessh, Web, - github_client_id: System.get_env("GITHUB_CLIENT_ID"), - github_client_secret: System.get_env("GITHUB_CLIENT_SECRET"), - github_user_agent: System.get_env("GITHUB_USER_AGENT"), + discord_client_id: System.get_env("DISCORD_CLIENT_ID"), + discord_client_secret: System.get_env("DISCORD_CLIENT_SECRET"), + discord_user_agent: System.get_env("DISCORD_USER_AGENT"), client_redirect_after_successful_sign_in: - System.get_env("CLIENT_REDIRECT_AFTER_OAUTH", "http://localhost:3000"), + System.get_env("CLIENT_REDIRECT_AFTER_OAUTH", "http://127.0.0.1:3000/oauth-successfule"), port: String.to_integer(System.get_env("WEB_PORT", "8080")) config :joken, diff --git a/front/Dockerfile b/front/Dockerfile index 03a4a4e..16f14f7 100644 --- a/front/Dockerfile +++ b/front/Dockerfile @@ -8,10 +8,10 @@ RUN npm ci COPY . /usr/app -ARG REACT_APP_GITHUB_OAUTH +ARG REACT_APP_DISCORD_OAUTH ARG REACT_APP_SSH_SERVER ARG REACT_APP_SSH_PORT -ENV REACT_APP_GITHUB_OAUTH $REACT_APP_GITHUB_OAUTH +ENV REACT_APP_DISCORD_OAUTH $REACT_APP_DISCORD_OAUTH ENV REACT_APP_SSH_SERVER $REACT_APP_SSH_SERVER ENV REACT_APP_SSH_PORT $REACT_APP_SSH_PORT RUN npm run build diff --git a/front/src/root.jsx b/front/src/root.jsx index 8de2575..1abc67b 100644 --- a/front/src/root.jsx +++ b/front/src/root.jsx @@ -34,8 +34,11 @@ export const Root = () => { ) : ( <> - - 🐙 Login w/ GitHub 🐙 + + 👾 Login w/ Discord 👾 )} diff --git a/front/src/routes/home.jsx b/front/src/routes/home.jsx index 0660a72..c65d87d 100644 --- a/front/src/routes/home.jsx +++ b/front/src/routes/home.jsx @@ -18,6 +18,14 @@ export const Home = () => {

Getting Started

    +
    +
  1. + Consider joining the{" "} + CheSSH Discord{" "} + to receive notifications when other players are looking for + opponents, or when it is your move in a game. +
  2. +
  3. Add a public key, or{" "} @@ -50,11 +58,14 @@ export const Home = () => { />
  4. -
  5. Finally, play chess!
  6. -

    Ideally, keeping the following contols in mind:

    +
  7. + Finally, play chess! Ideally, keeping the following contols in + mind: +
  8. +