This commit consolidates retrieving user artworks and novels into
a single function, GetUserWorks.
A new Work interface abstracts common behavior between artworks and novels.
The computeSliceBounds utility function is also moved to the end of the file.
This commit introduces worker pooling for handling media proxy requests,
allowing for actual concurrency in this area.
Key changes:
- Add ProxyJob struct to represent worker pool jobs
- Create a channel for ProxyJob and initialise workers in init function
- Modify ProxyRequest to use the worker pool
- Add proxyWorker and processProxyJob functions for job processing
The number of workers and job queue size are currently hardcoded but can
be made configurable in the future.
This commit introduces a mechanism for randomly selecting User-Agents
from a predefined list to be used for requests to the Pixiv API.
References to setting a custom User-Agent via the PIXIVFE_USERAGENT
environment variable have been removed as it is no longer used.
Change to an early check for empty userToken in API_POST function
to fail fast and avoid unnecessary retries.
Remove conditional check when adding the cookie and use the
token string consistently for PHPSESSID.
This commit modifies the token management and retry logic to handle
POST requests differently from GET requests. It introduces an `isPost`
flag to the `retryRequest` function, which is used to skip token
retrieval and status marking for POST requests.
This commit restores the ability to use a user-provided token when
making API requests and gives it precedence over the default token
provided by tokenManager.
Additionally, the function GetPixivToken has been renamed to
GetUserToken for clarity.
Implement new backoff settings for API requests, distinct from token
management backoff.
Update config, core request handling, and documentation to reflect the
new API request backoff mechanism. Refactor TokenManager to use the
manager's baseTimeout instead of individual token timeouts.