mirror of
https://github.com/Simple-Tracker/qBittorrent-ClientBlocker.git
synced 2025-01-08 11:47:54 +08:00
Improve
This commit is contained in:
parent
f38cd698b7
commit
a10b69ecae
@ -151,7 +151,7 @@ Docker version is configured through the same name variable configuration, which
|
||||
| clientURL | string | Empty | Web UI or RPC Address. Prerequisite for using blocker, if client config file cannot be automatically read, must be filled in correctly. Prefix must specify http or https protocol, such as ```http://127.0.0.1:990``` or ```http://127.0.0.1:9091/transmission/rpc``` |
|
||||
| clientUsername | string | Empty | Web UI Username. Leaving it blank will skip authentication. If you enable client "Skip local client authentication", you can leave it blank by default, because the client config file can be automatically read and set |
|
||||
| clientPassword | string | Empty | Web UI Password. If client "Skip local client authentication" is enabled, it can be left blank by default |
|
||||
| useBasicAuth | bool | false | At the same time, authentication is performed through HTTP Basic Auth. It can be used to add/replace authentication method of Web UI through reverse proxy, etc |
|
||||
| useBasicAuth | bool | false | Also authenticates via HTTP Basic Auth. Suitable for Web UI that only support Basic Auth (such as Transmission) or add/change authentication methods via reverse proxy, etc |
|
||||
| skipCertVerification | bool | false | Skip Web UI certificate verification. Suitable for self-signed and expired certificates |
|
||||
| fetchFailedThreshold | int | 0 (Disable) | Maximum number of fetch failures. When set number is exceeded, execCommand_FetchFailed will be executed |
|
||||
| execCommand_FetchFailed | string | Empty | Execute external command (FetchFailed). First parameter is regarded as an external program path, execute the command when number of fetch failures exceeds set threshold |
|
||||
|
@ -153,7 +153,7 @@ Docker 版本通过相同名称的环境变量配置, 通过自动转换环境
|
||||
| clientURL | string | 空 | Web UI 或 RPC 地址. 使用客户端屏蔽器的前提条件, 若未能自动读取客户端配置文件, 则须正确填入. 前缀必须指定 http 或 https 协议, 如 ```http://127.0.0.1:990``` 或 ```http://127.0.0.1:9091/transmission/rpc``` |
|
||||
| clientUsername | string | 空 | Web UI 账号. 留空会跳过认证. 若启用客户端内 "跳过本机客户端认证" 可默认留空, 因可自动读取客户端配置文件并设置 |
|
||||
| clientPassword | string | 空 | Web UI 密码. 若启用客户端内 "跳过本机客户端认证" 可默认留空 |
|
||||
| useBasicAuth | bool | false (禁用) | 同时通过 HTTP Basic Auth 进行认证. 适合只支持 Basic Auth 或通过反向代理等方式 增加/换用 认证方式的 Web UI |
|
||||
| useBasicAuth | bool | false (禁用) | 同时通过 HTTP Basic Auth 进行认证. 适合只支持 Basic Auth (如 Transmission) 或通过反向代理等方式 增加/换用 认证方式的 Web UI |
|
||||
| skipCertVerification | bool | false (禁用) | 跳过 Web UI 证书校验. 适合自签及过期证书 |
|
||||
| fetchFailedThreshold | int | 0 (禁用) | 最大获取失败次数. 当超过设定次数, 将执行设置的外部命令 |
|
||||
| execCommand_FetchFailed | string | 空 | 执行外部命令 (FetchFailed). 首个参数被视作外部程序路径, 当获取失败次数超过设定次数后执行 |
|
||||
|
@ -13,14 +13,15 @@
|
||||
"skipCertVerification": false,
|
||||
"blockList": [
|
||||
"^-(SD|XF|QD|BN|DL)",
|
||||
"^XL(?!0019)", "Xunlei(?! ?0019)", "cacao_torrent",
|
||||
"^-XL(?!0019)", "Xunlei(?! ?0019)", "cacao_torrent",
|
||||
"anacrolix[ /]torrent v?([0-1]\\.(([0-9]|[0-4][0-9]|[0-5][0-2])\\.[0-9]+|(53\\.[0-2]( |$)))|unknown)",
|
||||
"^-DT", "dt[ /]torrent", "^-HP", "hp[ /]torrent",
|
||||
"trafficConsume", "\u07ad__",
|
||||
"^-GT0002", "go[ \\.]torrent",
|
||||
"Taipei-Torrent dev",
|
||||
"qBittorrent[ /]3\\.3\\.15",
|
||||
"gobind", "offline-download"
|
||||
"gobind", "offline-download",
|
||||
"ljyun.cn"
|
||||
],
|
||||
"ipBlockList": [
|
||||
// Credit: https://docs.qq.com/doc/DQnJBTGJjSFZBR2JW.
|
||||
|
13
request.go
13
request.go
@ -114,9 +114,9 @@ func Fetch(url string, tryLogin bool, withCookie bool, withHeader *map[string]st
|
||||
if response.StatusCode == 409 {
|
||||
// 尝试获取并设置 CSRF Token.
|
||||
if currentClientType == "Transmission" {
|
||||
transmissionCSRFToken := response.Header.Get("X-Transmission-Session-Id")
|
||||
if transmissionCSRFToken != "" {
|
||||
Tr_SetCSRFToken(transmissionCSRFToken)
|
||||
trCSRFToken := response.Header.Get("X-Transmission-Session-Id")
|
||||
if trCSRFToken != "" {
|
||||
Tr_SetCSRFToken(trCSRFToken)
|
||||
return 409, nil, nil
|
||||
}
|
||||
}
|
||||
@ -160,6 +160,7 @@ func Submit(url string, postdata string, tryLogin bool, withCookie bool, withHea
|
||||
Log("Submit", GetLangText("Error-FetchResponse"), true, err.Error())
|
||||
return -2, nil, nil
|
||||
}
|
||||
|
||||
responseBody, err := ioutil.ReadAll(response.Body)
|
||||
defer response.Body.Close()
|
||||
|
||||
@ -184,9 +185,9 @@ func Submit(url string, postdata string, tryLogin bool, withCookie bool, withHea
|
||||
if response.StatusCode == 409 {
|
||||
// 尝试获取并设置 CSRF Token.
|
||||
if currentClientType == "Transmission" {
|
||||
transmissionCSRFToken := response.Header.Get("X-Transmission-Session-Id")
|
||||
if transmissionCSRFToken != "" {
|
||||
Tr_SetCSRFToken(transmissionCSRFToken)
|
||||
trCSRFToken := response.Header.Get("X-Transmission-Session-Id")
|
||||
if trCSRFToken != "" {
|
||||
Tr_SetCSRFToken(trCSRFToken)
|
||||
return 409, response.Header, nil
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user