hydroxide-push/README.md

128 lines
4.8 KiB
Markdown
Raw Permalink Normal View History

2024-03-26 22:39:37 +02:00
# hydroxide-push
### *Forked from [Hydroxide](https://github.com/emersion/hydroxide)*
[![.github/workflows/build.yaml](https://github.com/0ranki/hydroxide-push/actions/workflows/build.yaml/badge.svg)](https://github.com/0ranki/hydroxide-push/actions/workflows/build.yaml) ![GitHub Release](https://img.shields.io/github/v/release/0ranki/hydroxide-push)
2017-09-03 21:21:22 +03:00
<img src="https://github.com/0ranki/hydroxide-push/assets/50285623/04959566-3d13-4be4-84bd-d7daad3a3166" width="600">
2017-12-03 13:32:33 +02:00
## Push notifications for Proton Mail mobile via a UP provider
2024-07-01 21:05:25 +03:00
2024-03-26 22:39:37 +02:00
Protonmail depends on Google services to deliver push notifications,
This is a stripped down version of [Hydroxide](https://github.com/emersion/hydroxide)
to get notified of new mail. See original repo for details on operation.
2024-07-01 21:05:25 +03:00
Should work with free accounts too.
2024-07-03 14:30:31 +03:00
<sup><sub>Github is used to build the binaries and container images with Github Actions, and host the pre-built releases.
2024-07-01 21:16:24 +03:00
Mirrored from https://git.oranki.net/jarno/hydroxide-push</sub></sup>
Pre-built releases and container images are available on [Github](https://github.com/0ranki/hydroxide-push).
2017-12-09 15:22:54 +02:00
## Setup
2024-06-30 21:53:24 +03:00
Download or build the binary, pull the pre-built container image or build the image yourself.
Simplest way is to run the pre-built container image.
2017-12-09 15:22:54 +02:00
2024-03-26 22:39:37 +02:00
Login and push gateway details are saved under `$HOME/.config/hydroxide`. The container
image saves configuration under `/data`, so mount a named volume or host directory there.
The examples below use a named volume.
2017-12-09 15:22:54 +02:00
2024-03-26 22:39:37 +02:00
If using Docker, substitute `podman` with `docker` in the examples.
2017-12-09 15:22:54 +02:00
2024-03-26 22:39:37 +02:00
Binary:
2017-12-09 15:22:54 +02:00
```shell
2024-03-26 22:39:37 +02:00
./hydroxide-push auth your.proton@email.address
2017-12-09 15:22:54 +02:00
```
2024-03-26 22:39:37 +02:00
Container:
2017-09-03 21:21:22 +03:00
```shell
podman run -it --rm -v hydroxide-push:/data ghcr.io/0ranki/hydroxide-push auth your.proton@email.address
2017-12-03 13:32:33 +02:00
```
2024-03-26 22:39:37 +02:00
You will be prompted for the Proton account credentials and the details for the push server. Proton credentials are stored encrypted form.
2017-12-03 13:32:33 +02:00
The auth flow generates a separate password for the bridge to fake a login to the bridge, which is stored in plaintext to `$HOME/.config/notify.json`. Unlike upstream `hydroxide`, there is no service listening on any port, the password isn't useful for anything else.
2024-03-26 22:39:37 +02:00
### Reconfigure push server
2024-03-27 06:14:41 +02:00
Binary:
```shell
2024-03-26 22:39:37 +02:00
hydroxide-push setup-ntfy
```
2024-03-26 22:39:37 +02:00
Container:
2017-12-03 13:32:33 +02:00
```shell
podman run -it --rm -v hydroxide-push:/data ghcr.io/0ranki/hydroxide-push setup-ntfy
2017-09-03 21:21:22 +03:00
```
Alternatively to run the command in an already running container (replace `name-of-container` with the name or id of the running container):
```shell
podman exec -it name-of-container /hydroxide-push setup-ntfy
```
You'll be asked for the base URL of the push server, topic then username and password for HTTP basic authentication.
The push endpoint configuration can be changed while the daemon is running.
2017-09-03 21:21:22 +03:00
Username and password are stored in `notify.json`, the password is only Base64-encoded. You should create a dedicated user that
has write-only access to the topic for the daemon.
**Push topic username and password are cleared each time setup-ntfy is run, they need to be entered manually every time.**
The currently configured values are shown inside braces. Leave input blank to use the current values.
2018-01-13 12:40:21 +02:00
2024-03-27 06:14:41 +02:00
### Start the service
2017-09-03 21:21:22 +03:00
2024-03-27 06:14:41 +02:00
Binary:
```shell
hydroxide-push notify
```
Container:
```shell
podman run -it --rm -v hydroxide-push:/data ghcr.io/0ranki/hydroxide-push
2024-03-27 06:14:41 +02:00
```
2024-03-27 06:26:59 +02:00
## Podman pod
A Podman kube YAML file is provided in the repo.
> **Note:** If you're using 2FA or just don't want to put your password to a file, use the manual method above. Make sure the volume name (claimName) in the YAML mathces what you use in the commands.
- Download/copy `hydroxide-push-podman.yaml` to an empty directory on the machine you intend to run the daemon on
- Edit the config values at the top of the file
- Start the pod:
```shell
podman kube play ./hydroxide-push-podman.yaml
```
- Latest container image is pulled
- A named volume (`hydroxide-push`) will be created for the configuration
- Login to Proton and push URL configuration is handled automatically, after which the daemon starts
- After the initial setup, the ConfigMap (before `---`) can be removed from the YAML. Optionally to clear the environment variables, run
```shell
podman kube play ./hydroxide-push-podman.yaml --replace
```
The command can also be used to pull the latest version and restart the pod.
- To reauthenticate or clear data, simply remove the named volume or run the `auth` command
## Updating
Binary:
- stop the service
- download or build the new version, replace the of the old binary
- restart the service
Container:
- pull latest image
- restart container
## Building locally
Clone the repo, then `cd` to the repo root
Binary:
> Requires Go 1.22
```shell
CGO_ENABLED=0 go build -o $HOME/.local/bin/hydroxide-push ./cmd/hydroxide-push/
```
Container:
```shell
podman build -t localhost/hydroxide-push:latest .
```
2024-03-27 06:26:59 +02:00
## License
2017-09-03 21:21:22 +03:00
MIT