Merge branch 'master' of https://github.com/ewhal/nyaa
Conflicts: main.go Resolved conflicts with new merge
Cette révision appartient à :
révision
7209666fb8
12 fichiers modifiés avec 45 ajouts et 19 suppressions
|
@ -1,5 +1,5 @@
|
|||
package config
|
||||
|
||||
const (
|
||||
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&tr=http://tracker.baka-sub.cf/announce"
|
||||
Trackers = "&tr=udp://tracker.coppersurfer.tk:6969&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=http://tracker.baka-sub.cf/announce"
|
||||
)
|
|
@ -9,7 +9,6 @@
|
|||
background-color: #81d3fa;
|
||||
}
|
||||
|
||||
|
||||
/* modified copy of NyaaTorrent theme */
|
||||
nav#mainmenu {
|
||||
background: #263238;
|
||||
|
@ -56,6 +55,19 @@ a {
|
|||
text-decoration : none;
|
||||
}
|
||||
|
||||
.download-btn {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.table-borderless > tbody > tr > td,
|
||||
.table-borderless > tbody > tr > th,
|
||||
.table-borderless > tfoot > tr > td,
|
||||
.table-borderless > tfoot > tr > th,
|
||||
.table-borderless > thead > tr > td,
|
||||
.table-borderless > thead > tr > th {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.torrent-info .name {
|
||||
font-weight: bold;
|
||||
overflow: hidden;
|
||||
|
@ -72,11 +84,16 @@ a {
|
|||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* Styling/fixes for the table: */
|
||||
.table > tbody > tr > td {
|
||||
/* fix bootstrap uglyness */
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.custom-table-hover > tbody > tr:hover {
|
||||
opacity: 0.82;
|
||||
}
|
||||
|
||||
div.container div.blockBody:nth-of-type(2) table{table-layout:fixed;}
|
||||
div.container div.blockBody:nth-of-type(2) table tr:first-of-type th:first-of-type, div.container div.blockBody:nth-of-type(2) table tr:first-of-type th:nth-of-type(5){width:10%;}
|
||||
div.container div.blockBody:nth-of-type(2) table tr:first-of-type th:nth-of-type(3){width:15%;}
|
||||
|
|
1
main.go
1
main.go
|
@ -15,7 +15,6 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
|
||||
func RunServer(conf *config.Config) {
|
||||
|
||||
http.Handle("/", router.Router)
|
||||
|
|
|
@ -10,7 +10,9 @@ import(
|
|||
func FaqHandler(w http.ResponseWriter, r *http.Request) {
|
||||
var templates = template.Must(template.New("FAQ").Funcs(FuncMap).ParseFiles("templates/index.html", "templates/FAQ.html"))
|
||||
templates.ParseGlob("templates/_*.html") // common
|
||||
err := templates.ExecuteTemplate(w, "index.html", FaqTemplateVariables{Navigation{}, NewSearchForm(), r.URL, mux.CurrentRoute(r)})
|
||||
searchForm := NewSearchForm()
|
||||
searchForm.HideAdvancedSearch = true
|
||||
err := templates.ExecuteTemplate(w, "index.html", FaqTemplateVariables{Navigation{}, searchForm, r.URL, mux.CurrentRoute(r)})
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import(
|
|||
"net/http"
|
||||
"github.com/gorilla/feeds"
|
||||
"github.com/ewhal/nyaa/util/search"
|
||||
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func RssHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
@ -29,7 +29,7 @@ func RssHandler(w http.ResponseWriter, r *http.Request) {
|
|||
torrent_json := torrents[i].ToJson()
|
||||
feed.Items[i] = &feeds.Item{
|
||||
// need a torrent view first
|
||||
//Id: URL + torrents[i].Hash,
|
||||
Id: "https://nyaa.pantsu.cat/view/" + strconv.Itoa(torrents[i].Id),
|
||||
Title: torrents[i].Name,
|
||||
Link: &feeds.Link{Href: string(torrent_json.Magnet)},
|
||||
Description: "",
|
||||
|
|
|
@ -39,6 +39,7 @@ func SearchHandler(w http.ResponseWriter, r *http.Request) {
|
|||
search_param.Category,
|
||||
search_param.Sort,
|
||||
search_param.Order,
|
||||
false,
|
||||
}
|
||||
htv := HomeTemplateVariables{b, torrentService.GetAllCategories(false), searchForm, navigationTorrents, r.URL, mux.CurrentRoute(r)}
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ type SearchForm struct {
|
|||
Category string
|
||||
Sort string
|
||||
Order string
|
||||
HideAdvancedSearch bool
|
||||
}
|
||||
|
||||
// Some Default Values to ease things out
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
</select>
|
||||
<select name="s" class="form-control input-sm">
|
||||
<option value="">Show all</option>
|
||||
<option value="2" {{if eq .Search.Status "2"}}selected{{end}}>Remakes</option>
|
||||
<option value="2" {{if eq .Search.Status "2"}}selected{{end}}>Filter Remakes</option>
|
||||
<option value="3" {{if eq .Search.Status "3"}}selected{{end}}>Trusted</option>
|
||||
<option value="4" {{if eq .Search.Status "4"}}selected{{end}}>A+</option>
|
||||
</select>
|
||||
|
@ -43,7 +43,7 @@
|
|||
<option value="desc" {{if eq .Search.Order "desc"}}selected{{end}}>Descending</option>
|
||||
<option value="asc" {{if eq .Search.Order "asc"}}selected{{end}}>Ascending</option>
|
||||
</select>
|
||||
<select name="max" class="form-control input-sm" value>
|
||||
<select name="max" class="form-control input-sm">
|
||||
<option value="5" {{if eq .Navigation.MaxItemPerPage 5}}selected{{end}}>5</option>
|
||||
<option value="10" {{if eq .Navigation.MaxItemPerPage 10}}selected{{end}}>10</option>
|
||||
<option value="15" {{if eq .Navigation.MaxItemPerPage 15}}selected{{end}}>15</option>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
</nav>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
<table class="table custom-table-hover">
|
||||
<tr>
|
||||
<th>Category</th>
|
||||
<th>Name</th>
|
||||
|
@ -34,7 +34,7 @@
|
|||
<td class="date date-short">{{.Date}}</td>
|
||||
<td class="filesize">{{.Filesize}}</td>
|
||||
<td>
|
||||
<a href="{{.Magnet}}" target="_blank" title="Magnet link">
|
||||
<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">
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
<div style="padding-top: 10rem"></div>
|
||||
|
||||
<div class="container" id="container">
|
||||
{{if not .Search.HideAdvancedSearch}}
|
||||
<div class="blockBody" style="text-align:center">
|
||||
<font size="4.5">Advanced Search</font><br />
|
||||
<form class="navbar-form" role="search" action="/search" method="get">
|
||||
|
@ -71,6 +72,8 @@
|
|||
<div style="clear:both"></div>
|
||||
</div>
|
||||
<div style="margin:0.5em"></div>
|
||||
{{end}}
|
||||
|
||||
{{block "content" .}}Nothing Here.{{end}}
|
||||
</div>
|
||||
|
||||
|
|
|
@ -2,12 +2,11 @@
|
|||
{{define "content"}}
|
||||
<div class="blockBody">
|
||||
{{with .Torrent}}
|
||||
<table class="table">
|
||||
<hr>
|
||||
<table class="table table-borderless">
|
||||
<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>
|
||||
|
@ -22,12 +21,12 @@
|
|||
<td class="date-full">{{.Date}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>FileSize</td>
|
||||
<td>Size</td>
|
||||
<td>{{.Filesize}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Links</td>
|
||||
<td><a href="{{.Magnet}}" title="Magnet link" ><span class="glyphicon glyphicon-magnet" aria-hidden="true"></span></a>
|
||||
<td><a aria-label="Magnet Button" href="{{.Magnet}}" type="button" class="btn btn-success download-btn"><span class="glyphicon glyphicon-magnet" aria-hidden="true"></span> Download!</button>
|
||||
<!-- <a
|
||||
href="https://itorrents.org/torrent/{{.Hash}}.torrent" title="Torrent file"><span class="glyphicon glyphicon-floppy-save" aria-hidden="true"></span></a>-->
|
||||
</td>
|
||||
|
|
|
@ -60,7 +60,11 @@ func SearchByQuery(r *http.Request, pagenum int) (SearchParam, []model.Torrents,
|
|||
parameters.Params = append(parameters.Params, searchSubCatId)
|
||||
}
|
||||
if search_param.Status != "" {
|
||||
if search_param.Status == "2" {
|
||||
conditions = append(conditions, "status_id != ?")
|
||||
} else {
|
||||
conditions = append(conditions, "status_id = ?")
|
||||
}
|
||||
parameters.Params = append(parameters.Params, search_param.Status)
|
||||
}
|
||||
searchQuerySplit := strings.Split(search_param.Query, " ")
|
||||
|
|
Référencer dans un nouveau ticket