mirror of
https://gitee.com/ledc/IYUUAutoReseed
synced 2025-08-24 15:04:50 +00:00
Compare commits
22 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
6c1211708c | ||
|
40387fdb5b | ||
|
e10c36295c | ||
|
801d7b016f | ||
|
1ff415ea91 | ||
|
849370e26a | ||
|
815156b252 | ||
|
d62be67927 | ||
|
d513b1bedf | ||
|
b566181968 | ||
|
60b4939aee | ||
|
dad8afa8d4 | ||
|
a60e5f859c | ||
|
59622691e1 | ||
|
3a97c17e66 | ||
|
6d3b937097 | ||
|
4277568346 | ||
|
84f75ea443 | ||
|
715be0e7eb | ||
|
6eebc7d26c | ||
|
30410735af | ||
|
99a2894f37 |
24
Dockerfile
24
Dockerfile
@@ -1,4 +1,5 @@
|
||||
#FROM alpine:latest
|
||||
#FROM alpine:3.12
|
||||
FROM alpine:3.8
|
||||
#FROM swoft/alphp:base
|
||||
#FROM swoft/alphp:cli
|
||||
@@ -18,7 +19,7 @@ ARG app_env=prod
|
||||
|
||||
ENV APP_ENV=${app_env:-"prod"} \
|
||||
TIMEZONE=${timezone:-"Asia/Shanghai"} \
|
||||
cron="8 11 * * 0"
|
||||
cron="3 */10 * * *"
|
||||
|
||||
##
|
||||
# ---------- building ----------
|
||||
@@ -62,6 +63,7 @@ RUN set -ex \
|
||||
# php7-pdo_mysql \
|
||||
# php7-pdo_sqlite \
|
||||
# php7-phar \
|
||||
# php7-pcntl \
|
||||
# php7-posix \
|
||||
# php7-redis \
|
||||
php7-simplexml \
|
||||
@@ -76,9 +78,11 @@ RUN set -ex \
|
||||
php7-zip \
|
||||
# php7-zlib \
|
||||
php7-xml \
|
||||
&& git clone https://gitee.com/ledc/IYUUAutoReseed.git /var/www \
|
||||
&& cp /var/www/config/config.sample.php /var/www/config/config.php \
|
||||
&& ln -sf /var/www/config/config.php /config.php \
|
||||
&& git clone https://gitee.com/ledc/IYUUAutoReseed.git /IYUU \
|
||||
&& cp /IYUU/config/config.sample.php /IYUU/config/config.php \
|
||||
&& ln -sf /IYUU/config/config.php /config.php \
|
||||
&& cp /IYUU/docker/entrypoint.sh /entrypoint.sh \
|
||||
&& chmod -R 777 /entrypoint.sh \
|
||||
&& apk del --purge *-dev \
|
||||
&& rm -rf /var/cache/apk/* /tmp/* /usr/share/man /usr/share/php7 \
|
||||
# ---------- some config,clear work ----------
|
||||
@@ -93,7 +97,8 @@ RUN set -ex \
|
||||
# - config timezone
|
||||
&& ln -sf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \
|
||||
&& echo "${TIMEZONE}" > /etc/timezone \
|
||||
&& echo '2 */5 * * * cd /var/www && git fetch --all && git reset --hard origin/master' >> /etc/crontabs/root \
|
||||
&& echo '2 */5 * * * cd /IYUU && git fetch --all && git reset --hard origin/master' >> /etc/crontabs/root \
|
||||
#&& echo "${cron} /usr/bin/php /IYUU/iyuu.php &> /dev/null" >> /etc/crontabs/root \
|
||||
# ---------- some config work ----------
|
||||
# - ensure 'www-data' user exists(82 is the standard uid/gid for "www-data" in Alpine)
|
||||
# && addgroup -g 82 -S ${add_user} \
|
||||
@@ -103,8 +108,7 @@ RUN set -ex \
|
||||
# && chown -R ${add_user}:${add_user} /data \
|
||||
&& echo -e "\033[42;37m Build Completed :).\033[0m\n"
|
||||
|
||||
EXPOSE 9000
|
||||
# VOLUME ["/var/www", "/data"]
|
||||
WORKDIR /var/www
|
||||
|
||||
CMD ["sh", "-c", "/usr/bin/php /var/www/iyuu.php ; /usr/sbin/crond ; (crontab -l ;echo \"$cron /usr/bin/php /var/www/iyuu.php &> /dev/null\") | crontab - ; tail -f /dev/null"]
|
||||
# EXPOSE 9000
|
||||
# VOLUME ["/IYUU", "/data"]
|
||||
WORKDIR /IYUU
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
@@ -13,17 +13,17 @@ use IYUU\Library\Table;
|
||||
class AutoReseed
|
||||
{
|
||||
// 版本号
|
||||
const VER = '1.10.6';
|
||||
const VER = '1.10.17';
|
||||
// RPC连接
|
||||
private static $links = [];
|
||||
// 客户端配置
|
||||
private static $clients = [];
|
||||
// 站点列表
|
||||
private static $sites = [];
|
||||
// 不辅种的站点 'pt','hdchina'
|
||||
// 推荐的合作站点
|
||||
private static $recommend = [];
|
||||
// 不辅种的站点
|
||||
private static $noReseed = [];
|
||||
// cookie检查
|
||||
private static $cookieCheck = ['hdchina','hdcity','hdsky'];
|
||||
// 缓存路径
|
||||
public static $cacheDir = TORRENT_PATH.'cache'.DS;
|
||||
public static $cacheHash = TORRENT_PATH.'cachehash'.DS;
|
||||
@@ -36,6 +36,8 @@ class AutoReseed
|
||||
'infohash'=> '/api/infohash',
|
||||
'hash' => '/api/hash',
|
||||
'notify' => '/api/notify',
|
||||
'recommendSites' => '/Api/GetRecommendSites',
|
||||
'getSign' => '/Api/GetSign'
|
||||
);
|
||||
// curl
|
||||
private static $curl = null;
|
||||
@@ -64,24 +66,35 @@ class AutoReseed
|
||||
'torrent_id'=> 0,
|
||||
'error' => '',
|
||||
);
|
||||
// 初始化
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
* @throws \ErrorException
|
||||
*/
|
||||
public static function init()
|
||||
{
|
||||
global $configALL;
|
||||
echo '正在初始化运行参数,版本号:'.self::VER.PHP_EOL;
|
||||
echo '当前时间:'.date('Y-m-d H:i:s').PHP_EOL;
|
||||
sleep(mt_rand(1, 5));
|
||||
//sleep(mt_rand(1, 5));
|
||||
self::backup('config', $configALL);
|
||||
self::$curl = new Curl();
|
||||
self::$curl->setOpt(CURLOPT_SSL_VERIFYPEER, false);
|
||||
self::$curl->setOpt(CURLOPT_SSL_VERIFYHOST, 2);
|
||||
|
||||
// 合作站点鉴权绑定
|
||||
Oauth::login(self::$apiUrl . self::$endpoints['login']);
|
||||
$recommend_sites = [];
|
||||
$ret = self::$curl->get(self::$apiUrl . self::$endpoints['recommendSites']);
|
||||
$ret = json_decode($ret->response, true);
|
||||
if (isset($ret['ret']) && $ret['ret'] === 200 && isset($ret['data']['recommend']) && is_array($ret['data']['recommend'])) {
|
||||
$recommend_sites = $ret['data']['recommend'];
|
||||
self::$recommend = array_column($recommend_sites, 'site'); // init
|
||||
}
|
||||
Oauth::login(self::$apiUrl . self::$endpoints['login'], $recommend_sites);
|
||||
|
||||
// 显示支持站点列表
|
||||
self::ShowTableSites();
|
||||
self::$clients = isset($configALL['default']['clients']) && $configALL['default']['clients'] ? $configALL['default']['clients'] : array();
|
||||
self::$clients = empty($configALL['default']['clients']) ? [] : $configALL['default']['clients']; // init
|
||||
|
||||
// 递归删除上次历史记录
|
||||
IFile::rmdir(self::$cacheDir, true);
|
||||
@@ -92,6 +105,7 @@ class AutoReseed
|
||||
// 连接全局客户端
|
||||
self::links();
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示支持站点列表
|
||||
*/
|
||||
@@ -102,28 +116,22 @@ class AutoReseed
|
||||
'github源码仓库:https://github.com/ledccn/IYUUAutoReseed',
|
||||
'教程:https://gitee.com/ledc/IYUUAutoReseed/tree/master/wiki',
|
||||
'问答社区:http://wenda.iyuu.cn',
|
||||
'【IYUU自动辅种交流】QQ群:859882209、931954050'.PHP_EOL,
|
||||
'【IYUU自动辅种交流】QQ群:859882209、931954050、924099912'.PHP_EOL,
|
||||
'正在连接IYUUAutoReseed服务器,查询支持列表……'.PHP_EOL
|
||||
];
|
||||
foreach ($list as $v) {
|
||||
array_walk($list, function ($v, $k) {
|
||||
echo $v.PHP_EOL;
|
||||
}
|
||||
});
|
||||
$res = self::$curl->get(self::$apiUrl.self::$endpoints['sites'].'?sign='.Oauth::getSign().'&version='.self::VER);
|
||||
$rs = json_decode($res->response, true);
|
||||
$sites = isset($rs['data']['sites']) && $rs['data']['sites'] ? $rs['data']['sites'] : [];
|
||||
// 数据写入本地
|
||||
$sites = empty($rs['data']['sites']) ? [] : $rs['data']['sites'];
|
||||
if (empty($sites)) {
|
||||
if (!empty($rs['msg'])) {
|
||||
die($rs['msg'].PHP_EOL);
|
||||
}
|
||||
die('网络故障或远端服务器无响应,请稍后再试!!!');
|
||||
}
|
||||
|
||||
self::$sites = array_column($sites, null, 'id');
|
||||
$json = array_column($sites, null, 'site');
|
||||
ksort($json);
|
||||
$sitesConfig = ROOT_PATH.DS.'config'.DS.'sites.json';
|
||||
file_put_contents($sitesConfig, \json_encode($json, JSON_UNESCAPED_UNICODE));
|
||||
|
||||
$data = [];
|
||||
$i = $j = $k = 0; // i列、j序号、k行
|
||||
@@ -142,7 +150,14 @@ class AutoReseed
|
||||
$table = new Table();
|
||||
$table->setRows($data);
|
||||
echo($table->render());
|
||||
|
||||
// 生成IYUUPTT使用的JSON
|
||||
$_sites = array_column($sites, null, 'site');
|
||||
ksort($_sites);
|
||||
$sitesConfig = ROOT_PATH.DS.'config'.DS.'sites.json';
|
||||
file_put_contents($sitesConfig, \json_encode($_sites, JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
|
||||
/**
|
||||
* 连接远端RPC下载器
|
||||
*/
|
||||
@@ -152,7 +167,7 @@ class AutoReseed
|
||||
// 跳过未配置的客户端
|
||||
if (empty($v['username']) || empty($v['password'])) {
|
||||
self::$links[$k] = array();
|
||||
echo "clients_".$k." 用户名或密码未配置,已跳过".PHP_EOL.PHP_EOL;
|
||||
echo "clients_".$k." 用户名或密码未配置,已跳过!".PHP_EOL.PHP_EOL;
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
@@ -169,14 +184,17 @@ class AutoReseed
|
||||
self::$move = array($k, $v['move']);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
die('[连接错误] ' . $e->getMessage() . PHP_EOL);
|
||||
die('[连接错误] '. $v['host'] . $e->getMessage() . PHP_EOL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 添加下载任务
|
||||
* @param $rpcKey
|
||||
* @param string $torrent 种子元数据
|
||||
* @param string $save_path 保存路径
|
||||
* @param array $extra_options
|
||||
* @return bool
|
||||
*/
|
||||
public static function add($rpcKey, $torrent, $save_path = '', $extra_options = array())
|
||||
@@ -246,6 +264,7 @@ class AutoReseed
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 辅种或转移,总入口
|
||||
*/
|
||||
@@ -258,6 +277,7 @@ class AutoReseed
|
||||
self::wechatMessage();
|
||||
exit(self::$ExitCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* IYUUAutoReseed辅种
|
||||
*/
|
||||
@@ -273,7 +293,7 @@ class AutoReseed
|
||||
continue;
|
||||
}
|
||||
// 过滤无需辅种的客户端
|
||||
if (self::$move!==null && self::$move[0]!=$k && self::$move[1]==2) {
|
||||
if ((self::$move !== null) && (self::$move[0] != $k) && (self::$move[1] == 2)) {
|
||||
echo "clients_".$k." 根据设置无需辅种,已跳过!";
|
||||
continue;
|
||||
}
|
||||
@@ -282,7 +302,7 @@ class AutoReseed
|
||||
if (empty($hashArray)) {
|
||||
continue;
|
||||
}
|
||||
self::backup('clients_'.$k, $hashArray);
|
||||
|
||||
$infohash_Dir = $hashArray['hashString']; // 哈希目录对应字典
|
||||
unset($hashArray['hashString']);
|
||||
// 签名
|
||||
@@ -311,7 +331,7 @@ class AutoReseed
|
||||
continue;
|
||||
}
|
||||
// 判断返回值
|
||||
if (isset($res['ret']) && $res['ret']==200) {
|
||||
if (isset($res['ret']) && $res['ret'] === 200) {
|
||||
echo "clients_".$k." 辅种数据下载成功!!!".PHP_EOL.PHP_EOL;
|
||||
echo '【提醒】未配置passkey的站点都会跳过!'.PHP_EOL.PHP_EOL;
|
||||
} else {
|
||||
@@ -344,6 +364,21 @@ class AutoReseed
|
||||
// 种子页规则
|
||||
$download_page = str_replace('{}', $torrent_id, self::$sites[$sid]['download_page']);
|
||||
|
||||
// 辅种检查规则 2020年12月12日新增
|
||||
if (!is_array(self::$sites[$sid]['reseed_check'])) {
|
||||
// 初始化
|
||||
if (!empty(self::$sites[$sid]['reseed_check'])) {
|
||||
$reseed_check = explode(',', self::$sites[$sid]['reseed_check']);
|
||||
array_walk($reseed_check, function (&$v, $k) {
|
||||
$v = trim($v);
|
||||
});
|
||||
self::$sites[$sid]['reseed_check'] = $reseed_check;
|
||||
} else {
|
||||
self::$sites[$sid]['reseed_check'] = [];
|
||||
}
|
||||
}
|
||||
$reseed_check = self::$sites[$sid]['reseed_check']; // 赋值
|
||||
|
||||
// 临时种子连接(会写入辅种日志)
|
||||
$_url = $protocol . self::$sites[$sid]['base_url']. '/' .$download_page;
|
||||
/**
|
||||
@@ -355,7 +390,7 @@ class AutoReseed
|
||||
/**
|
||||
* 种子推送方式区分
|
||||
*/
|
||||
if (in_array($siteName, self::$cookieCheck)) {
|
||||
if (in_array('cookie', $reseed_check)) {
|
||||
// 特殊站点:种子元数据推送给下载器
|
||||
$reseedPass = false; // 标志:跳过辅种
|
||||
$cookie = trim($configALL[$siteName]['cookie']);
|
||||
@@ -614,6 +649,7 @@ class AutoReseed
|
||||
}
|
||||
// 种子目录:脚本要能够读取到
|
||||
$path = self::$links[$k]['BT_backup'];
|
||||
$torrentPath = '';
|
||||
// 待删除种子
|
||||
$torrentDelete = '';
|
||||
// 获取种子原文件的实际路径
|
||||
@@ -637,7 +673,6 @@ class AutoReseed
|
||||
$torrentDelete = $info_hash;
|
||||
break;
|
||||
default:
|
||||
# code...
|
||||
break;
|
||||
}
|
||||
if (!is_file($torrentPath)) {
|
||||
@@ -659,7 +694,6 @@ class AutoReseed
|
||||
if (isset($configALL['default']['move']['skip_check']) && $configALL['default']['move']['skip_check'] === 1) {
|
||||
$extra_options['skip_checking'] = "true"; //转移成功,跳校验
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
// 添加转移任务:成功返回:true
|
||||
@@ -702,20 +736,19 @@ class AutoReseed
|
||||
$torrent_id = $torrent['torrent_id'];
|
||||
$info_hash = $torrent['info_hash'];
|
||||
$siteName = self::$sites[$sid]['site'];
|
||||
|
||||
// passkey检测 [优先检查passkey,排除用户没有的站点]
|
||||
if (empty($configALL[$siteName]) || empty($configALL[$siteName]['passkey'])) {
|
||||
//echo '-------因当前' .$siteName. "站点未设置passkey,已跳过!!".PHP_EOL.PHP_EOL;
|
||||
$reseed_check = self::$sites[$sid]['reseed_check'];
|
||||
if ($reseed_check && is_array($reseed_check)) {
|
||||
// 循环检查所有项目
|
||||
foreach ($reseed_check as $item) {
|
||||
echo "clients_".$k."正在循环检查所有项目... {$siteName}".PHP_EOL;
|
||||
$item = ($item === 'uid' ? 'id' : $item); // 兼容性处理
|
||||
if (empty($configALL[$siteName]) || empty($configALL[$siteName][$item])) {
|
||||
$msg = '-------因当前' .$siteName. "站点未设置".$item.",已跳过!!".PHP_EOL.PHP_EOL;
|
||||
echo $msg;
|
||||
self::$wechatMsg['reseedSkip']++;
|
||||
return false;
|
||||
} else {
|
||||
echo "clients_".$k."正在辅种... {$siteName}".PHP_EOL;
|
||||
}
|
||||
// cookie检测
|
||||
if (in_array($siteName, self::$cookieCheck) && empty($configALL[$siteName]['cookie'])) {
|
||||
echo '-------因当前' .$siteName. '站点未设置cookie,已跳过!!' .PHP_EOL.PHP_EOL;
|
||||
self::$wechatMsg['reseedSkip']++;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// 重复做种检测
|
||||
if (isset($infohash_Dir[$info_hash])) {
|
||||
@@ -725,7 +758,7 @@ class AutoReseed
|
||||
}
|
||||
// 历史添加检测
|
||||
if (is_file(self::$cacheHash . $info_hash.'.txt')) {
|
||||
echo '-------当前种子上次辅种已成功添加,已跳过! '.$_url.PHP_EOL.PHP_EOL;
|
||||
echo '-------当前种子上次辅种已成功添加【'.self::$cacheHash . $info_hash.'】,已跳过! '.$_url.PHP_EOL.PHP_EOL;
|
||||
self::$wechatMsg['reseedPass']++;
|
||||
return false;
|
||||
}
|
||||
@@ -795,14 +828,16 @@ class AutoReseed
|
||||
}
|
||||
return empty($infohash_Dir) ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 实际路径与相对路径之间互相转换
|
||||
* @param string $path
|
||||
* @return string | null string转换成功
|
||||
*/
|
||||
private static function pathReplace($path = '')
|
||||
{
|
||||
global $configALL;
|
||||
$type = $configALL['default']['move']['type'];
|
||||
$type = intval($configALL['default']['move']['type']);
|
||||
$pathArray = $configALL['default']['move']['path'];
|
||||
$path = rtrim($path, DIRECTORY_SEPARATOR); // 提高Windows转移兼容性
|
||||
switch ($type) {
|
||||
@@ -844,11 +879,13 @@ class AutoReseed
|
||||
global $configALL;
|
||||
$path = rtrim($path, DIRECTORY_SEPARATOR); // 提高Windows转移兼容性
|
||||
// 转移过滤器、选择器 David/2020年7月11日
|
||||
$path_filter = isset($configALL['default']['move']['path_filter']) && !empty($configALL['default']['move']['path_filter']) ? $configALL['default']['move']['path_filter'] : null;
|
||||
$path_selector = isset($configALL['default']['move']['path_selector']) && !empty($configALL['default']['move']['path_selector']) ? $configALL['default']['move']['path_selector'] : null;
|
||||
$path_filter = !empty($configALL['default']['move']['path_filter']) ? $configALL['default']['move']['path_filter'] : null;
|
||||
$path_selector = !empty($configALL['default']['move']['path_selector']) ? $configALL['default']['move']['path_selector'] : null;
|
||||
if (\is_null($path_filter) && \is_null($path_selector)) {
|
||||
return false;
|
||||
} elseif (\is_null($path_filter)) {
|
||||
}
|
||||
|
||||
if (\is_null($path_filter)) {
|
||||
//选择器
|
||||
if (\is_array($path_selector)) {
|
||||
foreach ($path_selector as $pathName) {
|
||||
@@ -902,20 +939,13 @@ class AutoReseed
|
||||
private static function getTorrentUrl($site = '', $url = '')
|
||||
{
|
||||
global $configALL;
|
||||
// 注入合作站种子的URL规则
|
||||
$url = self::getRecommendTorrentUrl($site, $url);
|
||||
// 兼容旧配置,进行补全
|
||||
if (isset($configALL[$site]['passkey']) && $configALL[$site]['passkey']) {
|
||||
if (empty($configALL[$site]['url_replace'])) {
|
||||
$configALL[$site]['url_replace'] = array('{passkey}' => trim($configALL[$site]['passkey']));
|
||||
}
|
||||
if (empty($configALL[$site]['url_join'])) {
|
||||
$configALL[$site]['url_join'] = array();
|
||||
if (in_array($site, array('m-team','mocat','hdbd'))) {
|
||||
if (isset($configALL[$site]['ip_type'])) {
|
||||
$configALL[$site]['url_join'][] = $configALL[$site]['ip_type'].'=1';
|
||||
}
|
||||
$configALL[$site]['url_join'][] = 'https=1';
|
||||
}
|
||||
}
|
||||
}
|
||||
// 通用操作:替换
|
||||
if (isset($configALL[$site]['url_replace']) && $configALL[$site]['url_replace']) {
|
||||
@@ -927,6 +957,110 @@ class AutoReseed
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* 注入合作站种子的URL规则
|
||||
* @param string $site
|
||||
* @param string $url
|
||||
* @return string
|
||||
*/
|
||||
private static function getRecommendTorrentUrl($site = '', $url = '')
|
||||
{
|
||||
global $configALL;
|
||||
if (in_array($site, self::$recommend)) {
|
||||
$now = time();
|
||||
$uid = isset($configALL[$site]['id']) ? $configALL[$site]['id'] : $now;
|
||||
$pk = isset($configALL[$site]['passkey']) ? trim($configALL[$site]['passkey']) : $now;
|
||||
$hash = md5(trim($pk));
|
||||
|
||||
$signString = self::getDownloadTorrentSign($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':
|
||||
// 兼容旧版本的IYUU
|
||||
if (isset($configALL[$site]['id']) && $configALL[$site]['id']) {
|
||||
$url = str_replace('passkey={passkey}', 'uid={uid}&hash={hash}', $url);
|
||||
}
|
||||
// TODO... 注入流控规则 60S/20pcs、3600S/100pcs
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// 注入替换规则
|
||||
$replace = [
|
||||
'{uid}' => $uid,
|
||||
'{hash}'=> $hash,
|
||||
'{passkey}' => $pk, // 兼容旧版本的IYUU
|
||||
];
|
||||
$configALL[$site]['url_replace'] = $replace;
|
||||
|
||||
// 注入拼接规则
|
||||
if (empty($configALL[$site]['url_join'])) {
|
||||
$configALL[$site]['runtime_url_join'] = []; //保存用户配置规则
|
||||
$configALL[$site]['url_join'] = array($signString);
|
||||
} else {
|
||||
// 用户已配置过url_join 1.先保存用户原来的规则;2.恢复规则;3.注入签名规则
|
||||
if (!isset($configALL[$site]['runtime_url_join'])) {
|
||||
$configALL[$site]['runtime_url_join'] = $configALL[$site]['url_join']; //保存用户配置规则
|
||||
} else {
|
||||
$configALL[$site]['url_join'] = $configALL[$site]['runtime_url_join']; //恢复用户配置规则
|
||||
}
|
||||
$configALL[$site]['url_join'][] = $signString;
|
||||
}
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取下载合作站种子的签名
|
||||
* @descr 检查签名有效期,如果过期将获取新的签名
|
||||
* @param string $site
|
||||
* @return string
|
||||
*/
|
||||
private static function getDownloadTorrentSign($site = '')
|
||||
{
|
||||
global $configALL;
|
||||
$signKEY = 'signString';
|
||||
$expireKEY = 'signExpire';
|
||||
if (isset($configALL[$site][$signKEY]) && isset($configALL[$site][$expireKEY]) && ($configALL[$site][$expireKEY] > time())) {
|
||||
return $configALL[$site][$signKEY]; // 缓存在有效期内,直接返回
|
||||
}
|
||||
|
||||
// 请求IYUU获取签名
|
||||
$data = [
|
||||
'sign' => $configALL['iyuu.cn'],
|
||||
'timestamp' => time(),
|
||||
'version' => self::VER,
|
||||
'site' => $site,
|
||||
'uid' => isset($configALL[$site]['id']) ? $configALL[$site]['id'] : 0,
|
||||
];
|
||||
$res = self::$curl->get(self::$apiUrl . self::$endpoints['getSign'], $data);
|
||||
$ret = json_decode($res->response, true);
|
||||
$signString = '';
|
||||
if (isset($ret['ret']) && $ret['ret'] === 200) {
|
||||
if (isset($ret['data'][$signKEY]) && isset($ret['data']['expire'])) {
|
||||
$signString = $ret['data'][$signKEY];
|
||||
$expire = $ret['data']['expire'];
|
||||
$configALL[$site][$signKEY] = $signString;
|
||||
$configALL[$site][$expireKEY] = time() + $expire - 60; // 提前60秒过期
|
||||
}
|
||||
} else {
|
||||
echo $site.' 很抱歉,请求IYUU辅种签名时失败啦,请稍后重新尝试辅种!详情:'.$ret['msg'].PHP_EOL;
|
||||
}
|
||||
|
||||
return $signString;
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信模板消息拼接方法
|
||||
* @return string 发送情况,json
|
||||
@@ -935,7 +1069,7 @@ class AutoReseed
|
||||
{
|
||||
global $configALL;
|
||||
if (isset($configALL['notify_on_change']) && $configALL['notify_on_change'] && self::$wechatMsg['reseedSuccess'] == 0 && self::$wechatMsg['reseedError'] == 0) {
|
||||
return;
|
||||
return '';
|
||||
}
|
||||
$br = PHP_EOL;
|
||||
$text = 'IYUU自动辅种-统计报表';
|
||||
|
@@ -103,6 +103,7 @@ class IFile
|
||||
* @param String $path 路径
|
||||
* @param int $chmod 文件夹权限
|
||||
* @note $chmod 参数不能是字符串(加引号),否则linux会出现权限问题
|
||||
* @return bool
|
||||
*/
|
||||
public static function mkdir($path, $chmod=0777)
|
||||
{
|
||||
@@ -113,7 +114,7 @@ class IFile
|
||||
* @brief 复制文件
|
||||
* @param String $from 源文件路径
|
||||
* @param String $to 目标文件路径
|
||||
* @param String $mod 操作模式,c:复制(默认); x:剪切(删除$from文件)
|
||||
* @param String $mode 操作模式,c:复制(默认); x:剪切(删除$from文件)
|
||||
* @return bool 操作结果 true:成功; false:失败;
|
||||
*/
|
||||
public static function copy($from, $to, $mode = 'c')
|
||||
@@ -178,7 +179,7 @@ class IFile
|
||||
/**
|
||||
* @brief 获取文件类型
|
||||
* @param String $fileName 文件名
|
||||
* @return String $filetype 文件类型
|
||||
* @return String|array $filetype 文件类型
|
||||
* @note 如果文件不存在,返回false,如果文件后缀名不在识别列表之内,返回NULL,对于docx及elsx格式文档识别在会出现识别为ZIP格式的错误,这是office2007的bug目前尚未修复,请谨慎使用
|
||||
*/
|
||||
public static function getFileType($fileName)
|
||||
|
@@ -8,93 +8,94 @@ use Curl\Curl;
|
||||
*/
|
||||
class Oauth
|
||||
{
|
||||
// 合作的站点
|
||||
public static $sites = ['ourbits','hddolby','hdhome','pthome','moecat'];
|
||||
// 爱语飞飞token
|
||||
public static $token = '';
|
||||
// 合作站点用户id
|
||||
public static $user_id = 0;
|
||||
// 合作站点密钥
|
||||
public static $passkey = '';
|
||||
// 合作站名字
|
||||
public static $site = '';
|
||||
// 登录缓存路径
|
||||
public static $SiteLoginCache = ROOT_PATH.DS.'config'.DS.'siteLoginCache_{}.json';
|
||||
const SiteLoginCache = ROOT_PATH.DS.'config'.DS.'siteLoginCache_{}.json';
|
||||
/**
|
||||
* 从配置文件内读取爱语飞飞token作为鉴权参数
|
||||
*/
|
||||
public static function getSign()
|
||||
{
|
||||
global $configALL;
|
||||
// 爱语飞飞
|
||||
$token = isset($configALL['iyuu.cn']) && $configALL['iyuu.cn'] ? $configALL['iyuu.cn'] : '';
|
||||
$token = empty($configALL['iyuu.cn']) ? '' : $configALL['iyuu.cn'];
|
||||
if (empty($token) || strlen($token) < 46) {
|
||||
echo "缺少辅种接口请求参数:爱语飞飞token \n";
|
||||
echo "请访问https://iyuu.cn 用微信扫码申请,并填入配置文件config.php内。\n\n";
|
||||
echo "缺少辅种接口请求参数:爱语飞飞token ".PHP_EOL;
|
||||
echo "请访问https://iyuu.cn 用微信扫码申请,并填入配置文件config.php内。".PHP_EOL.PHP_EOL;
|
||||
exit(1);
|
||||
}
|
||||
return $token;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户注册与登录
|
||||
* 作用:在服务器端实现微信用户与合作站点用户id的关联
|
||||
* 参数:爱语飞飞token + 合作站点用户id + sha1(合作站点密钥passkey) + 合作站点标识
|
||||
* @param string $apiUrl
|
||||
* @param array $sites
|
||||
* @return bool
|
||||
* @throws \ErrorException
|
||||
*/
|
||||
public static function login($apiUrl = '', $sites = array())
|
||||
{
|
||||
global $configALL;
|
||||
// 云端下发合作的站点标识
|
||||
self::$sites = $sites ? $sites : self::$sites;
|
||||
if (empty($sites)) {
|
||||
die('云端下发合作站点信息失败,请稍后重试');
|
||||
}
|
||||
$_sites = array_column($sites, 'site');
|
||||
$ret = false;
|
||||
self::$token = self::getSign();
|
||||
foreach (self::$sites as $name) {
|
||||
if (is_file(str_replace('{}', $name, self::$SiteLoginCache))) {
|
||||
$token = self::getSign();
|
||||
foreach ($_sites as $k => $site) {
|
||||
if (is_file(str_replace('{}', $site, self::SiteLoginCache))) {
|
||||
// 存在鉴权缓存
|
||||
$ret = true;
|
||||
continue;
|
||||
}
|
||||
if (isset($configALL[$name]['passkey']) && $configALL[$name]['passkey'] && isset($configALL[$name]['id']) && $configALL[$name]['id']) {
|
||||
self::$user_id = $configALL[$name]['id'];
|
||||
self::$passkey = sha1($configALL[$name]['passkey']); // 避免泄露用户passkey秘钥
|
||||
self::$site = $name;
|
||||
if (isset($configALL[$site]['passkey']) && $configALL[$site]['passkey'] && isset($configALL[$site]['id']) && $configALL[$site]['id']) {
|
||||
$user_id = $configALL[$site]['id'];
|
||||
$passkey = $configALL[$site]['passkey'];
|
||||
|
||||
$curl = new Curl();
|
||||
$curl->setOpt(CURLOPT_SSL_VERIFYPEER, false);
|
||||
$data = [
|
||||
'token' => self::$token,
|
||||
'id' => self::$user_id,
|
||||
'passkey'=> self::$passkey,
|
||||
'site' => self::$site,
|
||||
'token' => $token,
|
||||
'id' => $user_id,
|
||||
'passkey'=> sha1($passkey), // 避免泄露用户passkey秘钥
|
||||
'site' => $site,
|
||||
];
|
||||
$res = $curl->get($apiUrl, $data);
|
||||
p($res->response);
|
||||
|
||||
$rs = json_decode($res->response, true);
|
||||
if (isset($rs['ret']) && $rs['ret'] == 200 && isset($rs['data']['success']) && $rs['data']['success']) {
|
||||
self::setSiteLoginCache($name, $rs);
|
||||
if (isset($rs['ret']) && ($rs['ret'] === 200) && isset($rs['data']['success']) && $rs['data']['success']) {
|
||||
self::setSiteLoginCache($site, $rs);
|
||||
$ret = true;
|
||||
} else {
|
||||
$msg = isset($rs['msg']) && $rs['msg'] ? $rs['msg'] : '远端服务器无响应,请稍后重试!';
|
||||
$msg = isset($rs['data']['errmsg']) && $rs['data']['errmsg'] ? $rs['data']['errmsg'] : $msg;
|
||||
$msg = !empty($rs['msg']) ? $rs['msg'] : '远端服务器无响应,请稍后重试!';
|
||||
$msg = !empty($rs['data']['errmsg']) ? $rs['data']['errmsg'] : $msg;
|
||||
echo $msg . PHP_EOL;
|
||||
}
|
||||
} else {
|
||||
echo $name.'合作站点参数配置不完整,请同时填写passkey和用户id。' . PHP_EOL;
|
||||
echo $site.'合作站点参数配置不完整,请同时填写passkey和用户id。' . PHP_EOL;
|
||||
echo '合作站点鉴权配置,请查阅:https://www.iyuu.cn/archives/337/'. PHP_EOL. PHP_EOL;
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* 写鉴权成功缓存
|
||||
* @desc 作用:减少对服务器请求,跳过鉴权提示信息;
|
||||
* @param string $site
|
||||
* @param array $array
|
||||
* @return bool|int
|
||||
*/
|
||||
private static function setSiteLoginCache($key = '', $array = [])
|
||||
private static function setSiteLoginCache($site = '', $array = [])
|
||||
{
|
||||
$json = json_encode($array, JSON_UNESCAPED_UNICODE);
|
||||
$myfile = str_replace('{}', $key, self::$SiteLoginCache);
|
||||
$myfile = str_replace('{}', $site, self::SiteLoginCache);
|
||||
$file_pointer = @fopen($myfile, "w");
|
||||
$worldsnum = @fwrite($file_pointer, $json);
|
||||
@fclose($file_pointer);
|
||||
return $worldsnum;
|
||||
}
|
||||
}
|
||||
|
@@ -197,14 +197,14 @@ function convertToMB($from)
|
||||
|
||||
/**
|
||||
* 字节数Byte转换为KB、MB、GB、TB
|
||||
*
|
||||
* @param $num
|
||||
* @return string
|
||||
*/
|
||||
function getFilesize($num)
|
||||
{
|
||||
$p = 0;
|
||||
$format='bytes';
|
||||
if ($num>0 && $num<1024) {
|
||||
$p = 0;
|
||||
return number_format($num).' '.$format;
|
||||
}
|
||||
if ($num>=1024 && $num<pow(1024, 2)) {
|
||||
@@ -393,8 +393,9 @@ function sign($timestamp)
|
||||
|
||||
/**
|
||||
* @brief 分离token中的用户uid
|
||||
* token算法:IYUU + uid + T + sha1(openid+time+盐)
|
||||
* @desc token算法:IYUU + uid + T + sha1(openid+time+盐)
|
||||
* @param string $token 用户请求token
|
||||
* @return bool|string
|
||||
*/
|
||||
function getUid($token)
|
||||
{
|
||||
|
@@ -45,7 +45,7 @@ return array(
|
||||
'host' => 'http://127.0.0.1:8083',
|
||||
'username' => 'admin',
|
||||
'password' => '',
|
||||
'root_folder'=> 1, // 0不创建根目录,1创建根目录(下载器默认1)
|
||||
'root_folder'=> 1, // 创建多文件子目录:0不创建,1创建(下载器默认1)【此处必须与下载器真实配置相同,否则添加任务不会校验!】
|
||||
'BT_backup' => '/BT_backup', // 移动做种:必须配置,Linux搜索方法:find / -name BT_backup
|
||||
'move' => 0, // 0不移动,1移动并辅种,2移动且只在当前客户端辅种
|
||||
),
|
||||
@@ -99,7 +99,7 @@ return array(
|
||||
* 以下为各站点的独立配置(互不影响、互不冲突)
|
||||
* 自动辅种:需要配置各站的passkey(没有配置passkey的站点会自动跳过)
|
||||
*/
|
||||
// ourbits
|
||||
// 【合作站点用户鉴权】ourbits
|
||||
'ourbits' => array(
|
||||
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
|
||||
'cookie' => '',
|
||||
@@ -125,12 +125,14 @@ return array(
|
||||
),
|
||||
|
||||
),
|
||||
// hddolby
|
||||
// 【合作站点用户鉴权】hddolby
|
||||
'hddolby' => array(
|
||||
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
|
||||
'cookie' => '',
|
||||
// 如果需要自动辅种,必须配置
|
||||
'passkey' => '',
|
||||
// 如果需要辅种,必须配置
|
||||
'rss' => '',
|
||||
'id' => 0, // 用户ID(不是用户名)
|
||||
'url_replace' => array(),
|
||||
'url_join' => array(),
|
||||
@@ -139,12 +141,14 @@ return array(
|
||||
'sleep' => 5, // 最少休眠5秒
|
||||
),
|
||||
),
|
||||
// hdhome
|
||||
// 【合作站点用户鉴权】hdhome
|
||||
'hdhome' => array(
|
||||
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
|
||||
'cookie' => '',
|
||||
// 如果需要自动辅种,必须配置
|
||||
'passkey' => '',
|
||||
// 如果需要辅种,必须配置
|
||||
'rss' => '',
|
||||
'id' => 0, // 用户ID(不是用户名)
|
||||
'url_replace' => array(),
|
||||
'url_join' => array(),
|
||||
@@ -153,12 +157,14 @@ return array(
|
||||
'sleep' => 5, // 最少休眠5秒
|
||||
),
|
||||
),
|
||||
// PTHome
|
||||
// 【合作站点用户鉴权】PTHome
|
||||
'pthome' => array(
|
||||
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
|
||||
'cookie' => '',
|
||||
// 如果需要自动辅种,必须配置
|
||||
'passkey' => '',
|
||||
// 如果需要辅种,必须配置
|
||||
'rss' => '',
|
||||
'id' => 0, // 用户ID(不是用户名)
|
||||
'url_replace' => array(),
|
||||
'url_join' => array(),
|
||||
@@ -167,22 +173,25 @@ return array(
|
||||
'sleep' => 5, // 最少休眠5秒
|
||||
),
|
||||
),
|
||||
// MoeCat
|
||||
'moecat' => array(
|
||||
// 【合作站点用户鉴权】chdbits
|
||||
'chdbits' => array(
|
||||
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
|
||||
'cookie' => '',
|
||||
// 如果需要自动辅种,必须配置
|
||||
'passkey' => '',
|
||||
'id' => 0, // 用户ID(不是用户名)
|
||||
'url_replace' => array(),
|
||||
'url_join' => array(
|
||||
//'ipv6=1', // 种子Tracker的IP地址选择 可选:ipv4,ipv6
|
||||
'https=1',
|
||||
),
|
||||
'limitRule' => array(
|
||||
'count' => 20, // 每次辅种20个
|
||||
'sleep' => 15, // 最少休眠15秒
|
||||
'url_join' => array(),
|
||||
),
|
||||
// HDAI
|
||||
'hdai' => array(
|
||||
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
|
||||
'cookie' => '',
|
||||
// 如果需要自动辅种,必须配置
|
||||
'passkey' => '',
|
||||
'id' => 0, // 用户ID(不是用户名)
|
||||
'url_replace' => array(),
|
||||
'url_join' => array(),
|
||||
),
|
||||
// m-team
|
||||
'm-team' => array(
|
||||
@@ -242,7 +251,7 @@ return array(
|
||||
),
|
||||
// HDSky
|
||||
'hdsky' => array(
|
||||
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
|
||||
// 如果需要自动辅种,必须配置此项
|
||||
'cookie' => '',
|
||||
// 如果需要自动辅种,必须配置
|
||||
'passkey' => '',
|
||||
@@ -278,9 +287,9 @@ return array(
|
||||
// 如果需要自动辅种,必须配置
|
||||
'passkey' => '',
|
||||
// 如果需要rss订阅,必须配置
|
||||
'rss' => '',
|
||||
'url_replace' => array(),
|
||||
'url_join' => array(),
|
||||
'rss' => '',
|
||||
),
|
||||
// nanyangpt
|
||||
'nanyangpt' => array(
|
||||
@@ -367,15 +376,6 @@ return array(
|
||||
'url_replace' => array(),
|
||||
'url_join' => array(),
|
||||
),
|
||||
// chdbits
|
||||
'chdbits' => array(
|
||||
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
|
||||
'cookie' => '',
|
||||
// 如果需要自动辅种,必须配置
|
||||
'passkey' => '',
|
||||
'url_replace' => array(),
|
||||
'url_join' => array(),
|
||||
),
|
||||
// leaguehd
|
||||
'leaguehd' => array(
|
||||
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
|
||||
@@ -646,5 +646,23 @@ return array(
|
||||
// 如果需要自动辅种,必须配置
|
||||
'passkey' => '',
|
||||
),
|
||||
// hitpt 百川
|
||||
'hitpt' => array(
|
||||
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
|
||||
'cookie' => '',
|
||||
// 如果需要自动辅种,必须配置
|
||||
'passkey' => '',
|
||||
'url_replace' => array(),
|
||||
'url_join' => array(),
|
||||
),
|
||||
// pttime PT时间
|
||||
'pttime' => array(
|
||||
// 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
|
||||
'cookie' => '',
|
||||
// 如果需要自动辅种,必须配置
|
||||
'passkey' => '',
|
||||
'url_replace' => array(),
|
||||
'url_join' => array(),
|
||||
),
|
||||
// 配置结束,后面的一行不能删除,必须保留!!!
|
||||
);
|
||||
|
@@ -19,7 +19,7 @@ ARG app_env=prod
|
||||
|
||||
ENV APP_ENV=${app_env:-"prod"} \
|
||||
TIMEZONE=${timezone:-"Asia/Shanghai"} \
|
||||
cron="0 10 * * 0"
|
||||
cron="3 */10 * * *"
|
||||
|
||||
##
|
||||
# ---------- building ----------
|
||||
@@ -27,7 +27,7 @@ ENV APP_ENV=${app_env:-"prod"} \
|
||||
|
||||
RUN set -ex \
|
||||
# change apk source repo
|
||||
&& sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/' /etc/apk/repositories \
|
||||
#&& sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/' /etc/apk/repositories \
|
||||
&& apk update \
|
||||
&& apk add --no-cache \
|
||||
# Install base packages ('ca-certificates' will install 'nghttp2-libs')
|
||||
@@ -78,9 +78,11 @@ RUN set -ex \
|
||||
php7-zip \
|
||||
# php7-zlib \
|
||||
php7-xml \
|
||||
&& git clone https://gitee.com/ledc/IYUUAutoReseed.git /var/www \
|
||||
&& cp /var/www/config/config.sample.php /var/www/config/config.php \
|
||||
&& ln -sf /var/www/config/config.php /config.php \
|
||||
&& git clone https://gitee.com/ledc/IYUUAutoReseed.git /IYUU \
|
||||
&& cp /IYUU/config/config.sample.php /IYUU/config/config.php \
|
||||
&& ln -sf /IYUU/config/config.php /config.php \
|
||||
&& cp /IYUU/docker/entrypoint.sh /entrypoint.sh \
|
||||
&& chmod -R 777 /entrypoint.sh \
|
||||
&& apk del --purge *-dev \
|
||||
&& rm -rf /var/cache/apk/* /tmp/* /usr/share/man /usr/share/php7 \
|
||||
# ---------- some config,clear work ----------
|
||||
@@ -95,7 +97,8 @@ RUN set -ex \
|
||||
# - config timezone
|
||||
&& ln -sf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \
|
||||
&& echo "${TIMEZONE}" > /etc/timezone \
|
||||
&& echo '2 */5 * * * cd /var/www && git fetch --all && git reset --hard origin/master' >> /etc/crontabs/root \
|
||||
&& echo '2 */5 * * * cd /IYUU && git fetch --all && git reset --hard origin/master' >> /etc/crontabs/root \
|
||||
#&& echo "${cron} /usr/bin/php /IYUU/iyuu.php &> /dev/null" >> /etc/crontabs/root \
|
||||
# ---------- some config work ----------
|
||||
# - ensure 'www-data' user exists(82 is the standard uid/gid for "www-data" in Alpine)
|
||||
# && addgroup -g 82 -S ${add_user} \
|
||||
@@ -105,8 +108,7 @@ RUN set -ex \
|
||||
# && chown -R ${add_user}:${add_user} /data \
|
||||
&& echo -e "\033[42;37m Build Completed :).\033[0m\n"
|
||||
|
||||
EXPOSE 9000
|
||||
# VOLUME ["/var/www", "/data"]
|
||||
WORKDIR /var/www
|
||||
|
||||
CMD ["sh", "-c", "/usr/bin/php /var/www/iyuu.php ; /usr/sbin/crond ; (crontab -l ;echo \"$cron /usr/bin/php /var/www/iyuu.php &> /dev/null\") | crontab - ; tail -f /dev/null"]
|
||||
# EXPOSE 9000
|
||||
# VOLUME ["/IYUU", "/data"]
|
||||
WORKDIR /IYUU
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
@@ -1,9 +1,10 @@
|
||||
# FROM arm64v8/alpine
|
||||
# FROM arm64v8/alpine:latest
|
||||
FROM arm64v8/alpine:3.12
|
||||
|
||||
ENV TZ Asia/Shanghai
|
||||
|
||||
ENV cron="0 9 * * 0"
|
||||
ENV cron="3 */10 * * *"
|
||||
|
||||
RUN set -ex \
|
||||
&& sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/' /etc/apk/repositories \
|
||||
@@ -16,12 +17,16 @@ RUN set -ex \
|
||||
&& git clone https://gitee.com/ledc/IYUUAutoReseed.git /IYUU \
|
||||
&& cp /IYUU/config/config.sample.php /IYUU/config/config.php \
|
||||
&& ln -sf /IYUU/config/config.php /config.php \
|
||||
&& cp /IYUU/docker/entrypoint.sh /entrypoint.sh \
|
||||
&& chmod -R 777 /entrypoint.sh \
|
||||
&& apk del --purge *-dev \
|
||||
&& rm -rf /var/cache/apk/* /tmp/* /usr/share/man \
|
||||
&& echo "${TZ}" > /etc/timezone \
|
||||
&& ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime \
|
||||
&& echo '2 */6 * * * cd /IYUU && git fetch --all && git reset --hard origin/master' >> /etc/crontabs/root
|
||||
# && echo '* * * * * echo "iyuu.cn" >/dev/null 2>&1' >> /etc/crontabs/root \
|
||||
&& echo '3 */6 * * * cd /IYUU && git fetch --all && git reset --hard origin/master' >> /etc/crontabs/root \
|
||||
# && echo "${cron} /usr/bin/php /IYUU/iyuu.php >/dev/null 2>&1" >> /etc/crontabs/root \
|
||||
&& echo -e "\033[42;37m Build Completed :).\033[0m\n"
|
||||
|
||||
WORKDIR /IYUU
|
||||
|
||||
CMD ["sh", "-c", "/usr/bin/php /IYUU/iyuu.php ; /usr/sbin/crond ; (crontab -l ;echo \"$cron /usr/bin/php /IYUU/iyuu.php &> /dev/null\") | crontab - ; tail -f /dev/null"]
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
2
docker/Arm64v8/push.sh
Normal file
2
docker/Arm64v8/push.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
docker image tag iyuu:arm64v8 iyuucn/iyuuautoreseed:arm64v8
|
||||
docker image push iyuucn/iyuuautoreseed:arm64v8
|
8
docker/entrypoint.sh
Normal file
8
docker/entrypoint.sh
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
DEFAULT_CRON="9 */6 * * *"
|
||||
cron=${cron:-$DEFAULT_CRON}
|
||||
set -e
|
||||
echo "$cron /usr/bin/php /IYUU/iyuu.php" | crontab -
|
||||
cd /IYUU && git fetch --all && git reset --hard origin/master
|
||||
/usr/bin/php /IYUU/iyuu.php
|
||||
/usr/sbin/crond -f
|
@@ -5,5 +5,4 @@ echo $pwddir
|
||||
cd $(dirname $0)
|
||||
git fetch --all
|
||||
git reset --hard origin/master
|
||||
git pull
|
||||
php ./iyuu.php
|
@@ -55,7 +55,7 @@ IYUU自动辅种工具(英文名:IYUUAutoReseed),是一款PHP语言编
|
||||
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、龙之家。
|
||||
学校、杜比、家园、天空、朋友、馒头、萌猫、我堡、猫站、铂金家、烧包、北洋、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。
|
||||
|
||||
## 运行环境
|
||||
具备PHP运行环境的所有平台,例如:Linux、Windows、MacOS!
|
||||
@@ -94,7 +94,7 @@ IYUU自动辅种工具(英文名:IYUUAutoReseed),是一款PHP语言编
|
||||
|
||||
## 需求提交/错误反馈
|
||||
|
||||
- QQ群:859882209[2000人.入门群],931954050[1000人.进阶群]
|
||||
- QQ群:859882209[2000人群],931954050[1000人群],924099912[2000人群]
|
||||
- 问答社区:http://wenda.iyuu.cn
|
||||
- 博客:https://www.iyuu.cn/
|
||||
- issues: https://gitee.com/ledc/IYUUAutoReseed/issues
|
||||
|
Reference in New Issue
Block a user