Remove unused things

This commit is contained in:
Tulir Asokan 2023-06-30 16:09:06 +03:00
parent a759468da3
commit 8da8d5c8ba
6 changed files with 0 additions and 116 deletions

View file

@ -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
}

View file

@ -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 {

View file

@ -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
}

View file

@ -1 +0,0 @@
package payload

View file

@ -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"

View file

@ -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"