支持 passkey 下载种子

This commit is contained in:
xiaomlove
2021-06-10 12:00:51 +08:00
parent 4b5e223498
commit 08617de9a8
5 changed files with 23 additions and 6 deletions

View File

@@ -710,6 +710,8 @@ $lang_settings = array
'text_sticky_first_level_background_color_note' => '一级置顶背景颜色,不设置则无背景色。',
'row_sticky_second_level_background_color' => '二级置顶背景颜色',
'text_sticky_second_level_background_color_note' => '二级置顶背景颜色,不设置则无背景色。',
'row_download_support_passkey' => '支持 passkey 下载种子',
'text_download_support_passkey_note' => '是否支持通过 passkey 下载种子(同时也需要种子 ID。',
);
?>

View File

@@ -710,6 +710,8 @@ $lang_settings = array
'text_sticky_first_level_background_color_note' => '一級置頂背景顏色,不設置則無背景色。',
'row_sticky_second_level_background_color' => '二級置頂背景顏色',
'text_sticky_second_level_background_color_note' => '二級置頂背景顏色,不設置則無背景色。',
'row_download_support_passkey' => '支持 passkey 下載種子',
'text_download_support_passkey_note' => '是否支持通過 passkey 下載種子(同時也需要種子 ID。',
);
?>

View File

@@ -710,6 +710,8 @@ $lang_settings = array
'text_sticky_first_level_background_color_note' => 'Sticky first level bg color, it will be none if not set.',
'row_sticky_second_level_background_color' => 'Sticky second level bg color',
'text_sticky_second_level_background_color_note' => 'Sticky second level bg color, it will be none if not set.',
'row_download_support_passkey' => 'Support download by passkey',
'text_download_support_passkey_note' => 'Support download torrent file by passkey or not(also require torrent id).',
);
?>

View File

@@ -2,7 +2,7 @@
require_once("../include/bittorrent.php");
dbconn();
$torrentRep = new \App\Repositories\TorrentRepository();
if (!empty($_REQUEST['downhash'])){
if (!empty($_REQUEST['downhash'])) {
$params = explode('|', $_REQUEST['downhash']);
if (empty($params[0]) || empty($params[1])) {
die("invalid downhash, format error");
@@ -24,9 +24,18 @@ if (!empty($_REQUEST['downhash'])){
die("invalid downhash, decrpyt fail");
}
$id = $decrypted[0];
}
else
{
} elseif (get_setting('torrent.download_support_passkey') == 'yes' && !empty($_REQUEST['passkey']) && !empty($_REQUEST['id'])) {
$res = sql_query("SELECT * FROM users WHERE passkey=". sqlesc($_REQUEST['passkey'])." LIMIT 1");
$user = mysql_fetch_array($res);
if (!$user)
die("invalid passkey");
elseif ($user['enabled'] == 'no' || $user['parked'] == 'yes')
die("account disabed or parked");
$oldip = $user['ip'];
$user['ip'] = getip();
$CURUSER = $user;
$id = $_REQUEST['id'];
} else {
$id = (int)$_GET["id"];
if (!$id)
httperr();

View File

@@ -132,7 +132,8 @@ elseif($action == 'savesettings_torrent') // save account
'prorules', 'randomhalfleech','randomfree','randomtwoup','randomtwoupfree','randomtwouphalfdown','largesize', 'largepro','expirehalfleech',
'expirefree','expiretwoup','expiretwoupfree','expiretwouphalfleech', 'expirenormal','hotdays','hotseeder','halfleechbecome','freebecome',
'twoupbecome','twoupfreebecome', 'twouphalfleechbecome','normalbecome','uploaderdouble','deldeadtorrent', 'randomthirtypercentdown',
'thirtypercentleechbecome', 'expirethirtypercentleech', 'sticky_first_level_background_color', 'sticky_second_level_background_color'
'thirtypercentleechbecome', 'expirethirtypercentleech', 'sticky_first_level_background_color', 'sticky_second_level_background_color',
'download_support_passkey'
);
GetVar($validConfig);
$TORRENT = [];
@@ -595,7 +596,8 @@ elseif ($action == 'torrentsettings')
tr($lang_settings['row_sticky_first_level_background_color'],"<input type='text' name=sticky_first_level_background_color style=\"width: 100px\" value={$TORRENT['sticky_first_level_background_color']}> ".$lang_settings['text_sticky_first_level_background_color_note'], 1);
tr($lang_settings['row_sticky_second_level_background_color'],"<input type='text' name=sticky_second_level_background_color style=\"width: 100px\" value={$TORRENT['sticky_second_level_background_color']}> ".$lang_settings['text_sticky_second_level_background_color_note'], 1);
yesorno($lang_settings['row_promotion_rules'], 'prorules', $TORRENT["prorules"], $lang_settings['text_promotion_rules_note']);
yesorno($lang_settings['row_download_support_passkey'], 'download_support_passkey', $TORRENT["download_support_passkey"], $lang_settings['text_download_support_passkey_note']);
yesorno($lang_settings['row_promotion_rules'], 'prorules', $TORRENT["prorules"], $lang_settings['text_promotion_rules_note']);
tr($lang_settings['row_random_promotion'], $lang_settings['text_random_promotion_note_one']."<ul><li><input type='text' style=\"width: 50px\" name=randomhalfleech value='".(isset($TORRENT["randomhalfleech"]) ? $TORRENT["randomhalfleech"] : 5 )."'>".$lang_settings['text_halfleech_chance_becoming']."</li><li><input type='text' style=\"width: 50px\" name=randomfree value='".(isset($TORRENT["randomfree"]) ? $TORRENT["randomfree"] : 2 )."'>".$lang_settings['text_free_chance_becoming']."</li><li><input type='text' style=\"width: 50px\" name=randomtwoup value='".(isset($TORRENT["randomtwoup"]) ? $TORRENT["randomtwoup"] : 2 )."'>".$lang_settings['text_twoup_chance_becoming']."</li><li><input type='text' style=\"width: 50px\" name=randomtwoupfree value='".(isset($TORRENT["randomtwoupfree"]) ? $TORRENT["randomtwoupfree"] : 1 )."'>".$lang_settings['text_freetwoup_chance_becoming']."</li><li><input type='text' style=\"width: 50px\" name=randomtwouphalfdown value='".(isset($TORRENT["randomtwouphalfdown"]) ? $TORRENT["randomtwouphalfdown"] : 0 )."'>".$lang_settings['text_twouphalfleech_chance_becoming']."</li><li><input type='text' style=\"width: 50px\" name=randomthirtypercentdown value='".(isset($TORRENT["randomthirtypercentdown"]) ? $TORRENT["randomthirtypercentdown"] : 0 )."'>".$lang_settings['text_thirtypercentleech_chance_becoming']."</li></ul>".$lang_settings['text_random_promotion_note_two'], 1);
tr($lang_settings['row_large_torrent_promotion'], $lang_settings['text_torrent_larger_than']."<input type='text' style=\"width: 50px\" name=largesize value='".(isset($TORRENT["largesize"]) ? $TORRENT["largesize"] : 20 )."'>".$lang_settings['text_gb_promoted_to']."<select name=largepro>".promotion_selection((isset($TORRENT['largepro']) ? $TORRENT['largepro'] : 2), 1)."</select>".$lang_settings['text_by_system_upon_uploading']."<br />".$lang_settings['text_large_torrent_promotion_note'], 1);
tr($lang_settings['row_promotion_timeout'], $lang_settings['text_promotion_timeout_note_one']."<ul>