Updating tracker list

This commit is contained in:
Dessalines 2018-11-29 10:40:25 -07:00
parent 5720c34296
commit 6216f7f59c
2 changed files with 18 additions and 7 deletions

View File

@ -123,7 +123,7 @@ export class Search extends Component<any, State> {
{moment(torrent.created_unix * 1000).fromNow()} {moment(torrent.created_unix * 1000).fromNow()}
</td> </td>
<td class="text-right"> <td class="text-right">
<a data-balloon="Magnet link" data-balloon-pos="left" class="btn btn-sm" href={magnetLink(torrent.infohash)}> <a data-balloon="Magnet link" data-balloon-pos="left" class="btn btn-sm" href={magnetLink(torrent.infohash, torrent.name)}>
<i class="fas fa-fw fa-magnet"></i> <i class="fas fa-fw fa-magnet"></i>
</a> </a>
<a data-balloon="Report Torrent" data-balloon-pos="left" class="btn btn-sm d-none d-md-inline" href={`https://gitlab.com/dessalines/torrents.csv/issues/new?issue[assignee_id]=&issue[milestone_id]=&issue[title]=Report%20Torrent%20infohash%20${torrent.infohash}`}> <a data-balloon="Report Torrent" data-balloon-pos="left" class="btn btn-sm d-none d-md-inline" href={`https://gitlab.com/dessalines/torrents.csv/issues/new?issue[assignee_id]=&issue[milestone_id]=&issue[title]=Report%20Torrent%20infohash%20${torrent.infohash}`}>

View File

@ -1,11 +1,22 @@
import { Results, Torrent } from './interfaces'; import { Results, Torrent } from './interfaces';
export function magnetLink(infohash: string): string { export function magnetLink(infohash: string, name: string): string {
return "magnet:?xt=urn:btih:" + infohash + return `magnet:?xt=urn:btih:${infohash}&dn=${name}${trackerListToUrl(trackerList)})}`;
"&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969%2Fannounce" + }
"&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce" +
"&tr=udp%3A%2F%2Ftracker.internetwarriors.net%3A1337%2Fannounce" + let trackerList: Array<string> = [
"&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80" "udp://tracker.coppersurfer.tk:6969/announce",
"udp://tracker.opentrackr.org:1337/announce",
"udp://tracker.internetwarriors.net:1337/announce",
"udp://9.rarbg.to:2710/announce",
"udp://exodus.desync.com:6969/announce",
"udp://tracker1.itzmx.com:8080/announce",
"http://tracker3.itzmx.com:6961/announce",
"udp://explodie.org:6969/announce"
];
function trackerListToUrl(trackerList: Array<string>): string {
return trackerList.map(t => "&tr=" + t).join("");
} }
export function humanFileSize(bytes, si): string { export function humanFileSize(bytes, si): string {