Remote filter lists
Proposed change
Add a filter command that does a HTTP GET request to the specified URL and returns the contents as a search filter.
e.g.
filterfromurl:"https://raw.githubusercontent.com/TMMania/Vault-Analyzer/main/2.%20Searches/Vault%20Analyzer%20End-Game" -tag:infuse
How does this fit into your workflow?
How most users would use it
The way I imagine most users would use it is in my example above: Keeping large, remote-provided filters up-to-date in their saved filters, while also allowing some dynamic 'extension' of the searches for the users personal needs without affecting the upstream filter.
This would also allow developers who produce complex searches to iterate versions more quickly and more tuned to the current state of/season in the game, without the fear that a copy of the filter a user has may be old or out of date, and not require the user to check and re-save the remote filters manually to maintain them.
Additionally, more complex but user-specific filter generators that utilise features not available in DIMs search could be easily generated and kept up to date, like the TMMania Filter Generator for DIM. In this case I'm imagining something like filterfromurl:"https://dimfilter.michaelabon.ca/?top=0.01&anybasestat%3D%3E45" (the site doesn't support that currently, but it's easy to see how such tools could be made).
My hyper-specific use-case
My use-case is rather convoluted and likely doesn't represent many users.
I'm trying to make an armour filter to highlight junk in a similar way to TMMania's excellent filters. However, rather than their approach of keeping the top X% and trashing everything else, I would like to keep the 'best' armour in each stat pool ( eg. maxbasestatvalue:any) for each type of armour ( eg. is:armorintrinsic or modslot:any ).
Supporting this kind of complex .forEach seems outside of DIM's scope to me, hence this issue not being about that. The only way to achieve the above behaviour currently (to my understanding) would be to hardcode each kind of armorintrinsic and modslot, and applying the criteria to each group. For (a very simplified!) example:
is:armor
( perkname:"sonar amplifier" maxbasestatvalue:any )
or ( perkname:"queen's favor" maxbasestatvalue:any )
or ( modslot:lastwish maxbasestatvalue:any )
or ( modslot:gardenofsalvation maxbasestatvalue:any )
or ( modslot:deepstonecrypt maxbasestatvalue:any )
or ( modslot:vaultofglass maxbasestatvalue:any )
etc...
This gets big and tedious to maintain quite quickly, and I want to be able to share it with others. However, I really don't like being in a situation where I'm going through a phase of being burned out with the game, and people are relying on me to update my season-specific filter. So the most obvious solution for me was to go off to build a generic script that could take DIM's https://github.com/DestinyItemManager/DIM/tree/master/src/data directory and generate it for me via GitHub Actions and a bit of Jinja. This would keep all of my filters as up-to-date as DIMs data, solving the "relying on a human" problem handily. The next logical question for this was "How do I keep it up to date within DIM without having to constantly go check if my script had updated it?", which is how I ended up with this issue.
Considerations if this were to be developed
- Since we're remotely grabbing stuff, XSS is a possibility and likely will require some tests to ensure its safety. A whitelist of domains you can grab filters from (GitHub? Gists?) might also be a good idea?
- CORS might also be a pain in the ass, depending on permitted domains
- Requests from the client side can be slow. Some feedback to show that a request is in progress will probably be necessary.
- For user-initiated requests (eg. typing a
filterfromurl:into the search bar) the current notification feed that we get when processing async tasks would likely be fine? - For 'background' requests (eg. on startup, loading the users saved searches and encountering a
filterfromurl:), this could just be an async request and probably doesn't need feedback. - If necessary, a spinner on the search?
- For user-initiated requests (eg. typing a
- Caching would likely be important.
- A hover effect showing the last time DIM grabbed the search if the user idles their mouse on a saved search with a
filterfromurl:in it might be nice. - Caching. Since I imagine most people would want to use either GitHub repo's or Gists for their sources, the below examples are based on the headers returned/supported by GitHub. I imagine most of this is probably already supported by the wishlist grabbing feature, but worth thinking about:
- Respect
Cache-Controlheaders. Once cached, unless the user changes the URL, we could return the cached response for quick response time and updating it could then become a periodic async task - GitHub's support for the the
If-Modified-Sinceheader appears to use theCache-Controlduration as theLast-Modifiedtime, which makes it a bit useless. Might still be useful for other websites, and it doesn't do any harm to include. - GitHub provides an
Etagheader, which can be combined withIf-None-Matchto get a304 Not Modified, which is pretty handy. Can combine this with aHEADfor faster requests on slower networks (or if a filter is like, megabytes in size) at the expense of a second request if our saved etag is different.
- Respect
- A hover effect showing the last time DIM grabbed the search if the user idles their mouse on a saved search with a
I'm actually interested in developing and PRing this, if you think it isn't entirely out of DIM's scope. I have fallen down a rabbit hole and may have tunnel-visioned a little hard on this solution though, so critiques are very welcome.
I love this idea and it'd simplify the need to manually save updated queries as favorites in DIM!! :)
Maybe we can do something similar to wishlists: add the option of loading and parsing Search Query Source(s) in a manner similar to how Wish List Sources are loaded so we can call search queries by name? It'd just require queries to be named, and doesn't seem to require too much to be added - the syntax for searches wouldn't change, and it'd address risks/complexity of loading remote data on the fly from the search box.
Example:
Source: dim-search-queries.txt
title: Sample Search Queries source
description: Using a format similar to wish lists to load DIM search queries and call them by name
/* My Favorite Search */
is:handcannon
/* Trash Class Items 1.0.0 */
is:classitem modslot:none is:armor2.0
-year:6
-source:games
-source:ironbanner
Usage
searchquery:Trash Class Items 1.0.0
This will allow queries to be saved and referenced without changing the search query syntax; the only requirement would be that all queries loaded from a url would need to be saved with Search Names to be callable.
Mockup
Maybe we can do something similar to wishlists: add the option of loading and parsing Search Query Source(s) in a manner similar to how Wish List Sources are loaded so we can call search queries by name?
This is a nice potential alternative idea to mine that I think would be a lot easier to implement.
Thanks for the brainstorming! We'd considered/discussed this before and had decided against it - advanced searches are already a very-long-tail "power user" feature so the idea of having subscriptions to searches seemed too far over on the side of something that only 0.0001% of people would use. There are also some UX things to consider, for example how people learn when a new search is added or updated from their subscriptions. In general we've tended towards building features directly into DIM that address the use cases that some of these big searches are for (e.g. the Triage feature), and then rely on folks sharing queries and favoriting them to build up a library of good searches. You might be surprised also to find out how much disagreement there is between these power users about exactly what each of these searches should do...
All that said, if it were to be added I agree that it should be added in largely the same way as wish lists work. Note that we'd like to swap to something like a JSON format for these as a custom-parsed text format can be unwieldy.
too far over on the side of something that only 0.0001% of people would use
heh, that's fair enough, I can certainly see it not being overly popular.
how people learn when a new search is added or updated from their subscriptions
Assuming it was implemented in the way @andrewpong proposed, similar to how wishlists are done currently, I would expect it to update silently. I would assume that each URL would correspond to a single search, so it has the same limitations as current saved searches and doesn't encourage making big "packs" of searches.
In general we've tended towards building features directly into DIM
You might have to expect a PR for an enhanced version of is:dupelower from me, soon 😉
and then rely on folks sharing queries and favoriting them to build up a library of good searches
One of the things that I wanted to address with this issue is that I constantly share searches with my friends, but my searches are constantly iterated upon and evolving. Not being able to ensure that they have the most up to date version means I end up sharing them a lot less, because there may be edge cases I've not accounted for and I don't want to have to ping them in 10 minutes with "btw use this one instead". But yeah, I do get your point.
You might be surprised also to find out how much disagreement there is between these power users about exactly what each of these searches should do...
Oh no, I'm totally unsurprised by this! That's sort of why I like the idea of searches being able to be remote, which allows them to be more easily forked etc. It also paves the way for 'popular searches' and such, if you feel like going the Google route...
Note that we'd like to swap to something like a JSON format for these as a custom-parsed text format can be unwieldy.
God I would love to be able to interact with DIM with JSON. It would make designing and generating searches a lot more programmatically-friendly.
Anyway, thank you for your response. This looks like a "no" at the moment, so should I close this issue?
This looks like a "no" at the moment, so should I close this issue?
I'll never say never, but I don't look forward to supporting features like this that are both relatively complex (both in implementation and support) and very niche. Probably best to see if you can build (or propose) other more integrated features and see if this remains a need, and if it is we can chat more about it.