fabacab / pat-twitter

Predator Alert Tool for Twitter enables you to receive alerts of predatory, harassing, or otherwise dangerous behavior on Twitter from sources you trust.
Other
10 stars 3 forks source link

Predator Alert Tool for Twitter - README

The Predator Alert Tool for Twitter is an add-on to your Web browser that enables you to subscribe to and view warnings about other Twitter users published by sources whose judgement you trust. It also enables you to create and optionally publish your own warnings, or "Predator Alerts," so you can share them with people who trust you.

Screenshot showing Predator Alert Tool for Twitter main user interface.

Overview

Unlike Twitter itself, Predator Alert Tool for Twitter is an unhosted Web app. This means that there isn't just one place where Predator Alerts are published, nor only one place to get a copy of the Predator Alert Tool for Twitter browser app. Instead, anyone who wants to can host their own "alert facilitator" (using software included in this package) to create and distribute alerts for their friends and community. Doing so also makes your website a distribution point of the Predator Alert Tool for Twitter browser add-on. Each facilitation server automatically generates the necessary customizations to the Predator Alert Tool for Twitter browser app that pairs it with the server that distributed it.

In other words, if you want to maintain a semi-private community warnlist, you or a friend can run your own such website for this purpose. This is called "running a facilitator." For more information about operating a Predator Alert Tool for Twitter facilitator, see Installing a facilitator.

System requirements

PAT Twitter user script (browser app)

The following software must be installed on your system before installing the Predator Alert Tool for Twitter user script.

Mozilla Firefox

If you use the Mozilla Firefox web browser (version 22 or higher), ensure you have the Greasemonkey extension installed (at version 1.0 or higher).

Google Chrome

If you use the Google Chrome web browser (version 29 or higher), ensure you have the Tampermonkey extension installed.

PAT Twitter facilitator server (website)

Note that while MySQL is theoretically supported (through PEAR's MDB2 database abstraction layer), I've done no testing for that configuration. Testers and patches are welcome.

OR

Try the PAT Twitter facilitator WordPress plugin, which does everything this code does, but should be easier to install for anyone familiar with how to install a WordPress plugin.

Installing a facilitator

The easiest way to set up your own Predator Alert Tool for Twitter facilitator is by deploying one to the Heroku cloud application platform. First, ensure you have git installed on your computer. Then, install the Heroku toolbelt.

Next, clone the Predator Alert Tool for Twitter repository and create a new Heroku app:

git clone https://github.com/fabacab/pat-twitter.git
cd pat-twitter
heroku apps:create

You'll need to tell Twitter about your new facilitator by creating a Twitter app in order to obtain a Twitter API key. For the purposes of Predator Alert Tool for Twitter, none of the information Twitter asks for makes any difference, so enter whatever you like.

Once you have your app's API key and API secret from Twitter, you can install them into your Predator Alert Tool for Twitter facilitator by setting them as environment variables:

heroku config:set TWITTER_CONSUMER_KEY=YOUR_API_KEY_HERE
heroku config:set TWITTER_CONSUMER_SECRET=YOUR_API_SECRET_HERE

Be sure you also check the box labelled "Allow this application to sign in with Twitter" to enable Sign in with Twitter. Also, in order to use some features of the Predator Alert Tool for Twitter facilitation server (such as the "Block users my friend blocks" function), you will need to grant your Twitter app "Read & write" permissions.

Predator Alert Tool for Twitter ships with an extremely simple template called "default." Activate it as follows:

heroku config:set PAT_TWITTER_THEME_FOLDER=default

If you want to change the look and feel of your facilitator, you can copy this template (located in the app's themes/ folder), modify it, and set the PAT_TWITTER_THEME_FOLDER environment variable to your new folder's name.

Next, provision a database for your facilitator:

heroku addons:add heroku-postgresql:dev

(Note that Heroku's free database tier has certain limitations. If you plan to run a fully public or popular Predator Alert Tool for Twitter facilitator, I recommend you move to a production-grade plan. Alternatively, you can run the server on most standard Web hosting plans.)

Finally, deploy your app to Heroku:

git push heroku master

You can navigate to your app by using the heroku open command. This should open your default browser and present you with a login screen.

Congratulations. You are now a Predator Alert Tool for Twitter facilitator. Share the URL of your app with anyone you want to and encourage them to break the silence around and cycle of abuse.

Updating a facilitator when new Predator Alert Tool for Twitter versions are released

New versions of the Predator Alert Tool for Twitter software will be tagged when they are generally available.

To update your facilitator to the latest available version:

cd WHEREVER_YOU_INSTALLED_PAT_TWITTER_EARLIER
git pull origin master
git push heroku master

To update your facilitator to a specific version, first fetch the changes from the repository, check out the tagged version, and redeploy that code. For instance, to update your facilitator to a (hypothetical) version "0.6.3" you would do the following:

cd WHEREVER_YOU_INSTALLED_PAT_TWITTER_EARLIER
git fetch origin             # Get the latest changes.
git checkout -b 0.6.3 0.6.3  # Check out a specific version on its own local branch.
git push heroku 0.6.3:master # Redeploy your app.

Updates to the Predator Alert Tool for Twitter may include updates to the browser app (userscript) or the facilitator itself, so you will need to update your facilitator when either component is updated.