Commit graph

82 commits

Author SHA1 Message Date
Thomas Buckley-Houston b4e48ae248 Version bump to v1.1.1 2018-06-18 18:59:32 +08:00
Thomas Buckley-Houston 3149db4bd3 Add anchor tags to HTTP Server output
This means you can now load the raw text in a browser and the resulting
page will have basic blue links that can be clicked on that will in turn
be loaded by the HTTP service.

A significant feature, so worthy of a minor version bump to;
v1.1.0
2018-06-17 21:26:44 +08:00
Thomas Buckley-Houston 1b42630b7f Text builder optimisations from @tobimensch 2018-06-15 11:15:01 +08:00
Thomas Buckley-Houston c9df161eb6 Don't UPX compress OSX binaries
The current versions of UPX cause an instant crash of the Browsh binary
on OSX :/

Version 1.0.13
2018-06-13 19:37:26 +08:00
Thomas Buckley-Houston f894057172 Version 1.0.12 2018-06-12 20:47:54 +08:00
Thomas Buckley-Houston e24ea50dd7 Version 1.0.11 2018-06-12 20:38:30 +08:00
Thomas Buckley-Houston cf35a065bf Version 1.0.10 2018-06-12 20:30:40 +08:00
Thomas Buckley-Houston 2577ea896b Fixes to get the Docker image building again
Firstly Firefox 60 now throws an error if its run as root inside a
user's home path. Which is great because that revelead my naivety about
using `RUN su user` in the Dockerfile. So now Firefox is running as a
non-root user inside Docker which is what was always best.

Also it turns out that the crude 3 second wait at startup hoping that
Firefox's Marionette had started listening, wasn't good enough. So now
we're actually listening for a log message to know when it's started
now.

Finally make all startup methods use a the post-webext connection state
to send the startup URL to the browser, the other methods just seemed to
flakey.

Includes version bump to 1.0.9
2018-06-12 15:40:49 +08:00
Thomas Buckley-Houston c13e8d26f6 Use absolute path to webextension.go asset
Bump to version 1.0.8
2018-06-11 16:28:00 +08:00
Thomas Buckley-Houston 47bcbbc0a6 Version 1.0.5
Adjust path in .goreleaser.yml

Boot Firefox before any tests to get any 'first launch' behaviour out of
the way.

Remove pacman build as we're using nfpm instead of fpm now.
2018-06-11 14:11:45 +08:00
Thomas Buckley-Houston 0109fa206e Move .goreleaser.yml file 2018-06-10 22:47:49 +08:00
Thomas Buckley-Houston 05c2d9f4f3 Version 1.0.2
Update Firefox version dependency to 60.0
2018-06-10 22:30:44 +08:00
Thomas Buckley-Houston 14796c0d93 Updates for Goreleaser
Update Golang to 0.10

Use `curl -sL http://git.io/goreleaser | bash` instead of `go get`
2018-06-10 20:33:41 +08:00
Thomas Buckley-Houston 98fa8014b9 Added Firefox paths for Windows and OSX
Also updated Gopkg dep versions.

And version bump to 1.0.0pre1!
2018-06-10 20:16:28 +08:00
Thomas Buckley-Houston 7d3620e12d HTTP Service: don't delete tab if last remaining
Previously we were using the tab's ID to decide if it was the root tab
(that if deleted would close the browser). However our ol' "friend" the
Firefox Privacy tab can sometimes take the TAB ID=1 hotspot, so now we
just have to call out to the browser to ask it how many tabs are
currently loaded, this is more reliable.
2018-06-05 18:50:10 +08:00
Thomas Buckley-Houston 3d39cf8b6d Fix maths for scroll-triggered big frame parsing
Big frames (ie plus and minus 6 or so frame heights) should only be sent
when plus or minus 6 frame heights have been scrolled.
2018-06-05 16:59:03 +08:00
Thomas Buckley-Houston ad64b4f0a3 Remove all text-decoration underlines
These don't dissapear when using the blank font, so they can sometimes
cause a little bit of blur behind link text.
2018-06-05 16:16:57 +08:00
Thomas Buckley-Houston ea841fc672 Show all tab HTTP requests as a 'loading' status
Suddenly found out about webextensions `webRequests` API, where you can
intercept all HTTP requests. Previously you only got status updates when
the current page fired a `window.onunload` event, which is often a long
time after the initial request to new URL is made.
2018-06-05 16:14:52 +08:00
Thomas Buckley-Houston b671a6c6b3 Drag and Drop mouse movement!
Not really sure why but `new MouseEvent` was always sending the coords
to the same place within an element, not matter where you clicked. Now
using initMouseEvent(), the click actually goes to the place on the
viewport where you clicked.
2018-06-05 15:51:27 +08:00
Thomas Buckley-Houston 707a433385 Better rules for finding input boxes
Google maps doesn't use a [type=text], or any kind of type attribute for
its search box. Plus it also has a [aria-hidden=true] input box that
Browsh was detecting and covering the actual active search box.
2018-06-05 15:25:57 +08:00
Thomas Buckley-Houston 8d958b0256 Readded the browser resize height magic number
This fixes a bug where the bottom of web pages wouldn't get parsed.

And also another bug where mouse clicks at the bottom of a page
wouldn't render.
2018-06-05 15:01:52 +08:00
Thomas Buckley-Houston e937f81a60 Added shortcut to toggle a mobile user agent 2018-06-05 14:40:03 +08:00
Thomas Buckley-Houston 5b575110b1 Include role="textbox" elements as an input boxes
This just about allows you to use Gmail
2018-06-04 21:29:43 +08:00
Thomas Buckley-Houston 07fd062510 Stackoverflow.com-related fixes
Stackoverflow surfaced a few bugs;

1. For some unknown reason it measures the em value of a single
character as having something like 10,000 pixels width. So for now I'm
just hardcoding the standard measurement of 9x15 for unreasonably large
widths.

2. Its cookie banner used `position: fixed !important`, so needed to
update the sticky fix code in case other sites do the same.

3. The cookie banner with the aplied sticky fix meant that the div just
sat staticlly in the middle of the DOM obscuring other text. So I
started a list of site-specific CSS specifics.
2018-06-04 21:01:46 +08:00
Thomas Buckley-Houston eb1176b8c3 Fixes for text that clobbers other text
During the text builder process its possible that a character tries to
fit onto a TTY cell that already has a character. There are multiple
reasons for this, the main one being hidden text. This commit changes
the method for deciding the priority of character to using the
`elementFromPoint(x, y)` method.

This commit also includes a fix to re-parse all text when there's a
mousedown event.
2018-06-04 20:03:59 +08:00
Thomas Buckley-Houston e2d39ba56c Prevent sticky elements from being sticky
Sticky elements are, for example, those headers that follow you
down the page as you scroll. They are annoying even in desktop
browsers, however because of the lower frame rate of Browsh, sticky
elements stutter down the page, so it's even more annoying. Not to
mention the screen real estate that sticky elements take up, which
is even more noticeable on a small TTY screen like Browsh's.
2018-06-04 17:52:00 +08:00
Thomas Buckley-Houston 7232ac120f Bug fix: improved line formatting
There was a long standing problem where random gaps would appear
between lines. The fix was to change a magic number that adds an extra
few pixels to the reported height of the 'em' character dimensions.
Unfortunately I don't know what this magic number actually does. It
might represent the distance between lines?
2018-06-04 17:02:15 +08:00
Thomas Buckley-Houston 72c74f1905 Fixes bug in HTTP Service rendering
I think with the recent change to the method of hiding text by using a
dedicated blank font, the initial page load and parsing (upon which the
HTTP Service very much depends), browser window resizes were causing a
delay in the time taken for text to be properly parsed, resulting in
mostly empty raw text pages.

The fix was to ensure that the BlankMono.ttf font was loaded with the
initial page load, by using the webextensions injected style.css file.
2018-06-04 15:51:47 +08:00
Thomas Buckley-Houston cc23f0ab3e Increased big text frames to size 6
That's that frames 6 times as big as the TTY are passed at once. This
lessens the likelihood of catching a glimpse of unparsed webpage as
you're scrolling down quickly.
2018-06-03 20:06:33 +08:00
Thomas Buckley-Houston 02bc0aad93 Hide/Show text using seperate font
Previously we were using CSS to make the text's colour transparent.
However that proved to cause a lot of problems with pre-existing
transition animations in the host webpage. There didn't seem to be
anyway to disable the transition time for text transitioning to
transparent, without also disabling all transitions.

Also added censorship to password input boxes.
2018-06-03 19:54:38 +08:00
Thomas Buckley-Houston 55c70d9e5e Multiline text input boxes
No doubt a lot of this code is reinventing the wheel, after all this is
basically now a simple text editor. I'm sure there'll be a few bugs to
iron out.
2018-06-02 18:47:37 +08:00
Thomas Buckley-Houston b78abbf26f Overflow scrolling for single line input boxes
Such a basic thing, that we take it for granted. But it's actually a bit
tricky to implement.
2018-05-28 22:03:33 +08:00
Thomas Buckley-Houston 0fc39a51e6 HTTP Server service: fetches URL, returns raw text
Using the `-http-server` argument will now start Browsh in HTTP Server
mode. It will accept request like this:

  `curl brow.sh/http://news.ycombinator.com`

This will return a plain text version of the Hacker News front page,
with a width of 100 characters, with each line separated by a line
break.
2018-05-27 20:45:43 +08:00
Thomas Buckley-Houston 4b84d52ae1 Backspace goes back in history
Also:
  * Use webextension to navigate URLs instead of the DOM. This means
    that crashed pages can still be navigated away from.
  * An attempt to implement mouse dragndrop, but it doesn't work :(
2018-05-25 18:48:57 +08:00
Thomas Buckley-Houston 938d51b692 Tabs! As we all know and love
Adding, cycling, deleting. The width of the tab handle is currently
fixed to 20. And if there are more tabs than can fit in the tab bar then
the extra ones just dissapear off to the right, but they can still be
cycled to with CTRL-Tab.

The marks the end of feature development in preperation for a version
1 release.
2018-05-24 18:45:07 +08:00
Thomas Buckley-Houston 5c7ff71c79 Input boxes, for searches, logins, writing, etc
Input boxes are currently only one line and to not properly wrap. So
textareas are also one line. TBC...

Also includes:
  * First implementation of the DOM MutationObserver. This needs to have
    an eye kept on it in case some websites trigger too mutatation
    events. For now it doesn't seem too bad. Although strangely it seems
    to stop on Youtube after about 15 seconds.
2018-05-20 21:17:33 +08:00
Thomas Buckley-Houston 9dc0f0a08f Webext: default to hiding text in webext
Text in the real browser only needs to be displayed when parsing with
the Text Builder in order to get the text's colour and z-index. Text
parsing should be done in frequently as it likely doesn't change often.
However graphics building of the current viewport is set to
automatically parse ever 250ms and it doesn't need to know anything
about text. So there's no point defaulting to having text on and hiding
it for every graphics frame.

This tweak has improved the perforance of the graphics parsing for small
frames (the same size as the viewport) from around 100ms to around 4ms!

There are still some curious and inexplicable CPU spikes when
scrolling... TBC
2018-05-08 14:07:54 +08:00
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 1acb178fa7 Lots of new integration tests 2018-04-07 11:35:17 +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 8b042b2479 Added PAGEUP and PAGEDOWN key movement 2018-02-17 15:02:50 +08:00