Closed zzamboni closed 1 year ago
@cmsj gentle ping about this PR - many good improvements here :) Thanks in advance!
Sorry 😬
Thanks! Do you know when https://www.hammerspoon.org/Spoons/URLDispatcher.html will be updated with the new version?
Saw that it's published now - thanks again! 😄
Yeah, in theory it gets published very quickly, once the GitHub Actions have run, but sometimes caching is weird.
Multiple improvements:
default_handler can now also be a function in addition to a bundle ID. If a function is given, it is called with the URL.
In url_patterns, the second value of each element can now be both a string (interpreted as a bundle ID) or a function (called with the URL). A function can also be specified as the third value, for backwards compatibility, so existing configurations should not break.
In url_patterns, the first value of each element can now be both a string (a single pattern), a table containing a list of patterns, or a filename from which the list of patterns to match will be read. Furthermore, a watcher is set so that the patterns are automatically reloaded if the file changes.
In url_patterns, the last element of each rule can be an app name pattern (or a list of them). If given, the rule will only be evaluated for URLs opened from applications matching any of the patterns.
In url_redir_decoders, the second element can now be a function, in which case the URL information is passed to the function, and the returned value is used as the URL to dispatch.