+ {{.Name}} |
{{.Hash}} |
diff --git a/main.go b/main.go
index 2a2a6c2b..3ebaf79b 100644
--- a/main.go
+++ b/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)}
|