4chan-x icon indicating copy to clipboard operation
4chan-x copied to clipboard

Add ability to watch threads via filters

Open paradox460 opened this issue 4 years ago • 5 comments

Adds the ability to make a filter trigger a thread watch, on use of the watch modifier for filters.

Ex:

Subject

/CSG/i;boards:g;watch # watch CSG threads on /g/ automatically

Fixes #1471, #2361, #2490, and probably many more

paradox460 avatar Feb 06 '21 01:02 paradox460

I feel like https://find.4chan.org/ could be utilised to do something here.

https://boards.4chan.org/search?#/%224chan%20x%22

That way it would search all of 4chan, or could filter per board.

saxamaphone69 avatar Feb 06 '21 02:02 saxamaphone69

Probably not a bad idea, but would require a lot more work. This one can sort of piggy-back off the existing infastructure

paradox460 avatar Feb 06 '21 06:02 paradox460

The native extension version queries the board's catalog.json when the thread watcher is updated whereas this only adds it to your watchlist if you actually visit a page containing the thread. Do you still find this useful? If so, it could be extended to query catalog.json in the future by adding some code to ThreadWatcher.parseBoard. But the present limitation should be documented.

ccd0 avatar Feb 06 '21 07:02 ccd0

I'll look into getting it to add some checks to the parseBoard call, doesn't sound too difficult. I normally browse in catalog mode anyway, and while testing got every thread on /v/ added to my watcher.


Looking over it, seems like the catalog.json is called rather infrequently, via ThreadWatcher.fetchBoard. Would there be a better place to hook into for getting all threads of a board (such as Index.update), or would adding a periodic (configurable, say every 5 mins default) task that uses catalog.json be an acceptable solution ?

paradox460 avatar Feb 06 '21 09:02 paradox460

I've added a module that works similarly to how the Native Extensions auto watch works.

You have to have a boards value set for the filter. It parses this and uses it to build a list of boards to fetch the catalog(s) from. It then fetches these catalogs, scans them, and adds each match to the ThreadWatcher.

If the user does not specify boards, then it works like it did when I originally opened this PR; it only scans where the user visits. Useful for catching threads you care about on boards you dont visit often, or threads that have comments IN them that are of interest to you

paradox460 avatar Feb 07 '21 09:02 paradox460