Commit Graph

150 Commits

Author SHA1 Message Date
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
perennial dcc3b712d8 Add inline comments to requests.go 2024-09-18 14:57:33 +10:00
perennial 54314d465c Implement token management and request retry system
Introduce a new TokenManager to handle token rotation, status
tracking, and automatic retries with exponential backoff for API
requests. This change aims to improve the reliability API
interactions by intelligently managing tokens and gracefully
handling request failures.

Update API request functions to utilise the new TokenManager. This
commit also adds configuration options for max retries, base timeout,
and max backoff time to fine-tune the retry behavior.
2024-09-18 14:49:18 +10:00
VnPower 509dab37b9 Merge pull request '[Feature] Improve novel features.' (#100) from jackyzy823/PixivFE:novel-series into v2
Reviewed-on: https://codeberg.org/VnPower/PixivFE/pulls/100
2024-09-17 14:54:34 +00:00
jackyzy823 5c1c6d2ead Implement novel series page and related APIs 2024-09-17 22:15:31 +08:00
perennial c72bc08f02 run make fmt 2024-09-17 15:55:11 +10:00
perennial 5b81ece024 GetRandomDefaultToken to GlobalConfig.GetToken 2024-09-14 14:37:43 +10:00
iacore 212a609af4 clean up ranking image thumbnail (template) 2024-09-06 16:45:21 +00:00
iacore 51dad4eb74 move most go files to server/ 2024-09-05 16:08:08 +00:00
VnPower 263f20b1b8 Merge pixivision into PixivFE 2024-09-04 20:42:45 +07:00
iacore 13cd5929c1 Add flamegraph page 2024-08-29 14:52:32 +00:00
iacore 14db9a41cf remove zipkin 2024-08-29 11:51:42 +00:00
iacore 0a61eaf8ed try to remove dependencies between requests
ended up not speeding up anything
2024-08-28 15:19:30 +00:00
iacore cf2afdd0b0 simplify handlers 2024-08-28 14:31:24 +00:00
iacore a3b34323bb add back skip logger logic 2024-08-28 14:24:40 +00:00
iacore a68b742b6a Add tracing 2024-08-28 13:58:51 +00:00
iacore 81cf9887cd fix type errors 2024-08-28 13:58:51 +00:00
iacore 21056f3930 centralize logging 2024-08-28 13:58:51 +00:00
iacore e10cf21089 centralize logging 2024-08-28 13:58:51 +00:00
iacore 7f67a25147 log every request to pixiv 2024-08-28 13:58:51 +00:00
iacore 839a1be6ba clean up requests, move everything into core/requests.go 2024-08-28 13:58:51 +00:00
iacore ba8af48948 Prevent cookie injection 2024-08-28 13:58:51 +00:00
iacore 1afc42305a Use cascadia for css selector 2024-08-28 13:58:51 +00:00
iacore b5895719c0 clean up 2024-08-28 13:58:51 +00:00
iacore c4d8fdb0f0 organize files
add http client with better maxidleconnections
2024-08-28 13:58:51 +00:00
iacore 95950607b3 fix more 2024-08-28 13:58:51 +00:00
iacore 8f9114d135 fix http.NewRequest with context 2024-08-28 13:58:51 +00:00
iacore d09fa30bc4 fix it more 2024-08-28 13:58:51 +00:00
iacore 65f14c554c convert part of main.go 2024-08-28 13:58:51 +00:00
iacore 822a157a6e use proper jet layout feature (extends) 2024-08-24 08:57:02 +00:00
iacore 097916465f rename pixiv_api back to core
core is a better name
2024-08-23 15:40:34 +00:00
iacore f80a3994a0 move files around 2024-08-17 05:23:32 +00:00
VnPower 5a1e83cba7 Add an option for artwork previews 2024-08-16 17:42:56 +07:00
VnPower 42d11a767b Option to open artworks to a new tab 2024-08-08 20:52:09 +07:00
VnPower 99b501e48d Fix some compatibility issue with Pixiv on the users page 2024-06-09 21:50:26 +07:00
VnPower aba95f1420 Bump version to v2.6 2024-06-09 20:13:35 +07:00
VnPower acfd25daa8 Debug 2024-06-09 17:27:34 +07:00
VnPower f38cf895a4 Add all available filters to the search page 2024-06-07 22:03:19 +07:00
VnPower df2a71d77a Convert some functions and methods 2024-06-06 10:50:22 +07:00
VnPower 60437bbb01 Build the URL once and not overcomplicate stuff 2024-06-06 10:04:27 +07:00
VnPower 1c21b6fa5b Major internal changes to the tag page 2024-06-05 20:55:31 +07:00
VnPower 1b09f77c84 Implement an URL constructor for <a> tags 2024-06-03 17:27:37 +07:00
VnPower e0ac8d23ad Novel section for users page 2024-05-12 16:54:12 +07:00