mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 12:30:49 +08:00
downhash use dot instead of solid line
This commit is contained in:
@@ -101,9 +101,9 @@ class Test extends Command
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ class HitAndRunResource extends Resource
|
||||
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([
|
||||
|
||||
@@ -132,10 +132,10 @@ class TorrentRepository extends BaseRepository
|
||||
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 @@ class TorrentRepository extends BaseRepository
|
||||
|
||||
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 @@ class TorrentRepository extends BaseRepository
|
||||
} 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
|
||||
|
||||
Reference in New Issue
Block a user