mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-06-27 15:49:23 +00:00
Add vendor (steam)
This commit is contained in:
35
vendor/github.com/Philipp15b/go-steam/community/community.go
generated
vendored
Normal file
35
vendor/github.com/Philipp15b/go-steam/community/community.go
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
package community
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/cookiejar"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
const cookiePath = "https://steamcommunity.com/"
|
||||
|
||||
func SetCookies(client *http.Client, sessionId, steamLogin, steamLoginSecure string) {
|
||||
if client.Jar == nil {
|
||||
client.Jar, _ = cookiejar.New(new(cookiejar.Options))
|
||||
}
|
||||
base, err := url.Parse(cookiePath)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
client.Jar.SetCookies(base, []*http.Cookie{
|
||||
// It seems that, for some reason, Steam tries to URL-decode the cookie.
|
||||
&http.Cookie{
|
||||
Name: "sessionid",
|
||||
Value: url.QueryEscape(sessionId),
|
||||
},
|
||||
// steamLogin is already URL-encoded.
|
||||
&http.Cookie{
|
||||
Name: "steamLogin",
|
||||
Value: steamLogin,
|
||||
},
|
||||
&http.Cookie{
|
||||
Name: "steamLoginSecure",
|
||||
Value: steamLoginSecure,
|
||||
},
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user