Replacing irccloud with open web technologies

I’ve been a very happy irccloud user for the last 3 years, I think they offer a great service, but my passion for open web technologies and self-hosting solutions made this service the first candidate to be part of my revolution.

For me, the most important use cases for irccloud are to be always online, keep the logs of all channels I’m in and being notified when someone ping me or an interesting topic arises.

The search for self-hosting starts

With those as primary needs, I started searching for different open source projects but quickly I realised that hosting weechat is the best option for me:

  • It’s open source and well maintained.
  • Super extensible with several scripting languages.
  • Really well documented.
  • Has several opens source clients.

From those clients, I’m specially interested in the web ones, don’t need another app in my phone.

Glowing Bear is for me the best of the web clients:

  • Again well maintained and supported by the community.
  • Works well in desktop and mobile.
  • On the way to be a progressive web app, with manifest and serviceworker support!

What’s missing?

The only part missing in my setup is the ability to this combination of weechat + glowing-bear to use web push to perform notifications. Right now it uses normal desktop notifications to notify about private messages, but that’s not a push from the server running weechat. When we are not running glowing-bear we won’t know. And that part is important!

So what do we need to build? Spoiler alert, I already did, as a proof of concept, so I end up building the following:

  • A weechat plugin that uses web push when you receive a private message to send the notification to your browser.
  • Modify Glowing Bear to use web push and display notifications. Also reopen the client when user clicks on the notifcation.

A webpush Weechat plugin

Based on notifo plugin by Alex Poirot, modified the original python script to use webpush libraries and variables coming from the client.

You can find the weechat script in this github repo.

When you load the script via:
/python load webpush.py


You will be ask to provide a set of variables to make the script work. Some of those variables you will find them in the Glowing Bear client (scroll down for more details), other variables as the VAPID information needed for performing push can be generated by your own or via a curl request doing:
$bash> curl https://webpushproxy.progressiveweb.pw/generatevapid

While setting the variables needed you will see something like:

/set plugins.var.python.webpush.endpoint "https://updates.push.services.mozilla.com/wpush/v1/gAAAAABZC3AKX33Pwsof7y0Q2zppDCJliANyTZIe_UqkYPAKnFmz1dqO-j7YlBpFJOdqMFHwfnJ0gWHDB7bGH1EZ-7MhVHa6lflC82dffJGVXL_vv-5vpWL8AZ0g14ee_kRvWCFof1cA"

Variables settings for webpush plugin

Modifications to the Glowing Bear client

You can find all the modifications done to the client in this github fork (in the branch push_notifications).

Just two modifications. Once you accept to receive notifications from the glowing bear client, you will have in the settings screen the extra variables needed to configure the weechat plugin variables, see the image below:

push settings

The other modification happens directly in the file serviceworker.js where I only had to add the logic to process push notifications, open a new tab is there is no tab already open.

Demo

So I recorded a little video showing how you can receive the notifications even if your tab is closed, hope you enjoy (better to make the video bigger to check the text :O)

 

2 comments on “Replacing irccloud with open web technologies

  1. -

    Wow this is super cool! I’m one of the Glowing Bear developers and we love it! This looks like it could be super useful to a lot of people. Would you be interested in submitting a pull request and getting this into the main repo?

  2. - Post author

    Sure was planning to contribute it if you guys feel that is good for the project.

    Will need to clarify some stuff, like the settings, and do more testing in chrome, specially in android.

    Also the plugin will need support for more than 1 client (i.e. your desktop and your phone, as it’s my use case), but that’s an improvement.

    Will open an issue in github to discuss what’s the direction you would like tho have this feature in master.

    Cheers!

Leave a Reply

Your email address will not be published. Required fields are marked *