Giter VIP home page Giter VIP logo

Comments (16)

enkiv2 avatar enkiv2 commented on July 30, 2024 2

As of 5c0110d, if you set your BROWSER environment variable to w3m -o auto_image=TRUE, pressing g will open the currently selected message in w3m with images loaded.

It also respects the value of $PAGER if $BROWSER isn't set, and falls back to $VISUAL, then $EDITOR, then less.

If $BROWSER is set, it sends HTML, otherwise it sends plain text to the pager.

from fern.

enkiv2 avatar enkiv2 commented on July 30, 2024 1

Alright, in cases where media attachments exist but are not linked to in the content, the pager now gets generated HTML for embedding them as of commit cb55138

This will double up any embeds that are actually linked in the content.

from fern.

enkiv2 avatar enkiv2 commented on July 30, 2024

I don't plan to add image support in mainline fern. It'd add dependencies & complications.

That said, I might add support for configurable pagers (in order to deal with situations like posts from instances with long upper limits inside small terminals -- the message window does not scroll & I'm not planning to add scroll support to it), & if I do that, setting pager to w3m with image support turned on will let you view images.

from fern.

enkiv2 avatar enkiv2 commented on July 30, 2024

THAT SAID -- if you want to submit a pull request, & can make the diff small & behavior degrade gracefully in the case that the dependency is missing (i.e., inserting a couple lines into message rendering & a couple lines up top for an import, where normal behavior remains if w3mimgdisplay python bindings aren't already installed) I'll merge it.

My policy is basically that fern code should remain a single file, no more than 1000 lines, & depend on nothing but Mastodon.py, no matter what features are added.

from fern.

shellkr avatar shellkr commented on July 30, 2024

from fern.

shellkr avatar shellkr commented on July 30, 2024

I just tried this and it almost worked as it should. The issue is that it does not open w3m $url but instead parses and sends the content of a post. Which means you will just get a long line of text in w3m and no images.

I hacked a bit but was little difficult when I am not familiar with the variables... but something like this works. From line 453.

               if browser!="":
                        subprocessRun(browser+" "+tl[tlIdx]["url"])

This will not open the post but the whole thread. Didn't figure out how to open just the post.

from fern.

enkiv2 avatar enkiv2 commented on July 30, 2024

from fern.

shellkr avatar shellkr commented on July 30, 2024

Yes, BROWSER=w3m as you instructed. I will take another look later. Maybe w3m goes into pager mode somehow. Need to go to work now though.

from fern.

enkiv2 avatar enkiv2 commented on July 30, 2024

It looks like w3m sometimes can't identify the input as HTML, so you'll have to add -T text/html to BROWSER.

My copy of w3m doesn't seem to be built with image support, so I can't verify that images are showing.

from fern.

shellkr avatar shellkr commented on July 30, 2024

Yeah, that makes it render but still does not show the images. I don't know if it is just me but I can not see a url to the image, just the "content" part. I can see the image url in fern but not after in w3m. Perhaps the url to the image is not sent to w3m?

from fern.

enkiv2 avatar enkiv2 commented on July 30, 2024

from fern.

shellkr avatar shellkr commented on July 30, 2024

Well, actually.. this is what BROWSER=less gives me on this. No image url is forwarded.

scrot_20190625-214905_662x118

less output:

<html><body><p><a href="https://mstdn.io/tags/boris" class="mention hashtag" rel="tag">#<span>Boris</span></a> <a href="https://mstdn.io/tags/bus" class="mention hashtag" rel="tag">#<span>bus</span></a></p></body></html>

scrot_20190625-215335_621x130

less output:

<html><body><p><span class="h-card"><a href="https://playvicious.social/@paeneultima" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>paeneultima</span></a></span> This is what upset them</p></body></html>

from fern.

enkiv2 avatar enkiv2 commented on July 30, 2024

from fern.

shellkr avatar shellkr commented on July 30, 2024

Yes, as you can see in the image it had image url's that didn't get through to less. Only the text part got through. I have investigated a bit and according to https://mastodonpy.readthedocs.io/en/stable/ you have 'content' but also a 'media_attachments' for media attached in the toot.

from fern.

enkiv2 avatar enkiv2 commented on July 30, 2024

from fern.

shellkr avatar shellkr commented on July 30, 2024

That did it! Now it works as it should... and btw... I packaged it up and put it out on the AUR.

from fern.

Related Issues (3)

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.