mirror of
https://github.com/idanoo/autobrr
synced 2025-07-22 00:09:12 +00:00
parent
b980b5530d
commit
1ae8624e05
10 changed files with 15 additions and 24 deletions
2
.github/workflows/codeql.yml
vendored
2
.github/workflows/codeql.yml
vendored
|
@ -21,7 +21,7 @@ on:
|
|||
- cron: '20 13 * * 6'
|
||||
|
||||
env:
|
||||
GO_VERSION: '1.23'
|
||||
GO_VERSION: '1.24'
|
||||
NODE_VERSION: '20.17.0'
|
||||
|
||||
jobs:
|
||||
|
|
2
.github/workflows/golang-linter.yml
vendored
2
.github/workflows/golang-linter.yml
vendored
|
@ -9,7 +9,7 @@ on:
|
|||
pull_request:
|
||||
|
||||
env:
|
||||
GO_VERSION: '1.23'
|
||||
GO_VERSION: '1.24'
|
||||
NODE_VERSION: '20.17.0'
|
||||
|
||||
jobs:
|
||||
|
|
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
|
@ -26,7 +26,7 @@ on:
|
|||
env:
|
||||
REGISTRY: ghcr.io
|
||||
REGISTRY_IMAGE: ghcr.io/${{ github.repository }}
|
||||
GO_VERSION: '1.23'
|
||||
GO_VERSION: '1.24'
|
||||
NODE_VERSION: '20.17.0'
|
||||
|
||||
permissions:
|
||||
|
|
|
@ -11,7 +11,7 @@ COPY web ./
|
|||
RUN pnpm run build
|
||||
|
||||
# build app
|
||||
FROM golang:1.23-alpine3.20 AS app-builder
|
||||
FROM golang:1.24-alpine3.21 AS app-builder
|
||||
|
||||
ARG VERSION=dev
|
||||
ARG REVISION=dev
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# build app
|
||||
FROM --platform=$BUILDPLATFORM golang:1.23-alpine3.20 AS app-builder
|
||||
FROM --platform=$BUILDPLATFORM golang:1.24-alpine3.21 AS app-builder
|
||||
RUN apk add --no-cache git tzdata
|
||||
|
||||
ENV SERVICE=autobrr
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# build app
|
||||
FROM --platform=$BUILDPLATFORM golang:1.23-alpine3.20 AS app-builder
|
||||
FROM --platform=$BUILDPLATFORM golang:1.24-alpine3.20 AS app-builder
|
||||
RUN apk add --no-cache git tzdata
|
||||
|
||||
ENV SERVICE=autobrr
|
||||
|
|
2
go.mod
2
go.mod
|
@ -1,6 +1,6 @@
|
|||
module github.com/autobrr/autobrr
|
||||
|
||||
go 1.23.2
|
||||
go 1.24
|
||||
|
||||
replace github.com/r3labs/sse/v2 => github.com/autobrr/sse/v2 v2.0.0-20230520125637-530e06346d7d
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ package list
|
|||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
|
@ -19,17 +18,14 @@ func (s *service) trakt(ctx context.Context, list *domain.List) error {
|
|||
l := s.log.With().Str("type", "trakt").Str("list", list.Name).Logger()
|
||||
|
||||
if list.URL == "" {
|
||||
errMsg := "no URL provided for steam"
|
||||
l.Error().Msg(errMsg)
|
||||
return fmt.Errorf(errMsg)
|
||||
return errors.Errorf("no URL provided for trakt: %s", list.Name)
|
||||
}
|
||||
|
||||
l.Debug().Msgf("fetching titles from %s", list.URL)
|
||||
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, list.URL, nil)
|
||||
if err != nil {
|
||||
l.Error().Err(err).Msg("could not make new request")
|
||||
return err
|
||||
return errors.Wrapf(err, "could not make new request for URL: %s", list.URL)
|
||||
}
|
||||
|
||||
req.Header.Set("trakt-api-version", "2")
|
||||
|
@ -44,20 +40,17 @@ func (s *service) trakt(ctx context.Context, list *domain.List) error {
|
|||
|
||||
resp, err := s.httpClient.Do(req)
|
||||
if err != nil {
|
||||
l.Error().Err(err).Msgf("failed to fetch titles from URL: %s", list.URL)
|
||||
return err
|
||||
return errors.Wrapf(err, "failed to fetch titles from URL: %s", list.URL)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
l.Error().Msgf("failed to fetch titles from URL: %s", list.URL)
|
||||
return fmt.Errorf("failed to fetch titles from URL: %s", list.URL)
|
||||
return errors.Errorf("failed to fetch titles from URL: %s", list.URL)
|
||||
}
|
||||
|
||||
contentType := resp.Header.Get("Content-Type")
|
||||
if !strings.HasPrefix(contentType, "application/json") {
|
||||
errMsg := fmt.Sprintf("invalid content type for URL: %s, content type should be application/json", list.URL)
|
||||
return fmt.Errorf(errMsg)
|
||||
return errors.Errorf("invalid content type for URL: %s, content type should be application/json", list.URL)
|
||||
}
|
||||
|
||||
var data []struct {
|
||||
|
@ -71,8 +64,7 @@ func (s *service) trakt(ctx context.Context, list *domain.List) error {
|
|||
}
|
||||
|
||||
if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
|
||||
l.Error().Err(err).Msgf("failed to decode JSON data from URL: %s", list.URL)
|
||||
return err
|
||||
return errors.Wrapf(err, "failed to decode JSON data from URL: %s", list.URL)
|
||||
}
|
||||
|
||||
var titles []string
|
||||
|
|
|
@ -141,7 +141,7 @@ func (s *service) Test(ctx context.Context, proxy *domain.Proxy) error {
|
|||
}
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return errors.New(resp.Status)
|
||||
return errors.New("got unexpected status code: %d", resp.StatusCode)
|
||||
}
|
||||
|
||||
s.log.Debug().Msgf("proxy %s test OK!", proxy.Addr)
|
||||
|
|
|
@ -7,7 +7,6 @@ import (
|
|||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"reflect"
|
||||
"strconv"
|
||||
|
@ -186,7 +185,7 @@ func (c *rpcClient) doCall(ctx context.Context, request RPCRequest) (*RPCRespons
|
|||
|
||||
if err != nil {
|
||||
if httpResponse.StatusCode >= 400 {
|
||||
return nil, errors.Wrap(err, fmt.Sprintf("rpc call %v() on %v status code: %v. Could not decode body to rpc response", request.Method, httpRequest.URL.String(), httpResponse.StatusCode))
|
||||
return nil, errors.Wrap(err, "rpc call %v() on %v status code: %v. Could not decode body to rpc response", request.Method, httpRequest.URL.String(), httpResponse.StatusCode)
|
||||
}
|
||||
// if res.StatusCode == http.StatusUnauthorized {
|
||||
// return nil, errors.New("unauthorized: bad credentials")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue