ajgranowski / reddit-expanded-community-filter-userscript Goto Github PK
View Code? Open in Web Editor NEWA userscript to filter muted communities from /r/all using your account preferences.
License: MIT License
A userscript to filter muted communities from /r/all using your account preferences.
License: MIT License
even I have muted the community can still see in r/all
I also have tried to put // @match https://www.reddit.com/r/*
in the code
maybe I need to configure Reddit in some way?
The userscript should include a timestamp of when it was built, similar to the timestamp embedded in the signature file.
Timestamp: Mon Jan 29 04:41:54 UTC 2024
Describe the solution you'd like
Add a timestamp comment for the time the script was built in the release userscript. This comment should be directly below the ==/UserScript==
block. The timestamp should be in UTC, and should be human readable.
Examples:
// Build timestamp: Sat Feb 10 05:55:00 AM UTC 2024
// Build timestamp: 2024-02-10T05:55:00Z
Additional context
See the wiki for getting started.
These might also help:
Is your feature request related to a problem? Please describe.
This script breaks for users drafted into testing the new Reddit layout. The new layout seems to be available at sh.reddit.com for testing.
Describe the solution you'd like
This script should work on both new.reddit.com and sh.reddit.com. This comment in #78 lays out some ideas for an approach, but some sort of strategy pattern seems appropriate.
Describe alternatives you've considered
We could redirect to new.reddit.com
if we detect the shreddit layout, but it seems like Reddit wants shreddit to become the default experience eventually.
Additional context
This new layout uses "shreddit" prefixed elements.
Is your feature request related to a problem? Please describe.
It would be cool to add i18n support to the script. Right now, all of the user interfaces only display in English.
Describe the solution you'd like
Add an i18n system to the script and internationalize the strings in DebugMenu.ts
and TotalMutedPostsCounter.ts
. We can use navigator.languages
to determine the users language preference.
Internationalized strings should support templates.
Describe the bug
With the recent Reddit update, access token retrieval also changed. Scraping from /coins
still appears to work for now.
To Reproduce
Steps to reproduce the behavior:
Unable to retrieve ___r JSON from window.
warning appears in the console.Expected behavior
No warnings appear in the console on page load.
Desktop:
Logs:
Error: Unable to retrieve ___r JSON from window.
fromWindow moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/ Reddit expanded community filter.user.js#24:117
fromWindow moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/ Reddit expanded community filter.user.js#24:356
promisify moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/ Reddit expanded community filter.user.js#24:327
promisify moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/ Reddit expanded community filter.user.js#24:326
updateAccessToken moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/ Reddit expanded community filter.user.js#24:357
start moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/ Reddit expanded community filter.user.js#24:445
VM83artn0g9co moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/ Reddit expanded community filter.user.js#24:572
VM83artn0g9co moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/ Reddit expanded community filter.user.js#24:579
qt moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/sandbox/injected-web.js:1
<anonymous> moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/ Reddit expanded community filter.user.js#24:1
Pe moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/sandbox/injected-web.js:1
post moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/sandbox/injected-web.js:1
ScriptData moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/sandbox/injected-web.js:1
onHandle moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/sandbox/injected-web.js:1
Le moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/sandbox/injected-web.js:1
Reddit expanded community filter.user.js:360:19
Failing back to scraping.
Is your feature request related to a problem? Please describe.
There is no log redaction, and part of the bug report process includes users posting their logs. It's possible for users to accidentally leak their access token if it's ever mistakenly printed to console and they report a bug.
Describe the solution you'd like
Logs should be intercepted, either by overwriting the window.console
object or by using a different logger that supports redaction.
Describe alternatives you've considered
Additional context
See the wiki for getting started.
Is your feature request related to a problem? Please describe.
OpenSSF recommends fuzzing, and adding fuzz testing to the project will increase the project's OpenSSF score.
Describe the solution you'd like
The recommended TypeScript tool for property-based fuzzing appears to be fast-check.
A solution should:
Describe alternatives you've considered
fast-fuzz might work as an alternative. It doesn't seem like there's much consensus around fuzzing tools for TypeScript projects.
Additional context
See the wiki for getting started.
Describe the bug
I get an Error: Could not find main content element.
error in debug mode, and posts from muted communities are no longer removed.
To Reproduce
Steps to reproduce the behavior:
Error: Could not find main content element.
error appears in the console.Expected behavior
No errors appear in the console on page load.
Desktop:
Logs:
Error: Unable to retrieve ___r JSON from window.
fromWindow moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/ Reddit expanded community filter.user.js#24:117
fromWindow moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/ Reddit expanded community filter.user.js#24:356
promisify moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/ Reddit expanded community filter.user.js#24:327
promisify moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/ Reddit expanded community filter.user.js#24:326
updateAccessToken moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/ Reddit expanded community filter.user.js#24:357
start moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/ Reddit expanded community filter.user.js#24:445
VM83artn0g9co moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/ Reddit expanded community filter.user.js#24:572
VM83artn0g9co moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/ Reddit expanded community filter.user.js#24:579
qt moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/sandbox/injected-web.js:1
<anonymous> moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/ Reddit expanded community filter.user.js#24:1
Pe moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/sandbox/injected-web.js:1
post moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/sandbox/injected-web.js:1
ScriptData moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/sandbox/injected-web.js:1
onHandle moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/sandbox/injected-web.js:1
Le moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/sandbox/injected-web.js:1
Reddit expanded community filter.user.js:360:19
Failing back to scraping. Reddit expanded community filter.user.js:361:19
Muted subreddits: Array(31) [ … ] Reddit expanded community filter.user.js:481:17
Error: Could not find main content element.
getFeedContainer moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/ Reddit expanded community filter.user.js#24:268
startObserving moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/ Reddit expanded community filter.user.js#24:431
promise callback*startObserving moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/ Reddit expanded community filter.user.js#24:430
startPromise moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/ Reddit expanded community filter.user.js#24:455
promise callback*start moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/ Reddit expanded community filter.user.js#24:454
VM83artn0g9co moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/ Reddit expanded community filter.user.js#24:572
VM83artn0g9co moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/ Reddit expanded community filter.user.js#24:579
qt moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/sandbox/injected-web.js:1
<anonymous> moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/ Reddit expanded community filter.user.js#24:1
Pe moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/sandbox/injected-web.js:1
post moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/sandbox/injected-web.js:1
ScriptData moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/sandbox/injected-web.js:1
onHandle moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/sandbox/injected-web.js:1
Le moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/sandbox/injected-web.js:1
Reddit expanded community filter.user.js:577:13
VM83artn0g9co moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/ Reddit expanded community filter.user.js#24:577
(Async: promise callback)
VM83artn0g9co moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/ Reddit expanded community filter.user.js#24:576
VM83artn0g9co moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/ Reddit expanded community filter.user.js#24:579
qt moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/sandbox/injected-web.js:1
<anonymous> moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/ Reddit expanded community filter.user.js#24:1
(Async: Async)
Pe moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/sandbox/injected-web.js:1
post moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/sandbox/injected-web.js:1
ScriptData moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/sandbox/injected-web.js:1
onHandle moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/sandbox/injected-web.js:1
Le moz-extension://88feb08e-155c-4cf2-a137-d89373a2d63b/sandbox/injected-web.js:1
Additional context
This appears to be caused by a design update. The feed now appears to be a <shreddit-feed>
element, and posts now appear to be <article>
s. It looks like there is also an issue with retrieving the access token, but the fallback method appears to be working so far.
Describe the bug
Top posts that should be muted are not muted when changing the feed sort (Hot, New, Top, Rising).
To Reproduce
Steps to reproduce the behavior:
New
to Top
from the feed header.
Expected behavior
Posts from muted subreddits should be removed after changing the feed sort.
Additional context
See the wiki for getting started.
I'm guessing the mutation observer isn't getting triggered. This would be a good place to start investigating.
All else fails, a hacky workaround could be calling refresh()
if we detect the URL changing after a sort change.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.