Commit Graph

192 Commits

Author SHA1 Message Date
iacore e27dc301e2 Add cookie: Locale 2024-10-08 22:55:13 +00:00
iacore 6d225d5959 Cleanup global i18n 2024-10-08 06:14:19 +00:00
perennial 435305af15 rm unused log import 2024-10-08 13:33:43 +11:00
perennial c60f1a8c40 'fix' spurious ranking page issues 2024-10-08 01:03:03 +11:00
perennial 9bdaefd706 Return nil rather than an error in computeSliceBounds 2024-10-08 00:40:02 +11:00
perennial ca5f041013 Revert "Use Work interface when retrieving user artworks and novels"
This reverts commit 27749085da.

Didn't check for other calls to GetUserArtworks
2024-10-08 00:03:12 +11:00
perennial 27749085da Use Work interface when retrieving user artworks and novels
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.
2024-10-07 23:46:54 +11:00
perennial b12b81455c Slicing safely in core/user.go
Prevents panic loop when accessing an invalid page on user route
2024-10-07 23:19:10 +11:00
iacore 4a0bcf2f58 Translate short strings 2024-10-07 05:05:47 +00:00
perennial 2c69a8c8d3 Improve error handling in retryRequest 2024-10-07 14:21:56 +11:00
jackyzy823 a014372f6f feat: display novel/manga series on user page 2024-10-07 00:20:09 +08:00
VnPower 317c1dac71 Merge pull request 'feat: implement manga series' (#120) from jackyzy823/PixivFE:manga-series into v2
Reviewed-on: https://codeberg.org/VnPower/PixivFE/pulls/120
2024-10-06 03:38:31 +00:00
iacore 845bbba3c7 remove proxy job queue 2024-10-05 15:53:47 +00:00
perennial 991fcea714 revert proxy server pooling 2024-10-06 01:50:19 +10:00
jackyzy823 6c2b7f7bf4 feat: series nav in artwork page 2024-10-05 23:33:17 +08:00
iacore d99c974745 use http client from utils 2024-10-05 15:32:10 +00:00
iacore bbec5f6496 cleanup 2024-10-05 15:22:14 +00:00
iacore 2f4e95d002 Capture error strings for i18n 2024-10-05 15:19:22 +00:00
jackyzy823 d912a78f3a feat: implement manga series 2024-10-05 22:59:45 +08:00
iacore 546f83df20 make regex constructions global 2024-10-05 14:58:32 +00:00
iacore 582bbc4a60 cleanup 2024-10-05 14:49:09 +00:00
iacore c70f3aaa8f cleanup 2024-10-05 14:25:00 +00:00
perennial 5ced43adbc Fix failing compilation + gofmt 2024-10-05 21:37:46 +10:00
perennial 9d79c9693b Implement worker pool for proxy requests
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.
2024-10-05 21:27:50 +10:00
VnPower bbf77baec3 Fix responses logging without any content 2024-10-02 19:31:59 +07:00
VnPower 684d18cf25 Fix App API base 2024-09-29 16:56:15 +07:00
iacore 5f8b659b49 use urlx.Parse 2024-09-28 23:12:00 +00:00
VnPower 08ffd72dc6 App API base for credentials 2024-09-28 19:23:49 +07:00
iacore 1868c7a539 clean up 2024-09-24 18:56:01 +00:00
iacore ee2f2ba104 Log response. Fix #116 2024-09-24 18:46:00 +00:00
VnPower 18d6874e89 Merge pull request 'Implement series navigation info in novel page' (#114) from jackyzy823/PixivFE:novel-nav into v2
Reviewed-on: https://codeberg.org/VnPower/PixivFE/pulls/114
2024-09-24 12:51:02 +00:00
jackyzy823 5a558a6b7d Implement series navigation info in novel page 2024-09-23 22:57:57 +08:00
perennial 79f5c99ae3 Actual token exhaustion error handling and messaging
Actually reset all tokens to initial state when exhausted in retryRequest and
provide a more informative error message.
2024-09-24 00:24:08 +10:00
perennial d1534682e2 Implement random User-Agent selection
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.
2024-09-23 22:30:26 +10:00
VnPower 48265616e4 Fix #109 2024-09-23 11:19:10 +07:00
VnPower 68c28e963b Fix embedded illust images in novels 2024-09-22 21:07:24 +07:00
VnPower 37ee3d1877 Merge pull request 'Novel comments and special marks' (#108) from jackyzy823/PixivFE:novel-page-improve into v2
Reviewed-on: https://codeberg.org/VnPower/PixivFE/pulls/108
2024-09-22 14:06:08 +00:00
VnPower 4d5b8b2209 Pixivision: Tag page 2024-09-22 20:39:51 +07:00
jackyzy823 0a0afa706c Support uploadedimage mark in novel 2024-09-22 18:28:48 +08:00
jackyzy823 8b978be40f Make illust in novel clickable 2024-09-22 18:28:48 +08:00
jackyzy823 c61cc0dd3f Implement novel comments 2024-09-22 18:28:48 +08:00
perennial 829959c81e Explicitly require userToken for POST requests
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.
2024-09-22 20:04:59 +10:00
perennial dbfe0a6383 Improve POST request handling in token management
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.
2024-09-22 02:58:48 +10:00
perennial a8aaefef37 Restore user token precedence and rename GetPixivToken
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.
2024-09-22 02:27:32 +10:00
perennial 0489fff340 novel: fix staticcheck issues 2024-09-22 00:43:56 +10:00
VnPower cbf870c989 Merge pull request 'Implement exponential backoff for API requests and token management' (#101) from perennial/PixivFE:tokenmanager into v2
Reviewed-on: https://codeberg.org/VnPower/PixivFE/pulls/101
2024-09-19 14:31:03 +00:00
VnPower 8e9342fb1f Pixivision category 2024-09-19 21:30:01 +07:00
perennial 6b8c579e9e Implement retryablehttp for API request retries
Refactor API request mechanism to use the retryablehttp
package instead. Update documentation and dependencies
to reflect this change.
2024-09-19 17:17:02 +10:00
perennial 3d6f5ace8c fix type bug 2024-09-19 16:41:52 +10:00
perennial bc19f485a2 Add separate API request level backoff mechanism
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.
2024-09-19 16:27:22 +10:00