Commit graph

306 commits

Author SHA1 Message Date
Thomas Buckley-Houston fff7c2e413 Only parse text that is within a sub-frame
This improves the performance of parsing and rendering text
2018-05-08 13:45:22 +08:00
Thomas Buckley-Houston 7a8811c526 Webext can now reconnect to a re-opened TTY
Albeit it is quite slow to notice the re-opened TTY client :/
2018-05-08 13:30:08 +08:00
Thomas Buckley-Houston dd4a29f04a Send 'sub-frames' rather than the whole DOM
Firstly, this improves performance on a larger pages. But it also
prevents browser crashes a very large pages by setting a limit to how
much work is done per frame.

Also includes:
  * Thread safe cell map for simultaneously reading and writing to the
    buffered frame of TTY cells.
  * Improved webext tests so that they programmaticlly build DOM rects
    based off simple text strings.
2018-05-05 16:43:10 +08:00
Thomas Buckley-Houston ae44a18cfc Moved URL bar input and mono mode toggle to CLI
Finally fixes integration tests
2018-04-28 19:02:40 +08:00
Thomas Buckley-Houston b605965e77 Move UI building to CLI
* CLI is now prepared for supporting multiple tabs.
  * Refactored global vars into relevant files
  * Now using real types in JSON sent to CLI
  * Still doesn't fix integration tests
2018-04-28 12:18:34 +08:00
Thomas Buckley-Houston ba5ce3c58b Move frame building from webext to CLI
This offloads significant CPU load from the browser. However it's become
clear that the previous feature of parsing the entire DOM needs to have
an upper limit imposed. For instance large Wikipedia pages still cause
problematic CPU load.

This commit does not fix the broken UI so integration tests fail.
2018-04-22 22:59:00 +08:00
Thomas Buckley-Houston c0f5fcca69 Compose frames of whole DOM, for faster scrolling
Instead of mirroring the browser's viewport, as if we had a camera over
the browser, the entire DOM is now sent in the frame. This means that
the CLI itself can scroll without having to wait for updates from the
webextension screenshotter.
2018-04-18 21:11:04 +08:00
Thomas Buckley-Houston 5b6cc89770 Refactored webext classes to be more SRP
The biggest refactor is separating out the DocumentBuilder from the DOM
Manager.

I also made consistent use of the mixin pattern I'd only half
implemented.
2018-04-09 18:36:46 +08:00
Thomas Buckley-Houston 34497c88aa Better test logging 2018-04-07 12:55:05 +08:00
Thomas Buckley-Houston 1acb178fa7 Lots of new integration tests 2018-04-07 11:35:17 +08:00
Thomas Buckley-Houston 3d0b2ec9c8 Split main browsh code into separate files 2018-04-01 17:03:21 +08:00
Thomas Buckley-Houston c0a79caf4e Refactor Browsh Go code into package
This helps with isolating the tests and refactoring the code into
separate files.
2018-04-01 16:31:25 +08:00
Thomas Buckley-Houston 640f191e61 Added adblocking to /etc/hosts in Docker image 2018-02-17 18:29:14 +08:00
Thomas Buckley-Houston 101b10b0e0 Use which when deciding if Firefox binary exists 2018-02-17 16:14:10 +08:00
Thomas Buckley-Houston c44e218c8a Bump to v0.2.13
FPM failed again :/
2018-02-17 15:16:21 +08:00
Thomas Buckley-Houston 29f4dce00b Bump to version 0.2.12 2018-02-17 15:08:07 +08:00
Thomas Buckley-Houston c9e0a9ecc4 Hack to force true colours 2018-02-17 15:06:11 +08:00
Thomas Buckley-Houston 8b042b2479 Added PAGEUP and PAGEDOWN key movement 2018-02-17 15:02:50 +08:00
Thomas Buckley-Houston 8cf3de33c3 Move integration tests to Golang CLI client
After moving to Tcell and implementing its screen diff updates, we can
no longer watch STDOUT to get frames during integration tests. Instead
we need to use Tcell's SimulationScreen and which has a GetContents()
method. This is actually also a much more robust way of being able to
see what Browsh actually outputs during testing.
2018-02-17 14:10:39 +08:00
Thomas Buckley-Houston b5a083e929 Replaced Termbox-go with Tcell
This was primarily to get native diff'ed frame rendering.
Termbox-go doesn't support true colours, thus the switch to Tcell, but
as it turns out Tcell claims to have wider platform support, so it looks
like an especially good change.

So now the CLI will only try to update the terminal screen when cells
actually change. This has some significant performant gains, especially
when using Browsh over SSH.

Also note that this required a complete change of the frame data
structure sent over the websocket. Previously it was a little
structured, but now it is just a plain 1 dimensional array of pure
strings, even the RGB components are sent as integers in strings. If I
can find a way to unmarshal mixed arrays in  Golang then it'll be worth
sending a mixed JSON array to save some compute overhead.
2018-02-14 10:33:39 +08:00
Thomas Buckley-Houston 60c20ee404 Release v0.2.11
Sigh, it's annoying that if the release block fails then we have to bump
the version :/ It's because the Mozilla Addon XPI version can be
re-released.
2018-02-09 11:52:19 +08:00
Thomas Buckley-Houston e1c8cf8a45 Release v0.2.10 2018-02-09 11:47:45 +08:00
Thomas Buckley-Houston 8c999b5d54 Exclude freebsd build from UPX compression 2018-02-09 11:47:02 +08:00
Thomas Buckley-Houston 30b83d9d8f Release v0.2.9 2018-02-09 11:34:24 +08:00
Thomas Buckley-Houston 043292d66b README updates
Make it less about me.
2018-02-09 11:33:59 +08:00
Thomas Buckley-Houston 3091510a08 Fixes bug: "undefined" when clicking on URL bar 2018-02-09 11:25:11 +08:00
Thomas Buckley-Houston bb313f568a Added a monochrome mode: ALT+M to toggle
TODO: Still needs a way to represent clickable text
2018-02-09 11:13:33 +08:00
Thomas Buckley-Houston 819a29c8b6 Mouse wheel scrolling
Also throttle the frame rate to 40ms/ Previously it was redrawing on
every sent STDIN event.
2018-02-09 10:06:54 +08:00
Thomas Buckley-Houston f624ea00f1 Forgot to bump the version in manifest.json 2018-02-08 20:28:12 +08:00
Thomas Buckley-Houston 2e37da37c4 Add gcloud_logger to Dockerfile
This is used on the Browsh as a Service platform for anonymous logins,
it does not get used by default unless explicitly called. It is an
external third-party binary and not at all integrated with the browsh
binary itself.

The situation is that browsh logs to a file *inside docker* so for now
the easier way to get at those logs is to include this tool inside the
docker container as well. I'm sure there are ways to completely separate
the concerns here and I hope to do that soon once I settle on the final
infrastructure for BaaS.
2018-02-08 18:39:07 +08:00
Thomas Buckley-Houston d2f74cefb8 FreeBSD builds. For @RainbowHackerHorse 2018-02-05 16:57:49 +08:00
Thomas Buckley-Houston cf6cde86f7 Added -startup-url and -time-limit args 2018-02-04 18:26:01 +08:00
Thomas Buckley-Houston fc5e72b191 Do FF's first run during docker *build*
This gets around a few problems caused by the fact that Firefox's first
ever run on a new profile is quiet different from a normal startup. Note
that this only effects Browsh in Docker.
2018-02-04 18:02:39 +08:00
Thomas Buckley-Houston c0e51e6413 Use Browsh-specific FF profile.
Also adds `-debug` flag.
2018-02-03 15:21:58 +08:00
Thomas Buckley-Houston 3b7ee79808 Just a version bump to retry a goreleaser bug 2018-02-02 17:35:18 +08:00
Thomas Buckley-Houston cdab6bde93 Bugfixes to Dockerfile 2018-02-02 17:20:37 +08:00
Thomas Buckley-Houston afca0dd468 Auto-reload a tab if it doesn't connect to webext 2018-02-01 23:15:34 +08:00
Thomas Buckley-Houston 7117eb9965 Added screenshot feature: press ALT+P
In the endless struggle to squash a Travis-specific bug, we now have
screenshots. Currently the screenshots are of the custom block font
state, so you can't read the text. But I'm planning on changing the
default state of the page to use a normal font - such that the
frame builder needs to toggle the block font on to build a frame. This
will make it more likely that screenshots will contain actual text.
2018-02-01 17:34:25 +08:00
Thomas Buckley-Houston 74538fed0e Fix for zero-width chars in page titles
Also removes the Mozilla Cliqz disclaimer tab on first startup.
Interestingly it has a carriage return in its HTML page title, which is
of course zero-width. But also the fact that this tab can sometimes load
before the requested tab at startup is a showstopper for automated
tests.
2018-01-31 15:40:43 +08:00
Thomas Buckley-Houston 0b3ff030cd Release v0.2.3 2018-01-30 17:50:55 +08:00
Thomas Buckley-Houston 2985774859 Automate releases 2018-01-28 16:08:19 +08:00
Thomas Buckley-Houston 6f0a732145 Adds Go built binaries to .gitignore 2018-01-24 16:50:09 +08:00
Thomas Buckley-Houston 221aa56869 Log Firefox's core debugging console to stdout
Includes the addition of a function to set Firefox preferences at
startup.
2018-01-24 16:32:52 +08:00
Thomas Buckley-Houston 9a82182a9a Don't use --new-instance, -P when launching FF 2018-01-24 10:59:57 +08:00
Thomas Buckley-Houston 318f5c3c34 First draft of integration tests 2018-01-23 20:04:23 +08:00
Thomas Buckley-Houston b387f66c69 Launch and install webextension from client
This means that Browsh can now be entirely run just by running the CLI
binary. The client launches Firefox as a subprocess, then connects to it
via the Marionette protocol, installs the webextension and finally
triggers a new tab with, currently, the Google homepage in it.

I was trying to set this up for automated testing as well by installing
the built webextension as a temporary addon, because otherwise you need
to sign the extension everytime with a unique semantic version. However
for some reason I can't quite recreate the environment that MDN's
`web-ext` creates. The extension installs fine but fails to load the
`content.js` script, I can't find a backtrace or any other details about
the failure. So for now, we're just going to have to use `web-ext` as
seperate process and have the client connect to that. Which is what one
should do during development anyway, so it's not a huge loss.
2018-01-21 11:56:05 +08:00
Thomas Buckley-Houston ef5c683591 Back and stop button 2018-01-17 15:52:52 +08:00
Thomas Buckley-Houston 4177bff127 First draft of mouse down/up/click support 2018-01-17 11:00:37 +08:00
Thomas Buckley-Houston 3fc70e6718 Basic z-layer detection for clobbered characters 2018-01-15 12:06:05 +08:00
Thomas Buckley-Houston 64431be7c3 First pass at supporting wide UTF8 chars like 中文 2018-01-14 22:29:08 +08:00