[MlMt] Proposal: conditional image loading by URL filtering
Sam Hathaway
list.mailmate at munkynet.org
Sat Nov 4 12:10:22 EDT 2017
Hi Benny and friends,
I’ve been thinking about whether there’d be an easy way for you to
add conditional domain-based image loading, without doing a bunch of UI
work for a feature that (admittedly) has limited appeal.
How about this:
1. define a new advanced preference: `defaults write com.freron.MailMate
MmExternalUriApprover -string /path/to/uriapprover`
2. If this is set, MailMate would run this program when displaying an
HTML email. It would send the program each image URL on stdin, and
expect to get back the strings `allow` or `deny`.
3. MailMate would use this information to decide whether to display each
external image.
I would write my own `uriapprover` script. A simple version might look
like this:
```perl
#!/usr/bin/env perl
use Modern::Perl;
use Text::Glob 'glob_to_regex_string';
use URI;
my @allowed = qw(
*.slack.com
*.amazon.com
*.postmark.com
);
my $allowed = join('|', map(glob_to_regex_string($_), @allowed));
sub allowed { eval { return URI->new($_)->host =~ m/($allowed)/o } }
while (<>) { say allowed($_) ? "allow" : "deny" }
```
Everyone else could ignore this feature.
What do you think?
-sam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freron.com/pipermail/mailmate/attachments/20171104/5a2128f1/attachment.html>
More information about the mailmate
mailing list