shuff
parent
66ebae34b0
commit
ed79119f3f
6
main.go
6
main.go
|
|
@ -52,7 +52,7 @@ func NewJelly(ctx context.Context, u, p, apitoken, optAccessToken string) (Jelly
|
|||
}
|
||||
|
||||
func (jelly Jelly) login(ctx context.Context, p string) (string, error) {
|
||||
resp, err := jelly.post(ctx, "https://jellyfin.home.blapointe.com/Users/AuthenticateByName", map[string]string{
|
||||
resp, err := jelly.post(ctx, "/Users/AuthenticateByName", map[string]string{
|
||||
"Username": jelly.u,
|
||||
"Pw": p,
|
||||
}, "Authorization", jelly._authHeader(jelly.apitoken))
|
||||
|
|
@ -67,7 +67,7 @@ func (jelly Jelly) login(ctx context.Context, p string) (string, error) {
|
|||
return AccessToken.AccessToken, err
|
||||
}
|
||||
|
||||
func (jelly Jelly) post(ctx context.Context, url string, body any, headers ...string) (*http.Response, error) {
|
||||
func (jelly Jelly) post(ctx context.Context, path string, body any, headers ...string) (*http.Response, error) {
|
||||
t := http.Transport{
|
||||
DisableKeepAlives: true,
|
||||
}
|
||||
|
|
@ -77,7 +77,7 @@ func (jelly Jelly) post(ctx context.Context, url string, body any, headers ...st
|
|||
}
|
||||
|
||||
b, _ := json.Marshal(body)
|
||||
req, err := http.NewRequest(http.MethodPost, url, bytes.NewReader(b))
|
||||
req, err := http.NewRequest(http.MethodPost, fmt.Sprintf("https://jellyfin.home.blapointe.com%s", path), bytes.NewReader(b))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue