mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-12-22 17:10:10 +00:00
quote values in X-Emby-Authorization, change routes in jfapi
Quoted values in X-Emby-Authorization, as observed from the web client. removed unnecessary /emby prefix for some routes in jfapi.go
This commit is contained in:
parent
e0c4d7c545
commit
1707c8c1f9
10
jfapi.go
10
jfapi.go
@ -130,7 +130,7 @@ func (jf *Jellyfin) authenticate(username, password string) (map[string]interfac
|
||||
jf.accessToken = respData["AccessToken"].(string)
|
||||
user := respData["User"].(map[string]interface{})
|
||||
jf.userId = respData["User"].(map[string]interface{})["Id"].(string)
|
||||
jf.auth = fmt.Sprintf("MediaBrowser Client=%s, Device=%s, DeviceId=%s, Version=%s, Token=%s", jf.client, jf.device, jf.deviceId, jf.version, jf.accessToken)
|
||||
jf.auth = fmt.Sprintf("MediaBrowser Client=\"%s\", Device=\"%s\", DeviceId=\"%s\", Version=\"%s\", Token=\"%s\"", jf.client, jf.device, jf.deviceId, jf.version, jf.accessToken)
|
||||
jf.header["X-Emby-Authorization"] = jf.auth
|
||||
jf.authenticated = true
|
||||
return user, resp.StatusCode, nil
|
||||
@ -213,11 +213,11 @@ func (jf *Jellyfin) getUsers(public bool) ([]map[string]interface{}, int, error)
|
||||
var err error
|
||||
if time.Now().After(jf.cacheExpiry) {
|
||||
if public {
|
||||
url := fmt.Sprintf("%s/emby/Users/Public", jf.server)
|
||||
url := fmt.Sprintf("%s/users/public", jf.server)
|
||||
data, status, err = jf._getReader(url, nil)
|
||||
|
||||
} else {
|
||||
url := fmt.Sprintf("%s/emby/Users", jf.server)
|
||||
url := fmt.Sprintf("%s/users", jf.server)
|
||||
data, status, err = jf._getReader(url, jf.loginParams)
|
||||
}
|
||||
if err != nil || status != 200 {
|
||||
@ -268,7 +268,7 @@ func (jf *Jellyfin) userById(userId string, public bool) (map[string]interface{}
|
||||
var data io.Reader
|
||||
var status int
|
||||
var err error
|
||||
url := fmt.Sprintf("%s/emby/Users/%s", jf.server, userId)
|
||||
url := fmt.Sprintf("%s/users/%s", jf.server, userId)
|
||||
data, status, err = jf._getReader(url, jf.loginParams)
|
||||
if err != nil || status != 200 {
|
||||
return nil, status, err
|
||||
@ -279,7 +279,7 @@ func (jf *Jellyfin) userById(userId string, public bool) (map[string]interface{}
|
||||
}
|
||||
|
||||
func (jf *Jellyfin) newUser(username, password string) (map[string]interface{}, int, error) {
|
||||
url := fmt.Sprintf("%s/emby/Users/New", jf.server)
|
||||
url := fmt.Sprintf("%s/Users/New", jf.server)
|
||||
stringData := map[string]string{
|
||||
"Name": username,
|
||||
"Password": password,
|
||||
|
Loading…
Reference in New Issue
Block a user