Add ability to watch threads via filters
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
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.
Probably not a bad idea, but would require a lot more work. This one can sort of piggy-back off the existing infastructure
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.
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 ?
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