Merge branch 'master' of https://github.com/ewhal/nyaa
Cette révision appartient à :
révision
9a60018e19
6 fichiers modifiés avec 278 ajouts et 67 suppressions
4
.gitignore
externe
4
.gitignore
externe
|
@ -2,4 +2,6 @@
|
|||
*.db
|
||||
main
|
||||
nyaa
|
||||
nyaa-master.exe
|
||||
nyaa.exe
|
||||
nyaa-master.exe
|
||||
*.zip
|
||||
|
|
21
index.html
21
index.html
|
@ -35,7 +35,7 @@
|
|||
</div>
|
||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a href="https://sukebei.pantsu.cat">Sukebei Pantsu</a></li>
|
||||
<li><a href="https://sukebei.pantsu.cat">Fap</a></li>
|
||||
<li><a href="https://nyaa.pantsu.cat/faq">Faq</a></li>
|
||||
|
||||
</ul>
|
||||
|
@ -67,8 +67,17 @@
|
|||
<option value="4" {{if eq .Status "4"}}selected{{end}}>A+</option>
|
||||
</select>
|
||||
<input name="q" class="form-control input-sm" placeholder="Search" type="text" value={{.Query}}>
|
||||
<select name="sort" class="form-control input-sm">
|
||||
<option value="torrent_id" {{if eq .Sort "torrent_id"}}selected{{end}}>Id</option>
|
||||
<option value="torrent_name" {{if eq .Sort "torrent_name"}}selected{{end}}>Name</option>
|
||||
<option value="date" {{if eq .Sort "date"}}selected{{end}}>Date</option>
|
||||
<option value="downloads" {{if eq .Sort "downloads"}}selected{{end}}>Downloads</option>
|
||||
</select>
|
||||
<select name="order" class="form-control input-sm">
|
||||
<option value="desc" {{if eq .Order "desc"}}selected{{end}}>Descend</option>
|
||||
<option value="asc" {{if eq .Order "asc"}}selected{{end}}>Ascend</option>
|
||||
</select>
|
||||
<select name="max" class="form-control input-sm" value>
|
||||
<option value="">No Items per Page</option>
|
||||
<option value="5" {{if eq .QueryRecordCount 5}}selected{{end}}>5</option>
|
||||
<option value="10" {{if eq .QueryRecordCount 10}}selected{{end}}>10</option>
|
||||
<option value="15" {{if eq .QueryRecordCount 15}}selected{{end}}>15</option>
|
||||
|
@ -91,13 +100,15 @@
|
|||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>Name</th>
|
||||
<th>Hash</th>
|
||||
<th>Date</th>
|
||||
<th>Size</th>
|
||||
<th>Links</th>
|
||||
</tr>
|
||||
{{ range .ListTorrents}}
|
||||
|
@ -105,8 +116,10 @@
|
|||
{{if eq .Status 3}}class="trusted"{{end}}
|
||||
{{if eq .Status 4}}class="aplus"{{end}}>
|
||||
<td>{{.Id}}</td>
|
||||
<td>{{.Name}}</td>
|
||||
<td><a href="/view/{{.Id}}">{{.Name}}</a></td>
|
||||
<td>{{.Hash}}</td>
|
||||
<td>{{.Date}}</td>
|
||||
<td>{{.Filesize}}</td>
|
||||
|
||||
|
||||
<td><a href="{{.Magnet}}" title="Magnet link" ><span class="glyphicon glyphicon-magnet" aria-hidden="true"></span></a>
|
||||
|
|
69
main.go
69
main.go
|
@ -16,7 +16,7 @@ import (
|
|||
)
|
||||
|
||||
var db *gorm.DB
|
||||
var templates = template.Must(template.ParseFiles("index.html", "FAQ.html"))
|
||||
var templates = template.Must(template.ParseFiles("index.html", "FAQ.html", "view.html"))
|
||||
var debugLogger *log.Logger
|
||||
var trackers = "&tr=udp://zer0day.to:1337/announce&tr=udp://tracker.leechers-paradise.org:6969&tr=udp://explodie.org:6969&tr=udp://tracker.opentrackr.org:1337&tr=udp://tracker.coppersurfer.tk:6969"
|
||||
|
||||
|
@ -25,7 +25,7 @@ func getDBHandle() *gorm.DB {
|
|||
|
||||
// Migrate the schema of Torrents
|
||||
dbInit.AutoMigrate(&Torrents{}, &Categories{}, &Sub_Categories{}, &Statuses{})
|
||||
|
||||
|
||||
checkErr(err)
|
||||
return dbInit
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ func apiHandler(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
}
|
||||
|
||||
func singleapiHandler(w http.ResponseWriter, r *http.Request) {
|
||||
func apiViewHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
vars := mux.Vars(r)
|
||||
id := vars["id"]
|
||||
|
@ -98,6 +98,9 @@ func searchHandler(w http.ResponseWriter, r *http.Request) {
|
|||
searchQuery := r.URL.Query().Get("q")
|
||||
cat := r.URL.Query().Get("c")
|
||||
stat := r.URL.Query().Get("s")
|
||||
sort := r.URL.Query().Get("sort")
|
||||
order := r.URL.Query().Get("order")
|
||||
|
||||
catsSplit := strings.Split(cat, "_")
|
||||
// need this to prevent out of index panics
|
||||
var searchCatId, searchSubCatId string
|
||||
|
@ -106,13 +109,21 @@ func searchHandler(w http.ResponseWriter, r *http.Request) {
|
|||
searchCatId = html.EscapeString(catsSplit[0])
|
||||
searchSubCatId = html.EscapeString(catsSplit[1])
|
||||
}
|
||||
if sort == "" {
|
||||
sort = "torrent_id"
|
||||
}
|
||||
if order == "" {
|
||||
order = "desc"
|
||||
}
|
||||
order_by := sort + " " + order
|
||||
|
||||
nbTorrents := 0
|
||||
|
||||
b := []TorrentsJson{}
|
||||
|
||||
torrents := getTorrents(createWhereParams("torrent_name LIKE ? AND status_id LIKE ? AND category_id LIKE ? AND sub_category_id LIKE ?",
|
||||
"%"+searchQuery+"%", stat+"%", searchCatId+"%", searchSubCatId+"%"), maxPerPage, maxPerPage*(pagenum-1))
|
||||
parameters := createWhereParams("torrent_name LIKE ? AND status_id LIKE ? AND category_id LIKE ? AND sub_category_id LIKE ?",
|
||||
"%"+searchQuery+"%", stat+"%", searchCatId+"%", searchSubCatId+"%")
|
||||
torrents := getTorrentsOrderBy(¶meters, order_by, maxPerPage, maxPerPage*(pagenum-1))
|
||||
|
||||
for i, _ := range torrents {
|
||||
nbTorrents++
|
||||
|
@ -122,7 +133,7 @@ func searchHandler(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
}
|
||||
|
||||
htv := HomeTemplateVariables{b, getAllCategories(false), searchQuery, stat, cat, maxPerPage, nbTorrents}
|
||||
htv := HomeTemplateVariables{b, getAllCategories(false), searchQuery, stat, cat, sort, order, maxPerPage, nbTorrents}
|
||||
|
||||
err := templates.ExecuteTemplate(w, "index.html", htv)
|
||||
if err != nil {
|
||||
|
@ -149,43 +160,60 @@ func rssHandler(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
torrents := getFeeds()
|
||||
created := time.Now().String()
|
||||
if ( len(torrents) > 0 ) {
|
||||
if len(torrents) > 0 {
|
||||
created = torrents[0].Timestamp
|
||||
}
|
||||
created_as_time, err := time.Parse("2006-01-02 15:04:05", created)
|
||||
if err == nil {
|
||||
;
|
||||
|
||||
}
|
||||
feed := &feeds.Feed{
|
||||
Title: "Nyaa Pantsu",
|
||||
Link: &feeds.Link{Href: "https://nyaa.pantsu.cat/"},
|
||||
Created: created_as_time,
|
||||
Title: "Nyaa Pantsu",
|
||||
Link: &feeds.Link{Href: "https://nyaa.pantsu.cat/"},
|
||||
Created: created_as_time,
|
||||
}
|
||||
feed.Items = []*feeds.Item{}
|
||||
feed.Items = make( []*feeds.Item, len(torrents))
|
||||
feed.Items = make([]*feeds.Item, len(torrents))
|
||||
|
||||
for i, _ := range torrents {
|
||||
timestamp_as_time, err := time.Parse("2006-01-02 15:04:05", torrents[i].Timestamp)
|
||||
if err == nil {
|
||||
feed.Items[i] = &feeds.Item{
|
||||
feed.Items[i] = &feeds.Item{
|
||||
// need a torrent view first
|
||||
//Id: URL + torrents[i].Hash,
|
||||
Title: torrents[i].Name,
|
||||
Link: &feeds.Link{Href: string(torrents[i].Magnet)},
|
||||
Title: torrents[i].Name,
|
||||
Link: &feeds.Link{Href: string(torrents[i].Magnet)},
|
||||
Description: "",
|
||||
Created: timestamp_as_time,
|
||||
Updated: timestamp_as_time,
|
||||
Created: timestamp_as_time,
|
||||
Updated: timestamp_as_time,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rss, err := feed.ToRss()
|
||||
if err == nil {
|
||||
w.Write( []byte( rss ) )
|
||||
w.Write([]byte(rss))
|
||||
} else {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
func viewHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
vars := mux.Vars(r)
|
||||
id := vars["id"]
|
||||
b := []TorrentsJson{}
|
||||
|
||||
torrent, err := getTorrentById(id)
|
||||
res := torrent.toJson()
|
||||
b = append(b, res)
|
||||
|
||||
htv := HomeTemplateVariables{b, getAllCategories(false), "", "", "_", "", "", 1, 1}
|
||||
|
||||
err = templates.ExecuteTemplate(w, "view.html", htv)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
|
||||
func rootHandler(w http.ResponseWriter, r *http.Request) {
|
||||
vars := mux.Vars(r)
|
||||
|
@ -209,7 +237,7 @@ func rootHandler(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
}
|
||||
|
||||
htv := HomeTemplateVariables{b, getAllCategories(false), "", "", "_", maxPerPage, nbTorrents}
|
||||
htv := HomeTemplateVariables{b, getAllCategories(false), "", "", "_", "torrent_id", "desc", maxPerPage, nbTorrents}
|
||||
|
||||
err := templates.ExecuteTemplate(w, "index.html", htv)
|
||||
if err != nil {
|
||||
|
@ -234,9 +262,10 @@ func main() {
|
|||
router.HandleFunc("/search", searchHandler)
|
||||
router.HandleFunc("/search/{page}", searchHandler)
|
||||
router.HandleFunc("/api/{page}", apiHandler).Methods("GET")
|
||||
router.HandleFunc("/api/torrent/{id}", singleapiHandler).Methods("GET")
|
||||
router.HandleFunc("/api/view/{id}", apiViewHandler).Methods("GET")
|
||||
router.HandleFunc("/faq", faqHandler)
|
||||
router.HandleFunc("/feed.xml", rssHandler)
|
||||
router.HandleFunc("/view/{id}", viewHandler)
|
||||
|
||||
http.Handle("/", router)
|
||||
|
||||
|
|
92
models.go
92
models.go
|
@ -10,31 +10,31 @@ import (
|
|||
)
|
||||
|
||||
type Feed struct {
|
||||
Id int
|
||||
Name string
|
||||
Hash string
|
||||
Magnet string
|
||||
Timestamp string
|
||||
Id int
|
||||
Name string
|
||||
Hash string
|
||||
Magnet string
|
||||
Timestamp string
|
||||
}
|
||||
|
||||
type Categories struct {
|
||||
Category_id int
|
||||
Category_name string
|
||||
Torrents []Torrents `gorm:"ForeignKey:category_id;AssociationForeignKey:category_id"`
|
||||
Sub_Categories []Sub_Categories `gorm:"ForeignKey:category_id;AssociationForeignKey:parent_id"`
|
||||
Category_id int
|
||||
Category_name string
|
||||
Torrents []Torrents `gorm:"ForeignKey:category_id;AssociationForeignKey:category_id"`
|
||||
Sub_Categories []Sub_Categories `gorm:"ForeignKey:category_id;AssociationForeignKey:parent_id"`
|
||||
}
|
||||
|
||||
type Sub_Categories struct {
|
||||
Sub_category_id int
|
||||
Sub_category_id int
|
||||
Sub_category_name string
|
||||
Parent_id int
|
||||
Torrents []Torrents `gorm:"ForeignKey:sub_category_id;AssociationForeignKey:sub_category_id"`
|
||||
Parent_id int
|
||||
Torrents []Torrents `gorm:"ForeignKey:sub_category_id;AssociationForeignKey:sub_category_id"`
|
||||
}
|
||||
|
||||
type Statuses struct {
|
||||
Status_id int
|
||||
Status_name string
|
||||
Torrents []Torrents `gorm:"ForeignKey:status_id;AssociationForeignKey:status_id"`
|
||||
Status_id int
|
||||
Status_name string
|
||||
Torrents []Torrents `gorm:"ForeignKey:status_id;AssociationForeignKey:status_id"`
|
||||
}
|
||||
|
||||
type Torrents struct {
|
||||
|
@ -42,12 +42,12 @@ type Torrents struct {
|
|||
Name string `gorm:"column:torrent_name"`
|
||||
Category_id int `gorm:"column:category_id"`
|
||||
Sub_category_id int `gorm:"column:sub_category_id"`
|
||||
Status_id int `gorm:"column:status_id"`
|
||||
Status_id int `gorm:"column:status_id"`
|
||||
Hash string `gorm:"column:torrent_hash"`
|
||||
Date int `gorm:"column:date"`
|
||||
Downloads int `gorm:"column:downloads"`
|
||||
Filesize string `gorm:"column:filesize"`
|
||||
Description []byte `gorm:"column:description"`
|
||||
Date int `gorm:"column:date"`
|
||||
Downloads int `gorm:"column:downloads"`
|
||||
Filesize string `gorm:"column:filesize"`
|
||||
Description []byte `gorm:"column:description"`
|
||||
Statuses Statuses `gorm:"ForeignKey:status_id;AssociationForeignKey:status_id"`
|
||||
Categories Categories `gorm:"ForeignKey:category_id;AssociationForeignKey:category_id"`
|
||||
Sub_Categories Sub_Categories `gorm:"ForeignKey:sub_category_id;AssociationForeignKey:sub_category_id"`
|
||||
|
@ -67,11 +67,13 @@ type CategoryJson struct {
|
|||
}
|
||||
|
||||
type TorrentsJson struct {
|
||||
Id string `json: "id"` // Is there a need to put the ID?
|
||||
Name string `json: "name"`
|
||||
Status int `json: "status"`
|
||||
Hash string `json: "hash"`
|
||||
Magnet template.URL `json: "magnet"`
|
||||
Id string `json: "id"` // Is there a need to put the ID?
|
||||
Name string `json: "name"`
|
||||
Status int `json: "status"`
|
||||
Hash string `json: "hash"`
|
||||
Date int `json: "date"`
|
||||
Filesize string `json: "filesize"`
|
||||
Magnet template.URL `json: "magnet"`
|
||||
}
|
||||
|
||||
type WhereParams struct {
|
||||
|
@ -87,6 +89,8 @@ type HomeTemplateVariables struct {
|
|||
Query string
|
||||
Status string
|
||||
Category string
|
||||
Sort string
|
||||
Order string
|
||||
QueryRecordCount int
|
||||
TotalRecordCount int
|
||||
}
|
||||
|
@ -103,15 +107,15 @@ func getFeeds() []Feed {
|
|||
rows, err := db.DB().
|
||||
Query(
|
||||
"SELECT `torrent_id` AS `id`, `torrent_name` AS `name`, `torrent_hash` AS `hash`, `timestamp` FROM `torrents` " +
|
||||
"ORDER BY `timestamp` desc LIMIT 50")
|
||||
if ( err == nil ) {
|
||||
"ORDER BY `timestamp` desc LIMIT 50")
|
||||
if err == nil {
|
||||
for rows.Next() {
|
||||
item := Feed{}
|
||||
rows.Scan( &item.Id, &item.Name, &item.Hash, &item.Timestamp )
|
||||
rows.Scan(&item.Id, &item.Name, &item.Hash, &item.Timestamp)
|
||||
magnet := "magnet:?xt=urn:btih:" + strings.TrimSpace(item.Hash) + "&dn=" + item.Name + trackers
|
||||
item.Magnet = magnet
|
||||
// memory hog
|
||||
result = append( result, item )
|
||||
result = append(result, item)
|
||||
}
|
||||
rows.Close()
|
||||
}
|
||||
|
@ -131,23 +135,25 @@ func getTorrentById(id string) (Torrents, error) {
|
|||
func getTorrentsOrderBy(parameters *WhereParams, orderBy string, limit int, offset int) []Torrents {
|
||||
var torrents []Torrents
|
||||
var dbQuery *gorm.DB
|
||||
|
||||
if (parameters != nil) { // if there is where parameters
|
||||
|
||||
if parameters != nil { // if there is where parameters
|
||||
dbQuery = db.Model(&torrents).Where(parameters.conditions, parameters.params...)
|
||||
} else {
|
||||
dbQuery = db.Model(&torrents)
|
||||
}
|
||||
|
||||
if (orderBy == "") { orderBy = "torrent_id DESC" } // Default OrderBy
|
||||
|
||||
if orderBy == "" {
|
||||
orderBy = "torrent_id DESC"
|
||||
} // Default OrderBy
|
||||
if limit != 0 || offset != 0 { // if limits provided
|
||||
dbQuery = dbQuery.Limit(limit).Offset(offset)
|
||||
}
|
||||
dbQuery.Order(orderBy).Preload("Categories").Preload("Sub_Categories").Find(&torrents)
|
||||
dbQuery.Order(orderBy).Preload("Categories").Preload("Sub_Categories").Find(&torrents)
|
||||
return torrents
|
||||
}
|
||||
|
||||
/* Functions to simplify the get parameters of the main function
|
||||
*
|
||||
/* Functions to simplify the get parameters of the main function
|
||||
*
|
||||
* Get Torrents with where parameters and limits, order by default
|
||||
*/
|
||||
func getTorrents(parameters WhereParams, limit int, offset int) []Torrents {
|
||||
|
@ -163,7 +169,7 @@ func getTorrentsDB(parameters WhereParams) []Torrents {
|
|||
/* Function to get all torrents
|
||||
*/
|
||||
|
||||
func getAllTorrentsOrderBy(orderBy string, limit int, offset int) [] Torrents {
|
||||
func getAllTorrentsOrderBy(orderBy string, limit int, offset int) []Torrents {
|
||||
return getTorrentsOrderBy(nil, orderBy, limit, offset)
|
||||
}
|
||||
|
||||
|
@ -190,11 +196,13 @@ func getAllCategories(populatedWithTorrents bool) []Categories {
|
|||
func (t *Torrents) toJson() TorrentsJson {
|
||||
magnet := "magnet:?xt=urn:btih:" + strings.TrimSpace(t.Hash) + "&dn=" + t.Name + trackers
|
||||
res := TorrentsJson{
|
||||
Id: strconv.Itoa(t.Id),
|
||||
Name: html.UnescapeString(t.Name),
|
||||
Status: t.Status_id,
|
||||
Hash: t.Hash,
|
||||
Magnet: safe(magnet)}
|
||||
Id: strconv.Itoa(t.Id),
|
||||
Name: html.UnescapeString(t.Name),
|
||||
Status: t.Status_id,
|
||||
Hash: t.Hash,
|
||||
Date: t.Date,
|
||||
Filesize: t.Filesize,
|
||||
Magnet: safe(magnet)}
|
||||
return res
|
||||
}
|
||||
|
||||
|
|
20
package.sh
Fichier exécutable
20
package.sh
Fichier exécutable
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env bash
|
||||
# Helper script to ease building binary packages for multiple targets.
|
||||
# Requires the linux64 and mingw64 gcc compilers and zip.
|
||||
# On Debian-based distros install mingw-w64.
|
||||
|
||||
version=$(git describe --tags)
|
||||
declare -a OSes
|
||||
OSes[0]='linux;x86_64-linux-gnu-gcc'
|
||||
OSes[1]='windows;x86_64-w64-mingw32-gcc'
|
||||
|
||||
for i in "${OSes[@]}"; do
|
||||
arr=(${i//;/ })
|
||||
os=${arr[0]}
|
||||
cc=${arr[1]}
|
||||
rm -f nyaa nyaa.exe
|
||||
echo -e "\nBuilding $os..."
|
||||
echo GOOS=$os GOARCH=amd64 CC=$cc CGO_ENABLED=1 go build -v
|
||||
GOOS=$os GOARCH=amd64 CC=$cc CGO_ENABLED=1 go build -v
|
||||
zip -9 -q nyaa-${version}_${os}_amd64.zip css js *.md *.html nyaa nyaa.exe
|
||||
done
|
139
view.html
Fichier normal
139
view.html
Fichier normal
|
@ -0,0 +1,139 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
|
||||
<title>Nyaa Pantsu</title>
|
||||
<!-- Latest compiled and minified CSS -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
||||
|
||||
<!-- Bootstrap -->
|
||||
|
||||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
<!-- Website CSS -->
|
||||
<link rel="stylesheet" href="https://nyaa.pantsu.cat/css/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-default">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="https://nyaa.pantsu.cat">Nyaa Pantsu</a>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a href="https://sukebei.pantsu.cat">Sukebei Pantsu</a></li>
|
||||
<li><a href="https://nyaa.pantsu.cat/faq">Faq</a></li>
|
||||
|
||||
</ul>
|
||||
<form class="navbar-form navbar-right" role="search" action="/search" method="get">
|
||||
<div class="form-group">
|
||||
<select name="c" class="form-control input-sm" value>
|
||||
<option value="_">All categories</option>
|
||||
<option value="1_" {{if eq .Category "1_"}}selected{{end}}>Software</option>
|
||||
<option value="1_1" {{if eq .Category "1_1"}}selected{{end}}>Software - Applications</option>
|
||||
<option value="1_2" {{if eq .Category "1_2"}}selected{{end}}>Software - Games</option>
|
||||
<option value="2_" {{if eq .Category "2_"}}selected{{end}}>Audio</option>
|
||||
<option value="2_3" {{if eq .Category "2_3"}}selected{{end}}>Audio - Lossless</option>
|
||||
<option value="2_4" {{if eq .Category "2_4"}}selected{{end}}>Audio - Lossy</option>
|
||||
<option value="3_" {{if eq .Category "3_"}}selected{{end}}>Anime</option>
|
||||
<option value="3_5" {{if eq .Category "3_5"}}selected{{end}}>Anime - English-translated</option>
|
||||
<option value="3_6" {{if eq .Category "3_6"}}selected{{end}}>Anime - Raw</option>
|
||||
<option value="4_" {{if eq .Category "4_"}}selected{{end}}>Literature</option>
|
||||
<option value="4_7" {{if eq .Category "4_7"}}selected{{end}}>Literature - English-translated</option>
|
||||
<option value="4_8" {{if eq .Category "4_8"}}selected{{end}}>Literature - Raw</option>
|
||||
<option value="5_" {{if eq .Category "5_"}}selected{{end}}>Live Action</option>
|
||||
<option value="5_9" {{if eq .Category "5_9"}}selected{{end}}>Live Action - English-translated</option>
|
||||
<option value="5_10" {{if eq .Category "5_10"}}selected{{end}}>Live Action - Idol/Promotional Video</option>
|
||||
<option value="5_11" {{if eq .Category "5_11"}}selected{{end}}>Live Action - Raw</option>
|
||||
</select>
|
||||
<select name="s" class="form-control input-sm">
|
||||
<option value="">Search all</option>
|
||||
<option value="2" {{if eq .Status "2"}}selected{{end}}>Remakes</option>
|
||||
<option value="3" {{if eq .Status "3"}}selected{{end}}>Trusted</option>
|
||||
<option value="4" {{if eq .Status "4"}}selected{{end}}>A+</option>
|
||||
</select>
|
||||
<input name="q" class="form-control input-sm" placeholder="Search" type="text" value={{.Query}}>
|
||||
<select name="max" class="form-control input-sm" value>
|
||||
<option value="">No Items per Page</option>
|
||||
<option value="5" {{if eq .QueryRecordCount 5}}selected{{end}}>5</option>
|
||||
<option value="10" {{if eq .QueryRecordCount 10}}selected{{end}}>10</option>
|
||||
<option value="15" {{if eq .QueryRecordCount 15}}selected{{end}}>15</option>
|
||||
<option value="20" {{if eq .QueryRecordCount 20}}selected{{end}}>20</option>
|
||||
<option value="25" {{if eq .QueryRecordCount 25}}selected{{end}}>25</option>
|
||||
<option value="30" {{if eq .QueryRecordCount 30}}selected{{end}}>30</option>
|
||||
<option value="35" {{if eq .QueryRecordCount 35}}selected{{end}}>35</option>
|
||||
<option value="40" {{if eq .QueryRecordCount 40}}selected{{end}}>40</option>
|
||||
<option value="45" {{if eq .QueryRecordCount 45}}selected{{end}}>45</option>
|
||||
<option value="50" {{if eq .QueryRecordCount 50}}selected{{end}}>50</option>
|
||||
<option value="70" {{if eq .QueryRecordCount 70}}selected{{end}}>70</option>
|
||||
<option value="100" {{if eq .QueryRecordCount 100}}selected{{end}}>100</option>
|
||||
<option value="150" {{if eq .QueryRecordCount 150}}selected{{end}}>150</option>
|
||||
<option value="200" {{if eq .QueryRecordCount 200}}selected{{end}}>200</option>
|
||||
<option value="300" {{if eq .QueryRecordCount 300}}selected{{end}}>300</option>
|
||||
</select>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-default">Search</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container">
|
||||
<table class="table">
|
||||
{{ range .ListTorrents}}
|
||||
<tr {{if eq .Status 2}}class="remake"{{end}}
|
||||
{{if eq .Status 3}}class="trusted"{{end}}
|
||||
{{if eq .Status 4}}class="aplus"{{end}}>
|
||||
<td>Id</td>
|
||||
<td>{{.Id}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Name</td>
|
||||
<td>{{.Name}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Hash</td>
|
||||
<td>{{.Hash}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Date</td>
|
||||
<td>{{.Date}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>FileSize</td>
|
||||
<td>{{.Filesize}}</td>
|
||||
</tr>
|
||||
tr
|
||||
<tr>
|
||||
<td>Links</td>
|
||||
<td><a href="{{.Magnet}}" title="Magnet link" ><span class="glyphicon glyphicon-magnet" aria-hidden="true"></span></a>
|
||||
<a href="https://itorrents.org/torrent/{{.Hash}}.torrent" title="Torrent file"><span class="glyphicon glyphicon-floppy-save" aria-hidden="true"></span></a>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
|
||||
<!-- Include all compiled plugins (below), or include individual files as needed -->
|
||||
<!-- Latest compiled and minified JavaScript -->
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
Référencer dans un nouveau ticket