From 16d665228ab715d42095781b8d8e85354f6b2055 Mon Sep 17 00:00:00 2001
From: Christopher Gurnee
Date: Mon, 1 Nov 2021 11:38:18 -0400
Subject: [PATCH] Replace OAuth client ID
Also do a better job of conforming to the Reddit API Terms of Use
---
README.md | 4 ++--
src/api/reddit/auth.js | 9 ++++++---
src/pages/about.js | 26 +++++++++++++-------------
3 files changed, 21 insertions(+), 18 deletions(-)
diff --git a/README.md b/README.md
index a43e169..3e9eeae 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Unddit
-[Unddit](https://www.unddit.com) is a site for undoing the removal of comments from [Reddit](https://www.reddit.com).
-Just go to any reddit post and replace the `re` of `reddit` in the URL with `un` to see all removed comments.
+[Unddit](https://www.unddit.com) is a site for undoing the removal of comments for [Reddit](https://www.reddit.com).
+Just go to any Reddit post and replace the `re` of `reddit` in the URL with `un` to see all removed comments.
This is a done by comparing the comments being stored in [Jason Baumgartner's](https://pushshift.io/) [Pushshift Reddit API](https://github.com/pushshift/api) and the ones from Reddit's API. The frontend, developed by Jesper Wrang and originally available at [removeddit.com](https://removeddit.com), is written in [React](https://reactjs.org/) and uses [Sass](https://sass-lang.com/) as the CSS Preprocessor.
diff --git a/src/api/reddit/auth.js b/src/api/reddit/auth.js
index 0e23714..8d72306 100644
--- a/src/api/reddit/auth.js
+++ b/src/api/reddit/auth.js
@@ -2,7 +2,8 @@
// The app NEEDS TO BE an installed app and NOT a web apps
// Current using dummy ID from throwaway
-const clientID = 'Gu4d7t1AglWJVg'
+const clientID = 'ZmYXJ5RaSDhF-77YaFulWw'
+const userAgent = 'com.unddit.www (by /u/unddit-com)'
// Token for reddit API
let token
@@ -17,7 +18,8 @@ const getToken = () => {
const tokenInit = {
headers: {
Authorization: `Basic ${window.btoa(`${clientID}:`)}`,
- 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8'
+ 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8',
+ 'User-Agent': userAgent
},
method: 'POST',
body: `grant_type=${encodeURIComponent('https://oauth.reddit.com/grants/installed_client')}&device_id=DO_NOT_TRACK_THIS_DEVICE`
@@ -36,7 +38,8 @@ export const getAuth = () => {
return getToken()
.then(token => ({
headers: {
- Authorization: `bearer ${token}`
+ Authorization: `bearer ${token}`,
+ 'User-Agent': userAgent
}
}))
}
diff --git a/src/pages/about.js b/src/pages/about.js
index 338e23c..bde9114 100644
--- a/src/pages/about.js
+++ b/src/pages/about.js
@@ -16,14 +16,14 @@ const About = props => {
removed
(by mods) and
deleted
- (by users) comments/posts from Reddit.
+ (by users) comments/posts for Reddit.
Usage: Drag this bookmarklet
Unddit
- to your bookmark bar and use it to get from reddit to Unddit.
+ to your bookmark bar and use it to get from Reddit to Unddit.
Alternatively you can manually replace the re of reddit in the URL with un.
@@ -51,31 +51,31 @@ const About = props => {
Q: How does it work?
This page is only possible because of the amazing work done by Jason.
- His site pushshift.io activly listens for new comments on reddit and stores them in his own database.
- Then sites like Unddit and reveddit can fetch these comment from pushshift.
- Unddit know what comment reddit shows (from Reddits API) and what comment should be showed (from Pushshifts API).
+ His site Pushshift.io actively listens for new comments on Reddit and stores them in his own database.
+ Then sites like Unddit and reveddit can fetch these comment from Pushshift.
+ Unddit know what comment Reddit shows (from Reddit's API) and what comment should be showed (from Pushshift's API).
By comparing the comments from these 2 APIs, we can figure out what has been deleted and removed.
- Q: What's the difference between ceddit and Removeddit?
+ Q: What's the difference between Ceddit and Removeddit?
- Not much. Removeddit was created as a temporary replacement for ceddit, at a time when ceddit didn't work.
- I thought this was necessary since I used ceddit more then Reddit itself.
- Months later ceddit was fixed, but I didn't see any reason to remove what I had done.
+ Not much. Removeddit was created as a temporary replacement for Ceddit, at a time when Ceddit didn't work.
+ I thought this was necessary since I used Ceddit more then Reddit itself.
+ Months later Ceddit was fixed, but I didn't see any reason to remove what I had done.
Today both sites live side by side and strive for the same goal.
There are some minor differences in them though:
-
- Ceddit respect user made deletions while removeddit does not. This decision was made early on and I feel like it's too late to change now.
- If I had created removeddit today I might had thought more about what was right here.
+ Ceddit respect user made deletions while Removeddit does not. This decision was made early on and I feel like it's too late to change now.
+ If I had created Removeddit today I might had thought more about what was right here.
-
- Removeddit usualy loads faster since it uses a slightly different algorithm for detecting removed comments.
+ Removeddit usually loads faster since it uses a slightly different algorithm for detecting removed comments.
Removeddit also uses significantly less JavaScript on the page which also should make the page load faster.
-
- Ceddit provides user lookup while removeddit doesn't.
+ Ceddit provides user lookup while Removeddit doesn't.