Local alias - my first public npm package

2017-06-12

One of my recent weekend projects involved my Raspberry Pi in somewhat different manner than usual.

I’ve observed that my home automation setup contains more and more URLs that I need to visit.
Obviously, I’m using the bookmarks, but I sometimes I’d like to have them synchronized across my all devices and browsers in my home network.

I also wanted a way to add quick wildcards to the addresses - in similar fashion Chrome does it.

I spent a few hours and coded a tool that allows me to do this:

Meet Local alias.

It’s a simple tool that receives a config.json with a list of aliases like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
...
"aliases": {
"forum": "https://community.openhab.org",
"community": ">forum",
"oh": "http://home:8080/start/index",
"basic": "http://home:8080/basicui/app?sitemap=home",
"rest": "http://home:8080/doc/index.html",
"habmin": "http://home:8080/habmin/index.html",
"things": "http://home:8080/paperui/index.html#/configuration/things",
"panel": "http://home:8080/habpanel/index.html#/view/%C5%9Awiat%C5%82a",
"logs": "http://home:9001/",
"log": ">logs",
"l": ">log",
"nodered": "http://home:1880",
"graph": "http://home:3000",
"grafana": ">graph",
"binding": "http://docs.openhab.org/addons/bindings/%s/readme.html",
"help": "http://docs.openhab.org/search?q=%s"
}
...

Then you can just type your hostname (host where local-alias is served, that is) and alias name.
That’s it.

As you can see, my RPi hostname is really short, and it’s the only scenario my solution makes sense.
You can change your RPi’s hostname to go and now you have a great local URL shortener accessible from all your devices.

Local alias is available as an npm package and its whole source code is hosted on GitHub.

In the near future I plan to add some simple GUI to modify config.json on the fly.
Feel free to contribute and report issues! :-)


Comments: