diff --git a/README.md b/README.md index ff2412a..0716c91 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -# simpletracker +# Simpletracker (Bootstrap) `simpletracker` is a minimal implementation of a private BitTorrent tracker, written in PHP. It supports both the PostgreSQL and MySQL backends. Features include @@ -33,3 +33,6 @@ The code has been tested on an Arch Linux server, using nginx (1.10.1), and both MySQL (10.1.18-MariaDB) and PostgreSQL (9.5.4). Users have also reported the code working on Windows. Your mileage may vary. +## What's different about this version? +- Bootstrap compatible +- Fixed bugs diff --git a/serve/css/style.css b/serve/css/style.css deleted file mode 100644 index 9527e96..0000000 --- a/serve/css/style.css +++ /dev/null @@ -1,285 +0,0 @@ -a, pre, tt { - word-wrap: break-word; -} -footer, li a { - text-align: center; -} -.submit, .text { - -webkit-appearance: none; -} -body { - font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; - margin: 0; - background-color: #eee; -} -h1 { - margin: 0 0 .5em; - font-size: 1.8em; - font-weight: 400; -} -a { - color: #03a9f4; - text-decoration: unset; -} -a:hover { - color: #47c0f7; -} -a:active { - color: #2196f3; -} -p { - margin: .3em 0; -} -footer { - color: #777; - margin: 2em 0; -} -form.login { - display: grid; - color: #000; - background-color: #fff; - width: 25%; - margin: 1em auto; - border-radius: .5em; - border: .05em solid #ddd; - padding: 2em; -} -li a, tt { - color: #fff; -} -img, nav { - width: 100%; -} -img, ul { - margin: 0 auto; -} -nav { - position: fixed; - top: 0; - background-color: #333; -} -ul { - list-style-type: none; - padding: 0; - width: 75%; - overflow: hidden; -} -li { - float: left; -} -li a { - display: block; - padding: 1em 1.2em; - text-decoration: none; -} -li a:hover { - background-color: #111; -} -tt { - background-color: #222; - padding: .3em .5em; - border-radius: .3em; - line-height: 2em; - letter-spacing: .03em; -} -pre { - color: #000; - background-color: #eee; - border: .1em solid #aaa; - padding: .5em; -} -pre, tt { - font-family: "Courier New", Courier, monospace; - font-size: .8em; -} -#torrents { - margin: 5em auto 0; - width: 75%; - border-collapse: collapse; - border-spacing: 0; - text-align: left; -} -.center, .submit { - text-align: center; -} -#torrents th { - color: #fff; - background-color: #444; - border: .1em solid #000; -} -#torrents tr:nth-child(odd) { - background-color: #fff; -} -#torrents tr:nth-child(even) { - background-color: #f7f7f7; -} -#torrents tr:hover { - background-color: #e6e6e6; -} -#torrents td, th { - margin: 0; - padding: .9em; - border: .1em solid #ddd; - color: #000; -} -.table { - overflow-x: auto; -} -.nav li.icon { - display: none; -} -.container, .submit { - display: inline-block; -} -.right { - float: right; -} -.info { - color: #000; - background-color: #fff; - width: 50%; - margin: 5em auto 0; - border-radius: .3em; - border: .05em solid #ddd; - padding: 2em; -} -input.submit { - height: 2.2em; -} -.submit { - color: #fff; - background-color: #28d; - border: .05em solid #169; - border-radius: 0; - width: 7em; - height: 1.5em; - margin-top: .5em; - padding: .3em; - font-size: 18px; - font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; - text-decoration: unset; - vertical-align: middle; -} -.submit:hover { - cursor: pointer; - color: #fff; - background-color: #4af; - border-color: #28c; -} -.submit:active { - cursor: pointer; - background-color: #17c; - border-color: #157; -} -.text { - font-size: 1em; - padding: .5em; - border: .05em solid #222; - border-radius: 0; -} -.text:focus { - outline: #43e; - border-color: #432; -} -.good { - color: #1bab52; -} -.bad { - color: #ab291b; -} -.notification { - margin: 10px 0; -} -.loginbox, .text, textarea { - width: 100%; - margin-bottom: .5em; - box-sizing: border-box; -} -.container { - position: relative; - padding-left: 35px; - margin-bottom: 12px; - cursor: pointer; - font-size: 22px; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} -.container input { - position: absolute; - opacity: 0; - cursor: pointer; - height: 0; - width: 0; -} -.checkmark { - position: absolute; - top: 0; - left: 0; - height: 25px; - width: 25px; - background-color: #eee; -} -.container:hover input~.checkmark { - background-color: #ccc; -} -.container input:checked~.checkmark { - background-color: #28d; -} -.checkmark:after { - content: ""; - position: absolute; - display: none; -} -.container input:hecked~.checkmark:after { - display: block; -} -.container .checkmark:after { - left: 9px; - top: 5px; - width: 5px; - height: 10px; - border: solid #fff; - border-width: 0 3px 3px 0; - transform: rotate(45deg); -} -@media screen and (max-width: 1024px) { - .info, .submit, form.login { - box-sizing: border-box; - } - ul { - width: 100%; - } - #torrents, .info, form.login { - width: 90%; - margin-bottom: 0; - } - .submit { - display: block; - width: 100%; - } - .right { - float: left; - } - .nav li a { - display: none; - } - .nav li.icon, .nav li.icon a { - float: right; - display: block; - } - .nav.responsive li { - position: relative; - } - .nav.responsive li.icon, .nav.responsive li.icon a { - position: absolute; - right: 0; - top: 0; - } - .nav.responsive li, .nav.responsive li a { - float: none; - display: block; - text-align: left; - } -} diff --git a/serve/download.php b/serve/download.php index e59a455..dc56f20 100644 --- a/serve/download.php +++ b/serve/download.php @@ -1,5 +1,4 @@ connect(); @@ -34,11 +33,9 @@ $modified['announce'] = $CONFIG['base_url'] . '/announce.php?username=' . urlencode($user_row['username']) . '&torrent_id=' . urlencode($torrent_id) . '&token=' . urlencode($token); $output = bencode($modified) or die('bencoding error'); - header('Cache-control: private'); header('Content-Type: application/octet-stream'); header('Content-Length: ' . strlen($output)); - header('Content-Disposition: filename=' . $row['name']); + header('Content-Disposition: attachment; filename="'.basename($row['name']).'"'); echo $output; } - diff --git a/serve/invitations.php b/serve/invitations.php index cf7e592..b6c746e 100644 --- a/serve/invitations.php +++ b/serve/invitations.php @@ -37,13 +37,15 @@ while ($row = $res->fetch()) { if (!$any) { $any = true; - printf('

Invited

'); + echo '

Invited

'; + } printf('%s', html_escape($row['username'])); - printf(' / '); + printf(' | '); printf('%s', html_escape($row['email'])); printf('
'); } + echo '
'; if ($any) { printf('
'); } @@ -55,22 +57,30 @@ while ($row = $res->fetch()) { if (!$any) { $any = true; - printf('

Invitations

'); + printf('

Pending Invitations

'); if (array_key_exists('success', $_GET)) { printf('
Invitation successfully created, go ahead and send the corresponding link to your invitee
'); } + echo '
'; } - - printf('%s', html_escape($row['email'])); - printf(' / '); - printf('%s', $row['invitation_key']); - printf(' / '); - printf('%s/register.php?invite=%s', $CONFIG['base_url'], $row['invitation_key'], $CONFIG['base_url'], $row['invitation_key']); - printf('
'); + + ?> +
+
+
Invitation
+
+
+

Invite Key:

+ Invite Link +
+
+
+ '; if ($any) { - printf('
'); + print('
'); } } diff --git a/serve/js/nav.js b/serve/js/nav.js deleted file mode 100644 index 278d986..0000000 --- a/serve/js/nav.js +++ /dev/null @@ -1,8 +0,0 @@ -function toggleMenu() { - var n = document.getElementById("nav"); - if ("nav" === n.className) { - n.className += " responsive"; - } else { - n.className = "nav"; - } -} diff --git a/serve/torrent.php b/serve/torrent.php index e6e7ccf..5a07284 100644 --- a/serve/torrent.php +++ b/serve/torrent.php @@ -1,5 +1,4 @@ connect(); @@ -46,7 +45,9 @@ printf('

Description

'); printf('
%s
', html_escape($row['description'])); - printf('

Files

'); + printf('

Files

+
+
'); $data = $db->decode_data($row['data']); $arr = bdecode($data); @@ -64,6 +65,7 @@ printf("
"); } } + printf('
'); } else { printf('
No such torrent
'); @@ -72,4 +74,3 @@ printf(''); site_footer(); - diff --git a/site.php b/site.php index 1f711f3..c107ac6 100644 --- a/site.php +++ b/site.php @@ -63,30 +63,63 @@ function site_header() { printf(''); printf(''); printf(''); - printf(''); - printf(''); + printf(''); + printf(''); + printf(''); + printf(''); printf('%s', html_escape($CONFIG['site_title'])); printf(''); printf(''); - if (array_key_exists('user', $_SESSION)) { - printf(''); + ?> + +
+ '); + ?> +
+ +