diff --git a/libgm/builders/tenor.go b/libgm/builders/tenor.go deleted file mode 100644 index befc11f..0000000 --- a/libgm/builders/tenor.go +++ /dev/null @@ -1,71 +0,0 @@ -package builders - -import ( - "fmt" - "net/url" - - "go.mau.fi/mautrix-gmessages/libgm/util" -) - -type TenorSearch struct { - query string - locale string - content_filter string - media_filter string - limit string // limit results -} - -func NewTenorSearchBuilder() *TenorSearch { - return &TenorSearch{} -} - -func (t *TenorSearch) SetQuery(query string) *TenorSearch { - t.query = query - return t -} -func (t *TenorSearch) SetLocale(locale string) *TenorSearch { - t.locale = locale - return t -} -func (t *TenorSearch) SetContentFilter(content_filter string) *TenorSearch { - t.content_filter = content_filter - return t -} -func (t *TenorSearch) SetMediaFilter(media_filter string) *TenorSearch { - t.media_filter = media_filter - return t -} -func (t *TenorSearch) SetLimit(limit string) *TenorSearch { - t.limit = limit - return t -} -func (t *TenorSearch) Build() (string, error) { - if t.query == "" { - return "", fmt.Errorf("failed to build TenorSearch: query is empty") - } - params := url.Values{} - params.Add("key", util.TENOR_API_KEY) - params.Add("q", t.query) - - if t.locale == "" { - t.locale = "en-US" - } - params.Add("locale", t.locale) - - if t.content_filter == "" { - t.content_filter = "medium" - } - params.Add("contentfilter", t.content_filter) - - if t.media_filter == "" { - t.media_filter = "minimal" - } - params.Add("media_filter", t.media_filter) - - if t.limit == "" { - t.limit = "16" - } - params.Add("limit", t.limit) - - return "?" + params.Encode(), nil -} diff --git a/libgm/crypto/cryptor.go b/libgm/crypto/cryptor.go index ae917cd..b700f58 100644 --- a/libgm/crypto/cryptor.go +++ b/libgm/crypto/cryptor.go @@ -6,11 +6,8 @@ import ( "crypto/hmac" "crypto/rand" "crypto/sha256" - "encoding/base64" - "encoding/json" "errors" "io" - "os" "google.golang.org/protobuf/reflect/protoreflect" @@ -35,19 +32,6 @@ func NewCryptor(aes_key []byte, sha_key []byte) *Cryptor { } } -func (c *Cryptor) SaveAsJson() { - AES_B64, SHA_B64 := base64.StdEncoding.EncodeToString(c.AES_CTR_KEY_256), base64.StdEncoding.EncodeToString(c.SHA_256_KEY) - inter := struct { - AES_CTR_KEY_256 string - SHA_256_KEY string - }{ - AES_CTR_KEY_256: AES_B64, - SHA_256_KEY: SHA_B64, - } - jsonData, _ := json.Marshal(inter) - os.WriteFile("cryptor.json", jsonData, os.ModePerm) -} - func (c *Cryptor) Encrypt(plaintext []byte) ([]byte, error) { iv := make([]byte, aes.BlockSize) if _, err := io.ReadFull(rand.Reader, iv); err != nil { diff --git a/libgm/misc.go b/libgm/misc.go deleted file mode 100644 index 5dc1096..0000000 --- a/libgm/misc.go +++ /dev/null @@ -1,24 +0,0 @@ -package libgm - -import ( - "os" - - "go.mau.fi/mautrix-gmessages/libgm/builders" - "go.mau.fi/mautrix-gmessages/libgm/util" -) - -type Misc struct { - client *Client -} - -func (m *Misc) TenorSearch(searchOpts *builders.TenorSearch) (interface{}, error) { - searchQuery, buildErr := searchOpts.Build() - if buildErr != nil { - return nil, buildErr - } - - uri := util.TENOR_SEARCH_GIF + searchQuery - m.client.Logger.Debug().Msg(uri) - os.Exit(1) - return nil, nil -} diff --git a/libgm/payload/conversations.go b/libgm/payload/conversations.go deleted file mode 100644 index 1e38816..0000000 --- a/libgm/payload/conversations.go +++ /dev/null @@ -1 +0,0 @@ -package payload diff --git a/libgm/util/constants.go b/libgm/util/constants.go index bb99f5a..3312fac 100644 --- a/libgm/util/constants.go +++ b/libgm/util/constants.go @@ -5,4 +5,3 @@ var USER_AGENT = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, lik var OS = "Linux" var X_USER_AGENT = "grpc-web-javascript/0.1" var QR_CODE_URL = "https://support.google.com/messages/?p=web_computer#?c=" -var TENOR_API_KEY = "YR0F99AJ65AV" diff --git a/libgm/util/paths.go b/libgm/util/paths.go index c8c8911..c2e20d4 100644 --- a/libgm/util/paths.go +++ b/libgm/util/paths.go @@ -18,6 +18,3 @@ var MESSAGING = INSTANT_MESSAGING + "/$rpc/google.internal.communications.instan var RECEIVE_MESSAGES = MESSAGING + "/ReceiveMessages" var SEND_MESSAGE = MESSAGING + "/SendMessage" var ACK_MESSAGES = MESSAGING + "/AckMessages" - -var TENOR_BASE_URL = "https://api.tenor.com/v1" -var TENOR_SEARCH_GIF = TENOR_BASE_URL + "/search"