Commit graph

193 commits

Author SHA1 Message Date
L
2c1adab75d Fix bookmarklet for Firefox users.
In firefox, if the bookmarklet returns something, the page contents will be replaced by it. In this case, the bookmarklet returns a Window object, replacing the original contents with "[object Window]".
Source: https://stackoverflow.com/questions/2774453
2025-03-06 20:06:37 +00:00
Christopher Gurnee
b7c868b127 Add dialog to notify of Reddit's ban of Pushshift 2023-05-01 23:37:42 +00:00
Christopher Gurnee
f47063bbcc Fix thumbnails containing & 2023-04-25 14:53:15 +00:00
Christopher Gurnee
1941879ad5 Add missing spoiler thumbnail 2022-12-18 16:18:38 +00:00
Christopher Gurnee
cb316a541e Initial updates for the new Pushshift API
This should make things mostly work with the new API, however there's
a lot more to do plus the API is (probably) still in flux.
2022-12-13 22:43:05 +00:00
Christopher Gurnee
25063ac8e3 Ensure all Pushshift comment reqs include q=*
Pushshift requests w/o `q=*` have been broken for about 2 weeks now.
Once they are working, this change will be reverted.
2022-11-28 17:18:16 +00:00
Christopher Gurnee
bd6812d92d Small performance improvement 2022-11-28 17:02:13 +00:00
Christopher Gurnee
cb7302c7ff Fix regression introduced in 9134f3f 2022-11-10 23:04:52 +00:00
Christopher Gurnee
9134f3f569 Fix bug where rich diff wasn't display by default
Instead, the original was displayed even when the edit was available.
This bug was introduced:

 * in 7c935ab for all edited posts, and
 * when rich diffs where first added, but only in cases where a perent
   comment was edited, and that parent was loaded by clicking `parent`
   from a top-level permalinked comment.
2022-11-07 18:41:08 +00:00
Christopher Gurnee
c83f139ff8 Halve Pushshift requests to 30/min. to avoid 429s 2022-10-26 15:44:33 +00:00
Christopher Gurnee
7c935ab666 Add eslint-plugin-react-hooks and fix a related bug
To reproduce the bug with the older code, visit
  https://www.unddit.com/r/space/comments/y8ul7n/_/it2cz6o/
and then click the Parent link on the top-most comment. Installing
eslint-plugin-react-hooks hopefully prevents future related bugs.
2022-10-20 23:24:19 +00:00
Christopher Gurnee
529162bec0 Switch from JS Standard Style to plain ESLint
The codebase hasn't been checked against Standard in ages, so remove it
and configure plain ESLint and eslint-plugin-react instead. Also fix a
few small bugs discovered by ESLint and plugin-react.
2022-10-20 23:21:56 +00:00
Christopher Gurnee
af18d3a868 Improve Reddit OAuth token retrieval
* Only make one OAuth attempt at a time (no async OAuth requests)
 * Respect token expiration
2022-10-10 17:59:47 +00:00
Christopher Gurnee
be7064124f Respect Reddit API limits
With Pushshift's increase in the maximum request size from 100 to 250
comments, this also increases the Reddit request rate by 2.5x. This
makes it possible to overrun the API limits, so start tracking and
respecting them. Also switch back to logging into Reddit to increase
these limits.
2022-10-10 17:05:48 +00:00
Christopher Gurnee
ec0fc925b4 Increase PushShift comments retrieved size to 250 2022-10-10 17:02:35 +00:00
Christopher Gurnee
5b0adb2a1d Update the Is-Pushsift-down link 2022-08-01 16:25:45 +00:00
Christopher Gurnee
d6c0fc65d3 Color comments '[ Removed by Reddit ]' as removed 2022-06-13 16:25:48 +00:00
Christopher Gurnee
064f319db9 Add and make default a highlighted mode for edits 2022-05-30 17:37:49 +00:00
Christopher Gurnee
981c06fb73 Fix some minor context-related edge cases 2022-05-22 14:46:04 +00:00
Christopher Gurnee
ccfb452bce Prevent extraneous requests to the Reddit API
Unnecessary requests for already-retrieved comments were sometimes being
sent to the Reddit API when retrieving context or loading permalinks.
2022-05-16 22:39:43 +00:00
Christopher Gurnee
d35f7e7bf0 Fix some minor (mostly display) context bugs 2022-05-16 20:53:14 +00:00
Christopher Gurnee
07d4863c7a Add support for Reddit-style bookmarks/hashes 2022-05-16 14:16:18 +00:00
Christopher Gurnee
85af5be925 Add context query param: shows permalink ancestors
Appending `?context=#` to a permalink will highlight the permalinked
comment and display above it up to 8 ancestors, similar to Reddit's
behaviour. To keep things fast, this update required that the Pushshift
comments endpoint work with `ids` queries which was fixed around May 11.
2022-05-13 22:33:18 +00:00
Christopher Gurnee
7cc5521c83 Fix minor bug in error-handling 2022-05-13 16:16:37 +00:00
Christopher Gurnee
d3fbd86dd3 Rename redditIdsToPushshift() to fullnamesToShortIDs() 2022-05-13 16:13:43 +00:00
Christopher Gurnee
08991dfbb0 Work around Pushshift bug for certain time ranges
Comments in the time ranges below need a workaround which slows down
Pushshift queries, but it's required to retrieve them correctly

 * Sep/1/2017 0:00 - Sep/30/2017 23:59:59 UTC
 * Feb/1/2018 0:00 - Mar/31/2018 23:59:59 UTC
2022-05-09 20:07:12 +00:00
Christopher Gurnee
0ca5630ffe Refactor counting of removed/deleted comments
This fixes a small bug, and avoids unnecessary setState() calls.
2022-04-29 17:05:15 +00:00
Christopher Gurnee
44b3049406 Fix under-post links when Reddit is broken 2022-04-21 22:42:17 +00:00
Christopher Gurnee
6d687e188c Fix default of scrolling past the post w/permalinks
Regression from 536bccb
2022-04-21 22:14:52 +00:00
Christopher Gurnee
b8411d84b3 Fix permalinked comments missing from Pushshift
There were two bugs when a permalinked comment was missing from
Pushshift, but available via Reddit:

 * the links below the comment (`permalink reddit reveddit`) were
   often broken due to calling `redditIdsToPushshift()` twice
 * if removed or deleted, it wasn't counted or colored correctly
2022-04-20 15:08:27 +00:00
Christopher Gurnee
2449a88f01 Add tooltips on click for touch/pen screens
Credit to SO contributer 'H K': https://stackoverflow.com/a/60660207
2022-04-17 03:18:23 +00:00
Christopher Gurnee
5d09ea54ab Do fetch deleted link-posts from Pushshift
There's still some data that Pushshift can restore from these link-posts
2022-04-16 15:17:02 +00:00
Christopher Gurnee
536bccba2a Fix visits to full posts but with a bookmark/hash
Beforehand, only initial visits to single comments (permalinks)
and internal links correctly scrolled to the bookmark/hash.
2022-04-15 00:18:49 +00:00
Christopher Gurnee
1e21ba474a Fix some small post display/link issues
* make the post placeholder bigger to minimize the layout changes
   as the post loads
 * correctly add link clicks to the location history if the current
   location differs from the link target
2022-04-14 23:53:36 +00:00
Christopher Gurnee
df0c86aac0 Don't fetch removed link-posts from Pushshift
Removed/deleted self-posts are still fetched from Pushshift to get
the selftext, however there's no value in fetching link-posts.

Also:

 * Don't display '[deleted]' if no selftext was deleted.
 * Add key attributes to the post <div> so that React recreates
   it instead of mutating it after the Post loads. This prevents
   transitioning the background color (from the dark/light mode css).
2022-04-14 22:25:17 +00:00
Christopher Gurnee
8ed7e8c644 Fix incorrectly named 'class' JSX attribute 2022-04-11 19:27:18 +00:00
Christopher Gurnee
8d80eacf41 Don't add link-to-self clicks to location history 2022-04-11 16:34:49 +00:00
Christopher Gurnee
929a153e19 Flash 'show' setting if all comments are filtered 2022-04-09 15:56:02 +00:00
Christopher Gurnee
ccca3b3120 Handle permalinks w/mismatched link_ids correctly 2022-04-09 15:03:54 +00:00
Christopher Gurnee
69e59a75d2 Improve scrolling with parent and permalinks
Visiting a permalink (from an internal or external link) now scrolls to
just past the post, and both parent and permalinks scroll smoothly where
appropriate; it makes sense for internal permalinks to immediately jump.
2022-04-08 18:51:58 +00:00
Christopher Gurnee
5ea27dd616 Add componentWillUnmount() to thread/index.js 2022-04-08 14:18:57 +00:00
Christopher Gurnee
763d9bdae7 Remove empty class attributes from /about 2022-04-08 13:37:56 +00:00
Christopher Gurnee
d120c8f6d3 Fix dark mode transition fx & adjust spacing a bit 2022-03-31 15:49:16 +00:00
Christopher Gurnee
29c390709d Fix some post link issues
* Only redirect Reddit post links to Unddit if it's likely to work.
 * Use React <Link>s instead of <a>s if the post link matches the
   post itself. This avoids an unnecessary page reload if clicked.
 * Relative links in comments still don't work well...
2022-03-30 01:05:45 +00:00
Christopher Gurnee
77895e8d71 Add dark/light/system mode switch
Also give more space to the selftext of posts.
Closes #6
2022-03-28 18:52:23 +00:00
Christopher Gurnee
46c64f9498 Log time taken to load post/comments 2022-03-25 16:54:09 +00:00
Christopher Gurnee
a97fc287e5 Update comment counts as downloads progress 2022-03-23 12:41:30 +00:00
Christopher Gurnee
31dc89bf13 Make error message a bit more clear 2022-03-21 15:58:32 +00:00
Christopher Gurnee
0abf9222fb Improve permalinks and add parent link to comments
Beforehand, visiting a permalink would cause Unddit to begin loading
from the Post's first comment. If the max-to-download setting was too
small, and the permalinked comment wasn't yet encountered, no comment
tree would be displayed.

Now, only comments that occur at the same time as the permalinked
comment or later (chronologically) are downloaded.

This also adds a Parent link to each comment. When viewing a permalinked
comment, clicking the top-level Parent link will download only new
comments between the parent and child comments. Likewise, clicking the
'view rest of comments' link will only download new comments from the
first comment up until the previously viewed comment.

In general, Unddit will not re-download comments that it knows it has
previously downloaded, nor download more than max-to-download comments
per link clicked. This can leave 'gaps' in the list of downloaded
comments. If the 'load more comments' link is clicked, Unddit will only
download comments that can fill such gaps between the currently-linked
permalink (or if not viewing one, the first comment) and the last, up to
the max-to-download setting.
2022-03-18 23:56:10 +00:00
Christopher Gurnee
2d436062ce Improve error handling 2022-03-18 23:53:31 +00:00