louisbarclay / nudge

Nudge makes the internet less addictive.
https://nudgeware.io
MIT License
143 stars 9 forks source link

Twitter: how to hide things on right side #116

Closed karolzlot closed 2 years ago

karolzlot commented 2 years ago

I think extension isn't working for me in case of Twitter. It works on youtube/ facebook.

karolzlot commented 2 years ago

After switching to English it is the same.

karolzlot commented 2 years ago

I tried to fix it myself, but I coudn't find in which file I should start looking.

th0rgall commented 2 years ago

Hey, I'm sorely missing Nudge's Hider on Twitter as well, so I did a bit of digging. For me it's the Feed itself that isn't working. The reason is probably just that Twitter has changed some class names (that is likely to happen), and Nudge's hiding rules haven't been updated.

I tried to fix it myself, but I coudn't find in which file I should start looking.

@karolzlot the file you want is hidees.js: https://github.com/louisbarclay/nudge/blob/master/extension/js/vars/hidees.js.

However, that file is generated from a Google Sheet: https://github.com/louisbarclay/nudge/blob/master/extension/js/background/sync-hidees.js , which contains the rules that tell what elements have to be hidden. The hidees.js file above is only a snapshot that is used in case the newest rules from the Google Sheet failed to sync.

And they will fail to sync: the library used to access the Google Sheet is using the deprecated API V3 version, https://spreadsheets.google.com/feeds/cells/1Y-xQb1qRgnicD_0M-8REXKbSPi4lnsQW7lqUqh52fiw/1/public/values?alt=json. At least in the developer version, this results in errors in Chrome (see also issue https://github.com/louisbarclay/nudge/issues/118)

So I think that the proper way to fix this issue is to

  1. Fix/update the Google Sheets API syncing
  2. Propose a change to @louisbarclay to the Google Sheet with the updated rule: https://docs.google.com/spreadsheets/d/1Y-xQb1qRgnicD_0M-8REXKbSPi4lnsQW7lqUqh52fiw/edit#gid=0

To find the right ruleset, you can experiment with the locally stored hidees snapshot (or better yet, make your own Google Sheet copy, fix things there, load "hidees" from your own Google Sheet, test your fixes, then ask @louisbarclay)

I experimented with the rule for the feed locally and got it working again : https://github.com/th0rgall/nudge/commit/946301bec5fa4f54a7e0ae69c53e3482889e277a#diff-eb0b7caf05f0fdfcb42dc05e1459c54b2f4a8270699ac62ead166a43aa7f33a2R27-R44 (in the case of the feed, only the parentParentClassName had changed by one class on Twitter!)

th0rgall commented 2 years ago

I fixed the Google Sheets API syncing here https://github.com/louisbarclay/nudge/pull/122.

It actually seems that the latest hidees in Louis' hidees sheet are actually already fixing the issue with Twitter (see screenshot):

Screenshot 2021-10-03 at 18 30 14

The underlying issue was then the Google API deprecation fixed above. I assume this was what happened:

  1. The last time the hidees.js in this repo were updated was on January 22, 2021. The version of nudge in this repo is 1.0.0, and the version in the Chrome store is 1.0.74 which was last updated on June 22, 2021.
  2. Twitter broke. Louis fixed it, but didn't deploy a new extension version to the Chrome store. The fix got pulled by clients via the syncing functionality.
  3. Google turned down the v3 API on August 2, 2021.
  4. Twitter hiding didn't work anymore, since the app probably fell back on the June 22 hidees.js. @karolzlot reported this.
louisbarclay commented 2 years ago

Thanks a lot for this @th0rgall! I've now released a new version of Nudge to the Chrome Web Store including your latest fixes to the Twitter hidees. I've also made you an admin of the Google Sheet. @karolzlot if you'd also like to be an admin, to be able to add new hidees, let me know.

karolzlot commented 2 years ago

@louisbarclay Yes, you can add me. If you add me I may use it in future if something will need to be improved.

louisbarclay commented 2 years ago

Great. Send a Google Sheets-compatible email to hi@louis.work.