Commit graph

34 commits

Author SHA1 Message Date
Ananth Bhaskararaman c191b34201 feat: Structured log messages
Log messages have been re-written with structured fields.

Also, important Go depenedencies like x/sys and errors packages have
been updated.

Github actions have also been updated.
2023-12-09 13:17:50 -05:00
Ananth Bhaskararaman f93a4d12cf feat: Use log/slog for logging to file or stdout
Switched to Go1.21 to use the log/slog package for strutctured logging.

TODO: Log messages that are stringifying objects can now use strutctured
output.

TODO: Customise log levels for different messages.

Fix tests
2023-12-08 19:09:08 -05:00
Thomas Buckley-Houston aaea254f0d fix: Don't load startup URL in HTTP Server mode
I think this is the source of a long-standing issue in the HTTP Server
where it would just freeze after a certain period of time. Every
successful page load, wether it was explicitly requested as a raw-text
request or not, attempts to send a raw text payload on page load. So I
think the automatic default home page startup loading was confusing
things.

Fixes #207
2022-07-16 17:18:39 -04:00
Thomas Buckley-Houston e85455880a HTTP server: timeout for page loading 2019-06-19 13:23:42 +03:00
Thomas Buckley-Houston d6b5951059 HTTP server: add experimental DOM-dump mode
Simply dumps the contents of the DOM
2019-06-19 09:03:20 +03:00
Thomas Buckley-Houston 27826b34e2 Various improvements to integration tests
This has been a long time coming, but it's still not perfect. Basically
I'm trying to reset the entire environment as much as possible so that
each spec runs in a clean room. Mostly in this commit Firefox is being
killed and restarted for every spec, which has made a lot of
improvements.
2019-06-11 12:21:39 +03:00
BO41 ad235b6c51 Use less verbose if statements (#166) 2018-08-04 19:55:37 +08:00
Thomas Buckley-Houston 855d8daa41 Use thread-safe map for HTTP requests
This fixes a race condition when may parallel requests are made to the
HTTP service
2018-08-02 19:26:09 +08:00
Thomas Buckley-Houston ec62ceaeac Remove "ms" from durations in HTTP response header 2018-08-02 15:56:25 +08:00
Thomas Buckley-Houston 4bf2f67410 Changes UA regex for Kube probe detection
Trying to stop Kubernetes' regular health check probes from loading
an actual raw text request.
2018-07-25 02:30:32 +08:00
Thomas Buckley-Houston 514260205c Page load and parsing durations in HTTP header 2018-07-24 15:54:45 +08:00
Thomas Buckley-Houston 023836b69e Attempt to return empty 200s for Kube probes 2018-07-21 13:34:45 +08:00
Thomas Buckley-Houston 23702a2b4d Block user agents and domains using user config 2018-07-18 17:38:17 +08:00
Thomas Buckley-Houston 73c8bd94f3 Made all obvious variables user-configurable
There's a bit of refactoring in order for the webextension to deal with
the new order of initialisation now that config is sent by the Golang
client.

Closes #83
2018-07-18 15:55:35 +08:00
Thomas Buckley-Houston ef18913e3c First implementation of config file
Includes change of CLI args, many of been moved to the config file and
those that remain begin with `--` not `-` and may be worded differently.

Touches #37
2018-07-17 18:43:52 +08:00
Thomas Buckley-Houston 4b2ce6abbc Gofmt formatting 2018-07-17 10:10:08 +08:00
Thomas Buckley-Houston 2fc0b5cde3 Formatted all Go code
Closes #97
2018-07-11 17:00:06 +08:00
Thomas Buckley-Houston be098c0673 Redirect HTML service requests for favicon.ico
... to a real favicon
2018-07-11 16:46:33 +08:00
Thomas Buckley-Houston 85affab04d Collapse recursive URLs to the HTML service
Eg; https://html.brow.sh/https://html.brow.sh/google.com
jsut becomes google.com
2018-07-11 16:39:35 +08:00
Thomas Buckley-Houston 74fd11ab7b Correct link on text.brow.sh home page 2018-07-10 09:11:06 +08:00
Thomas Buckley-Houston c457210c72 Refactor disallowed domains in HTTP service 2018-07-09 19:22:51 +08:00
Thomas Buckley-Houston 29132f3695 Better attempt to fix Google phishing warnings 2018-07-09 13:51:58 +08:00
Thomas Buckley-Houston 384688302e Quick fix to stop Chrome detecting phishing
Apparently Google isn't happy about
https://html.brow.sh/mail.google.com URLs.
2018-07-09 13:06:50 +08:00
Thomas Buckley-Houston 160a19ece8 Add arg for HTTP server bind address
Eg; `browsh -http-server-bind 127.0.0.1`

Fixes #57
2018-07-08 15:41:13 +08:00
Thomas Buckley-Houston 26fa4cb3de Use www.brow.sh's HTML service welcome page
It's nice to see the big Browsh logo rather just some boring plain text
2018-07-08 15:33:08 +08:00
Thomas Buckley-Houston 752f34ddb3 Redirect HTTP to HTTPS 2018-06-27 17:10:48 +08:00
Thomas Buckley-Houston 16f1917ed8 Basic application-level HTTP rate limiting
Here set to 10 requests per minute. Note that the current implementation
doesn't use a shared store across instances, so in effect clients can
request on average instances-count * 10 requests per minute.
2018-06-26 15:21:10 +08:00
Thomas Buckley-Houston c0c68842f0 Added gzip compression to HTTP server 2018-06-26 13:57:52 +08:00
Thomas Buckley-Houston 2e1de9dab1 Add 10min public cache to HTTP server 2018-06-25 22:06:29 +08:00
Thomas Buckley-Houston 3f6211c8a4 Added robots.txt to ignore everything but / 2018-06-23 19:27:55 +08:00
Thomas Buckley-Houston ea53e6b467 Return help message for / request on HTTP service 2018-06-18 20:00:29 +08:00
Thomas Buckley-Houston c70083958f HTTP server: Use whole URI, including query 2018-06-17 21:40:16 +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 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