Browsh – A fully-modern text-based browser, rendering to TTY and browsers
github.com
github.com
The big thing is I want to write my own UDP protocol for it. It'll be similar to MoSH's in the sense it's optimised for text, only sends diffs and supports network roaming. But it'll be different in the sense that Browsh is a _document_ viewer first and secondly a live-updating UI. Basically, you shouldn't have to wait for a roundtrip to scroll the contents of the page.
Then with this protocol, there can of course be multiple clients. Including JS in normal browsers! (I don't know how well UDP is supported in browsers, so maybe it falls back to TCP). I think I want Browsh to be mainly a text-based browser that actually runs in normal browsers. That might sound counter-intuitive, but recall that the Browsh server runs _remotely_, the actual downloading and native rendering of a webpage is done by Firefox/Chromium in a healthy datacentre in some big city.
Hopefully I can find a way to fund a nice big farm of Browsh servers to provide a free tier. With that and the JS client, you won't even need to download an app to use Browsh, just a few Kbs of JS in any normal browser.
I run into this when using a large (2k) mosh terminal. Scrolling through a file is painfully slow: it seems to redownload the whole screen, even though only a small number of lines are new. Any insight?
In theory WebTransport could solve both the problem of a UDP like transport (it deals with encryption and sessions as it's QUIC based, you could still do mosh like things inside it) and browser support... Sadly as https://web.dev/webtransport/#try-it-out says:
"The best way to experiment with WebTransport is to start up a compatible HTTP/3 server locally. (Unfortunately, a public reference server compatible with the latest specification is not currently available.)"
It's one of those things Google hasn't quite finished and it's unclear if they care enough to.
https://piped.kavin.rocks/watch?v=dcjkezf1ARY
(This library specifically doesn't have nodejs bindings yet, though)
I hope to see your plans work out, sounds awesome.
Why not just run it over mosh? What's the advantage to baking it into Browsh?
See docs and gif demos here: http://uggly.bytester.net
https://news.ycombinator.com/item?id=25129747
Something like this would help with that a lot because you just need a lightweight terminal.
I’m curious to see how Browsh fares!
My first try at compiling NetSurf was met with failure (I was stumped by the build process)
Do people here have recommendations for super minimal browsers whose source source is specifically very portable / easy to adapt / easy to configure? Something where ripping out even the network internals (i.e. libcurl) and replacing it is easy-ish?
Thanks!
The monochrome mode is exactly what I'm looking for, and the documentation is extremely clear. I will definitely spend some time taking a stab at a port. Really really excited about it.
Will probably contact you with updates if I'm able to make some progress :-)
Thank you for this great work!
From the docs:
"When the CLI starts, it looks for a compatible browser (currently only Firefox) and starts it in headless mode...."
That's actually the point of browsh -- you can ssh from anywhere to a (different) machine running the headless Firefox. The machine ssh'ing in doesn't need much except a terminal.
16MB of RAM and 200MHz (x86) would be more than sufficient to run Windows 95 and Internet Explorer 3, which is a full GUI browser, so that's probably the level of functionality you'll end up achieving.
The legwork to port it (its underlying FLTK toolkit, the socket-communicating daemons, openssl, etc.) looks a bit daunting however. I might consider it if nothing else works.
Thank you
hg clone https://hg.dillo.org
Also there's fork on github with mpv+youtube-dl support.
There was a DOS one (arachne?) I couldn't try, And Links2 also has GUI but it's quite archaic.
I think you'd have better luck trying to compile NetSurf.
IMO the gains w/ chafa are pretty enormous. I find it enormously helpful with w3m where it is my default image handler these days.
https://m8y.org/tmp/console_images/catimg_min_font_size.jpeg
Me reading the "Why use Browsh?" statement: "Oh, I was completely wrong. This is actually brilliant."
This is feature not a bug, as the saying goes. I have been using text-only browsers for over 30 years. Without CSS or Javascript, the ability of web design to delay, distract and annoy is greately reduced. I get a much more consistent experience across all websites. A simple HTML reader shifts the balance of power over the experience of reading a website toward the user. Javascript generally shifts the balance of power toward the website operator.
If I want to run Javascript on the command line, today there are many options, e.g., Deno.
Which websites work well? A decreasing number, unfortunately. However, most RSS readers give a decent enough text interface, so you can use your RSS feed as a kind of liason to the wider web.
It's mostly a matter of getting accustomed to different hotkeys and scrolling UX. But once you're there, it's no less efficient than a normal browser, arguably. If anything, the minimalism keeps you away from more, erm, distracting sites.
The question of whether a website "works" does not make much sense with respect to a text-only browser becaus our only goal when using a text-only browser is to read text. "Works" seems to suggest CSS or Javascript must execute, that there are graphics, e.g., images or fonts, that must display, in order for the textual content to be readable. IME, this is almost never the case.
With the text-only browser I use there is never need for a webpage to "load" or to wait for some script to execute. The goal is to only read text, not to view graphical design. As such, the only question is whether the browser (a) renders the HTML and (b) whether the textual content of the website is visible when the HTML is rendered.
Regarding (a), IME, the number of websites that fail to render is so small I could count them on one hand, if I could even remember them. It almost never happens. The text-only browser I use is much more forgiving when rendering HTML than a popular graphical browser. The HTML can be very rudimentary, it can contain errors, and the page will still look great.
Regarding (b), IME, there are some websites that do not place their textual content in HTML tags. What web developers call "SPAs" are one example but there are others as well. Instead of placing text in HTML tags, the text is presented as either JSON or unformatted ASCII, e.g., with escaped newlines.
This JSON or unformatted ASCII may be contained in the webpage or, as is often the case with SPAs, it may be requested from another address sometimes called an "endpoint".
The website operator expects the public will choose a browser that runs Javascript, that she will enable Javascript and that she will consent to running the remote Javascript needed to transform the JSON or unformatted ASCII into HTML. The later is a task that is easily accomplished outside the browser, without the use of Javascript. But by enabling Javascript, e.g., just to read some text, the user also opens herself up to the use of Javascript to serve ads and track her online behaviour. Needless to say, with Javascript disabled, or with a text-only browser having no support for Javascript, advertising and tracking generally does not work. (This is the true context for the term "works" as applied to a website. Displaying text does not require Javascript, but ads and tracking do require Javascript.)
For this minority of websites referred to in (b), unless the text we are reading contains hyperlinks, a browser is not required because there is no HTML to render. We can use programs suited for reading/editing text, such as less(1), vi(1) or ed(1). Where the text contains some hyperlinks, we can create simple HTML according to our own aesthetics. Adding a single HTML tag at the top of the document, or wrapping paragraphs in <p> tags is usually enough for it to render as readable text in the text-only browser.
Someone Else's Problem (SEP) is a beautiful thing.
Have you considered bundling support for tinyweb protocols like Gemini and Gopher? Those will work with full fidelity over the kinds of connections you’re focused on, and the core Browsh features allow you to jump from Gopherspace/ Geminispace to www without leaving the terminal.
Maybe the smart way to do this is to add Browsh as an optional dependency to a terminal-based Gemini client… the proxy architecture would add overhead if you run the whole thing locally though. I can see preferring to have a SSH connection from the client to a master proxy node that handles all protocols.
Rendering variable-width fonts in a TUI-like layout environment isn’t exactly straightforward obviously, but I’m sure it could be solved adequately. The point is to still retain the snappiness of TUIs by not going full GUI and by still limiting layout to the coarse textmode grid.
At least, Browsh has a Docker image, so anywhere you can run `docker run browsh/browsh`, you can run Browsh.
noscript/basic (x)html browsers are not grotesquely and absurdely complex and massive (including their SDK) and though, can perform a good enough job for bazillions of services provided over the internet.
Namely, even if you have an army of coders with infinite time and code a lean and simple C (C89 with benign bits of C99/C11) "modern" web engine, it won't change the core of the problem.
It won't happen peacefully, my guess is it requires strong regulation, at least for critical sites (like those from the administration).
One of the main issues is the corpo(state?)-sponsored hackers paid to sabotage the alternatives.