beeper / self-host

Learn how to self-host Beeper
Apache License 2.0
1.05k stars 35 forks source link

Add instructions to self-host imessagego #40

Open gabrc52 opened 8 months ago

gabrc52 commented 8 months ago

Somewhere, there should be instructions to self-host the new iMessage bridge, which i haven't gotten to work.

The instructions in the relevant repos are very vague. https://github.com/beeper/imessage tells you you need a relay server and registration provider.

The relay https://github.com/beeper/registration-relay gives no specifics on how to reverse-proxy, e.g. https://github.com/beeper/registration-relay/pull/6

https://github.com/beeper/mac-registration-provider does tell you how to specify a custom relay service but https://github.com/beeper/phone-registration-provider does not tell you how to configure it so it uses the selfhosted relay instead of Beeper's.

The answer is it should be stored in /var/jb/.beepserv_wsurl, e.g. https://example.com/api/v1/provider (in the case of rootless jailbreak such as palera1n, otherwise it would probably be in the root(!) of the phone /.beepserv_wsurl). I had to read the source code of the bridge to find that out.

Next, there are no instructions on how to make the imessage bridge use the relay service in the first place. The answer seems to be that nac_validation_data_url should be set to https://example.com (no trailing slash), nac_validation_is_relay should be set to true. I also had to read the source code to find that out, but I guess you could have guessed that.

And then my guess is that nac_validation_data_token should be set as the same environment variable as the REGISTRATION_RELAY_SECRET for the relay, so I have done so.

image

The 400 error isn't particularly self-documenting, but doing all the above seemed to make it stop, but then I am getting 404 errors instead.

I'm not getting further than the following: image

In the logs I am getting the same error as other people who have tried selfhosting: https://github.com/beeper/imessage/issues/12

My guess is that the bridge received nothing from the relay but somehow interpreted it as something and that's why it's trying to dereference a null pointer.

And I don't know where I am even supposed to put the registration code that the registration provider gives me. Is the imessage bridge supposed to ask for it after I finish signing in? Is it supposed to just magically ask the relay which will in turn ask the phone, thus rendering the registration code redundant?

I don't know what step I am stuck in because there are no official instructions in the first place. I'd appreciate either help troubleshooting, and in turn I could help contribute some docs, or if you could write up some instructions on how to self-host the bridge.

gabrc52 commented 8 months ago

And then my guess is that nac_validation_data_token should be set as the same environment variable as the REGISTRATION_RELAY_SECRET for the relay, so I have done so.

No, it's not. It should be the registration code from the iPhone/Mac: https://github.com/beeper/imessage/issues/12#issuecomment-1891809276

And I don't know where I am even supposed to put the registration code that the registration provider gives me.

So this is resolved (but how would this bridge work with multiple users then, if it doesn't ask interactively?