Skip to content

Commit

Permalink
Add option to connect to WhatsApp servers in Instagram mode
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Feb 13, 2024
1 parent 49e2394 commit ede866a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ var cmdToggleEncryption = &commands.FullHandler{
}

func fnToggleEncryption(ce *WrappedCommandEvent) {
if !ce.Bridge.Config.Meta.Mode.IsMessenger() {
if !ce.Bridge.Config.Meta.Mode.IsMessenger() && !ce.Bridge.Config.Meta.IGE2EE {
ce.Reply("Encryption support is not yet enabled in Instagram mode")
return
} else if !ce.Portal.IsPrivateChat() {
Expand Down
1 change: 1 addition & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ type Config struct {

Meta struct {
Mode BridgeMode `yaml:"mode"`
IGE2EE bool `yaml:"ig_e2ee"`
Proxy string `yaml:"proxy"`
GetProxyFrom string `yaml:"get_proxy_from"`
} `yaml:"meta"`
Expand Down
1 change: 1 addition & 0 deletions config/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ func DoUpgrade(helper *up.Helper) {
helper.Copy(up.Str, "metrics", "listen")

helper.Copy(up.Str, "meta", "mode")
helper.Copy(up.Bool, "meta", "ig_e2ee")
helper.Copy(up.Str|up.Null, "meta", "proxy")
helper.Copy(up.Str|up.Null, "meta", "get_proxy_from")

Expand Down
3 changes: 3 additions & 0 deletions example-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ meta:
#
# Remember to change the appservice id, bot profile info, bridge username_template and management_room_text too.
mode: instagram
# When in Instagram mode, should the bridge connect to WhatsApp servers for encrypted chats?
# In FB/Messenger mode encryption is always enabled, this option only affects Instagram mode.
ig_e2ee: false
# Static proxy address (HTTP or SOCKS5) for connecting to Meta.
proxy:
# HTTP endpoint to request new proxy address from, for dynamically assigned proxies.
Expand Down
2 changes: 1 addition & 1 deletion user.go
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ func (user *User) eventHandler(rawEvt any) {
user.BridgeState.Send(status.BridgeState{StateEvent: status.StateConnected})
user.tryAutomaticDoublePuppeting()
user.handleTable(evt.Table)
if user.bridge.Config.Meta.Mode.IsMessenger() {
if user.bridge.Config.Meta.Mode.IsMessenger() || user.bridge.Config.Meta.IGE2EE {
go func() {
err := user.connectE2EE()
if err != nil {
Expand Down

0 comments on commit ede866a

Please sign in to comment.