# Goldberry

Goldberry is a graphical smallnet client supporting gopher and gemini protocols, as well as local files (coming soon).

![Goldberry's user interface showing a gemini capsule named 'spacewalk'](goldberry.png)

This is an experimental project, but builds fine and works well for what it does. Try it out if you like. Goldberry is meant to be the graphical consort of my other client [bombadillo](https://bombadillo.colorfield.space), though the two vary in philosophy/style quite a bit.

This was built mostly on a whim. I do not have much use for a graphical client and mostly just did it as a hobby project in spare time. The code is a mess and there are some questionable design choices. For example, goldberry does not at present verify tls certificates: it will accept anything that is offered by the server. It also does not implement the entirety of gemini: much like bombadillo, no client certificates. goldberry can and does render images, but does not do so inline and only makes one request per page.

## Building

At present goldberry is only tested on x86/64 Linux. It should be buildable for both windows and OSX as well, but has not been tested.

From the root folder of the repo:

``` sh
make
sudo make install
```

The first step builds the application locally and the later installs it and the man page to the `/usr/local` heirarchy (`bin` and `share/man/man1` respectively).

### Dependencies

There are two main dependencies for goldberry, though both have their own dependencies as well.

#### wails

goldberry is built with the golang toolkit [wails](https://wails.app/gettingstarted/). As such, it has the same dependencies. In short:

- go
- node
- npm
- gtk
- gcc
- webkit
- wails

To see minimum versions and for install help, see the [wails linux documentation](https://wails.app/gettingstarted/linux/).

Once wails is installed and working, goldberry should build just fine.

#### clipboard

This dependency is used to allow access to the system clipboard. This was not functioning via wails' frontend (js, via either the async or the blocking method). As a result this dependency was added in order to facilitate usage of the clipboard. On linux/unix either `xsel` or `xclip` must be installed for clipboard access to work.

This dependency is listed in the go mod and should get added automatically. If for any reason it does not, you can `go get github.com/atotto/clipboard`.

## Using goldberry

### 'Hot' Keys

- `Escape`: Exit a dialog or exit full-screen
    - In order or precedence:
        - "Add to reading list" dialog
        - "Reading List" menu
        - Full screen
- `Ctrl q`: Quit goldberry/exit the application
- `Ctrl UpArrow`, `Ctrl-Enter`: Full screen
- `Ctrl b`: Navigate back one page in session history
- `Ctrl f`: Navigate forward one page in session history
- `Ctrl Space`: Open the reading list pane
- `Ctrl +`, `Ctrl =`: Zoom in/increase the document font size
- `Ctrl -`, `Ctrl _`: Zoom out/decrease the document font size
- `Ctrl *`: Add an item to the reading list (opens a dialog)
- `Ctrl h`: Navigate to the home page
- `Ctrl r`: Reload the current page
- `Ctrl a`: Select all text in the current document
- `Ctrl l`: Force reload of the configuration file
- `Ctrl S`: Force save of the configuration file (mostly useful for debugging)
- `Ctrl u`: Move focus to the url bar and select all text currently there
- `Ctrl-*`: Open the "add to reading list" dialog, this is the only way to add items to the reading list

### Other Interactions

Right clicking on a link of any kind will result in the link's target/url being copied to the system clipboard. Since goldberry does not utilize context menus, this is the only way to get a url from a link.

### Configuration

goldberry is configured via a json file. The file is stored at one of two locations:

- `$XDG_CONFIG_HOME/goldberry/goldberry.json`
- `~/.config/goldberry/goldberry.json`

On many systems these will be the same path. You can edit the file directly and then either reload goldberry or press `Ctrl l`.

The following configuration options are available:

- `OpenWebLinks` [boolean]: If `true` will try to follow web links (http(s)) by opening them in your system default web browser
- `OpenGopherLinks` [boolean]: If `true` will attempt to follow gopher links within goldberry
- `OpenFileLinks` [boolean]: Does nothing currently, but will control access to the local filesystem for using goldberry as a file viewer
- `KeepHistory` [boolean]: If `true` will store persistent history data with viewable links and a listing of most visited addresses on the home page
- `History` [array - string]: You should not need to edit this unless you just want to clear them out or alter your history manually for some reason. goldberry will keep a maximum of 100 history items
- `UseCustomHome` [boolean]: If `true` will allow custom html text to appear on the home page. The html is taken from the config option `CustomHomeHTML`
- `CustomHomeHTML` [string]: An html string to render on the homepage
- `SearchURL` [string]: This should be a search engine address with `%s` in place of the search query. A default gemini search engine is provided, but can be swapped out as desired via this option. Any text entered in the URL bar that is not an address will be treated as a text search
- `BaseFontSize` [int]: The base font size for documents, in pixels. This can be adjusted in the application via `Ctrl +` and `Ctrl -` and will be saved to the config file on quit
- `TimeOutSeconds` [int]: The number of seconds to set as the request timeout for all requests
- `ReadingList` [array - string]: This should not need to be edited manually as everything can be managed within the application. If need be, items can be manually deleted or added. Each array entry is a string with a url two tab characters and then the title of the reading list item. This double tab solution is a temporary fix to a json marshalling issue and js objects should be expected in the future

