Giter VIP home page Giter VIP logo

htmail-view's Introduction

htmail-view

About

Web page renderer based on WebKit2. In contrast to a ordenary WebKit2-based browser, htmail-view will prevent loading remote content while showing a single web page (i.e. from a local file).

It was written to be called from mutt to view HTML mails. It tries to protect the users privacy by not loading remote resources. The default browser will be used if the user follows a link.

Prerequisites

  • Gtk3 gir bindings
  • WebKit2 gir bindings
  • Perl packages
    • Browser::Open
    • Glib::Object::Introspection
    • URI
  • wmctrl (optional; used by wmctrl-wrapper)

Installation

htmail-view is a self-contained perl script. On Debian GNU/Linux you could use the prepared .deb packages (see github releases).

Usage

Mutt

~/.muttrc

# prefer plain text
alternative_order text/plain text/enriched text/html

# auto convert text/html MIME type to text/plain
auto_view text/html

# run viewer defined in mailcap by <return> in attach view
bind attach <return> view-mailcap

# mailcap file to use (optional)
set mailcap_path="~/.mutt/mailcap"


# handover mail to htmail-view (works only for multipart mails containing text/html payload)
macro index,pager H "<pipe-message>htmail-decode<return>" "render html mail using htmail-view"

The Debian package will aready add an entry to the global mailcap file.

Use htmail-view for text/html parts

mailcap

text/html; htmail-view file://%s; test=test -n "$DISPLAY"; nametemplate=%s.html; needsterminal;
text/html; w3m -I %{charset} -T text/html; copiousoutput;

Use wmctrl wrapper (focus handling)

The wrapper will save the window id of the currently focused window before htmail-view is launched. After htmail-view has been terminated it will try to restore the focused window.

mailcap

text/html; /usr/lib/htmail-view/wmctrl-wrapper file://%s; test=test -n "$DISPLAY"; nametemplate=%s.html; needsterminal;
text/html; w3m -I %{charset} -T text/html; copiousoutput;

htmail-view's People

Contributors

liske avatar nicop06 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

jiayulu fpl

htmail-view's Issues

webkit_settings_set_enable_private_browsing deprecated

Code seems requiring an update.

WARNING **: webkit_settings_set_enable_private_browsing is deprecated and does nothing, use #WebKitWebView:is-ephemeral or #WebKitWebContext:is-ephemeral instead at /usr/bin/htmail-view line 248, <STDIN> line 4.  
*** unhandled exception in callback:
***   Can't locate object method "get_children" via package "WebKit2::ContextMenu" at /usr/bin/htmail-view line 384, <STDIN> line 4.
***  ignoring at /usr/lib/x86_64-linux-gnu/perl5/5.32/Glib/Object/Introspection.pm line 67, <STDIN> line 4.

v0.6 loads images unconditionally

Thanks for porting this to WebKit2 so quickly! I was looking at what would it take last weekend and it did not seem trivial to me at all. It was awesome to see that this is still an active project :)

I just tried 0.6 on my Debian buster system. Unfortunately, it looks like images are loaded as soon as I open an HTML page (and without hitting the button). With -v, I do see those resources emitted as RES-REQ#REJECT, but they still load.

in-line images (cid:XXXXXXXX) not loading

Per the author's comment in "v0.6 loads images unconditionally", we have:

"In WebKit there was the resource-request-starting signal but WebKit2 only has the resource-load-started signal. The latter is called after beginning to download additional resources..."

The key word there is "after". This translates to "too late" to affect the loading of the "file://" resource corresponding to the original "cid:XXXXXXXX" URL. In verbose mode, it is clear that appropriate remapping of "cid:XXXXXXXX --> file://(something)" is happening, but there needs to be some way to catch the "notify::response" signal and load the remapped resource. I think what needs to happen is similar to the "lbh_resource_notify_response_cb()" function in "balsa/html.c", but I can't figure out a way to accomplish this using the perl Gtk 3.0 and WebKit2 4.0 interface.

Part of why I can't figure out how to do this is not knowing how C function definitions such as
"webkit_web_view_load_uri (WebKitWebView *web_view, const gchar *uri);" map to Perl statements like "$view->load_uri($uri->as_string);" in the general case via the introspection typelibs. Is there some kind of typelib "explorer" that would allow browsing of functions, methods, objects, structures, etc.?

Thanks in advance for any assistance provided.

HTML error robustness

Hi,

I just installed htmail-view to enhance my mutt experience (previously, I opened HTML email in firefox, which was way too slow). I'm happy with the speed, but it seems to me that the webkit renderer is very picky about HTML errors in the email.

In short, many (if not most) of my received HTML emails are not viewable with htmail-view, as it results in an error like the one below:
error

(additionally, I get no icons, but that's a separate issue of course :-))

Now, is this a purposeful setting for the webkit render, and, if so, can it easily be changed into a more relaxed HTML parsing?

Thanks!

Content-type in Mutt 1.9.4 is "multipart/alternative"

Htmail-view does not work from the index or pager, but it will open the text/html in the attach view of mutt. I am just wondering whether the fact that the content-type shown in the attach view is "multipart/alternative" and not just "multipart" is an issue. The htmail-decode perl script certainly tests the items to determine whether or not they are multipart.

When I try to use htmail-view in index or pager, I get the error:

ERROR: Unexpected MIME type text/plain!

Forgive my ignorance as I'm an amateur and maybe I'm asking help instead of opening an issue!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.