Skip to content

Commit

Permalink
Merge pull request #89 from mautrix/webapi
Browse files Browse the repository at this point in the history
Switch to web app API
  • Loading branch information
tulir committed Jun 15, 2023
2 parents 8d741f4 + e1f6531 commit ec20cdc
Show file tree
Hide file tree
Showing 24 changed files with 1,290 additions and 19,752 deletions.
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# unreleased
# v0.5.0 (unreleased)

* Switched to web app API to make authentication work again.
**This will require all users to relogin.**
* Allowed thread bridging in non-thread-only chats.
* Improved handling of getting logged out remotely.
* Updated Docker image to Alpine 3.17.
* Added options to automatically ratchet/delete megolm sessions to minimize
access to old messages.
* Added option to not set room name/avatar even in encrypted rooms.
* Implemented appservice pinging using MSC2659.
* Updated Docker image to Alpine 3.18.

# v0.4.0 (2022-11-15)

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM docker.io/alpine:3.17
FROM docker.io/alpine:3.18

RUN apk add --no-cache \
python3 py3-pip py3-setuptools py3-wheel \
Expand Down
56 changes: 56 additions & 0 deletions maugclib/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,59 @@
# maugclib
This is a "fork" of [tdryer/hangups](https://github.com/tdryer/hangups) that uses Google Chat instead of Hangouts.
All the extra bloat is removed since the bridge doesn't use it.

## Authentication

To authenticate you need to login to your google account. You should start this
process from https://chat.google.com. This will automatically redirect you to
the login if necessary. Once logged in, open the developer tools in your
browser. From here we need to fill out the following JSON object with the
values of a number of cookies. See the browser specific documentation below on
how to get the value of these cookies from your browser.

```
{
"/": {
"COMPASS": "",
"SSID": "",
"SID": "",
"OSID": "",
"HSID": ""
},
"/u/0/webchannel/": {
"COMPASS": ""
}
}
```

To actually log in with this, it will need to be converted to a Python
dictionary and then passed into `maugclib.auth.TokenManager.from_cookies`. You
can then pass the `TokenManager` instance into `maugclib.client.Client()` as
normal and everything should kick off.

### Chrome

Click on `Application` in the top of the `DevTools` window. Then find `Storage`
on the left side of the screen. Scroll down to `Cookies` and expand it. Select
`https://chat.google.com`.

From here, you'll have to double click on the value
cell for each cookie to get into an `edit` mode. From here you can copy the
value via keyboard or the right-click context menu.

> Note that you will need to enter the `COMPASS` cookie twice in the JSON
object.

### Firefox

Click on `Storage` at the top of the `Developer Tools` window. Then find
`Cookies` on the left side of the screen and expand it. Select
`https://chat.google.com`.

From here, you'll have to double click on the value
cell for each cookie to get into an `edit` mode. From here you can copy the
value via keyboard or the right-click context menu.

> Note: There are two distinct cookies named `COMPASS`. One of them has a path
of `/` and the other has a path of `/u/0/webchannel/` and they should be
entered in the appropriate section in the JSON object.
4 changes: 2 additions & 2 deletions maugclib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Import the objects here that form the public API of hangups so they may be
# conveniently imported.

from .auth import RefreshTokenCache, TokenManager

# Keep version in a separate file so setup.py can import it separately.
from .client import Client
from .exceptions import (
Expand All @@ -11,6 +9,7 @@
FileTooLargeError,
HangupsError,
NetworkError,
NotLoggedInError,
ResponseError,
ResponseNotJSONError,
SIDError,
Expand All @@ -19,3 +18,4 @@
UnexpectedResponseDataError,
UnexpectedStatusError,
)
from .http_utils import Cookies
250 changes: 0 additions & 250 deletions maugclib/auth.py

This file was deleted.

0 comments on commit ec20cdc

Please sign in to comment.