[Alpine-info] copying lengthy embedded url's possible?
Damion Yates via Alpine-info
alpine-info at u.washington.edu
Sat Jul 20 18:52:35 PDT 2024
On Saturday 20 July 2024, Bret Busby via Alpine-info <
alpine-info at u.washington.edu> wrote:
> On 21/7/24 04:41, Bret Busby wrote:
>
>> On 21/7/24 04:15, James Miller via Alpine-info wrote:
>>
>>> Here's my scenario. I'm almost always doing my Alpine e-mail tasks while
>>> logged in via an ssh session. That is by design since e-mail, for me, is
>>> preferably a textual rather than graphical affair. So, think text-mode,
>>> keyboard driven. Let's call the computer where Alpine is running the ssh
>>> host and the one I've initiated the ssh login from the ssh client.
>>>
>>> A problem I've encountered but have so far been unable to resolve is
>>> that I am sometimes, in order to pass a security check, sent by e-mail some
>>> extremely lengthy embedded URL that is supposed to allow me to sign in to
>>> some account or other of mine. When this happens, what I'd like to do is
>>> open the link in a graphical environment and browser running on the ssh
>>> client computer. Were I able to get the whole URL to somehow display in
>>> Alpine, I'd just use my mouse to copy it, then paste the URL into a
>>> graphical browser: this is what I used to do before such URL's began to
>>> exceed all reasonable URL length conventions (I assume for security
>>> reasons).
>>>
>>> I've tried using Alpine's edit URL option but so far that has failed
>>> because I can only view/copy, at one time, maybe 50 characters of the
>>> hundreds of characters that comprise the URL. Given the complexity of the
>>> URL and the fact that numerous segments need to be separately displayed,
>>> then copied/pasted, the chance are high that some mistake(s) will be made,
>>> thus resulting in an invalid URL. And in addition, the time it can take to
>>> copy/paste in this fashion can exceed the validity interval of the URL.
>>>
>>> So, am I missing some way to display, for copy/pasting purposes, these
>>> mile-long URL's in Alpine? If not, can anyone suggest a workaround?
>>>
>>> Thanks
>>>
>>> PS I do have on the ssh host a text-mode browser and Alpine is
>>> configured to open URL's using that browser, but the lengthy embedded URL's
>>> usually fail to open using that means since the page being requested
>>> requires a java-enabled browser.
>>>
>>
>
>
> Since you have not specified your operating system platform, the response
>> below, assumes that you are running alpine on Linux.
>>
>> In alpine, I suggest that you use the 'h' to display the full headers,
>> which also displays HTML code, such as hypertext links, then, use 'e' to
>> export the message to (for example) your home directory, as
>> "email<hh-mm>.txt"
>> then open the text file with a text editor, such as gedit, then mark and
>> copy the URL.
>>
>> That would put the URL in your clipboard, from whence, you should be able
>> to paste the URL into another application.
>>
>> Works for me.
>>
>> Just be careful of characters (hidden or visible), at the end of text
>> lines, where the URL wraps over multiple lines.
>>
>> Sometimes, that requires a bit of playing around with it, for example,
>> copying and appending parts of the URL, one line at a time.
>>
>> Also, an aspect to remember, is that many excessively long URL's include
>> tracking components and other malicious components, so, you might want to
>> edit the URL's, depending on the nature of the URL's, by truncating at the
>> point where the remainder of the URL, is superfluous to reaching the target.
>>
>> ..
>> Bret Busby
>> Armadale
>> West Australia
>> (UTC+0800)
>> ..............
>>
>>
> Also something else for you to try; when you see a URL that includes a
> question mark, try copying and pasting the URL up to, but excluding, the
> question mark, so that you copy and paste the sequence of characters before
> the question mark, and, find whether that takes you to the web page that
> you want to visit.
>
I've been doing this for many many years, so have several ideas for you:
1) If you use Firefox locally and your remote machine spawns `firefox url`
from alpine, then add long as you made the SSH connection using -X, some
X11 magic makes the local Firefox jump to the URL. I discovered this when
actually wanting the remote server to X forward the whole browser, because
the remote machine was on the right LAN for the address in question (I
ultimately solved this with an ssh -D socks fwd). I was willing to put up
with some graphical slowness for a moment. By killing the local Firefox it
did the slow version. I actually had no idea X could do this. Chrome
doesn't support this feature, so using chrome it'll possibly slowly spawn
your remote chrome over, bit this could corrupt your remote
.config/google-chrome/* stuff. The latter also needs a fast and low latency
link
2) Configure alpine to spawn your own shell script. That script should echo
the URL and sleep for 5 seconds. This will let you c+p cleanly (might
require some terminfo config on wide screen wrapping), this is the most
likely to solve your issue better than trying to grab parts of the URL from
the email, edit URL line or even view headers/raw (which will not resolve
quoted-printable). The script can clear the screen and return after.
3) Adapting on the script idea you can have it intelligently determine
things about your session. For example in my case my alpine is at work, of
I'm there I want to just spawn a new chrome tab, this works fine. If
`xlock` is running, I'm likely remote and the script follows different
conditional logic. If there is no $DISPLAY then it does the echo & pause
thing from 2), if there is, then I use xdotool and xclip to remotely select
chrome, ^t and paste a URL in, all over X forwarding. This simulates the
firefox ability and is significantly faster than trying to X a whole
browser.
4) It may be possible to passphraselessly scp a text file with a URL in a
script to something polling locally, assuming you have an sshd. Some more
communicated kludge liked this is likely needed of you're using Wayland or
a Mac.
I'm about 50:50 local and usually `pgrep xlock` tells me if I'm local or
sshed in, but I have other complications as I'm within a persistent
`screen` session, so I need to fudge $DISPLAY. FWIW I also x forward `xv`
for images or use `chafa` for a good ASCII art rendition of images.
Let me know how you get on.
- Damion
--
Damion Yates - damion.yates at gmail.com
London, England
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman12.u.washington.edu/pipermail/alpine-info/attachments/20240721/8840b4b5/attachment.html>
More information about the Alpine-info
mailing list