Adjust constants and defaults
This commit is contained in:
parent
6f21016ccf
commit
5f47cbc6e6
5 changed files with 10 additions and 8 deletions
|
@ -105,6 +105,7 @@ var SpacedBlocks = [][]string{
|
||||||
{"appservice", "as_token"},
|
{"appservice", "as_token"},
|
||||||
{"segment_key"},
|
{"segment_key"},
|
||||||
{"metrics"},
|
{"metrics"},
|
||||||
|
{"google_messages"},
|
||||||
{"bridge"},
|
{"bridge"},
|
||||||
{"bridge", "command_prefix"},
|
{"bridge", "command_prefix"},
|
||||||
{"bridge", "management_room_text"},
|
{"bridge", "management_room_text"},
|
||||||
|
|
|
@ -90,10 +90,10 @@ metrics:
|
||||||
|
|
||||||
google_messages:
|
google_messages:
|
||||||
# OS name to tell the phone. This is the name that shows up in the paired devices list.
|
# OS name to tell the phone. This is the name that shows up in the paired devices list.
|
||||||
os: mautrix-gmessages
|
os: Android (mautrix)
|
||||||
# Browser type to tell the phone. This decides which icon is shown.
|
# Browser type to tell the phone. This decides which icon is shown.
|
||||||
# Valid types: OTHER, CHROME, FIREFOX, SAFARI, OPERA, IE, EDGE
|
# Valid types: OTHER, CHROME, FIREFOX, SAFARI, OPERA, IE, EDGE
|
||||||
browser: OTHER
|
browser: CHROME
|
||||||
# Device type to tell the phone. This also affects the icon, as well as how many sessions are allowed simultaneously.
|
# Device type to tell the phone. This also affects the icon, as well as how many sessions are allowed simultaneously.
|
||||||
# One web, two tablets and one PWA should be able to connect at the same time.
|
# One web, two tablets and one PWA should be able to connect at the same time.
|
||||||
# Valid types: WEB, TABLET, PWA
|
# Valid types: WEB, TABLET, PWA
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
package util
|
package util
|
||||||
|
|
||||||
const GoogleAPIKey = "AIzaSyCA4RsOZUFrm9whhtGosPlJLmVPnfSHKz8"
|
const GoogleAPIKey = "AIzaSyCA4RsOZUFrm9whhtGosPlJLmVPnfSHKz8"
|
||||||
const UserAgent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"
|
const UserAgent = "Mozilla/5.0 (Linux; Android 13) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"
|
||||||
const SecUA = `"Google Chrome";v="113", "Chromium";v="113", "Not-A.Brand";v="24"`
|
const SecUA = `"Google Chrome";v="113", "Chromium";v="113", "Not-A.Brand";v="24"`
|
||||||
const UAPlatform = "Linux"
|
const UAPlatform = "Android"
|
||||||
const XUserAgent = "grpc-web-javascript/0.1"
|
const XUserAgent = "grpc-web-javascript/0.1"
|
||||||
const QRCodeURLBase = "https://support.google.com/messages/?p=web_computer#?c="
|
const QRCodeURLBase = "https://support.google.com/messages/?p=web_computer#?c="
|
||||||
|
const SecUAMobile = "?1"
|
||||||
|
|
|
@ -27,7 +27,7 @@ func BuildRelayHeaders(req *http.Request, contentType string, accept string) {
|
||||||
if len(contentType) > 0 {
|
if len(contentType) > 0 {
|
||||||
req.Header.Add("content-type", contentType)
|
req.Header.Add("content-type", contentType)
|
||||||
}
|
}
|
||||||
req.Header.Add("sec-ch-ua-mobile", "?0")
|
req.Header.Add("sec-ch-ua-mobile", SecUAMobile)
|
||||||
req.Header.Add("user-agent", UserAgent)
|
req.Header.Add("user-agent", UserAgent)
|
||||||
req.Header.Add("sec-ch-ua-platform", "\""+UAPlatform+"\"")
|
req.Header.Add("sec-ch-ua-platform", "\""+UAPlatform+"\"")
|
||||||
req.Header.Add("accept", accept)
|
req.Header.Add("accept", accept)
|
||||||
|
@ -44,7 +44,7 @@ func BuildUploadHeaders(req *http.Request, metadata string) {
|
||||||
req.Header.Add("connection", "keep-alive")
|
req.Header.Add("connection", "keep-alive")
|
||||||
req.Header.Add("x-goog-download-metadata", metadata)
|
req.Header.Add("x-goog-download-metadata", metadata)
|
||||||
req.Header.Add("sec-ch-ua", SecUA)
|
req.Header.Add("sec-ch-ua", SecUA)
|
||||||
req.Header.Add("sec-ch-ua-mobile", "?0")
|
req.Header.Add("sec-ch-ua-mobile", SecUAMobile)
|
||||||
req.Header.Add("user-agent", UserAgent)
|
req.Header.Add("user-agent", UserAgent)
|
||||||
req.Header.Add("sec-ch-ua-platform", "\""+UAPlatform+"\"")
|
req.Header.Add("sec-ch-ua-platform", "\""+UAPlatform+"\"")
|
||||||
req.Header.Add("accept", "*/*")
|
req.Header.Add("accept", "*/*")
|
||||||
|
@ -67,7 +67,7 @@ func NewMediaUploadHeaders(imageSize string, command string, uploadOffset string
|
||||||
headers.Add("x-goog-upload-protocol", protocol)
|
headers.Add("x-goog-upload-protocol", protocol)
|
||||||
}
|
}
|
||||||
headers.Add("x-goog-upload-header-content-length", imageSize)
|
headers.Add("x-goog-upload-header-content-length", imageSize)
|
||||||
headers.Add("sec-ch-ua-mobile", "?0")
|
headers.Add("sec-ch-ua-mobile", SecUAMobile)
|
||||||
headers.Add("user-agent", UserAgent)
|
headers.Add("user-agent", UserAgent)
|
||||||
if imageContentType != "" {
|
if imageContentType != "" {
|
||||||
headers.Add("x-goog-upload-header-content-type", imageContentType)
|
headers.Add("x-goog-upload-header-content-type", imageContentType)
|
||||||
|
|
2
user.go
2
user.go
|
@ -397,7 +397,7 @@ func (user *User) Login(maxAttempts int) (<-chan qrChannelItem, error) {
|
||||||
user.createClient(libgm.NewAuthData())
|
user.createClient(libgm.NewAuthData())
|
||||||
qr, err := user.Client.StartLogin()
|
qr, err := user.Client.StartLogin()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
user.DeleteConnection()
|
user.unlockedDeleteConnection()
|
||||||
user.pairSuccessChan = nil
|
user.pairSuccessChan = nil
|
||||||
user.loginInProgress.Store(false)
|
user.loginInProgress.Store(false)
|
||||||
return nil, fmt.Errorf("failed to connect to Google Messages: %w", err)
|
return nil, fmt.Errorf("failed to connect to Google Messages: %w", err)
|
||||||
|
|
Loading…
Reference in a new issue