Compare commits

...

6 Commits

Author SHA1 Message Date
David
945df1a9cb Merge pull request #56 from GrayXu/master
新增站点:蝴蝶
2021-09-05 16:44:36 +08:00
Gray Xu
88420c4260 新增站点:蝴蝶 2021-09-05 16:36:19 +08:00
david
136c9ee2ba 加版本号 2021-07-09 18:25:55 +08:00
david
9497cea867 优化URL替换规则,支持新站点 2021-07-09 18:22:19 +08:00
david
6f23c966e1 修改用户绑定接口地址 2021-07-01 23:58:53 +08:00
david
9d8eee73d9 新增站点:蒲公英、阿童木 2021-03-06 11:26:17 +08:00
3 changed files with 54 additions and 23 deletions

View File

@@ -13,7 +13,7 @@ use IYUU\Library\Table;
class AutoReseed class AutoReseed
{ {
// 版本号 // 版本号
const VER = '1.10.22'; const VER = '1.10.23';
// RPC连接 // RPC连接
private static $links = []; private static $links = [];
// 客户端配置 // 客户端配置
@@ -31,7 +31,7 @@ class AutoReseed
// API接口配置 // API接口配置
public static $apiUrl = 'http://api.iyuu.cn'; public static $apiUrl = 'http://api.iyuu.cn';
public static $endpoints = array( public static $endpoints = array(
'login' => '/user/login', 'login' => '/App.Api.Bind',
'sites' => '/api/sites', 'sites' => '/api/sites',
'infohash'=> '/api/infohash', 'infohash'=> '/api/infohash',
'hash' => '/api/hash', 'hash' => '/api/hash',
@@ -39,7 +39,9 @@ class AutoReseed
'recommendSites' => '/Api/GetRecommendSites', 'recommendSites' => '/Api/GetRecommendSites',
'getSign' => '/Api/GetSign' 'getSign' => '/Api/GetSign'
); );
// curl /**
* @var null | Curl
*/
private static $curl = null; private static $curl = null;
// 退出状态码 // 退出状态码
public static $ExitCode = 0; public static $ExitCode = 0;
@@ -523,7 +525,7 @@ class AutoReseed
} }
$downloadUrl = $_url; $downloadUrl = $_url;
} else { } else {
$url = self::getTorrentUrl($siteName, $_url); $url = self::getTorrentUrl($siteName, $sid, $_url);
$downloadUrl = $url; $downloadUrl = $url;
} }
@@ -933,20 +935,29 @@ class AutoReseed
/** /**
* 获取站点种子的URL * 获取站点种子的URL
* @param string $site * @param string $site
* @param int $sid
* @param string $url * @param string $url
* @return string 带host的完整种子下载连接 * @return string 带host的完整种子下载连接
*/ */
private static function getTorrentUrl($site = '', $url = '') private static function getTorrentUrl($site = '', $sid = 0, $url = '')
{ {
global $configALL; global $configALL;
// 注入合作站种子的URL规则 // 注入URL替换规则
$url = self::getRecommendTorrentUrl($site, $url); if (in_array($site, self::$recommend)) {
// 兼容旧配置,进行补全 $url = self::getRecommendTorrentUrl($site, $url);
if (isset($configALL[$site]['passkey']) && $configALL[$site]['passkey']) { } else {
if (empty($configALL[$site]['url_replace'])) { $reseed_check = self::$sites[$sid]['reseed_check'];
$configALL[$site]['url_replace'] = array('{passkey}' => trim($configALL[$site]['passkey'])); if ($reseed_check && is_array($reseed_check)) {
$replace = [];
foreach ($reseed_check as $value) {
$value = ($value === 'uid' ? 'id' : $value); // 兼容性处理
$key = '{' . $value .'}';
$replace[$key] = empty($configALL[$site][$value]) ? '' : $configALL[$site][$value];
}
$configALL[$site]['url_replace'] = $replace;
} }
} }
// 通用操作:替换 // 通用操作:替换
if (isset($configALL[$site]['url_replace']) && $configALL[$site]['url_replace']) { if (isset($configALL[$site]['url_replace']) && $configALL[$site]['url_replace']) {
$url = strtr($url, $configALL[$site]['url_replace']); $url = strtr($url, $configALL[$site]['url_replace']);
@@ -969,24 +980,15 @@ class AutoReseed
global $configALL; global $configALL;
if (in_array($site, self::$recommend)) { if (in_array($site, self::$recommend)) {
$now = time(); $now = time();
$uid = isset($configALL[$site]['id']) ? $configALL[$site]['id'] : $now; $uid = isset($configALL[$site]['id']) ? $configALL[$site]['id'] : 0;
$pk = isset($configALL[$site]['passkey']) ? trim($configALL[$site]['passkey']) : $now; $pk = isset($configALL[$site]['passkey']) ? trim($configALL[$site]['passkey']) : $now;
$hash = md5(trim($pk)); $hash = md5(trim($pk));
$signString = self::getDownloadTorrentSign($site); // 检查签名有效期,如果过期获取新的签名 $signString = self::getDownloadTorrentSign($site); // 检查签名有效期,如果过期获取新的签名
switch ($site) { switch ($site) {
case 'pthome':
case 'hdhome':
case 'hddolby':
//兼容性处理:新旧规则
if (isset($configALL[$site]['rss']) && $configALL[$site]['rss']) {
$url = str_replace('passkey={passkey}', 'uid={uid}&hash={hash}', $url);
$hash = $configALL[$site]['rss']; // 直接提交专用下载hash
}
break;
case 'ourbits': case 'ourbits':
// 兼容旧版本的IYUU // 兼容旧版本的IYUU
if (isset($configALL[$site]['id']) && $configALL[$site]['id']) { if ($uid) {
$url = str_replace('passkey={passkey}', 'uid={uid}&hash={hash}', $url); $url = str_replace('passkey={passkey}', 'uid={uid}&hash={hash}', $url);
} }
// TODO... 注入流控规则 60S/20pcs、3600S/100pcs // TODO... 注入流控规则 60S/20pcs、3600S/100pcs

View File

@@ -664,5 +664,34 @@ return array(
'url_replace' => array(), 'url_replace' => array(),
'url_join' => array(), 'url_join' => array(),
), ),
// npupt 蒲公英
'npupt' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '',
// 如果需要自动辅种,必须配置
'passkey' => '',
),
// hdatmos 阿童木
'hdatmos' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '',
// 如果需要自动辅种,必须配置
'passkey' => '',
),
'greatposterwall' => array(
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
'cookie' => '',
// 如果需要自动辅种,必须配置
'passkey' => '', // torrent_pass
'torrent_pass' => '', // torrent_pass
'authkey' => '', // authkey
),
// hudbt 华科蝴蝶
'hudbt' => array(
'cookie' => '',
'passkey' => '',
'url_replace' => array(),
'url_join' => array(),
),
// 配置结束,后面的一行不能删除,必须保留!!! // 配置结束,后面的一行不能删除,必须保留!!!
); );

View File

@@ -55,7 +55,7 @@ IYUU自动辅种工具英文名IYUUAutoReseed是一款PHP语言编
2. qBittorrent 2. qBittorrent
## 支持自动辅种的站点 ## 支持自动辅种的站点
学校、杜比、家园、天空、朋友、馒头、萌猫、我堡、猫站、铂金家、烧包、北洋、TCCF、南洋、TTG、映客、城市、52pt、brobits、备胎、SSD、CHD、ptmsg、leaguehd、聆音、瓷器、hdarea、eastgame(TLF)、1ptba、hdtime、hd4fans、opencd、hdbug、hdstreet、joyhd、u2、upxin(HDU)、oshen、discfan(GZT)、cnscg圣城(已删除)、北邮、CCFBits、dicmusic、天雪、葡萄、HDRoute、伊甸园hdbd、海胆haidan、HDfans、龙之家、百川PT。 学校、杜比、家园、天空、朋友、馒头、萌猫、我堡、猫站、铂金家、烧包、北洋、TCCF、南洋、TTG、映客、城市、52pt、brobits、备胎、SSD、CHD、ptmsg、leaguehd、聆音、瓷器、hdarea、eastgame(TLF)、1ptba、hdtime、hd4fans、opencd、hdbug、hdstreet、joyhd、u2、upxin(HDU)、oshen、discfan(GZT)、cnscg圣城(已删除)、北邮、CCFBits、dicmusic、天雪、葡萄、HDRoute、伊甸园hdbd、海胆haidan、HDfans、龙之家、百川PT、HDAI、蒲公英、阿童木、蝴蝶
## 运行环境 ## 运行环境
具备PHP运行环境的所有平台例如Linux、Windows、MacOS 具备PHP运行环境的所有平台例如Linux、Windows、MacOS