Skip to content

Commit

Permalink
Merge pull request #1106 from PyR8zdl/how-do-they-work
Browse files Browse the repository at this point in the history
Adds magnet support
  • Loading branch information
HDVinnie authored Feb 1, 2020
2 parents bd99b45 + c0c7d0a commit 7b66378
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
12 changes: 12 additions & 0 deletions config/torrent.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,16 @@
*/

'comment' => 'This torrent was downloaded from UNIT3D',

/*
|--------------------------------------------------------------------------
| Magnet
|--------------------------------------------------------------------------
|
| Enable/Disable magnet links
|
*/

'magnet' => 0,

];
1 change: 1 addition & 0 deletions resources/lang/en/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
'disable' => 'Disable',
'doubleup_activated' => 'Global Double Upload Mode Activated',
'download' => 'Download',
'magnet' => 'Magnet',
'edit' => 'Edit',
'edit-your-comment' => 'Edit your Comment',
'email' => 'E-mail',
Expand Down
16 changes: 16 additions & 0 deletions resources/views/torrent/results.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,29 @@ class="torrent-poster-img-small show-poster" alt="@lang('torrent.poster')">
<i class="{{ config('other.font-awesome') }} fa-download"></i>
</button>
</a>
@if (config('torrent.magnet') == 1)
<a href="magnet:?dn={{ $torrent->name }}&xt=urn:btih:{{ $torrent->info_hash }}&as={{ route('torrent.download.rsskey', ['id' => $torrent->id, 'rsskey' => $user->rsskey ]) }}&tr={{ route('announce', ['passkey' => $user->passkey]) }}&xl={{ $torrent->size }}">
<button class="btn btn-primary btn-circle" type="button" data-toggle="tooltip"
data-original-title="@lang('common.magnet')">
<i class="{{ config('other.font-awesome') }} fa-magnet"></i>
</button>
</a>
@endif
@else
<a href="{{ route('download', ['id' => $torrent->id]) }}">
<button class="btn btn-primary btn-circle" type="button" data-toggle="tooltip"
data-original-title="@lang('common.download')">
<i class="{{ config('other.font-awesome') }} fa-download"></i>
</button>
</a>
@if (config('torrent.magnet') == 1)
<a href="magnet:?dn={{ $torrent->name }}&xt=urn:btih:{{ $torrent->info_hash }}&as={{ route('torrent.download.rsskey', ['id' => $torrent->id, 'rsskey' => $user->rsskey ]) }}&tr={{ route('announce', ['passkey' => $user->passkey]) }}&xl={{ $torrent->size }}">
<button class="btn btn-primary btn-circle" type="button" data-toggle="tooltip"
data-original-title="@lang('common.magnet')">
<i class="{{ config('other.font-awesome') }} fa-magnet"></i>
</button>
</a>
@endif
@endif

<span data-toggle="tooltip" data-original-title="Bookmark" id="torrentBookmark{{ $torrent->id }}"
Expand Down
14 changes: 14 additions & 0 deletions resources/views/torrent/torrent.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,26 @@ class="l-breadcrumb-item-link">
<i class='{{ config("other.font-awesome") }} fa-download'></i> @lang('common.download')
</span>
</a>
@if (config('torrent.magnet') == 1)
<a href="magnet:?dn={{ $torrent->name }}&xt=urn:btih:{{ $torrent->info_hash }}&as={{ route('torrent.download.rsskey', ['id' => $torrent->id, 'rsskey' => $user->rsskey ]) }}&tr={{ route('announce', ['passkey' => $user->passkey]) }}&xl={{ $torrent->size }}" role="button" class="btn btn-labeled btn-success">
<span class='btn-label'>
<i class='{{ config("other.font-awesome") }} fa-magnet'></i> @lang('common.magnet')
</span>
</a>
@endif
@else
<a href="{{ route('download', ['id' => $torrent->id]) }}" role="button" class="btn btn-labeled btn-success">
<span class='btn-label'>
<i class='{{ config("other.font-awesome") }} fa-download'></i> @lang('common.download')
</span>
</a>
@if (config('torrent.magnet') == 1)
<a href="magnet:?dn={{ $torrent->name }}&xt=urn:btih:{{ $torrent->info_hash }}&as={{ route('torrent.download.rsskey', ['id' => $torrent->id, 'rsskey' => $user->rsskey ]) }}&tr={{ route('announce', ['passkey' => $user->passkey]) }}&xl={{ $torrent->size }}" role="button" class="btn btn-labeled btn-success">
<span class='btn-label'>
<i class='{{ config("other.font-awesome") }} fa-magnet'></i> @lang('common.magnet')
</span>
</a>
@endif
@endif

@if ($torrent->tmdb != 0)
Expand Down

0 comments on commit 7b66378

Please sign in to comment.