status
Cette révision appartient à :
Parent
05d78abf6e
révision
9dbc00eddc
2 fichiers modifiés avec 23 ajouts et 6 suppressions
17
index.html
17
index.html
|
@ -18,6 +18,17 @@
|
|||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<style>
|
||||
.remake {
|
||||
background-color: #f0b0b0;
|
||||
}
|
||||
.trusted {
|
||||
background-color: #98d9a8;
|
||||
}
|
||||
.aplus {
|
||||
background-color: #60b0f0;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<nav class="navbar navbar-default">
|
||||
<div class="container">
|
||||
|
@ -71,8 +82,10 @@
|
|||
<th>Links</th>
|
||||
</tr>
|
||||
{{ range .Records}}
|
||||
<tr>
|
||||
<td>{{.Name}}</td>
|
||||
<tr {{if eq .Status 2}}class="remake"{{end}}
|
||||
{{if eq .Status 3}}class="trusted"{{end}}
|
||||
{{if eq .Status 4}}class="aplus"{{end}}>
|
||||
<td>{{.Name}}</td>
|
||||
<td>{{.Hash}}</td>
|
||||
<td><a href="{{.Magnet}}" target="_blank" title="Magnet link" ><span class="glyphicon glyphicon-magnet" aria-hidden="true"></span></a>
|
||||
<a href="http://torcache.net/torrent/{{.Hash}}.torrent"><span class="glyphicon glyphicon-floppy-save" aria-hidden="true"></span></a>
|
||||
|
|
12
main.go
12
main.go
|
@ -52,7 +52,7 @@ func apiHandler(w http.ResponseWriter, r *http.Request) {
|
|||
page := vars["page"]
|
||||
pagenum, _ := strconv.Atoi(html.EscapeString(page))
|
||||
b := Record{Records: []Records{}}
|
||||
rows, err := dbHandle.Query("select torrent_id, torrent_name, torrent_hash from torrents ORDER BY torrent_id DESC LIMIT 50 offset ?", 50*pagenum-1)
|
||||
rows, err := dbHandle.Query("select torrent_id, torrent_name, status_id, torrent_hash from torrents ORDER BY torrent_id DESC LIMIT 50 offset ?", 50*pagenum-1)
|
||||
for rows.Next() {
|
||||
var id, name, hash, magnet string
|
||||
rows.Scan(&id, &name, &hash)
|
||||
|
@ -60,6 +60,7 @@ func apiHandler(w http.ResponseWriter, r *http.Request) {
|
|||
res := Records{
|
||||
Id: id,
|
||||
Name: name,
|
||||
Status: status,
|
||||
Hash: hash,
|
||||
Magnet: safe(magnet)}
|
||||
|
||||
|
@ -82,7 +83,7 @@ func singleapiHandler(w http.ResponseWriter, r *http.Request) {
|
|||
vars := mux.Vars(r)
|
||||
id := vars["id"]
|
||||
b := Record{Records: []Records{}}
|
||||
rows, err := dbHandle.Query("select torrent_id, torrent_name, torrent_hash from torrents where torrent_id = ? ORDER BY torrent_id DESC", html.EscapeString(id))
|
||||
rows, err := dbHandle.Query("select torrent_id, torrent_name, status_id, torrent_hash from torrents where torrent_id = ? ORDER BY torrent_id DESC", html.EscapeString(id))
|
||||
for rows.Next() {
|
||||
var id, name, hash, magnet string
|
||||
rows.Scan(&id, &name, &hash)
|
||||
|
@ -90,6 +91,7 @@ func singleapiHandler(w http.ResponseWriter, r *http.Request) {
|
|||
res := Records{
|
||||
Id: id,
|
||||
Name: name,
|
||||
Status: status,
|
||||
Hash: hash,
|
||||
Magnet: safe(magnet)}
|
||||
|
||||
|
@ -117,7 +119,7 @@ func searchHandler(w http.ResponseWriter, r *http.Request) {
|
|||
param2 := strings.Split(cat, "_")[0]
|
||||
param3 := strings.Split(cat, "_")[1]
|
||||
b := Record{Category: cat, Records: []Records{}}
|
||||
rows, err := dbHandle.Query("select torrent_id, torrent_name, torrent_hash from torrents "+
|
||||
rows, err := dbHandle.Query("select torrent_id, torrent_name, status_id, torrent_hash from torrents "+
|
||||
"where torrent_name LIKE ? AND category_id LIKE ? AND sub_category_id LIKE ? "+
|
||||
"ORDER BY torrent_id DESC LIMIT 50 offset ?",
|
||||
"%"+html.EscapeString(param1)+"%", html.EscapeString(param2)+"%", html.EscapeString(param3)+"%", 50*pagenum-1)
|
||||
|
@ -128,6 +130,7 @@ func searchHandler(w http.ResponseWriter, r *http.Request) {
|
|||
res := Records{
|
||||
Id: id,
|
||||
Name: name,
|
||||
Status: status,
|
||||
Hash: hash,
|
||||
Magnet: safe(magnet)}
|
||||
|
||||
|
@ -150,7 +153,7 @@ func rootHandler(w http.ResponseWriter, r *http.Request) {
|
|||
page := vars["page"]
|
||||
pagenum, _ := strconv.Atoi(html.EscapeString(page))
|
||||
b := Record{Category: "_", Records: []Records{}}
|
||||
rows, err := dbHandle.Query("select torrent_id, torrent_name, torrent_hash from torrents ORDER BY torrent_id DESC LIMIT 50 offset ?", 50*pagenum-1)
|
||||
rows, err := dbHandle.Query("select torrent_id, torrent_name, status_id, torrent_hash from torrents ORDER BY torrent_id DESC LIMIT 50 offset ?", 50*pagenum-1)
|
||||
for rows.Next() {
|
||||
var id, name, hash, magnet string
|
||||
rows.Scan(&id, &name, &hash)
|
||||
|
@ -158,6 +161,7 @@ func rootHandler(w http.ResponseWriter, r *http.Request) {
|
|||
res := Records{
|
||||
Id: id,
|
||||
Name: name,
|
||||
Status: status,
|
||||
Hash: hash,
|
||||
Magnet: safe(magnet)}
|
||||
|
||||
|
|
Référencer dans un nouveau ticket