diff --git a/README.md b/README.md index 28657d5..a1b427c 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This is a done by comparing the comments found from Reddit API and comments from # The "I just want to get this shit running" guide Using [Ubuntu 16.04](http://releases.ubuntu.com/16.04/) and [nginx](https://www.nginx.com/resources/wiki/) ``` -sudo git clone git@github.com:JubbeArt/removeddit.git /var/www/ +sudo git clone https://github.com/JubbeArt/removeddit.git /var/www/removeddit sudo apt install -y nginx sudo cp /var/www/removeddit/config/basic /etc/nginx/sites-available/default ``` @@ -55,7 +55,7 @@ Change both the "server_name" in the config to your domain name. ## SSL with Let's encrypt Read the full guide [here](https://certbot.eff.org/#ubuntutyakkety-nginx). Start of by installing the Let's Encrypt client [certbot](https://certbot.eff.org/) ``` -sudo apt install software-properties-common +sudo apt install -y software-properties-common sudo add-apt-repository ppa:certbot/certbot sudo apt update sudo apt install -y python-certbot-nginx @@ -64,18 +64,18 @@ sudo apt install -y python-certbot-nginx Copy the Let's Encrypt config file for our site ``` sudo mkdir /etc/letsencrypt/configs -cp /var/www/removeddit/config/letsencrypt /etc/letsencrypt/configs/removeddit.com.conf +cp /var/www/removeddit/config/letsencrypt.conf /etc/letsencrypt/configs/removeddit.com.conf ``` -In this config file change the domains and the email for your own. The email is tells when the certificates are close to expiring. +In this config file change the domains and the email address for your own. The emails tells you when the certificates are close to expiring. -This is when the webmasters start praying to God Almighty, for only He can deside the fate of the certbot. +This is when the webmasters start praying to God, for only He can deside the fate of the certbot. Forgive me, Father, for I have sinned. Just don't fuck up certs you asshole. ``` sudo certbot --config /etc/letsencrypt/configs/removeddit.com.conf certonly ``` -You'll now have a valid SSL certificate (hopefully)! You might have to edit the path for `ssl_certificate` and `ssl_certificate_key` in `/etc/nginx/sites-available/removeddit.com` depending on where the certs are located. (Should be in `/etc/letsencrypt/live/`) +You'll now have a valid SSL certificate (hopefully)! You now have to uncomment the `ssl_certificate` and `ssl_certificate_key` in `/etc/nginx/sites-available/removeddit.com` and maybe change the path depending on where the certs are located (check in `/etc/letsencrypt/live/`). ## Automated renewal of certs The certificate expires after 90 days so we want a way to atomatically update the certs. diff --git a/config/ssl b/config/ssl index 0d4add3..aef4e04 100644 --- a/config/ssl +++ b/config/ssl @@ -9,8 +9,9 @@ server { access_log /var/log/nginx/removeddit/access.log; error_log /var/log/nginx/removeddit/error.log; - ssl_certificate /etc/letsencrypt/live/removeddit.com/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/removeddit.com/privkey.pem; + # Uncomment these after you've received the certificates + #ssl_certificate /etc/letsencrypt/live/removeddit.com/fullchain.pem; + #ssl_certificate_key /etc/letsencrypt/live/removeddit.com/privkey.pem; location / { try_files /index.html /index.html =404; diff --git a/index.html b/index.html index f9b414d..bccbdbf 100644 --- a/index.html +++ b/index.html @@ -15,7 +15,7 @@
This is a site for viewing removed comments from Reddit. - It was created by Jesper Wrang and uses Jason Baumgartner service for getting removed comments.
+ It was created by Jesper Wrang and uses Jason Baumgartner service for getting removed comments.
How to use: go to any Reddit thread and replace the reddit in the URL with removeddit
E.g.
diff --git a/static/script.js b/static/script.js
index 1d96eb7..4735c34 100644
--- a/static/script.js
+++ b/static/script.js
@@ -19,6 +19,8 @@ if(pathname.length <= 4) {
const subreddit = pathname[2]
const threadID = pathname[4]
+const root = getCommentContext() === "" ? threadID : getCommentContext()
+
const redditTokenURL = "https://www.reddit.com/api/v1/access_token"
const redditThreadURL = `https://oauth.reddit.com/r/${subreddit}/comments/${threadID}`
const redditMorechildrenURL = `https://oauth.reddit.com/api/morechildren?link_id=t3_${threadID}&children=`
@@ -149,7 +151,7 @@ function extractMorechildrenIDs(comments) {
comments.jquery[14][3][0].forEach(comment => {
if(comment.kind == "more") {
if(comment.data.id === "_") {
- console.log("From more, continue: " + comment.data.parent_id)
+ //console.log("From more, continue: " + comment.data.parent_id)
continuethisthreadIDs.push(comment.data.parent_id)
} else {
const children = comment.data.children
@@ -184,11 +186,11 @@ async function getRemovedComments(allCommentIDs) {
idsDiff = [...new Set(idsDiff)]
generateCommentInfo(idsDiff.length)
- console.log("All ids :", allCommentIDs)
- console.log("Comments ids (dup): ", commentIDs)
- console.log("With/without dups: ", commentIDs.length, new Set(commentIDs).size)
- console.log("Difference: ", idsDiff)
- console.log("Lookup size:", commentLookup.size)
+ //console.log("All ids :", allCommentIDs)
+ //console.log("Comments ids (dup): ", commentIDs)
+ //console.log("With/without dups: ", commentIDs.length, new Set(commentIDs).size)
+ //console.log("Difference: ", idsDiff)
+ //console.log("Lookup size:", commentLookup.size)
return fetchMultiple(pushshiftCommentsURL, idsDiff, null, ["data"], true)
}
@@ -198,7 +200,7 @@ async function getRemovedComments(allCommentIDs) {
// ------------------------------------------------------------------------------
async function generateComments(removedComments) {
- const commentSection = generateHTML(`
[likely removed by automoderator]
" : markdown.render(comment.body)}