Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove AUTH_URL and INVITE env variables since they can be deterministic #242

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .env template
Original file line number Diff line number Diff line change
@@ -6,8 +6,6 @@ CLIENT_ID="" # discord
CLIENT_SECRET="" # discord
DONATE="" # donation url
GITHUB="" # github url
INVITE="" # discord oauth2 redirect to /invite page, use identify/guilds perms
AUTH_URL="" # discord oauth2 redirect to /login page, use identify/guilds perms
RESCHEDULING=true
REMINDERS=true
LOCALENV=true
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -196,16 +196,12 @@ Each next announcement will be posted X hours after the date/time of the current
* install [git](https://git-scm.com/downloads), [node](https://nodejs.org/en/download/), [heroku-cli](https://devcenter.heroku.com/articles/heroku-cli#download-and-install), and [mongodb server](https://www.mongodb.com/download-center/community)
* Run `npm install`
* Set up a [discord bot application](https://discordapp.com/developers) with permissions and a token
* permissions:
* send messages
* manage messages
* embed links
* read message history
* add reactions
* OAuth2 redirect
* `http://localhost:5000/login`
* guilds
* identify
* Configure the bot as following
* OAuth2
* Redirects
* `http://localhost:5000/login`
* Bot
* Follow instructions after clicking to create a bot
* Copy `.env template` to `.devenv` and fill out the values
* Create a file called `dev` (no extension) with the following content:
```javascript
2 changes: 1 addition & 1 deletion src/routes/login.ts
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ export default () => {
if (req.query.redirect) {
req.session.redirect = req.query.redirect;
}
res.redirect(process.env.AUTH_URL);
res.redirect(`https://discord.com/api/oauth2/authorize?client_id=${process.env.CLIENT_ID}&redirect_uri=${encodeURI(process.env.HOST + config.urls.login.path)}&response_type=code&scope=identify%20guilds`);
}
});

2 changes: 1 addition & 1 deletion src/routes/other.ts
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ export default () => {
const router = express.Router();

router.use(config.urls.invite.path, (req, res, next) => {
res.redirect(process.env.INVITE);
res.redirect(`https://discordapp.com/oauth2/authorize?client_id=${process.env.CLIENT_ID}&scope=bot&permissions=93248`);
});

router.use(config.urls.donate.path, (req, res, next) => {