downhash use dot instead of solid line

This commit is contained in:
xiaomlove
2024-12-24 01:10:48 +08:00
parent 2ca703c8df
commit d8ce2bd638
8 changed files with 15 additions and 12 deletions

View File

@@ -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);
}
}

View File

@@ -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([

View File

@@ -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