Commit Graph

52 Commits

Author SHA1 Message Date
iacore 5f8b659b49 use urlx.Parse 2024-09-28 23:12:00 +00:00
iacore 079993e801 Use proper rate limiter
Rename package handlers to middleware, since most are middleware

router.go is not middleware. can be moved out to router/router.go
2024-09-25 05:05:04 +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
perennial 6a1334658a Improve About page content and add domain information
Update the About page to provide clearer information about the PixivFE instance.
Add functionality to display the current domain name.
2024-09-24 21:47:08 +10:00
perennial 305f574f15 Refactor proxy checker initialisation and shutdown
Restructure the proxy checking logic to use a ticker for periodic checks
when a non-zero interval is set. Improve handling of zero interval case
by waiting for a stop signal. Improve stop mechanism and initialisation
of stopChan.

Also introduce a new test file proxy_checker_test.go for unit testing.
2024-09-24 18:41:40 +10:00
perennial 198258b641 Remove unused funcs in token_manager_test 2024-09-24 16:28:53 +10:00
perennial 722988986b Format handlers/doc.go 2024-09-24 16:21:29 +10:00
perennial 2442f6598c Add tutorial to router.go 2024-09-24 16:10:01 +10:00
perennial 3c1bb0badb Add comments to package handlers 2024-09-24 15:51:23 +10:00
jackyzy823 5a558a6b7d Implement series navigation info in novel page 2024-09-23 22:57:57 +08:00
perennial 32a52d4f29 Remove unused functions in token_manager 2024-09-24 00:37:13 +10:00
perennial d25b3a3ec9 Add comments to HTTP utility functions and client 2024-09-23 21:20:24 +10:00
jackyzy823 db798db95b Support *_PROXY env 2024-09-22 22:55:29 +08: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
perennial 8a2f817ae6 Add configurable repository URL
This commit introduces a new PIXIVFE_REPO_URL configuration option,
allowing users to specify a custom repository URL.

The about page now uses this configurable URL, and the configuration
loading process has been updated to validate and handle the new option.

Documentation has been updated to reflect these changes.
2024-09-22 20:57:29 +10:00
perennial d977ae7d62 Improve version and revision info handling
Modify the REVISION variable to include both commit date and hash.
Update config package to parse and store revision components separately.
Modify about page and routes to display more detailed revision information.
2024-09-22 20:57:28 +10:00
jackyzy823 517fef6e78 Support special marks for novel
1. `rb` mark for furigana
2. `jumpuri` mark to open link externally
3. `chapter` mark
4. `jump` to jump to page num anchor
5. Refactor `newpage` mark
2024-09-22 18:28:48 +08:00
jackyzy823 c61cc0dd3f Implement novel comments 2024-09-22 18:28:48 +08: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
VnPower 7af2e9a500 Merge pull request 'Display revision on about page' (#104) from jackyzy823/PixivFE:about-revision into v2
Reviewed-on: https://codeberg.org/VnPower/PixivFE/pulls/104
2024-09-21 14:40:33 +00:00
jackyzy823 b1526fc751 Add novel series to render test 2024-09-21 18:17:17 +08:00
jackyzy823 87b3656818 Fix render test 2024-09-21 18:16:59 +08:00
perennial 9bab56f6dd proxy checker: fix staticcheck issues 2024-09-21 19:18:52 +10:00
perennial 6492663203 Refactor audit Init function for readability
Simplify the conditional logic in the Init function by using an early
return when optionSaveResponse is false. Move the MaxRecordedCount
assignment and directory creation outside the conditional block to
improve code structure and readability.
2024-09-20 18:30:17 +10:00
perennial 2647143a05 Add logging statements in audit 2024-09-20 18:28:44 +10:00
perennial 6a6fb803a4 Remove redundant responseSaveLocation variable
Replace local responseSaveLocation variable in audit_init.go
with direct references to config.GlobalConfig.ResponseSaveLocation.
2024-09-20 18:09:34 +10:00
perennial b480df0e7f Add configurable response save location
Introduce a new ResponseSaveLocation config option to flexibly store
API responses during development. Move InDevelopment flag to a
dedicated "Development options" section in the config struct.
Update audit package to use the new configurable save location instead
of a hardcoded path.
2024-09-20 16:09:41 +10:00
perennial 316ca993e9 Add inline comments to audit_log.go 2024-09-20 15:16:47 +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 4c0cb79470 Run make fmt 2024-09-19 20:04:19 +10:00
perennial 5c35d87371 Edit settings in token_manager_test.go 2024-09-19 20:03:46 +10:00
perennial c0aaedfc3b Add test suite for token_manager
This commit introduces a new file token_manager_test.go containing
unit tests for the token_manager package.

The test suite covers various aspects, including initialisation,
token selection methods, status updates, fallback mechanisms, and
concurrent access.
2024-09-19 19:51:24 +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 31a801ac34 Add inline comments to token_manager.go 2024-09-18 14:52:57 +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
jackyzy823 f53e1c3e4d Display revision on about page 2024-09-18 00:22:55 +08: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
VnPower eed11702e8 Change some wordings 2024-09-17 20:44:54 +07:00
VnPower a5f7c36bbb AI filter #26 2024-09-17 20:01:42 +07:00
perennial c72bc08f02 run make fmt 2024-09-17 15:55:11 +10:00
perennial f6a2bc4fda Wait for initial proxy check on server startup
Modify the server startup process to wait for the first proxy check to
complete before initialising the server.

Add logging to provide visibility into the proxy checker initialisation
process.
2024-09-17 15:48:07 +10:00
jackyzy823 47d403993f Fix novel page redirection 2024-09-16 23:38:41 +08:00
VnPower a34a21eed4 Fix proxy checker unable to run anymore 10 seconds after server init 2024-09-16 20:39:57 +07:00
VnPower f55c73bbdf Move proxy_checker into the server/ folder 2024-09-16 20:17:15 +07:00
VnPower 31f47c4c49 Option to filter R18/R18G artworks #38 2024-09-15 16:33:37 +07:00
iacore 09c09099d8 rename templates (clean up) 2024-09-06 16:22:35 +00:00
iacore d9b1293512 split proxy checker out to its own package 2024-09-05 17:35:10 +00:00