patcon / matterbridge-autoconfig

App that generates a Matterbridge config file based on channel names.
https://matterbridge-autoconfig-g0vtw.herokuapp.com
7 stars 1 forks source link

Allow auto-configuration for public Gitter chat rooms #8

Open patcon opened 5 years ago

patcon commented 5 years ago

Re: https://github.com/patcon/matterbridge-autoconfig/blob/master/README.md#transparency

Isn't yet possible, as the gitter endpoint is private: https://developer.gitter.im/docs/rooms-resource#create-a-room

Traced back some of the logic for how it determines what is web-client (and allowed), and what is using a token or non-internal oauth, and which is disallowed. Seems that all these products get a pass: https://gitlab.com/gitlab-org/gitter/webapp/blob/develop/server/services/oauth-service.js#L185-204

And so could probably instruct people to use the desktop app and extract these privileged credentials from the config file: https://gitlab.com/gitlab-org/gitter/desktop#manually-sign-inauthorize

Related issue:

patcon commented 5 years ago

Ok, I'm sure it's saved somewhere, but I couldn't find the preferences json file that was mentioned, just an empty sqlite3 db where it was supposed to be. I'm sure it's somewhere, but I couldn't find it in any of the places I would expect.

I found some other places mentioned in the cleanup section of the homebrew formula, and this has some interesting caches to check through: https://github.com/Homebrew/homebrew-cask/blob/master/Casks/gitter.rb#L18-L21

So I made a little script to do this, now just need to figure out how the private API endpoints for room creation work: https://gist.github.com/patcon/b7e8c20cf586db63504eabe68345be4d

patcon commented 5 years ago

Got a reply on how to do this: https://gitlab.com/gitlab-org/gitter/webapp/blob/d39b24c6fa894a608a3c0138df3165594cadf78c/server/api/v1/groups/rooms.js#L81-113