Geek Stuff

November 20, 2022

Geek Stuff

Two stupid yet useful things I've done recently on my local setup.

LanguageTool Desktop App spoofing

I like LanguageTool: a multilingual grammar, style, and spell checker.
It is a great help for me, in both English and French.

I have the browser extension setup on each of my browser. But I was not so happy about the text I wrote been sent to servers. Fortunately, LanguageTool is open source, and they provide all the needed info about setting up a server.

So of course I did it and install a server on my local machine. Then on the browser extension they allow you to specify a custom server URL. Thank you for being so kind and open.

That setup worked like a charm for a while. But I needed more than having LanguageTool in the browser! Those kinds of tool become quickly a must-have.

Luckily, LanguageTool is actually working on a desktop app. This app allows you to have the spell checker in desktops apps, not only the browser. Nice!

Unfortunately, the same privacy question emerge, and that time, the desktop app does not provide a way to specify an external server. I was having mixed feelings: wanting the tool really bad, but without sending my email/notes content to an external server.

Enters the geek inside me!

I decided to spoof the official language tool server with my local version.

The trick is straightforward — even if it took me some time to get right — I updated my /etc/hosts file to have api.languagetool.org pointing on my local machine and then set up a docker + mkcert + traefick stack to make the spoof complete. Luckily, the official API has the same endpoints as the open-source version, so it worked effortlessly.

I now have LanguageTool Desktop app working with my local version of the server, and no data leaves my computer!

Shared browser extension settings across multiple browser

Recently, I discovered the darkreader.org browser extension.
It allows you to get a dark mode version of any websites, it works by adding some custom styling to the page. That's a nice one to have.

Problem is, the extension changes all websites, even the ones that already have a dark theme — or are dark by nature — fortunately a blacklist feature is present in the extension, so you can disable the extension on specific domains.

Still, I got annoyed because, as you can imagine, I'm using multiple browsers with multiple accounts (work, perso, etc.). So, each browser has its own instance of the extension; thus, each one had different settings, and so I had to blacklist each same website on each browser/account. How is this acceptable?

The geek enters again!

This extension is open source, that's a chance.
I decided to build a small local server that expose a basic key/value API on top of a SQLite database. Then I updated the extension, so it uses that localhost API instead of the browser storage.

And voilà! I now have multiple instances of that same extension, but with synchronised settings.
The funny side effect is that I can see all the settings this extension is using in my SQLite database.

Conclusion

I love to play those little games.

Having a perfect local setup allows me to be more productive. It's like polishing your tool to get a better work done. Well, I can't help, I'm a geek.

Note: Those tricks are not available because they are too specific to my setup, but also, let's be honest, they are not the most beautiful code I've written. If you are interested in some details, contact me.