diff --git a/controllers/torrent/stats.go b/controllers/torrent/stats.go index 2fbb5ac3..25bdcece 100644 --- a/controllers/torrent/stats.go +++ b/controllers/torrent/stats.go @@ -8,6 +8,7 @@ import ( "github.com/NyaaPantsu/nyaa/models/torrents" "github.com/NyaaPantsu/nyaa/models" + "github.com/NyaaPantsu/nyaa/config" "github.com/Stephen304/goscrape" "github.com/gin-gonic/gin" ) @@ -27,13 +28,18 @@ func GetStatsHandler(c *gin.Context) { var Trackers []string for _, line := range strings.Split(torrent.Trackers[3:], "&tr=") { - //Starts at character 3 because the three first characters are always "tr=" so we need to dismiss them tracker, error := url.QueryUnescape(line) - if error == nil && tracker[:6] == "udp://" { + if error == nil && strings.Contains(tracker, "udp://") { Trackers = append(Trackers, tracker) } //Cannot scrape from http trackers so don't put them in the array - } + } + + for _, line := range config.Get().Torrents.Trackers.Default { + if !contains(Trackers, line) { + Trackers = append(Trackers, line) + } + } stats := goscrape.Single(Trackers, []string{ torrent.Hash, @@ -73,3 +79,12 @@ func GetStatsHandler(c *gin.Context) { return } + +func contains(s []string, e string) bool { + for _, a := range s { + if a == e { + return true + } + } + return false +} diff --git a/public/css/main.css b/public/css/main.css index f7e33560..ab64406c 100644 --- a/public/css/main.css +++ b/public/css/main.css @@ -2216,6 +2216,19 @@ form.delete-form button.form-input.btn-red { height: 28px; } +.user-torrent-table { + margin-bottom: 80px +} + +.user-torrent-search { + width: 100%; + position: absolute; + right: 0; + left: 0; + bottom: 9px; +} + + /* Language specific CSS */ html[lang="ja-jp"] .form-refine span.spacing { diff --git a/public/css/themes/classic.css b/public/css/themes/classic.css index 7d1acb95..05626ce8 100644 --- a/public/css/themes/classic.css +++ b/public/css/themes/classic.css @@ -123,9 +123,9 @@ th.tr-name a { .icon-magnet:before { font-size: 14px; -}.upload-tag-table +} -.icon-floppy::before { +.icon-floppy:before { content: ''; } .icon-floppy { diff --git a/templates/site/torrents/view.jet.html b/templates/site/torrents/view.jet.html index 831b1bb9..753e0421 100644 --- a/templates/site/torrents/view.jet.html +++ b/templates/site/torrents/view.jet.html @@ -151,10 +151,18 @@ {{ if User.ID > 0}} {{ T("report_btn") }} {{ if User.HasAdmin()}} - {{ T("delete") }} +
+ {{ yield csrf_field()}} + + +
{{ T("edit") }} {{ else if User.CurrentUserIdentical(Torrent.UploaderID) }} - {{ T("delete") }} +
+ {{ yield csrf_field()}} + + +
{{ T("edit") }} {{end}} {{end}} diff --git a/templates/site/user/edit.jet.html b/templates/site/user/edit.jet.html index 00980fb3..a1a56399 100644 --- a/templates/site/user/edit.jet.html +++ b/templates/site/user/edit.jet.html @@ -233,7 +233,7 @@ - + diff --git a/templates/site/user/torrents.jet.html b/templates/site/user/torrents.jet.html index b689f8ac..64ce6353 100644 --- a/templates/site/user/torrents.jet.html +++ b/templates/site/user/torrents.jet.html @@ -3,7 +3,7 @@ {{ block profile_navigation()}}{{ yield profile_menu(route="profile") }}{{end}} {{block profile_content()}} {{ if len(UserProfile.Torrents) > 0 }} -
+
@@ -47,6 +47,7 @@ {{end}}
{{ T("category")}} {{ T("name")}}
+ {{else}}

{{ T("no_torrents_uploaded") }}

{{end}} diff --git a/templates/template_functions.go b/templates/template_functions.go index 0ef7967c..8c7bcd15 100644 --- a/templates/template_functions.go +++ b/templates/template_functions.go @@ -177,7 +177,7 @@ func genNav(nav Navigation, currentURL *url.URL, pagesSelectable int) template.H display = " style=\"display:none;\"" if nav.CurrentPage < int(maxPages) { display = "" - href = " href=\"" + "/" + nav.Route + "/" + strconv.Itoa(nav.CurrentPage+1) + "?" + currentURL.RawQuery + "\"" + href = " href=\"" + "/" + nav.Route + "/" + strconv.Itoa(int(maxPages)) + "?" + currentURL.RawQuery + "\"" } ret = ret + "
»"