Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Update last-scraped date on view even if stats.go return unknown stats & other things (#1673)

* Update view.jet.html

* reduce the time limit of how fast stats.go is supposed to be called

* Update router.go

* add subcategory display in old navigation

* css to go along

* remove useless variable

* Update oldNav.jet.html

* fix travis

* fix missing css line that had user search input & link way wider than they should've been

* "See more torrents from" now make use of user torrent search route

* remove useless variable

* use stat obsolete variable in listing instead of checking the date
Cette révision appartient à :
kilo 2017-10-16 09:03:18 +02:00 révisé par ewhal
Parent 2f0e06cfe4
révision a4ea57e771
7 fichiers modifiés avec 37 ajouts et 12 suppressions

Voir le fichier

@ -26,7 +26,7 @@ func init() {
// User Profile specific routes
userRoutes := router.Get().Group("/user")
{
userRoutes.GET("", UserProfileHandler)
userRoutes.GET("", RedirectToUserSearch)
userRoutes.GET("/:id", UserProfileHandler)
userRoutes.GET("/:id/:username", UserProfileHandler)
userRoutes.GET("/:id/:username/follow", UserFollowHandler)

Voir le fichier

@ -357,9 +357,9 @@ func (t *Torrent) ToJSON() TorrentJSON {
statsObsolete[0] = true
//The displayed stats are obsolete, S/D/L will show "Unknown"
}
if time.Since(scrape.LastScrape).Hours() > 1460 || (scrape.Seeders == 0 && scrape.Leechers == 0 && scrape.Completed == 0 && time.Since(scrape.LastScrape).Hours() > 24) {
if time.Since(scrape.LastScrape).Hours() > 730 || (scrape.Seeders == 0 && scrape.Leechers == 0 && scrape.Completed == 0 && time.Since(scrape.LastScrape).Hours() > 12) {
statsObsolete[1] = true
//The stats need to be refreshed, either because they are valid and older than two months (not as reliable) OR if they are unknown but have been scraped more than 24h ago
//The stats need to be refreshed, either because they are valid and older than one months (not as reliable) OR if they are unknown but have been scraped more than 12h ago
}
t.ParseLanguages()

Voir le fichier

@ -653,12 +653,25 @@ th {
}
.website-nav #nav-category-list {
width: 70%;
margin-bottom: 13px;
margin-bottom: 7px;
}
.website-nav .pagination a {
display: inline!important;
}
.sub-category-list {
padding-left: 16px;
font-size: 12px;
margin-bottom: 9px;
}
.sub-category-list span{
display: block;
}
.sub-category-list span:before {
content: '-» ';
}
.sub-category-list span:first-child:before {
content: '';
}
textarea {
max-width: 100%;
}
@ -1199,6 +1212,7 @@ html, body {
border-radius: 0 4px 4px 0;
text-align: left;
padding: 10px 10px 15px 10px;
position: relative;
}
.profile-content h3 {

Voir le fichier

@ -4,9 +4,10 @@
<tr><td>{{if Search.Category == ""}}<b>{{ T("all_categories")}}</b>{{else}}<a href="{{genSearchWithCategory(URL, "_")}}">{{ T("all_categories")}}</a>{{end}}</td></tr>
<tr>
{{ range _, cat := GetCategories(true, false) }}
<td>{{if Search.Category == cat.ID }}<b>{{ T(cat.Name) }}</b>{{else}}<a href="{{genSearchWithCategory(URL, cat.ID)}}">{{ T(cat.Name) }}</a>{{end}}</td>
<td>{{if Search.Category == cat.ID ||(len(Search.Category) > 2 && Search.Category[:2] == cat.ID)}}<b>{{ T(cat.Name) }}</b>{{else}}<a href="{{genSearchWithCategory(URL, cat.ID)}}">{{ T(cat.Name) }}</a>{{end}}</td>
{{ if _ % 3 == 2}}
</tr><tr>
</tr>
<tr>
{{end}}
{{if _ + 1 == len(GetCategories(true, false)) }}
</tr>{{end}}
@ -14,6 +15,16 @@
</tr>
</tbody>
</table>
{{ if Search.Category != ""}}
<div class="sub-category-list">
{{ range _, cat := GetCategory(Search.Category[:1], true)}}
<span>
{{if Search.Category == cat.ID}}<b>{{ T(cat.Name) }}</b>{{else}}
<a href="{{genSearchWithCategory(URL, cat.ID)}}">{{ T(cat.Name)}}</a>{{end}}
</span>
{{end}}
</div>
{{end}}
<table id="sort-list-order">
<tbody>
<tr>

Voir le fichier

@ -93,7 +93,7 @@
<td class="tr-size home-td hide-xs">
{{ fileSize(.Filesize, T) }}
</td>
{{if .LastScrape.IsZero || formatDateRFC(.LastScrape) == "0001-01-01T00:00:00Z"}}
{{if .StatsObsolete[0] }}
<td class="tr-se home-td hide-smol">-</td>
<td class="tr-le home-td hide-smol">-</td>
<td class="tr-dl home-td hide-xs">-</td>

Voir le fichier

@ -317,14 +317,14 @@
Query.Get('/stats/{{Torrent.ID}}', function (data) {
if(typeof data.seeders != "undefined" && data.seeders != -1) {
seeders.innerHTML = "<span>" + data.seeders + "</span>"
leechers.innerHTML = "<span>" +data.leechers + "</span>"
downloads.innerHTML = "<span>" +data.downloads + "</span>"
scrapeDate.innerText = new Date().toLocaleString(document.getElementsByTagName("html")[0].getAttribute("lang"), "ymdOpt")
leechers.innerHTML = "<span>" + data.leechers + "</span>"
downloads.innerHTML = "<span>" + data.downloads + "</span>"
} else {
seeders.innerHTML = oldStats[0]
leechers.innerHTML = oldStats[1]
downloads.innerHTML = oldStats[2]
}
scrapeDate.innerText = new Date().toLocaleString(document.getElementsByTagName("html")[0].getAttribute("lang"), "ymdOpt")
})
</script>
{{end}}

Voir le fichier

@ -49,7 +49,7 @@
</table>
<div class="user-torrent-search">
<div class="pagination">
<a href="/search?userID={{ UserProfile.ID }}" aria-label="Next">
<a href="/user/{{UserProfile.ID}}/{{UserProfile.Username}}/search" aria-label="Next">
<span style="display:block;border-right:1px solid;">
{{ T("see_more_torrents_from", UserProfile.Username) }}
</span>