Merge branch 'master' of https://github.com/akuma06/nyaa.git
Cette révision appartient à :
révision
ff6b6aae31
4 fichiers modifiés avec 20 ajouts et 6 suppressions
7
model/status.go
Fichier normal
7
model/status.go
Fichier normal
|
@ -0,0 +1,7 @@
|
||||||
|
package model
|
||||||
|
|
||||||
|
//user status e.g. verified, filtered, etc
|
||||||
|
type Status struct {
|
||||||
|
Id int `json:"id"`
|
||||||
|
Name string `json:"name",sql:"size:255"`
|
||||||
|
}
|
|
@ -36,13 +36,16 @@ type User struct {
|
||||||
LastLoginIp string `json:"lastLoginIp",sql:"size:100"`
|
LastLoginIp string `json:"lastLoginIp",sql:"size:100"`
|
||||||
CurrentLoginIp string `json:"currentLoginIp",sql:"size:100"`
|
CurrentLoginIp string `json:"currentLoginIp",sql:"size:100"`
|
||||||
|
|
||||||
|
Status Status `gorm:"many2one:users_status;"`
|
||||||
|
|
||||||
// Liking
|
// Liking
|
||||||
LikingCount int `json:"likingCount"`
|
LikingCount int `json:"likingCount"`
|
||||||
LikedCount int `json:"likedCount"`
|
LikedCount int `json:"likedCount"`
|
||||||
Likings []User `gorm:"foreignkey:userId;associationforeignkey:follower_id;many2many:users_followers;"`
|
Likings []User `gorm:"foreignkey:userId;associationforeignkey:follower_id;many2many:users_followers;"`
|
||||||
Liked []User `gorm:"foreignkey:follower_id;associationforeignkey:userId;many2many:users_followers;"`
|
Liked []User `gorm:"foreignkey:follower_id;associationforeignkey:userId;many2many:users_followers;"`
|
||||||
|
|
||||||
Connections []Connection
|
Connections []Connection
|
||||||
|
|
||||||
Languages []Language `gorm:"many2many:user_languages;"` // Many To Many, user_languages is the join table
|
Languages []Language `gorm:"many2many:user_languages;"` // Many To Many, user_languages is the join table
|
||||||
Roles []Role `gorm:"many2many:users_roles;"` // Many To Many, users_roles
|
Roles []Role `gorm:"many2many:users_roles;"` // Many To Many, users_roles
|
||||||
Torrents []Torrents
|
Torrents []Torrents
|
||||||
|
@ -79,7 +82,7 @@ type PublicUser struct {
|
||||||
Connections omit `json:"connections,omitempty"`
|
Connections omit `json:"connections,omitempty"`
|
||||||
Languages omit `json:"languages,omitempty"`
|
Languages omit `json:"languages,omitempty"`
|
||||||
Roles omit `json:"roles,omitempty"`
|
Roles omit `json:"roles,omitempty"`
|
||||||
Torrents omit `json:"articles,omitempty"`
|
Torrents omit `json:"articles,omitempty"` //should user torrents not be displayed?
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connection is a connection model for oauth.
|
// Connection is a connection model for oauth.
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
<option value="torrent_name" {{if eq .Search.Sort "torrent_name"}}selected{{end}}>Name</option>
|
<option value="torrent_name" {{if eq .Search.Sort "torrent_name"}}selected{{end}}>Name</option>
|
||||||
<option value="date" {{if eq .Search.Sort "date"}}selected{{end}}>Date</option>
|
<option value="date" {{if eq .Search.Sort "date"}}selected{{end}}>Date</option>
|
||||||
<option value="downloads" {{if eq .Search.Sort "downloads"}}selected{{end}}>Downloads</option>
|
<option value="downloads" {{if eq .Search.Sort "downloads"}}selected{{end}}>Downloads</option>
|
||||||
|
<option value="filesize" {{if eq .Search.Sort "filesize"}}selected{{end}}>Size</option>
|
||||||
</select>
|
</select>
|
||||||
<select name="order" class="form-control input-sm">
|
<select name="order" class="form-control input-sm">
|
||||||
<option value="desc" {{if eq .Search.Order "desc"}}selected{{end}}>Descending</option>
|
<option value="desc" {{if eq .Search.Order "desc"}}selected{{end}}>Descending</option>
|
||||||
|
|
|
@ -7,7 +7,10 @@ import (
|
||||||
func FormatFilesize(bytes int64) string {
|
func FormatFilesize(bytes int64) string {
|
||||||
var unit string
|
var unit string
|
||||||
var value float64
|
var value float64
|
||||||
if bytes > 1024*1024*1024 {
|
if bytes > 1024*1024*1024*1024 {
|
||||||
|
unit = "TiB"
|
||||||
|
value = float64(bytes) / (1024*1024*1024*1024)
|
||||||
|
} else if bytes > 1024*1024*1024 {
|
||||||
unit = "GiB"
|
unit = "GiB"
|
||||||
value = float64(bytes) / (1024*1024*1024)
|
value = float64(bytes) / (1024*1024*1024)
|
||||||
} else if bytes > 1024*1024 {
|
} else if bytes > 1024*1024 {
|
||||||
|
|
Référencer dans un nouveau ticket