1. Line 23 in `start.sh` (Docker) contained an erroneous newline that would cause the container to constantly restart. Removed that.
2. Updated the README.md to contain the current usage (0.0.7 + commits) of golinks.
* Added an updated compose/docker section **NOTE** I am using my repo `brokenscripts/golinks` on DockerHub to align with 0.0.7 until your latest version is pushed.
* Updated the configuration section to show the actual variables used in the current release.
3. Added a small gif to show usage.
---
Files Updated:
* `README.md`
* `start.sh`
Files Added:
* `golinks.gif/golinks.gif`
Co-authored-by: brokenscripts <brokenscripts@protonmail.com>
Reviewed-on: #53
Co-authored-by: brokenscripts <brokenscripts@noreply@mills.io>
Co-committed-by: brokenscripts <brokenscripts@noreply@mills.io>
golinks
golinks is a web app that allows you to create smart bookmarks, commands and aliases by pointing your web browser's default search engine at a running instance. Similar to bunny1 or yubnub.
Installation
Source
$ go get git.mills.io/prologic/golinks
OS X Homebrew
There is a formula provided that you can tap and install from prologic/homebrew-golinks:
brew tap prologic/golinks https://git.mills.io/prologic/homebrew-golinks.git
brew install golinks
NB: This installs the latest released binary; so if you want a more recent unreleased version from master you'll have to clone the repository and build yourself.
Initial Setup (required)
Set your browser's default custom search engine to your golinks hosted location, such as http://localhost:8000/?q=%s. Replacing localhost with wherever you host golinks from.
Then type help to view the main help page, g foo bar to perform a Google search for "foo bar" or list to list all available commands.
Usage (Standalone)
If using the binary golinks, then run it as follows, specifying the parameters individually or by specifying a configuration file
golinks -bind 0.0.0.0:8000 -baseURL http://localhost:8000
Or using a configuration file:
golinks -config ~/.config/golinks/config.cfg
When using the binary, it supports any of the parameters specified in the Example Config File section.
NOTE: They are case sensitive and must be used, exactly as shown in the config file section such as baseURL.
Docker
To startup a container with an image from docker hub, run the following:
docker run -it -d -p 8000:8000 brokenscripts/golinks
This will start up the server on port 8000.
Docker Compose
Or use the following docker-compose configuration that creates a bind mount from a golinks folder in the current user's home directory to where the environment variable DBPATH is pointed at in the container.
Note: The latest version of golinks, used in this docker image, uses
environmentvariables instead of the oldcommandvariables.
version: "3.9"
services:
golinks:
image: brokenscripts/golinks
container_name: golinks
restart: unless-stopped
volumes:
- "${HOME}/golinks:/search.db"
environment:
BIND: "0.0.0.0:8000"
BASEURL: "https://golinks.domain.net" # Using an internal proxy that will make this resolve correctly
DBPATH: "/search.db"
TITLE: "GoLinks"
SEARCHURL: "https://www.google.com/search?q=%s&btnK"
SUGGESTURL: "https://suggestqueries.google.com/complete/search?client=firefox&q=%s"
| FLAG | DEFAULT | Description |
|---|---|---|
BIND |
0.0.0.0:8000 |
Must be in IP:PORT format. Where the container listens at. |
BASEURL |
http://localhost:8000 |
Must start with http:// or https:// and can optionally have a port following the domain name. If using a proxy, ensure that this matches what your clients will visit. |
DBPATH |
/search.db |
Where in the container you want the bookmarks stored |
TITLE |
Search |
The OpenSearch service title (i.e. what your browser will call golinks' search) |
SEARCHURL |
https://www.google.com/search?q=%s&btnK |
The URL golinks will redirect searches to by default (if no custom bookmark matches) |
SUGGESTURL |
https://suggestqueries.google.com/complete/search?client=firefox&q=%s |
URL of autosuggest service to retrieve search suggestions from |
| FLAG | DEFAULT | Description |
|---|---|---|
CONFIG |
Path to an optional config file containing the below golinks variables |
See Configuration File below for more information.
Custom Bookmarks
To add a bookmark (or overwrite an existing one), enter add [name] [url] as your search query, where name is the shortcut for the bookmark and url the URL:
add imdb https://www.imdb.com
Now you can just enter imdb in your search bar to go straight to imdb.com.
You can also add %s to your URL, which will be replaced with your search query:
add ddg https://duckduckgo.com/?q=%s
Now you can use ddg [query] to search via DuckDuckGo, e.g. ddg free stuff to find yourself some free stuff.
To remove a search, use remove [name], so remove ddg will remove the above search.
Commands
help to view the online help pagelist to see all your bookmarks and commandsadd to create a new bookmarkremove to remove a bookmarkdate to get the current container date (UTC default)time to get the current container time (UTC default)ping to get the current UNIX timestamp (epoch)
Configuration File
golinks can also use a configuration file (specified via CONFIG=/path/to/file) with a very simple format. Each line of the file should contain one option, specified in the same way as the corresponding CLI flag but without the leading -. Empty lines and lines beginning with #are ignored.
Note: If using a config file, do not specify the environment variables shown above
Example Config File
Save the variables shown below as config.cfg (example filename) and bind mount into the container and specify the environment CONFIG variable pointing to where this is mounted at.
bind 0.0.0.0:8000
baseURL http://localhost:8000
dbpath /search.db
title GoLinks
searchURL https://www.google.com/search?q=%s&btnK
suggestURL https://suggestqueries.google.com/complete/search?client=firefox&q=%s
In Action!
Here is a quick example of having Chrome's search engine change the keyword go to point to my golinks.
After using go you can see the bar change to Search GoLinks.
Typing help (so.. go help) does a redirect to the defined help URL contained in golinks.
Stargazers over time
Support
Support the ongoing development of Bitcask!
Sponsor
- Become a Sponsor
Contributing
golinks is considered "production" software and is used daily. If you find this interresting or useful please fork and contribute back via pull-requests! If you find bugs or have ideas for new features, please file an issue!
License
MIT
