【Bug】【青龙】QingLong OpenAPI authentication requests localhost:5600 and causes cookie persistence failure
版本
BiliTool版本号:develop: cba2ea458bffc840abe9c479de6175ef8383d7f3
青龙版本号:v2.20.2
确认
- 是的,我已搜索并确认,没有其他相同的议题
- 是的,我确认,已尝试升级bilitool到最新版,但未解决
- 是的,我确认,已尝试升级青龙到最新版,但未解决
服务器架构
- x64
- arm64
- arm
- 其他(请在下面补充)
服务器系统
- Windows
- macOS
- Linux
- Debian
- Ubuntu
- Windows
- Alpine
- Centos
- 其他(请在下面补充)
Additional information:
Current distribution: debian.12青龙容器类型
- Docker
- Podman
- 其他(请在下面补充)
青龙镜像
- whyour/qinglong:latest(Alpine)
- whyour/qinglong:debian(Debian)
选择的BiliTool运行模式
- dotnet
- bilitool
Additional log:
bilitool: 当前选择的运行方式:dotnet如果是青龙拉库相关bug,请贴出拉库方式截图
- 否
- 是,截图如下
如果是缺失文件相关bug,请贴出容器内文件路径信息
- 否
- 是,信息如下
查看方式参考文档:提示文件不存在或路径异常怎么排查
BiliTool仓库文件路径:/ql/data/repo/RayWangQvQ_BiliBiliToolPro_develop
脚本文件路径:please fill in the actual script path if needed
<这里贴截图>
问题描述
When running BiliTool under QingLong, cookie persistence fails during the OpenAPI authentication step.
The log shows that the current platform is correctly detected as QingLong, and OpenAPI authentication is used. However, the program sends the token request to:
http://localhost:5600/open/auth/tokenIn the current QingLong environment, the OpenAPI service is available on:
http://localhost:5700Because of this port mismatch, the request to localhost:5600 fails with:
Connection refused (localhost:5600)and cookie persistence fails.
According to QingLong OpenAPI documentation, the token endpoint is:
GET /open/auth/tokenExample request:
curl 'http://[host]:[port]/open/auth/token?client_id=xxx&client_secret=xxx'After obtaining the token, OpenAPI requests should use:
Authorization: Bearer {token}For example:
curl 'http://[host]:[port]/open/env?t=1730550435755' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {token}'It looks like BiliTool still uses the old default QingLong OpenAPI address localhost:5600, while newer QingLong environments use localhost:5700.
Expected behavior:
- Change the default QingLong OpenAPI URL from:
http://localhost:5600to:
http://localhost:5700- Allow users to override the QingLong OpenAPI URL through an environment variable, for example:
QL_URL=http://localhost:5700or:
Ray_QL_URL=http://localhost:5700- When the connection fails, the error message should clearly indicate that the QingLong OpenAPI URL or port may be incorrect, instead of only saying that the user needs to manually add environment variables to QingLong.
日志信息
[15:44:47 INF] ---开始 持久化Cookie ---
[15:44:47 INF] 当前运行平台:QingLong
[15:44:47 WRN] 使用OpenAPI鉴权
[15:44:49 ERR] [REQUEST]
GET /open/auth/token?client_id=***&client_secret=*** HTTP/1.1
Host: localhost:5600
Accept: application/json; q=0.1, application/xml; q=0.1
[EXCEPTION]
System.Net.Http.HttpRequestException: Connection refused (localhost:5600)
---> System.Net.Sockets.SocketException (111): Connection refused
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|285_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(QueueItem queueItem)
at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.<SendCoreAsync>g__Core|5_0(HttpRequestMessage request, Boolean useAsync, CancellationToken cancellationToken)
at Microsoft.Extensions.Http.PolicyHttpMessageHandler.SendCoreAsync(HttpRequestMessage request, Context context, CancellationToken cancellationToken)
at Polly.Retry.AsyncRetryEngine.ImplementationAsync[TResult](Func`3 action, Context context, CancellationToken cancellationToken, ExceptionPredicates shouldRetryExceptionPredicates, ResultPredicates`1 shouldRetryResultPredicates, Func`5 onRetryAsync, Int32 permittedRetryCount, IEnumerable`1 sleepDurationsEnumerable, Func`4 sleepDurationProvider, Boolean continueOnCapturedContext)
at Polly.AsyncPolicy`1.ExecuteAsync(Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext)
at Microsoft.Extensions.Http.PolicyHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at Microsoft.Extensions.Http.Logging.LoggingScopeHttpMessageHandler.<SendCoreAsync>g__Core|5_0(HttpRequestMessage request, Boolean useAsync, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
at WebApiClientCore.Implementations.ApiRequestSender.SendCoreAsync(ApiRequestContext context, CancellationToken requestAborted)
at WebApiClientCore.Implementations.ApiRequestSender.SendAsync(ApiRequestContext context, CancellationToken requestAborted)
[ELAPSED] 00:00:02.0504937
[15:44:49 ERR] 持久化失败,青龙版本高于2.18,请手动添加环境变量到青龙Additional environment log:
bilitool: 青龙repo目录: /ql/data/repo
bilitool: bili仓库目录: /ql/data/repo/RayWangQvQ_BiliBiliToolPro_develop
bilitool: 当前系统发行版本:debian.12
bilitool: 当前系统:linux
bilitool: 当前架构:x64
bilitool: 当前选择的运行方式:dotnetSource: RayWangQvQ/BiliBiliToolPro