diff --git a/app/Console/Commands/Test.php b/app/Console/Commands/Test.php index bad0a107..5b84e5fa 100644 --- a/app/Console/Commands/Test.php +++ b/app/Console/Commands/Test.php @@ -101,9 +101,9 @@ public function __construct() */ public function handle() { - $torrent = Torrent::query()->find(12, ['info_hash']); - $infoHash = $torrent->info_hash; - dd($infoHash === rawurldecode("%15%24%f3%e6%91e%f6%fbT%be%3f%b8%f3%f7_%f5%f6%aa%3fv")); + $str = "1.abc.de"; + $res = explode(".", $str, 2); + dd($res); } } diff --git a/app/Filament/Resources/User/HitAndRunResource.php b/app/Filament/Resources/User/HitAndRunResource.php index 94558ec0..08211444 100644 --- a/app/Filament/Resources/User/HitAndRunResource.php +++ b/app/Filament/Resources/User/HitAndRunResource.php @@ -56,6 +56,7 @@ public static function table(Table $table): Table Tables\Columns\TextColumn::make('seedTimeRequired')->label(__('label.seed_time_required')), Tables\Columns\TextColumn::make('inspectTimeLeft')->label(__('label.inspect_time_left')), Tables\Columns\TextColumn::make('statusText')->label(__('label.status')), + Tables\Columns\TextColumn::make('created_at')->label(__('label.created_at')), ]) ->defaultSort('id', 'desc') ->filters([ diff --git a/app/Repositories/TorrentRepository.php b/app/Repositories/TorrentRepository.php index 64507426..19dbad56 100644 --- a/app/Repositories/TorrentRepository.php +++ b/app/Repositories/TorrentRepository.php @@ -132,10 +132,10 @@ public function getDetail($id, User $user) return $result; } - private function getDownloadUrl($id, array|User $user): string + public function getDownloadUrl($id, array|User $user): string { return sprintf( - '%s/download.php?downhash=%s|%s', + '%s/download.php?downhash=%s.%s', getSchemeAndHttpHost(), is_array($user) ? $user['id'] : $user->id, $this->encryptDownHash($id, $user) ); } @@ -365,6 +365,7 @@ public function decryptDownHash($downHash, $user) private function getEncryptDownHashKey($user) { + $passkey = ""; if ($user instanceof User && $user->passkey) { $passkey = $user->passkey; } elseif (is_array($user) && !empty($user['passkey'])) { @@ -372,7 +373,8 @@ private function getEncryptDownHashKey($user) } elseif (is_scalar($user)) { $user = User::query()->findOrFail(intval($user), ['id', 'passkey']); $passkey = $user->passkey; - } else { + } + if (empty($passkey)) { throw new \InvalidArgumentException("Invalid user: " . json_encode($user)); } //down hash is relative to user passkey diff --git a/public/details.php b/public/details.php index 24dc8eeb..cd64df75 100644 --- a/public/details.php +++ b/public/details.php @@ -247,7 +247,7 @@ } // ------------- end claim block ------------------// - tr($lang_details['torrent_dl_url'],sprintf('%s',$lang_details['torrent_dl_url_notice'], getSchemeAndHttpHost(), $CURUSER['id'], $torrentRep->encryptDownHash($row['id'], $CURUSER), $lang_details['torrent_dl_url_text']),1); + tr($lang_details['torrent_dl_url'],sprintf('%s',$lang_details['torrent_dl_url_notice'], $torrentRep->getDownloadUrl($id, $CURUSER), $lang_details['torrent_dl_url_text']),1); // ---------------- start subtitle block -------------------// $subTorrentIdArr = [$row['id']]; diff --git a/public/download.php b/public/download.php index 28d6e80e..01add6c0 100644 --- a/public/download.php +++ b/public/download.php @@ -9,7 +9,7 @@ function denyDownload() } $torrentRep = new \App\Repositories\TorrentRepository(); if (!empty($_REQUEST['downhash'])) { - $params = explode('|', $_REQUEST['downhash']); + $params = explode('.', $_REQUEST['downhash'], 2); if (empty($params[0]) || empty($params[1])) { die("invalid downhash, format error"); } diff --git a/public/getusertorrentlistajax.php b/public/getusertorrentlistajax.php index e3d08c89..1d723ad4 100644 --- a/public/getusertorrentlistajax.php +++ b/public/getusertorrentlistajax.php @@ -281,7 +281,7 @@ function maketable($res, $mode = 'seeding') // $res = sql_query("SELECT torrent,added,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, torrents.banned, torrents.approval_status, categories.name as catname,size,torrents.hr,image,category,seeders,leechers FROM peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='yes' ORDER BY torrents.id DESC") or sqlerr(); $fields = "torrent,added,snatched.uploaded,snatched.downloaded,snatched.seedtime,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, torrents.banned, torrents.approval_status, categories.name as catname,size,torrents.hr,image,category,seeders,leechers,snatched.userid, categories.mode as search_box_id, peers.peer_id, peers.agent, peers.port, peers.ipv4, peers.ipv6"; $tableWhere = "peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='yes'"; - $order = "torrents.id DESC"; + $order = "peers.id DESC"; break; } @@ -291,7 +291,7 @@ function maketable($res, $mode = 'seeding') // $res = sql_query("SELECT torrent,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, torrents.banned, torrents.approval_status, categories.name as catname,size,torrents.hr,image,category,seeders,leechers, torrents.added FROM peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='no' ORDER BY torrents.id DESC") or sqlerr(); $fields = "torrent,snatched.uploaded,snatched.downloaded,snatched.seedtime,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, torrents.banned, torrents.approval_status, categories.name as catname,size,torrents.hr,image,category,seeders,leechers, torrents.added,snatched.userid, categories.mode as search_box_id, peers.peer_id, peers.agent, peers.port, peers.ipv4, peers.ipv6"; $tableWhere = "peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='no'"; - $order = "torrents.id DESC"; + $order = "peers.id DESC"; break; } diff --git a/public/takeupload.php b/public/takeupload.php index 035cee81..ec8b4008 100644 --- a/public/takeupload.php +++ b/public/takeupload.php @@ -514,7 +514,7 @@ function checkTorrentDict($dict, $key, $type = null) $description ------------------------------------------------------------------------------------------------------------------------- -{$lang_takeupload_target[$langfolder_array[$i]]['mail_torrent']}{$lang_takeupload_target[$langfolder_array[$i]]['mail_here']}
+{$lang_takeupload_target[$langfolder_array[$i]]['mail_torrent']}{$lang_takeupload_target[$langfolder_array[$i]]['mail_here']}
$baseUrl/details.php?id=$id&hit=1 ------{$lang_takeupload_target[$langfolder_array[$i]]['mail_yours']} diff --git a/public/torrentrss.php b/public/torrentrss.php index 426efc4a..22d06a3b 100644 --- a/public/torrentrss.php +++ b/public/torrentrss.php @@ -240,7 +240,7 @@ function get_where($tablename = "sources", $itemname = "source", $getname = "sou } $itemurl = $url."/details.php?id=".$row['id']; if ($dllink) - $itemdlurl = $url."/download.php?id=".$row['id']."&downhash=" . rawurlencode( $user['id'] . '|'. $torrentRep->encryptDownHash($row['id'], $user)); + $itemdlurl = $torrentRep->getDownloadUrl($row['id'], $user); else $itemdlurl = $url."/download.php?id=".$row['id']; if (!empty($_GET['icat'])) $title .= "[".$row['category_name']."]"; $title .= $row['name'];