status
Cette révision appartient à :
Parent
ae9e9d9e57
révision
41122a56e2
2 fichiers modifiés avec 32 ajouts et 10 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>
|
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
</head>
|
</head>
|
||||||
|
<style>
|
||||||
|
.remake {
|
||||||
|
background-color: #f0b0b0;
|
||||||
|
}
|
||||||
|
.trusted {
|
||||||
|
background-color: #98d9a8;
|
||||||
|
}
|
||||||
|
.aplus {
|
||||||
|
background-color: #60b0f0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<body>
|
<body>
|
||||||
<nav class="navbar navbar-default">
|
<nav class="navbar navbar-default">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
@ -71,8 +82,10 @@
|
||||||
<th>Links</th>
|
<th>Links</th>
|
||||||
</tr>
|
</tr>
|
||||||
{{ range .Records}}
|
{{ range .Records}}
|
||||||
<tr>
|
<tr {{if eq .Status 2}}class="remake"{{end}}
|
||||||
<td>{{.Name}}</td>
|
{{if eq .Status 3}}class="trusted"{{end}}
|
||||||
|
{{if eq .Status 4}}class="aplus"{{end}}>
|
||||||
|
<td>{{.Name}}</td>
|
||||||
<td>{{.Hash}}</td>
|
<td>{{.Hash}}</td>
|
||||||
<td><a href="{{.Magnet}}"><span class="glyphicon glyphicon-magnet" aria-hidden="true"></span></a>
|
<td><a href="{{.Magnet}}"><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>
|
<a href="http://torcache.net/torrent/{{.Hash}}.torrent"><span class="glyphicon glyphicon-floppy-save" aria-hidden="true"></span></a>
|
||||||
|
|
25
main.go
25
main.go
|
@ -30,6 +30,7 @@ type Record struct {
|
||||||
type Records struct {
|
type Records struct {
|
||||||
Id string `json: "id"`
|
Id string `json: "id"`
|
||||||
Name string `json: "name"`
|
Name string `json: "name"`
|
||||||
|
Status int `json: "status"`
|
||||||
Hash string `json: "hash"`
|
Hash string `json: "hash"`
|
||||||
Magnet string `json: "magnet"`
|
Magnet string `json: "magnet"`
|
||||||
}
|
}
|
||||||
|
@ -53,14 +54,16 @@ func apiHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
page := vars["page"]
|
page := vars["page"]
|
||||||
pagenum, _ := strconv.Atoi(html.EscapeString(page))
|
pagenum, _ := strconv.Atoi(html.EscapeString(page))
|
||||||
b := Record{Records: []Records{}}
|
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() {
|
for rows.Next() {
|
||||||
var id, name, hash, magnet string
|
var id, name, hash, magnet string
|
||||||
rows.Scan(&id, &name, &hash)
|
var status int
|
||||||
|
rows.Scan(&id, &name, &status, &hash)
|
||||||
magnet = "magnet:?xt=urn:btih:" + hash + "&dn=" + url.QueryEscape(name) + "&tr=udp://tracker.openbittorrent.com"
|
magnet = "magnet:?xt=urn:btih:" + hash + "&dn=" + url.QueryEscape(name) + "&tr=udp://tracker.openbittorrent.com"
|
||||||
res := Records{
|
res := Records{
|
||||||
Id: id,
|
Id: id,
|
||||||
Name: name,
|
Name: name,
|
||||||
|
Status: status,
|
||||||
Hash: hash,
|
Hash: hash,
|
||||||
Magnet: magnet}
|
Magnet: magnet}
|
||||||
|
|
||||||
|
@ -83,14 +86,16 @@ func singleapiHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
vars := mux.Vars(r)
|
vars := mux.Vars(r)
|
||||||
id := vars["id"]
|
id := vars["id"]
|
||||||
b := Record{Records: []Records{}}
|
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() {
|
for rows.Next() {
|
||||||
var id, name, hash, magnet string
|
var id, name, hash, magnet string
|
||||||
rows.Scan(&id, &name, &hash)
|
var status int
|
||||||
|
rows.Scan(&id, &name, &status, &hash)
|
||||||
magnet = "magnet:?xt=urn:btih:" + hash + "&dn=" + url.QueryEscape(name) + "&tr=udp://tracker.openbittorrent.com"
|
magnet = "magnet:?xt=urn:btih:" + hash + "&dn=" + url.QueryEscape(name) + "&tr=udp://tracker.openbittorrent.com"
|
||||||
res := Records{
|
res := Records{
|
||||||
Id: id,
|
Id: id,
|
||||||
Name: name,
|
Name: name,
|
||||||
|
Status: status,
|
||||||
Hash: hash,
|
Hash: hash,
|
||||||
Magnet: magnet}
|
Magnet: magnet}
|
||||||
|
|
||||||
|
@ -118,17 +123,19 @@ func searchHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
param2 := strings.Split(cat, "_")[0]
|
param2 := strings.Split(cat, "_")[0]
|
||||||
param3 := strings.Split(cat, "_")[1]
|
param3 := strings.Split(cat, "_")[1]
|
||||||
b := Record{Category: cat, Records: []Records{}}
|
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 ? "+
|
"where torrent_name LIKE ? AND category_id LIKE ? AND sub_category_id LIKE ? "+
|
||||||
"ORDER BY torrent_id DESC LIMIT 50 offset ?",
|
"ORDER BY torrent_id DESC LIMIT 50 offset ?",
|
||||||
"%"+html.EscapeString(param1)+"%", html.EscapeString(param2)+"%", html.EscapeString(param3)+"%", 50*pagenum-1)
|
"%"+html.EscapeString(param1)+"%", html.EscapeString(param2)+"%", html.EscapeString(param3)+"%", 50*pagenum-1)
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
var id, name, hash, magnet string
|
var id, name, hash, magnet string
|
||||||
rows.Scan(&id, &name, &hash)
|
var status int
|
||||||
|
rows.Scan(&id, &name, &status, &hash)
|
||||||
magnet = "magnet:?xt=urn:btih:" + hash + "&dn=" + url.QueryEscape(name) + "&tr=udp://tracker.openbittorrent.com"
|
magnet = "magnet:?xt=urn:btih:" + hash + "&dn=" + url.QueryEscape(name) + "&tr=udp://tracker.openbittorrent.com"
|
||||||
res := Records{
|
res := Records{
|
||||||
Id: id,
|
Id: id,
|
||||||
Name: name,
|
Name: name,
|
||||||
|
Status: status,
|
||||||
Hash: hash,
|
Hash: hash,
|
||||||
Magnet: magnet}
|
Magnet: magnet}
|
||||||
|
|
||||||
|
@ -148,14 +155,16 @@ func rootHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
page := vars["page"]
|
page := vars["page"]
|
||||||
pagenum, _ := strconv.Atoi(html.EscapeString(page))
|
pagenum, _ := strconv.Atoi(html.EscapeString(page))
|
||||||
b := Record{Category: "_", Records: []Records{}}
|
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() {
|
for rows.Next() {
|
||||||
var id, name, hash, magnet string
|
var id, name, hash, magnet string
|
||||||
rows.Scan(&id, &name, &hash)
|
var status int
|
||||||
|
rows.Scan(&id, &name, &status, &hash)
|
||||||
magnet = "magnet:?xt=urn:btih:" + hash + "&dn=" + url.QueryEscape(name) + "&tr=udp://tracker.openbittorrent.com"
|
magnet = "magnet:?xt=urn:btih:" + hash + "&dn=" + url.QueryEscape(name) + "&tr=udp://tracker.openbittorrent.com"
|
||||||
res := Records{
|
res := Records{
|
||||||
Id: id,
|
Id: id,
|
||||||
Name: name,
|
Name: name,
|
||||||
|
Status: status,
|
||||||
Hash: hash,
|
Hash: hash,
|
||||||
Magnet: magnet}
|
Magnet: magnet}
|
||||||
|
|
||||||
|
|
Référencer dans un nouveau ticket