[Alpine-info] copying lengthy embedded url's possible?

Andrew C Aitchison via Alpine-info alpine-info at u.washington.edu
Tue Jul 30 13:42:05 PDT 2024




>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.


On Sun, 21 Jul 2024, Damion Yates via Alpine-info replied:

> 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.


[ The command `firefox --noremote URL` disables this feature. ]


> 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.


Thanks. I have a similar script, but I hadn't thought of getting it to
print the URL cleanly. Even when the URL is shown in plain in the
message (rather than just being an html link target as in James's
case) alpine wraps it before the end of the screen, so copy'n'paste
drags in whitespace between the chunks of URL.


> 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.


Thanks for the suggestion of xclip in this script;
it is working very nicely for me using bVNC from an Android tablet.
I can now activate the URL from alpine in my VNC session,
switch back to the local firefox to paste the URL and view the page.

As well as DISPLAY my script uses the XDG_SESSION_TYPE and TERM
environment variables to help determine which action to perform.

--
Andrew C. Aitchison Kendal, UK
andrew at aitchison.me.uk


More information about the Alpine-info mailing list