项目作者: jonluca

项目描述 :
Website that will allow selection of flair on https://reddit.com/r/churning
高级语言: JavaScript
项目地址: git://github.com/jonluca/Churning-Flair-Selector-Site.git
创建时间: 2018-12-06T17:05:21Z
项目社区:https://github.com/jonluca/Churning-Flair-Selector-Site

开源协议:MIT License

下载


/r/churning Flair Selector

This is a site that allows users of a subreddit to select flair. This was specifically made for /r/churning but can be easily adapted to any other subreddit. The announcement for this service was made here.

Set up

Create a file called config.js. It should have the following format:

  1. module.exports = {
  2. web_app_secret: "",
  3. web_app_id: "",
  4. redirect: "",
  5. mod_username: "",
  6. mod_password: "",
  7. mod_script_id: "",
  8. mod_script_secret: "",
  9. subreddit: ""
  10. };

You must first navigate to the apps page for the account you want to handle the flair selection. That URL is https://www.reddit.com/prefs/apps/.

When there, you need to create 2 apps. You must create a web app (which will handle the retrieval of user profile information) and you must also create a personal script app. You will have 2 sets of app IDs and secrets. The personal script is what is actually used to set the user flair.

Note that the user must A) be a mod of the subreddit and B) must have the flair permission.

Key Value
web_app_secret Web application secret
web_app_id Web application id
redirect Redirect url (i.e. while developing, http://localhost:3000, while in prod https://churning.us)
mod_username Username of mod account
mod_password Password of mod account
mod_script_id Personal script id
mod_script_secret Personal script secret
admin_pass HTTP Auth password for the admin page
subreddit Subreddit that the user is a mod of

Development

Copy and paste the following section to get started.

  1. git clone git@github.com:jonluca/Churning-Flair-Selector-Site.git
  2. cd Churning-Flair-Selector-Site
  3. echo 'module.exports = {
  4. web_app_secret: "",
  5. web_app_id: "",
  6. redirect: "",
  7. mod_username: "",
  8. mod_password: "",
  9. mod_script_id: "",
  10. mod_script_secret: "",
  11. admin_pass: "",
  12. subreddit: ""
  13. };' > config.js
  14. yarn install

Fill out the sections in config.js, then start the application with npm start or node bin/www.

The other part you’ll need to change is the front end filtering logic in public/js/main.js. Currently it assumes a format similar to that in public/data/flairs.json, which is for airports, since this application was originally made for /r/churning. You’ll want to change the logic around displaying, filtering, and retrieving the various flair options.

Maintenance

This is currently maintained by @jonluca on GitHub and /u/JonLuca on reddit. Feel free to fork this and modify it for your subreddit. This site is provided with the MIT license.