commit 026791b19c087c2aee775134ffd4e10f70fa5323
Author: selfhoster1312 <selfhoster1312@kl.netlib.re>
Date: Fri Oct 24 17:19:52 2025 +0000
diff --git a/bridge/harmony/harmony.go b/bridge/harmony/harmony.go
deleted file mode 100644
index 14174c3..0000000
--- a/bridge/harmony/harmony.go
+++ /dev/null
@@ -1252 +00 @@
-package harmony
-
-import (
- "fmt"
- "log"
- "strconv"
- "strings"
- "time"
-
- "github.com/42wim/matterbridge/bridge"
- "github.com/42wim/matterbridge/bridge/config"
- "github.com/harmony-development/shibshib"
- chatv1 "github.com/harmony-development/shibshib/gen/chat/v1"
- typesv1 "github.com/harmony-development/shibshib/gen/harmonytypes/v1"
- profilev1 "github.com/harmony-development/shibshib/gen/profile/v1"
-)
-
-type cachedProfile struct {
- data *profilev1.GetProfileResponse
- lastUpdated time.Time
-}
-
-type Bharmony struct {
- *bridge.Config
-
- c *shibshib.Client
- profileCache map[uint64]cachedProfile
-}
-
-func uToStr(in uint64) string {
- return strconv.FormatUint(in, 10)
-}
-
-func strToU(in string) (uint64, error) {
- return strconv.ParseUint(in, 10, 64)
-}
-
-func New(cfg *bridge.Config) bridge.Bridger {
- b := &Bharmony{
- Config: cfg,
- profileCache: map[uint64]cachedProfile{},
- }
-
- return b
-}
-
-func (b *Bharmony) getProfile(u uint64) (*profilev1.GetProfileResponse, error) {
- if v, ok := b.profileCache[u]; ok && time.Since(v.lastUpdated) < time.Minute*10 {
- return v.data, nil
- }
-
- resp, err := b.c.ProfileKit.GetProfile(&profilev1.GetProfileRequest{
- UserId: u,
- })
- if err != nil {
- if v, ok := b.profileCache[u]; ok {
- return v.data, nil
- }
- return nil, err
- }
- b.profileCache[u] = cachedProfile{
- data: resp,
- lastUpdated: time.Now(),
- }
- return resp, nil
-}
-
-func (b *Bharmony) avatarFor(m *chatv1.Message) string {
- if m.Overrides != nil {
- return m.Overrides.GetAvatar()
- }
-
- profi, err := b.getProfile(m.AuthorId)
- if err != nil {
- return ""
- }
-
- return b.c.TransformHMCURL(profi.Profile.GetUserAvatar())
-}
-
-func (b *Bharmony) usernameFor(m *chatv1.Message) string {
- if m.Overrides != nil {
- return m.Overrides.GetUsername()
- }
-
- profi, err := b.getProfile(m.AuthorId)
- if err != nil {
- return ""
- }
-
- return profi.Profile.UserName
-}
-
-func (b *Bharmony) toMessage(msg *shibshib.LocatedMessage) config.Message {
- message := config.Message{}
- message.Account = b.Account
- message.UserID = uToStr(msg.Message.AuthorId)
- message.Avatar = b.avatarFor(msg.Message)
- message.Username = b.usernameFor(msg.Message)
- message.Channel = uToStr(msg.ChannelID)
- message.ID = uToStr(msg.MessageId)
-
- switch content := msg.Message.Content.Content.(type) {
- case *chatv1.Content_EmbedMessage:
- message.Text = "Embed"
- case *chatv1.Content_AttachmentMessage:
- var s strings.Builder
- for idx, attach := range content.AttachmentMessage.Files {
- s.WriteString(b.c.TransformHMCURL(attach.Id))
- if idx < len(content.AttachmentMessage.Files)-1 {
- s.WriteString(", ")
- }
- }
- message.Text = s.String()
- case *chatv1.Content_PhotoMessage:
- var s strings.Builder
- for idx, attach := range content.PhotoMessage.GetPhotos() {
- s.WriteString(attach.GetCaption().GetText())
- s.WriteString("\n")
- s.WriteString(b.c.TransformHMCURL(attach.GetHmc()))
- if idx < len(content.PhotoMessage.GetPhotos())-1 {
- s.WriteString("\n\n")
- }
- }
- message.Text = s.String()
- case *chatv1.Content_TextMessage:
- message.Text = content.TextMessage.Content.Text
- }
-
- return message
-}
-
-func (b *Bharmony) outputMessages() {
- for {
- msg := <-b.c.EventsStream()
-
- if msg.Message.AuthorId == b.c.UserID {
- continue
- }
-
- b.Remote <- b.toMessage(msg)
- }
-}
-
-func (b *Bharmony) GetUint64(conf string) uint64 {
- num, err := strToU(b.GetString(conf))
- if err != nil {
- log.Fatal(err)
- }
-
- return num
-}
-
-func (b *Bharmony) Connect() (err error) {
- b.c, err = shibshib.NewClient(b.GetString("Homeserver"), b.GetString("Token"), b.GetUint64("UserID"))
- if err != nil {
- return
- }
- b.c.SubscribeToGuild(b.GetUint64("Community"))
-
- go b.outputMessages()
-
- return nil
-}
-
-func (b *Bharmony) send(msg config.Message) (id string, err error) {
- msgChan, err := strToU(msg.Channel)
- if err != nil {
- return
- }
-
- retID, err := b.c.ChatKit.SendMessage(&chatv1.SendMessageRequest{
- GuildId: b.GetUint64("Community"),
- ChannelId: msgChan,
- Content: &chatv1.Content{
- Content: &chatv1.Content_TextMessage{
- TextMessage: &chatv1.Content_TextContent{
- Content: &chatv1.FormattedText{
- Text: msg.Text,
- },
- },
- },
- },
- Overrides: &chatv1.Overrides{
- Username: &msg.Username,
- Avatar: &msg.Avatar,
- Reason: &chatv1.Overrides_Bridge{Bridge: &typesv1.Empty{}},
- },
- InReplyTo: nil,
- EchoId: nil,
- Metadata: nil,
- })
- if err != nil {
- err = fmt.Errorf("send: error sending message: %w", err)
- log.Println(err.Error())
- }
-
- return uToStr(retID.MessageId), err
-}
-
-func (b *Bharmony) delete(msg config.Message) (id string, err error) {
- msgChan, err := strToU(msg.Channel)
- if err != nil {
- return "", err
- }
-
- msgID, err := strToU(msg.ID)
- if err != nil {
- return "", err
- }
-
- _, err = b.c.ChatKit.DeleteMessage(&chatv1.DeleteMessageRequest{
- GuildId: b.GetUint64("Community"),
- ChannelId: msgChan,
- MessageId: msgID,
- })
- return "", err
-}
-
-func (b *Bharmony) typing(msg config.Message) (id string, err error) {
- msgChan, err := strToU(msg.Channel)
- if err != nil {
- return "", err
- }
-
- _, err = b.c.ChatKit.Typing(&chatv1.TypingRequest{
- GuildId: b.GetUint64("Community"),
- ChannelId: msgChan,
- })
- return "", err
-}
-
-func (b *Bharmony) Send(msg config.Message) (id string, err error) {
- switch msg.Event {
- case "":
- return b.send(msg)
- case config.EventMsgDelete:
- return b.delete(msg)
- case config.EventUserTyping:
- return b.typing(msg)
- default:
- return "", nil
- }
-}
-
-func (b *Bharmony) JoinChannel(channel config.ChannelInfo) error {
- return nil
-}
-
-func (b *Bharmony) Disconnect() error {
- return nil
-}
diff --git a/changelog.md b/changelog.md
index ab593f4..765eec5 100644
--- a/changelog.md
+++ b/changelog.md
@@ -47 +49 @@
- Main development repository is now https://github.com/matterbridge-org/matterbridge
- History was rewritten to remove the vendor/ folder, easing PR reviews and making the
- repository much lighter. [See issue #5](https://github.com/matterbridge-org/community/issues/5).
+ repository much lighter. [See issue community/#5](https://github.com/matterbridge-org/community/issues/5).
+- Removed protocols, see [issue community/#9](https://github.com/matterbridge-org/matterbridge/issues/9)
+ - harmony protocol does not exist anymore
# v1.26.0
diff --git a/docs/credits.md b/docs/credits.md
index db0be0a..6d27e7e 100644
--- a/docs/credits.md
+++ b/docs/credits.md
@@ -97 +96 @@ Matterbridge wouldn't exist without these libraries:
- gops - <https://github.com/google/gops>
- gozulipbot - <https://github.com/ifo/gozulipbot>
- gumble - <https://github.com/layeh/gumble>
-- harmony - <https://github.com/harmony-development/shibshib>
- irc - <https://github.com/lrstanley/girc>
- keybase - <https://github.com/keybase/go-keybase-chat-bot>
- matrix - <https://github.com/matrix-org/gomatrix>
diff --git a/docs/protocols/README.md b/docs/protocols/README.md
index 1f962b4..45373f5 100644
--- a/docs/protocols/README.md
+++ b/docs/protocols/README.md
@@ -977 +976 @@ Matterbridge supports many protocols, although not all of them support all featu
- Has moved to matrix protocol
- [Harmony](https://harmonyapp.io)
- Does not exist anymore?
-
- [Steam](https://store.steampowered.com/)
- Not supported anymore, see [here](https://github.com/Philipp15b/go-steam/issues/94) for more info.
diff --git a/gateway/bridgemap/bharmony.go b/gateway/bridgemap/bharmony.go
deleted file mode 100644
index a747dda..0000000
--- a/gateway/bridgemap/bharmony.go
+++ /dev/null
@@ -112 +00 @@
-//go:build !noharmony
-// +build !noharmony
-
-package bridgemap
-
-import (
- bharmony "github.com/42wim/matterbridge/bridge/harmony"
-)
-
-func init() {
- FullMap["harmony"] = bharmony.New
-}
diff --git a/go.mod b/go.mod
index 39539ae..fc87aed 100644
--- a/go.mod
+++ b/go.mod
@@ -137 +136 @@ require (
github.com/gomarkdown/markdown v0.0.0-20240419095408-642f0ee99ae2
github.com/google/gops v0.3.27
github.com/gorilla/schema v1.4.1
- github.com/harmony-development/shibshib v0.0.0-20220101224523-c98059d09cfa
github.com/hashicorp/golang-lru v1.0.2
github.com/jpillora/backoff v1.0.0
github.com/keybase/go-keybase-chat-bot v0.0.0-20221220212439-e48d9abd2c20
diff --git a/go.sum b/go.sum
index e2d6c6b..161cdfc 100644
--- a/go.sum
+++ b/go.sum
@@ -1018 +1016 @@ github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:W
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
-github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
-github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/gomarkdown/markdown v0.0.0-20240419095408-642f0ee99ae2 h1:yEt5djSYb4iNtmV9iJGVday+i4e9u6Mrn5iP64HH5QM=
@@ -1138 +1116 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
-github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
-github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
@@ -1438 +1396 @@ github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aN
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw=
-github.com/harmony-development/shibshib v0.0.0-20220101224523-c98059d09cfa h1:0EefSRfsNrdEwmoGVz4+cMG8++5M2XhvJ1tTRmmrJu8=
-github.com/harmony-development/shibshib v0.0.0-20220101224523-c98059d09cfa/go.mod h1:+KEOMb29OC2kRa5BajwNM2NEjHTbQA/Z3gKYARLHREI=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
@@ -5527 +5466 @@ golang.org/x/tools v0.23.0/go.mod h1:pnu6ufv6vQkll6szChhK3C3L/ruaIv5eBeztNG8wtsI
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
-golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gomod.garykim.dev/nc-talk v0.3.0 h1:MZxLc/gX2/+bdOw4xt6pi+qQFUQld1woGfw1hEJ0fbM=
gomod.garykim.dev/nc-talk v0.3.0/go.mod h1:q/Adot/H7iqi+H4lANopV7/xcMf+sX3AZXUXqiITwok=
google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
@@ -5889 +5816 @@ google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
-google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
-google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
-google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
diff --git a/matterbridge.toml.sample b/matterbridge.toml.sample
index 0665a59..f85cbe9 100644
--- a/matterbridge.toml.sample
+++ b/matterbridge.toml.sample
@@ -163718 +16376 @@ StripNick=false
#OPTIONAL (default false)
ShowTopicChange=false
-###################################################################
-# Harmony
-###################################################################
-
-[harmony.chat_harmonyapp_io]
-Homeserver = "https://chat.harmonyapp.io:2289"
-Token = "your token goes here"
-UserID = "user id of the bot account"
-Community = "community id that channels will be located in"
-UseUserName = true
-RemoteNickFormat = "{NICK}"
-
###################################################################
#API
###################################################################
@@ -194410 +19326 @@ enable=true
- [[gateway.inout]]
- account="harmony.chat_harmonyapp_io"
- channel="channel id goes here"
-