This commit is contained in:
bel
2025-06-05 19:20:49 -06:00
parent 66ebae34b0
commit ed79119f3f

View File

@@ -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) { 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, "Username": jelly.u,
"Pw": p, "Pw": p,
}, "Authorization", jelly._authHeader(jelly.apitoken)) }, "Authorization", jelly._authHeader(jelly.apitoken))
@@ -67,7 +67,7 @@ func (jelly Jelly) login(ctx context.Context, p string) (string, error) {
return AccessToken.AccessToken, err 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{ t := http.Transport{
DisableKeepAlives: true, DisableKeepAlives: true,
} }
@@ -77,7 +77,7 @@ func (jelly Jelly) post(ctx context.Context, url string, body any, headers ...st
} }
b, _ := json.Marshal(body) 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 { if err != nil {
return nil, err return nil, err
} }