diff --git a/README.md b/README.md index 9f00ff9..c49e442 100644 --- a/README.md +++ b/README.md @@ -38,10 +38,12 @@ Copy the example environment file and configure your settings: cp .env.example .env ``` -Edit the `.env` file to set your configuration: + Edit the `.env` file to set your configuration: - `PORT`: The port to run the server on (default: 8000) - `HARDCOVER_TOKEN`: Your Hardcover API token (required for development) +To generate a Hardcover API token, visit https://hardcover.app/account/api/keys/new?scope=read%3Acatalog%3Adata+read%3Alibrary%3Apublic+read%3Ausers+read%3Asocial to create a new token with the required permissions pre-selected. + ### Installation Install dependencies: diff --git a/internal/feed/hardcover.go b/internal/feed/hardcover.go index b24d56d..86a74ed 100644 --- a/internal/feed/hardcover.go +++ b/internal/feed/hardcover.go @@ -344,13 +344,13 @@ func (b *hardcoverBuilder) getUserInterests( earliest := now.AddDate(-2, 0, 0) log.Info().Msg("Fetching user interests") data, err := hardcover.UserInterests(ctx, b.client, username, earliest) + if err != nil { + return interests, err + } log.Info(). Dur("elapsed", time.Since(now)). Int("count", len(data.UserBooks)). Msg("Retrieved user interests") - if err != nil { - return interests, err - } if len(data.Users) == 0 { return interests, nil } diff --git a/internal/hardcover/client.go b/internal/hardcover/client.go index a9ce83d..9b1b0e6 100644 --- a/internal/hardcover/client.go +++ b/internal/hardcover/client.go @@ -20,7 +20,7 @@ func (t *authTransport) RoundTrip(req *http.Request) (*http.Response, error) { req.Header.Set("Authorization", t.key) req.Header.Set( "User-Agent", - fmt.Sprintf("bookfeed/%s (https://github.com/RobBrazier/bookfeed)", version), + fmt.Sprintf("bookfeed/%s (https://github.com/robbrazier/bookfeed)", version), ) return t.wrapped.RoundTrip(req) }