Skip to content

Commit

Permalink
client: load version number dynamically
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Nov 29, 2024
1 parent 8b61dc5 commit f2897d9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
9 changes: 4 additions & 5 deletions attachments.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,14 @@ func uploadDiscordAttachment(cli *http.Client, url string, data []byte) error {
if err != nil {
return err
}
for key, value := range discordgo.DroidFetchHeaders {
for key, value := range discordgo.DroidBaseHeaders {
req.Header.Set(key, value)
}
req.Header.Set("Content-Type", "application/octet-stream")
req.Header.Set("Referer", "https://discord.com/")
req.Header.Del("X-Debug-Options")
req.Header.Del("X-Discord-Locale")
req.Header.Del("X-Discord-Timezone")
req.Header.Del("X-Super-Properties")
req.Header.Set("Sec-Fetch-Dest", "empty")
req.Header.Set("Sec-Fetch-Mode", "cors")
req.Header.Set("Sec-Fetch-Site", "cross-site")

resp, err := cli.Do(req)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ require (
maunium.net/go/mauflag v1.0.0 // indirect
)

replace github.com/bwmarrin/discordgo => github.com/beeper/discordgo v0.0.0-20241129150404-0ddeff8635e8
replace github.com/bwmarrin/discordgo => github.com/beeper/discordgo v0.0.0-20241129181343-6f7633fc47bd
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60=
github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
github.com/beeper/discordgo v0.0.0-20241129150404-0ddeff8635e8 h1:pJeDjlzwk6z6XTC1N54QNdAplXlnQ+Er+tO6ogquj0Q=
github.com/beeper/discordgo v0.0.0-20241129150404-0ddeff8635e8/go.mod h1:59+AOzzjmL6onAh62nuLXmn7dJCaC/owDLWbGtjTcFA=
github.com/beeper/discordgo v0.0.0-20241129181343-6f7633fc47bd h1:wq/LmW+im+L5MTCxkIiRW6DYosEDuCoOqx8J7vkGucA=
github.com/beeper/discordgo v0.0.0-20241129181343-6f7633fc47bd/go.mod h1:59+AOzzjmL6onAh62nuLXmn7dJCaC/owDLWbGtjTcFA=
github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs=
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand Down
10 changes: 8 additions & 2 deletions user.go
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,9 @@ func (user *User) Connect() error {
InsecureSkipVerify: os.Getenv("DISCORD_SKIP_TLS_VERIFICATION") == "true",
}
session.Client.Transport = &http.Transport{
Proxy: http.ProxyURL(u),
TLSClientConfig: tlsConf,
Proxy: http.ProxyURL(u),
TLSClientConfig: tlsConf,
ForceAttemptHTTP2: true,
}
session.Dialer.Proxy = http.ProxyURL(u)
session.Dialer.TLSClientConfig = tlsConf
Expand All @@ -576,6 +577,11 @@ func (user *User) Connect() error {
}
session.EventHandler = user.eventHandlerSync

err = session.LoadMainPage(context.TODO())
if err != nil {
user.log.Warn().Err(err).Msg("Failed to load main page")
}

user.Session = session

for {
Expand Down

0 comments on commit f2897d9

Please sign in to comment.