A playbook for countering narratives on social media. Web-based report built using D3.js for data visualizations, and the Svelte framework.
You will need to have Node.js and NPM installed on your machine.
https://nodejs.org/en/download/
-
Clone the repo on your machine
-
In the parent folder install the dependencies by running this command,
npm i
-
To "compile" the report run,
npm run build
-
You can now start the web server by running,
npm start
-
Open your browser and paste the following address to see your report,
localhost:5555
Viewers might want to reach out by email. They can encrypt their message using the PGP public key displayed at the bottom of the page.
Many tools are available to generate a new public/private key pair, encrypt a message using the public key, and decrypt the message using the private key.
For testing purposes, you can use the online pgptool.
To update copy the public key here.
Set your parameters in the constants file.
In particular "CONDITIONS_FOR_POSTS_OF_INTEREST" that should define what constitutes a social media post of interest,
CONDITIONS_FOR_POSTS_OF_INTEREST = [
[ condition_1 AND condition_2 ] OR
[ condition_3 ] OR
[ condition_1 AND condition_4 ] OR
...
]
However, you will need to place the fonts in the root /assets/fonts/ directory of your server.
Install Tor,
sudo apt update
sudo apt install tor
Uncomment these two lines in the config file /etc/tor/torrc
HiddenServiceDir /var/lib/tor/hidden_service/
HiddenServicePort 80 127.0.0.1:80
Get the Onion address of your server by running
sudo cat /var/lib/tor/hidden_service/hostname
For example,
en5kq3sxdasdasd212aoisdjaoifzu3kxtxvttrsbibaznpk4ljqd.onion
If you want modern browsers to offer the onion endpoint to visitor, set the onion location in your HTML,
<meta http-equiv="onion-location" content="http://<your-onion-service-address>.onion" />
Here is the snippet of code to add a code block,
// load components
import CodeBlock from "../../components/CodeBlock.svelte";
// let editor;
const options = {
mode: "javascript",
lineNumbers: true,
value: `function test() {\n return 42\n}\n\nfunction test() {\n return 42\n}`
}
<CodeBlock {options}/>
Google Fonts is a great resource to shop for fonts.
Simply download the .ttf file to the public fonts folder
Then add the following snippet of code to the bottom of the App file
/* Custom Fonts */
@font-face {
font-family: '{FONT NAME}';
font-style: normal;
font-weight: 400;
src: url('/fonts/{FILENAME}.ttf') format('truetype');
}
You can then apply the font in your CSS
font-family: '{FONT NAME}', sans-serif;
To lint the src/ files use eslint
npx eslint src/* --fix
Here are the instructions to host the website inside an AWS S3 bucket.
-
Go to your AWS S3 console
-
Click on "Create bucket", set the name and region, and make sure "Block all public access" is unchecked. Then, click on "Create Bucket".
-
Click on your bucket and then click on the "Permissions" tab
-
Edit "Bucket policy" and paste the following policy while making sure to replace {bucket_name} with the name of your bucket:
{ "Version": "2012-10-17", "Statement": [ { "Sid": "PublicRead", "Effect": "Allow", "Principal": "*", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::{bucket_name}/*" } ] }
-
Click on "Save changes"
-
Click on the "Objects" tab and then click on "Upload"
-
Drag and drop all the content from the public folder of this repo and then click on "Upload"
-
Click on the "Properties" tab and scroll down to the "Static website hosting" section. Click on "Edit"
-
Enable Static website hosting, and set "index.html" as the Index document. Click on "Save changes"
-
Make sure everything works by clicking on the Bucket website endpoint