Rick is my personal internet navigator.
I use it as my default search engine, which defaults to a normal duckduckgo search but contain some powerups, such as
- Directly do a website search, such as youtube search yt rickroll
- Store personal shortcuts for frequently-accessed links e.g. school's website, zoom links, etc. gh home
Powerups are configurable. Some of them are listed here
Personal Note: Using this tool have saved me thousands of clicks a year from just 1 routinely-visited website (cue, school's website 😀)
- simple, query-based, path-based redirection
- mappings for long items
There are several environment variables to change:
- Copy
wrangler.example.toml
towrangler.toml
and fill in your cloudflare account id - You might want to change BASE_URL in
scripts/prepare.js
- Create
rick.config.yml
. You can find an example inexample.rick.config.yml
- Run
pnpm publish
to publish.
Config are listed in rick.config.yml
. There are 3 main redirects supported by rick: simple, query, path.
This is the simplest form of redirection.
For example, to map cf
to https://dash.cloudflare.com/
, you can add the following
cf:
base_url: https://dash.cloudflare.com/
docstring: "navigates to cloudflare dashboard"
Docstrings are optional. If you provide them, it will be shown on the homepage.
If you only have base_url
as the property for a mapping, you can shorten it too. So,
cf:
base_url: https://dash.cloudflare.com/
is considered equivalent to
cf: https://dash.cloudflare.com/
You can also create shortcuts for websites that uses query, e.g. search engines.
For example, rick defaults to searching using DuckDuckGo!, but you can easily switch to google using the g
command by adding the following to your config:
g:
base_url: 'https://www.google.com/search'
docstring: 'does a google search'
q_params: 'q'
You can provide more than 1 q_params too, by specifying it as a YAML list.
Another cool thing that you can do with rick is converting between multiple search engines, e.g. youtube search to wikipedia search to google search.
Example:
- yt rickroll
- Convert youtube search into wikipedia search wk https://www.youtube.com/results?search_query=rickroll
You can also create shortcuts for websites with guessable-path.
A great example of this type of website is github.
https://github.com/
shows your homepagehttps://github.com/benclmnt
shows the profile page of userbenclmnt
https://github.com/benclmnt/rick
shows the repository of this project.
To create such shortcut, you'll need to add the following
gh:
base_url: 'https://github.com/{{ acc }}/{{ repo }}'
docstring: 'does a github search.'
acc:
home: 'benclmnt'
We use double curly brackets {{}}
to denote the changeable parts (parameters) of the url. You can use this mapping as follows gh [acc_name] [repo_name]
.
⚠️ The parameters should not be namedbase_url
,docstring
,type
orq_params
.
By default, the parameters will be whatever you typed in. If you don't supply all parameters, rick is smart enough to remove the dangling /
s.
You can also supply known mappings, such as home: 'benclmnt'
! So, if you type gh home
, it is equivalent to gh benclmnt
. This is useful if the path is identified using a long hash / uuid.
Similar to redirects, the type
here is optional. If rick sees {{
in the base_url, it can infer that you'd probably want a path-type 😉.
To sum up,
- gh maps to
https://github.com
- gh home and gh benclmnt maps to
https://github.com/benclmnt
- gh home rick maps to
https://github.com/benclmnt/rick
What if you want to support both navigating to youtube homepage yt
and youtube search yt v
?
Since they are not path-based, you can add a _leaf
key, which won't be added to the command as follows.
yt:
_leaf: 'https://www.youtube.com'
v:
base_url: 'https://www.youtube.com/results'
q_params: 'search_query'
docstring: 'does a youtube search'
There is no limits to how deep you can nest the commands. So in the following example a b c
will redirect to youtube.
a:
b:
c: 'https://www.youtube.com'
To specify defaults / fallback for commands, use the key $default$
.
The project runs on the awesome Cloudflare worker.
Inspiration:
- https://github.com/taneliang/neh
- Facebook's bunny tool