Merge remote-tracking branch 'origin/dev' into dev
# Conflicts: # router/template_functions.go
Cette révision appartient à :
révision
380515b322
|
@ -1,27 +1,44 @@
|
||||||
/*Don't make changes to layout here, only colours*/
|
/*Don't make changes to layout here, only colours*/
|
||||||
/* Torrent status colors */
|
/* Torrent status colors */
|
||||||
.remake {
|
.remake {
|
||||||
background-color: #473e50; /*270,13%,28%*/
|
/*270,13%,28%*/
|
||||||
|
background-color: #473e50;
|
||||||
}
|
}
|
||||||
|
|
||||||
.trusted {
|
.trusted {
|
||||||
background-color: #395045; /*150,17%,27%*/
|
/*150,17%,27%*/
|
||||||
|
background-color: #395045;
|
||||||
}
|
}
|
||||||
|
|
||||||
.aplus {
|
.aplus {
|
||||||
background-color: #3c5b71; /*205,30%,34%*/
|
/*205,30%,34%*/
|
||||||
|
background-color: #3c5b71;
|
||||||
}
|
}
|
||||||
|
|
||||||
.remake a {
|
.remake a {
|
||||||
color: #cfc2dc; /*270,26%,81%*/
|
/*270,26%,81%*/
|
||||||
|
color: #cfc2dc;
|
||||||
}
|
}
|
||||||
|
|
||||||
.trusted a {
|
.trusted a {
|
||||||
color: #bde0db; /*170,36%,81%*/
|
/*170,36%,81%*/
|
||||||
|
color: #bde0db;
|
||||||
}
|
}
|
||||||
|
|
||||||
.remake a:hover {
|
.remake a:hover {
|
||||||
color: #cf9fff;
|
color: #cf9fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.trusted a:hover {
|
.trusted a:hover {
|
||||||
color: #6ae3d1;
|
color: #6ae3d1;
|
||||||
}
|
}
|
||||||
.table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th {
|
|
||||||
|
.table > tbody > tr > td,
|
||||||
|
.table > tbody > tr > th,
|
||||||
|
.table > tfoot > tr > td,
|
||||||
|
.table > tfoot > tr > th,
|
||||||
|
.table > thead > tr > td,
|
||||||
|
.table > thead > tr > th {
|
||||||
border-color: hsla(200,60%,70%,0.15);
|
border-color: hsla(200,60%,70%,0.15);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,26 +77,29 @@
|
||||||
background-image: url(/img/megumin.png);
|
background-image: url(/img/megumin.png);
|
||||||
}
|
}
|
||||||
|
|
||||||
body, footer {
|
body,
|
||||||
|
footer {
|
||||||
background-color: #282A2E;
|
background-color: #282A2E;
|
||||||
color: #eff5f5;
|
color: #eff5f5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.pagination > .active > a {
|
.pagination > .active > a {
|
||||||
background: #ececec;
|
background: #ececec;
|
||||||
border-color: #ececec;
|
border-color: #ececec;
|
||||||
color: #337ab7; /* restore usual text color */
|
/* restore usual text color */
|
||||||
|
color: #337ab7;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Links, Text */
|
/* Links, Text */
|
||||||
a {
|
a {
|
||||||
color: #a2c9dd;
|
color: #a2c9dd;
|
||||||
}
|
}
|
||||||
|
|
||||||
a:hover {
|
a:hover {
|
||||||
color: #55c5ff;
|
color: #55c5ff;
|
||||||
text-shadow: 1px 1px 0 #000;
|
text-shadow: 1px 1px 0 #000;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-success {
|
.btn-success {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
background-color: #b294bb;
|
background-color: #b294bb;
|
||||||
|
@ -90,16 +110,21 @@ a:hover {
|
||||||
background-color: #b294bb;
|
background-color: #b294bb;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-control, pre {
|
.form-control,
|
||||||
|
pre {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
background-color: #29363d
|
background-color: #29363d
|
||||||
}
|
}
|
||||||
|
|
||||||
/* style the dropdown member menu */
|
/* style the dropdown member menu */
|
||||||
.nav > .dropdown.open, .profile-image[aria-expanded="true"], .nav ul.dropdown-menu {
|
.nav > .dropdown.open,
|
||||||
|
.profile-image[aria-expanded="true"],
|
||||||
|
.nav ul.dropdown-menu {
|
||||||
background: #282A2E;
|
background: #282A2E;
|
||||||
}
|
}
|
||||||
.dropdown-menu > li > a:focus, .dropdown-menu > li > a:hover {
|
|
||||||
|
.dropdown-menu > li > a:focus,
|
||||||
|
.dropdown-menu > li > a:hover {
|
||||||
background: #263238;
|
background: #263238;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,9 +152,11 @@ a:hover {
|
||||||
border-bottom: .5em solid #fff;
|
border-bottom: .5em solid #fff;
|
||||||
margin-bottom: -.5em;
|
margin-bottom: -.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-content {
|
.modal-content {
|
||||||
background: #29363d;
|
background: #29363d;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-content .close {
|
.modal-content .close {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
@ -140,7 +167,6 @@ a:hover {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Comments*/
|
/*Comments*/
|
||||||
|
|
||||||
.commentList .commentData {
|
.commentList .commentData {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
@ -153,6 +179,7 @@ a:hover {
|
||||||
textarea.torrent-desc {
|
textarea.torrent-desc {
|
||||||
background: none;
|
background: none;
|
||||||
}
|
}
|
||||||
.md-editor>textarea:focus {
|
|
||||||
|
.md-editor > textarea:focus {
|
||||||
background: none;
|
background: none;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,11 @@
|
||||||
.remake {
|
.remake {
|
||||||
background-color: rgb(240, 176, 128);
|
background-color: rgb(240, 176, 128);
|
||||||
}
|
}
|
||||||
|
|
||||||
.trusted {
|
.trusted {
|
||||||
background-color: #a3e9a4;
|
background-color: #a3e9a4;
|
||||||
}
|
}
|
||||||
|
|
||||||
.aplus {
|
.aplus {
|
||||||
background-color: #81d3fa;
|
background-color: #81d3fa;
|
||||||
}
|
}
|
||||||
|
@ -12,39 +14,47 @@
|
||||||
.container.remake {
|
.container.remake {
|
||||||
box-shadow: 0px 0px 30px 10px rgba(240, 176, 128, 0.6);
|
box-shadow: 0px 0px 30px 10px rgba(240, 176, 128, 0.6);
|
||||||
}
|
}
|
||||||
|
|
||||||
.row.remake {
|
.row.remake {
|
||||||
margin-bottom: 0.5rem;
|
margin-bottom: 0.5rem;
|
||||||
color: rgb(119, 94, 140);
|
color: rgb(119, 94, 140);
|
||||||
padding:2px 0;
|
padding: 2px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container.trusted {
|
.container.trusted {
|
||||||
box-shadow: 0px 0px 30px 10px rgba(163, 233, 164, 0.6);
|
box-shadow: 0px 0px 30px 10px rgba(163, 233, 164, 0.6);
|
||||||
}
|
}
|
||||||
|
|
||||||
.row.trusted {
|
.row.trusted {
|
||||||
margin-bottom: 0.5rem;
|
margin-bottom: 0.5rem;
|
||||||
color: rgb(119, 94, 140);
|
color: rgb(119, 94, 140);
|
||||||
padding:2px 0;
|
padding: 2px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container.aplus {
|
.container.aplus {
|
||||||
box-shadow: 0px 0px 30px 10px rgba(129, 211, 250, 0.6);
|
box-shadow: 0px 0px 30px 10px rgba(129, 211, 250, 0.6);
|
||||||
}
|
}
|
||||||
|
|
||||||
.row.aplus {
|
.row.aplus {
|
||||||
margin-bottom: 0.5rem;
|
margin-bottom: 0.5rem;
|
||||||
color: rgb(119, 94, 140);
|
color: rgb(119, 94, 140);
|
||||||
padding:2px 0;
|
padding: 2px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* modified copy of NyaaTorrent theme */
|
/* modified copy of NyaaTorrent theme */
|
||||||
#mainmenu, #mainmenu .dropdown-menu{
|
#mainmenu,
|
||||||
|
#mainmenu .dropdown-menu {
|
||||||
background: #263238;
|
background: #263238;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
#mainmenu {
|
#mainmenu {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
z-index: 4;
|
z-index: 4;
|
||||||
border: 0px solid white;
|
border: 0px solid white;
|
||||||
}
|
}
|
||||||
|
|
||||||
#mainmenu a {
|
#mainmenu a {
|
||||||
background: none;
|
background: none;
|
||||||
color: white;
|
color: white;
|
||||||
|
@ -59,6 +69,7 @@
|
||||||
background: white;
|
background: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This used to avoid usage of Javascript for switching images. */
|
||||||
#mascot {
|
#mascot {
|
||||||
background-image: url(/img/renchon.png);
|
background-image: url(/img/renchon.png);
|
||||||
width: 125px;
|
width: 125px;
|
||||||
|
@ -67,7 +78,6 @@
|
||||||
bottom: 0px;
|
bottom: 0px;
|
||||||
left: 2%;
|
left: 2%;
|
||||||
}
|
}
|
||||||
/* This used to avoid usage of Javascript for switching images. */
|
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background-color: #ececec;
|
background-color: #ececec;
|
||||||
|
@ -84,7 +94,8 @@ body {
|
||||||
.pagination > .active > a {
|
.pagination > .active > a {
|
||||||
background: #ececec;
|
background: #ececec;
|
||||||
border-color: #ececec;
|
border-color: #ececec;
|
||||||
color: #337ab7; /* restore usual text color */
|
/* restore usual text color */
|
||||||
|
color: #337ab7;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Links, Text */
|
/* Links, Text */
|
||||||
|
@ -125,15 +136,17 @@ td {
|
||||||
.comment-row td:first-of-type {
|
.comment-row td:first-of-type {
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
color:#bbb;
|
color: #bbb;
|
||||||
}
|
}
|
||||||
|
|
||||||
.md-editor > textarea, .md-preview {
|
.md-editor > textarea,
|
||||||
|
.md-preview {
|
||||||
background: none !important;
|
background: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Table style & fixes */
|
/* Table style & fixes */
|
||||||
.table > tbody > tr > th, .nowrap {
|
.table > tbody > tr > th,
|
||||||
|
.nowrap {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +155,8 @@ td {
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
.table > tbody > tr > th, .table > tbody > tr > td {
|
.table > tbody > tr > th,
|
||||||
|
.table > tbody > tr > td {
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,15 +186,34 @@ th a:hover {
|
||||||
opacity: 0.25;
|
opacity: 0.25;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.container div.blockBody:nth-of-type(2) table{table-layout:fixed;}
|
div.container div.blockBody:nth-of-type(2) table {
|
||||||
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%;}
|
table-layout: fixed;
|
||||||
div.container div.blockBody:nth-of-type(2) table tr:first-of-type th:nth-of-type(3){width:15%;}
|
}
|
||||||
div.container div.blockBody:nth-of-type(2) table tr:first-of-type th:nth-of-type(4){width:19%;}
|
|
||||||
div.container div.blockBody:nth-of-type(2) table tr:first-of-type th:last-of-type{width:6%;}
|
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%;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.container div.blockBody:nth-of-type(2) table tr:first-of-type th:nth-of-type(4) {
|
||||||
|
width: 19%;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.container div.blockBody:nth-of-type(2) table tr:first-of-type th:last-of-type {
|
||||||
|
width: 6%;
|
||||||
|
}
|
||||||
|
|
||||||
/* Mobile-friendly main table */
|
/* Mobile-friendly main table */
|
||||||
@media only screen and (max-width: 700px) {
|
@media only screen and (max-width: 700px) {
|
||||||
table, thead, tbody, tr {
|
|
||||||
|
table,
|
||||||
|
thead,
|
||||||
|
tbody,
|
||||||
|
tr {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,7 +225,8 @@ div.container div.blockBody:nth-of-type(2) table tr:first-of-type th:last-of-typ
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
td:nth-of-type(1), td:nth-of-type(2) {
|
td:nth-of-type(1),
|
||||||
|
td:nth-of-type(2) {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,18 +269,15 @@ div.container div.blockBody:nth-of-type(2) table tr:first-of-type th:last-of-typ
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#mainmenu .navbar-form select.form-control
|
#mainmenu .navbar-form select.form-control {
|
||||||
{
|
|
||||||
width: 12rem;
|
width: 12rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
#mainmenu .navbar-form select.form-control#max
|
#mainmenu .navbar-form select.form-control#max {
|
||||||
{
|
|
||||||
width: 6rem;
|
width: 6rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.special-img
|
.special-img {
|
||||||
{
|
|
||||||
position: relative;
|
position: relative;
|
||||||
top: -7px;
|
top: -7px;
|
||||||
float: left;
|
float: left;
|
||||||
|
@ -257,13 +288,16 @@ div.container div.blockBody:nth-of-type(2) table tr:first-of-type th:last-of-typ
|
||||||
line-height: 35px;
|
line-height: 35px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#mainmenu .navbar-header, #mainmenu .navbar-nav, #mainmenu .navbar-form {
|
#mainmenu .navbar-header,
|
||||||
|
#mainmenu .navbar-nav,
|
||||||
|
#mainmenu .navbar-form {
|
||||||
padding-top: 8px;
|
padding-top: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#mainmenu .badgemenu {
|
#mainmenu .badgemenu {
|
||||||
padding-top: 0;
|
padding-top: 0;
|
||||||
margin-right: -50px; /* Any order columns */
|
/* Any order columns */
|
||||||
|
margin-right: -50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PROFILE PAGE */
|
/* PROFILE PAGE */
|
||||||
|
@ -407,6 +441,7 @@ select#bottom_language_selector {
|
||||||
#comments blockquote {
|
#comments blockquote {
|
||||||
color: #789922;
|
color: #789922;
|
||||||
}
|
}
|
||||||
|
|
||||||
#comments blockquote:before {
|
#comments blockquote:before {
|
||||||
content: ">";
|
content: ">";
|
||||||
}
|
}
|
||||||
|
@ -418,7 +453,9 @@ select#bottom_language_selector {
|
||||||
}
|
}
|
||||||
|
|
||||||
.proSeedBar {
|
.proSeedBar {
|
||||||
width:100%; height: 0.5rem; overflow: hidden;
|
width: 100%;
|
||||||
|
height: 0.5rem;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.proSeedBar .seeds {
|
.proSeedBar .seeds {
|
||||||
|
@ -436,7 +473,8 @@ select#bottom_language_selector {
|
||||||
|
|
||||||
.comment-date {
|
.comment-date {
|
||||||
font-size: smaller;
|
font-size: smaller;
|
||||||
width: auto; /* Undo bootstrap's fixed width */
|
/* Undo bootstrap's fixed width */
|
||||||
|
width: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.text-error {
|
.text-error {
|
||||||
|
@ -444,7 +482,6 @@ select#bottom_language_selector {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wordbreak fix*/
|
/* Wordbreak fix*/
|
||||||
|
|
||||||
.break {
|
.break {
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
hyphens: auto;
|
hyphens: auto;
|
||||||
|
@ -463,7 +500,6 @@ select#bottom_language_selector {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Comments*/
|
/*Comments*/
|
||||||
|
|
||||||
.commentList::before,
|
.commentList::before,
|
||||||
.commentList::after {
|
.commentList::after {
|
||||||
content: "";
|
content: "";
|
||||||
|
@ -516,7 +552,7 @@ select#bottom_language_selector {
|
||||||
height: 2.2em;
|
height: 2.2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.commentList ul.comments ul{
|
.commentList ul.comments ul {
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin-left: 85px;
|
margin-left: 85px;
|
||||||
|
@ -536,7 +572,7 @@ select#bottom_language_selector {
|
||||||
margin-left: 12%;
|
margin-left: 12%;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media only screen and (min-device-width : 320px) and (max-device-width : 480px) {
|
@media only screen and (min-device-width: 320px) and (max-device-width: 480px) {
|
||||||
|
|
||||||
.comment {
|
.comment {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -545,42 +581,54 @@ select#bottom_language_selector {
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 995px) {
|
@media (max-width: 995px) {
|
||||||
|
|
||||||
.navbar-header {
|
.navbar-header {
|
||||||
float: none;
|
float: none;
|
||||||
}
|
}
|
||||||
.navbar-left,.navbar-right {
|
|
||||||
|
.navbar-left,
|
||||||
|
.navbar-right {
|
||||||
float: none !important;
|
float: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbar-toggle {
|
.navbar-toggle {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbar-collapse {
|
.navbar-collapse {
|
||||||
border-top: 1px solid transparent;
|
border-top: 1px solid transparent;
|
||||||
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
|
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbar-fixed-top {
|
.navbar-fixed-top {
|
||||||
top: 0;
|
top: 0;
|
||||||
border-width: 0 0 1px;
|
border-width: 0 0 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbar-collapse.collapse {
|
.navbar-collapse.collapse {
|
||||||
display: none!important;
|
display: none!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbar-nav {
|
.navbar-nav {
|
||||||
float: none!important;
|
float: none!important;
|
||||||
margin-top: 7.5px;
|
margin-top: 7.5px;
|
||||||
}
|
}
|
||||||
.navbar-nav>li {
|
|
||||||
|
.navbar-nav > li {
|
||||||
float: none;
|
float: none;
|
||||||
}
|
}
|
||||||
.navbar-nav>li>a {
|
|
||||||
|
.navbar-nav > li > a {
|
||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
padding-bottom: 10px;
|
padding-bottom: 10px;
|
||||||
}
|
}
|
||||||
.collapse.in{
|
.collapse.in {
|
||||||
display:block !important;
|
display: block !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 1500px) {
|
@media (max-width: 1500px) {
|
||||||
|
|
||||||
#mascot {
|
#mascot {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,10 +8,8 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/NyaaPantsu/nyaa/model"
|
"github.com/NyaaPantsu/nyaa/model"
|
||||||
"github.com/NyaaPantsu/nyaa/util/languages"
|
|
||||||
"github.com/NyaaPantsu/nyaa/util/log"
|
"github.com/NyaaPantsu/nyaa/util/log"
|
||||||
"github.com/NyaaPantsu/nyaa/util/metainfo"
|
"github.com/NyaaPantsu/nyaa/util/metainfo"
|
||||||
"github.com/gorilla/mux"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -49,8 +47,9 @@ func DatabaseDumpHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
// TODO Remove ?
|
// TODO Remove ?
|
||||||
navigationTorrents := Navigation{0, 0, 0, "search_page"}
|
navigationTorrents := Navigation{0, 0, 0, "search_page"}
|
||||||
T := languages.GetTfuncFromRequest(r)
|
common := NewCommonVariables(r)
|
||||||
dtv := DatabaseDumpTemplateVariables{dumpsJson, "/gpg/gpg.pub", NewSearchForm(), navigationTorrents, T, GetUser(r), r.URL, mux.CurrentRoute(r)}
|
common.Navigation = navigationTorrents
|
||||||
|
dtv := DatabaseDumpTemplateVariables{common, dumpsJson, "/gpg/gpg.pub"}
|
||||||
err = databaseDumpTemplate.ExecuteTemplate(w, "index.html", dtv)
|
err = databaseDumpTemplate.ExecuteTemplate(w, "index.html", dtv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("DatabaseDump(): %s", err)
|
log.Errorf("DatabaseDump(): %s", err)
|
||||||
|
|
|
@ -2,20 +2,10 @@ package router
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/NyaaPantsu/nyaa/util/languages"
|
|
||||||
"github.com/gorilla/mux"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func FaqHandler(w http.ResponseWriter, r *http.Request) {
|
func FaqHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
ftv := FaqTemplateVariables{
|
ftv := FaqTemplateVariables{NewCommonVariables(r)}
|
||||||
Navigation: NewNavigation(),
|
|
||||||
Search: NewSearchForm(),
|
|
||||||
T: languages.GetTfuncFromRequest(r),
|
|
||||||
User: GetUser(r),
|
|
||||||
URL: r.URL,
|
|
||||||
Route: mux.CurrentRoute(r),
|
|
||||||
}
|
|
||||||
err := faqTemplate.ExecuteTemplate(w, "index.html", ftv)
|
err := faqTemplate.ExecuteTemplate(w, "index.html", ftv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
|
|
@ -10,7 +10,6 @@ import (
|
||||||
"github.com/NyaaPantsu/nyaa/model"
|
"github.com/NyaaPantsu/nyaa/model"
|
||||||
"github.com/NyaaPantsu/nyaa/service/torrent"
|
"github.com/NyaaPantsu/nyaa/service/torrent"
|
||||||
"github.com/NyaaPantsu/nyaa/util"
|
"github.com/NyaaPantsu/nyaa/util"
|
||||||
"github.com/NyaaPantsu/nyaa/util/languages"
|
|
||||||
"github.com/NyaaPantsu/nyaa/util/log"
|
"github.com/NyaaPantsu/nyaa/util/log"
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
)
|
)
|
||||||
|
@ -64,14 +63,11 @@ func HomeHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
torrentsJson := model.TorrentsToJSON(torrents)
|
torrentsJson := model.TorrentsToJSON(torrents)
|
||||||
|
common := NewCommonVariables(r)
|
||||||
|
common.Navigation = navigationTorrents
|
||||||
htv := HomeTemplateVariables{
|
htv := HomeTemplateVariables{
|
||||||
|
CommonTemplateVariables: common,
|
||||||
ListTorrents: torrentsJson,
|
ListTorrents: torrentsJson,
|
||||||
Search: NewSearchForm(),
|
|
||||||
Navigation: navigationTorrents,
|
|
||||||
T: languages.GetTfuncFromRequest(r),
|
|
||||||
User: GetUser(r),
|
|
||||||
URL: r.URL,
|
|
||||||
Route: mux.CurrentRoute(r),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = homeTemplate.ExecuteTemplate(w, "index.html", htv)
|
err = homeTemplate.ExecuteTemplate(w, "index.html", htv)
|
||||||
|
|
|
@ -7,7 +7,6 @@ import (
|
||||||
"github.com/NyaaPantsu/nyaa/service/user"
|
"github.com/NyaaPantsu/nyaa/service/user"
|
||||||
"github.com/NyaaPantsu/nyaa/util/languages"
|
"github.com/NyaaPantsu/nyaa/util/languages"
|
||||||
"github.com/NyaaPantsu/nyaa/util/timeHelper"
|
"github.com/NyaaPantsu/nyaa/util/timeHelper"
|
||||||
"github.com/gorilla/mux"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type LanguagesJSONResponse struct {
|
type LanguagesJSONResponse struct {
|
||||||
|
@ -29,14 +28,9 @@ func SeeLanguagesHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
clv := ChangeLanguageVariables{
|
clv := ChangeLanguageVariables{
|
||||||
Search: NewSearchForm(),
|
CommonTemplateVariables: NewCommonVariables(r),
|
||||||
Navigation: NewNavigation(),
|
|
||||||
T: languages.GetTfuncFromRequest(r),
|
|
||||||
Language: Tlang.Tag,
|
Language: Tlang.Tag,
|
||||||
Languages: availableLanguages,
|
Languages: availableLanguages,
|
||||||
User: GetUser(r),
|
|
||||||
URL: r.URL,
|
|
||||||
Route: mux.CurrentRoute(r),
|
|
||||||
}
|
}
|
||||||
err := changeLanguageTemplate.ExecuteTemplate(w, "index.html", clv)
|
err := changeLanguageTemplate.ExecuteTemplate(w, "index.html", clv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -17,7 +17,6 @@ import (
|
||||||
"github.com/NyaaPantsu/nyaa/service/user"
|
"github.com/NyaaPantsu/nyaa/service/user"
|
||||||
"github.com/NyaaPantsu/nyaa/service/user/permission"
|
"github.com/NyaaPantsu/nyaa/service/user/permission"
|
||||||
form "github.com/NyaaPantsu/nyaa/service/user/form"
|
form "github.com/NyaaPantsu/nyaa/service/user/form"
|
||||||
"github.com/NyaaPantsu/nyaa/util/languages"
|
|
||||||
"github.com/NyaaPantsu/nyaa/util/log"
|
"github.com/NyaaPantsu/nyaa/util/log"
|
||||||
msg "github.com/NyaaPantsu/nyaa/util/messages"
|
msg "github.com/NyaaPantsu/nyaa/util/messages"
|
||||||
"github.com/NyaaPantsu/nyaa/util/search"
|
"github.com/NyaaPantsu/nyaa/util/search"
|
||||||
|
@ -106,9 +105,13 @@ func NewPanelSearchForm() SearchForm {
|
||||||
return form
|
return form
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func NewPanelCommonVariables(r *http.Request) CommonTemplateVariables {
|
||||||
|
common := NewCommonVariables(r)
|
||||||
|
common.Search = NewPanelSearchForm()
|
||||||
|
return common
|
||||||
|
}
|
||||||
|
|
||||||
func IndexModPanel(w http.ResponseWriter, r *http.Request) {
|
func IndexModPanel(w http.ResponseWriter, r *http.Request) {
|
||||||
// FIXME WrapModHandler already get user from db
|
|
||||||
currentUser := GetUser(r)
|
|
||||||
offset := 10
|
offset := 10
|
||||||
|
|
||||||
torrents, _, _ := torrentService.GetAllTorrents(offset, 0)
|
torrents, _, _ := torrentService.GetAllTorrents(offset, 0)
|
||||||
|
@ -116,14 +119,12 @@ func IndexModPanel(w http.ResponseWriter, r *http.Request) {
|
||||||
comments, _ := commentService.GetAllComments(offset, 0, "", "")
|
comments, _ := commentService.GetAllComments(offset, 0, "", "")
|
||||||
torrentReports, _, _ := reportService.GetAllTorrentReports(offset, 0)
|
torrentReports, _, _ := reportService.GetAllTorrentReports(offset, 0)
|
||||||
|
|
||||||
T := languages.GetTfuncFromRequest(r)
|
htv := PanelIndexVbs{NewPanelCommonVariables(r), torrents, model.TorrentReportsToJSON(torrentReports), users, comments}
|
||||||
htv := PanelIndexVbs{torrents, model.TorrentReportsToJSON(torrentReports), users, comments, NewPanelSearchForm(), T, currentUser, r.URL}
|
|
||||||
err := panelIndex.ExecuteTemplate(w, "admin_index.html", htv)
|
err := panelIndex.ExecuteTemplate(w, "admin_index.html", htv)
|
||||||
log.CheckError(err)
|
log.CheckError(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TorrentsListPanel(w http.ResponseWriter, r *http.Request) {
|
func TorrentsListPanel(w http.ResponseWriter, r *http.Request) {
|
||||||
currentUser := GetUser(r)
|
|
||||||
vars := mux.Vars(r)
|
vars := mux.Vars(r)
|
||||||
page := vars["page"]
|
page := vars["page"]
|
||||||
|
|
||||||
|
@ -145,15 +146,15 @@ func TorrentsListPanel(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
messages := msg.GetMessages(r)
|
messages := msg.GetMessages(r)
|
||||||
T := languages.GetTfuncFromRequest(r)
|
common := NewCommonVariables(r)
|
||||||
navigation := Navigation{ count, int(searchParam.Max), pagenum, "mod_tlist_page"}
|
common.Navigation = Navigation{ count, int(searchParam.Max), pagenum, "mod_tlist_page"}
|
||||||
ptlv := PanelTorrentListVbs{torrents, searchForm, navigation, T, currentUser, messages.GetAllErrors(), messages.GetAllInfos(), r.URL}
|
common.Search = searchForm
|
||||||
|
ptlv := PanelTorrentListVbs{common, torrents, messages.GetAllErrors(), messages.GetAllInfos()}
|
||||||
err = panelTorrentList.ExecuteTemplate(w, "admin_index.html", ptlv)
|
err = panelTorrentList.ExecuteTemplate(w, "admin_index.html", ptlv)
|
||||||
log.CheckError(err)
|
log.CheckError(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TorrentReportListPanel(w http.ResponseWriter, r *http.Request) {
|
func TorrentReportListPanel(w http.ResponseWriter, r *http.Request) {
|
||||||
currentUser := GetUser(r)
|
|
||||||
vars := mux.Vars(r)
|
vars := mux.Vars(r)
|
||||||
page := vars["page"]
|
page := vars["page"]
|
||||||
|
|
||||||
|
@ -171,15 +172,14 @@ func TorrentReportListPanel(w http.ResponseWriter, r *http.Request) {
|
||||||
torrentReports, nbReports, _ := reportService.GetAllTorrentReports(offset, (pagenum-1)*offset)
|
torrentReports, nbReports, _ := reportService.GetAllTorrentReports(offset, (pagenum-1)*offset)
|
||||||
|
|
||||||
reportJSON := model.TorrentReportsToJSON(torrentReports)
|
reportJSON := model.TorrentReportsToJSON(torrentReports)
|
||||||
T := languages.GetTfuncFromRequest(r)
|
common := NewCommonVariables(r)
|
||||||
navigation := Navigation{nbReports, offset, pagenum, "mod_trlist_page"}
|
common.Navigation = Navigation{nbReports, offset, pagenum, "mod_trlist_page"}
|
||||||
ptrlv := PanelTorrentReportListVbs{reportJSON, NewSearchForm(), navigation, T, currentUser, r.URL}
|
ptrlv := PanelTorrentReportListVbs{common, reportJSON}
|
||||||
err = panelTorrentReportList.ExecuteTemplate(w, "admin_index.html", ptrlv)
|
err = panelTorrentReportList.ExecuteTemplate(w, "admin_index.html", ptrlv)
|
||||||
log.CheckError(err)
|
log.CheckError(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func UsersListPanel(w http.ResponseWriter, r *http.Request) {
|
func UsersListPanel(w http.ResponseWriter, r *http.Request) {
|
||||||
currentUser := GetUser(r)
|
|
||||||
vars := mux.Vars(r)
|
vars := mux.Vars(r)
|
||||||
page := vars["page"]
|
page := vars["page"]
|
||||||
|
|
||||||
|
@ -195,14 +195,14 @@ func UsersListPanel(w http.ResponseWriter, r *http.Request) {
|
||||||
offset := 100
|
offset := 100
|
||||||
|
|
||||||
users, nbUsers := userService.RetrieveUsersForAdmin(offset, (pagenum-1)*offset)
|
users, nbUsers := userService.RetrieveUsersForAdmin(offset, (pagenum-1)*offset)
|
||||||
T := languages.GetTfuncFromRequest(r)
|
common := NewCommonVariables(r)
|
||||||
htv := PanelUserListVbs{users, NewSearchForm(), Navigation{nbUsers, offset, pagenum, "mod_ulist_page"}, T, currentUser, r.URL}
|
common.Navigation = Navigation{nbUsers, offset, pagenum, "mod_ulist_page"}
|
||||||
|
htv := PanelUserListVbs{common, users}
|
||||||
err = panelUserList.ExecuteTemplate(w, "admin_index.html", htv)
|
err = panelUserList.ExecuteTemplate(w, "admin_index.html", htv)
|
||||||
log.CheckError(err)
|
log.CheckError(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func CommentsListPanel(w http.ResponseWriter, r *http.Request) {
|
func CommentsListPanel(w http.ResponseWriter, r *http.Request) {
|
||||||
currentUser := GetUser(r)
|
|
||||||
vars := mux.Vars(r)
|
vars := mux.Vars(r)
|
||||||
page := vars["page"]
|
page := vars["page"]
|
||||||
|
|
||||||
|
@ -225,31 +225,30 @@ func CommentsListPanel(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
comments, nbComments := commentService.GetAllComments(offset, (pagenum-1)*offset, conditions, values...)
|
comments, nbComments := commentService.GetAllComments(offset, (pagenum-1)*offset, conditions, values...)
|
||||||
T := languages.GetTfuncFromRequest(r)
|
common := NewCommonVariables(r)
|
||||||
htv := PanelCommentListVbs{comments, NewSearchForm(), Navigation{nbComments, offset, pagenum, "mod_clist_page"}, T, currentUser, r.URL}
|
common.Navigation = Navigation{nbComments, offset, pagenum, "mod_clist_page"}
|
||||||
|
htv := PanelCommentListVbs{common, comments}
|
||||||
err = panelCommentList.ExecuteTemplate(w, "admin_index.html", htv)
|
err = panelCommentList.ExecuteTemplate(w, "admin_index.html", htv)
|
||||||
log.CheckError(err)
|
log.CheckError(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TorrentEditModPanel(w http.ResponseWriter, r *http.Request) {
|
func TorrentEditModPanel(w http.ResponseWriter, r *http.Request) {
|
||||||
currentUser := GetUser(r)
|
|
||||||
id := r.URL.Query().Get("id")
|
id := r.URL.Query().Get("id")
|
||||||
torrent, _ := torrentService.GetTorrentById(id)
|
torrent, _ := torrentService.GetTorrentById(id)
|
||||||
T := languages.GetTfuncFromRequest(r)
|
|
||||||
|
|
||||||
torrentJson := torrent.ToJSON()
|
torrentJson := torrent.ToJSON()
|
||||||
uploadForm := NewUploadForm()
|
uploadForm := NewUploadForm()
|
||||||
uploadForm.Name = torrentJson.Name
|
uploadForm.Name = torrentJson.Name
|
||||||
uploadForm.Category = torrentJson.Category + "_" + torrentJson.SubCategory
|
uploadForm.Category = torrentJson.Category + "_" + torrentJson.SubCategory
|
||||||
uploadForm.Status = torrentJson.Status
|
uploadForm.Status = torrentJson.Status
|
||||||
|
uploadForm.WebsiteLink = string(torrentJson.WebsiteLink)
|
||||||
uploadForm.Description = string(torrentJson.Description)
|
uploadForm.Description = string(torrentJson.Description)
|
||||||
htv := PanelTorrentEdVbs{uploadForm, NewPanelSearchForm(), T, currentUser, form.NewErrors(), form.NewInfos(), r.URL}
|
htv := PanelTorrentEdVbs{NewPanelCommonVariables(r), uploadForm, form.NewErrors(), form.NewInfos()}
|
||||||
err := panelTorrentEd.ExecuteTemplate(w, "admin_index.html", htv)
|
err := panelTorrentEd.ExecuteTemplate(w, "admin_index.html", htv)
|
||||||
log.CheckError(err)
|
log.CheckError(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TorrentPostEditModPanel(w http.ResponseWriter, r *http.Request) {
|
func TorrentPostEditModPanel(w http.ResponseWriter, r *http.Request) {
|
||||||
currentUser := GetUser(r)
|
|
||||||
var uploadForm UploadForm
|
var uploadForm UploadForm
|
||||||
id := r.URL.Query().Get("id")
|
id := r.URL.Query().Get("id")
|
||||||
err := form.NewErrors()
|
err := form.NewErrors()
|
||||||
|
@ -266,14 +265,14 @@ func TorrentPostEditModPanel(w http.ResponseWriter, r *http.Request) {
|
||||||
torrent.Category = uploadForm.CategoryID
|
torrent.Category = uploadForm.CategoryID
|
||||||
torrent.SubCategory = uploadForm.SubCategoryID
|
torrent.SubCategory = uploadForm.SubCategoryID
|
||||||
torrent.Status = uploadForm.Status
|
torrent.Status = uploadForm.Status
|
||||||
|
torrent.WebsiteLink = uploadForm.WebsiteLink
|
||||||
torrent.Description = uploadForm.Description
|
torrent.Description = uploadForm.Description
|
||||||
torrent.Uploader = nil // GORM will create a new user otherwise (wtf?!)
|
torrent.Uploader = nil // GORM will create a new user otherwise (wtf?!)
|
||||||
db.ORM.Save(&torrent)
|
db.ORM.Save(&torrent)
|
||||||
infos["infos"] = append(infos["infos"], "Torrent details updated.")
|
infos["infos"] = append(infos["infos"], "Torrent details updated.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
T := languages.GetTfuncFromRequest(r)
|
htv := PanelTorrentEdVbs{NewPanelCommonVariables(r), uploadForm, err, infos}
|
||||||
htv := PanelTorrentEdVbs{uploadForm, NewPanelSearchForm(), T, currentUser, err, infos, r.URL}
|
|
||||||
err_ := panelTorrentEd.ExecuteTemplate(w, "admin_index.html", htv)
|
err_ := panelTorrentEd.ExecuteTemplate(w, "admin_index.html", htv)
|
||||||
log.CheckError(err_)
|
log.CheckError(err_)
|
||||||
}
|
}
|
||||||
|
@ -314,16 +313,12 @@ func TorrentReportDeleteModPanel(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TorrentReassignModPanel(w http.ResponseWriter, r *http.Request) {
|
func TorrentReassignModPanel(w http.ResponseWriter, r *http.Request) {
|
||||||
currentUser := GetUser(r)
|
htv := PanelTorrentReassignVbs{NewPanelCommonVariables(r), ReassignForm{}, form.NewErrors(), form.NewInfos()}
|
||||||
T := languages.GetTfuncFromRequest(r)
|
|
||||||
|
|
||||||
htv := PanelTorrentReassignVbs{ReassignForm{}, NewPanelSearchForm(), T, currentUser, form.NewErrors(), form.NewInfos(), r.URL}
|
|
||||||
err := panelTorrentReassign.ExecuteTemplate(w, "admin_index.html", htv)
|
err := panelTorrentReassign.ExecuteTemplate(w, "admin_index.html", htv)
|
||||||
log.CheckError(err)
|
log.CheckError(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TorrentPostReassignModPanel(w http.ResponseWriter, r *http.Request) {
|
func TorrentPostReassignModPanel(w http.ResponseWriter, r *http.Request) {
|
||||||
currentUser := GetUser(r)
|
|
||||||
var rForm ReassignForm
|
var rForm ReassignForm
|
||||||
err := form.NewErrors()
|
err := form.NewErrors()
|
||||||
infos := form.NewInfos()
|
infos := form.NewInfos()
|
||||||
|
@ -340,8 +335,7 @@ func TorrentPostReassignModPanel(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
T := languages.GetTfuncFromRequest(r)
|
htv := PanelTorrentReassignVbs{NewPanelCommonVariables(r), rForm, err, infos}
|
||||||
htv := PanelTorrentReassignVbs{rForm, NewPanelSearchForm(), T, currentUser, err, infos, r.URL}
|
|
||||||
err_ := panelTorrentReassign.ExecuteTemplate(w, "admin_index.html", htv)
|
err_ := panelTorrentReassign.ExecuteTemplate(w, "admin_index.html", htv)
|
||||||
log.CheckError(err_)
|
log.CheckError(err_)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,22 +2,12 @@ package router
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/NyaaPantsu/nyaa/util/languages"
|
|
||||||
"github.com/gorilla/mux"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func NotFoundHandler(w http.ResponseWriter, r *http.Request) {
|
func NotFoundHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
w.WriteHeader(http.StatusNotFound)
|
w.WriteHeader(http.StatusNotFound)
|
||||||
|
|
||||||
nftv := NotFoundTemplateVariables{
|
nftv := NotFoundTemplateVariables{NewCommonVariables(r)}
|
||||||
Navigation: NewNavigation(),
|
|
||||||
Search: NewSearchForm(),
|
|
||||||
T: languages.GetTfuncFromRequest(r),
|
|
||||||
User: GetUser(r),
|
|
||||||
URL: r.URL,
|
|
||||||
Route: mux.CurrentRoute(r),
|
|
||||||
}
|
|
||||||
|
|
||||||
err := notFoundTemplate.ExecuteTemplate(w, "index.html", nftv)
|
err := notFoundTemplate.ExecuteTemplate(w, "index.html", nftv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -3,7 +3,6 @@ package router
|
||||||
import (
|
import (
|
||||||
"github.com/NyaaPantsu/nyaa/model"
|
"github.com/NyaaPantsu/nyaa/model"
|
||||||
"github.com/NyaaPantsu/nyaa/util"
|
"github.com/NyaaPantsu/nyaa/util"
|
||||||
"github.com/NyaaPantsu/nyaa/util/languages"
|
|
||||||
"github.com/NyaaPantsu/nyaa/util/log"
|
"github.com/NyaaPantsu/nyaa/util/log"
|
||||||
"github.com/NyaaPantsu/nyaa/util/search"
|
"github.com/NyaaPantsu/nyaa/util/search"
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
|
@ -39,15 +38,15 @@ func SearchHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
b := model.TorrentsToJSON(torrents)
|
b := model.TorrentsToJSON(torrents)
|
||||||
|
|
||||||
navigationTorrents := Navigation{nbTorrents, int(searchParam.Max), pagenum, "search_page"}
|
common := NewCommonVariables(r)
|
||||||
|
common.Navigation = Navigation{nbTorrents, int(searchParam.Max), pagenum, "search_page"}
|
||||||
// Convert back to strings for now.
|
// Convert back to strings for now.
|
||||||
searchForm := SearchForm{
|
common.Search = SearchForm{
|
||||||
SearchParam: searchParam,
|
SearchParam: searchParam,
|
||||||
Category: searchParam.Category.String(),
|
Category: searchParam.Category.String(),
|
||||||
ShowItemsPerPage: true,
|
ShowItemsPerPage: true,
|
||||||
}
|
}
|
||||||
T := languages.GetTfuncFromRequest(r)
|
htv := HomeTemplateVariables{common, b}
|
||||||
htv := HomeTemplateVariables{b, searchForm, navigationTorrents, T, GetUser(r), r.URL, mux.CurrentRoute(r)}
|
|
||||||
|
|
||||||
err = searchTemplate.ExecuteTemplate(w, "index.html", htv)
|
err = searchTemplate.ExecuteTemplate(w, "index.html", htv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -15,6 +15,11 @@ import (
|
||||||
"github.com/nicksnyder/go-i18n/i18n"
|
"github.com/nicksnyder/go-i18n/i18n"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type captchaData struct {
|
||||||
|
CaptchaID string
|
||||||
|
T languages.TemplateTfunc
|
||||||
|
}
|
||||||
|
|
||||||
var FuncMap = template.FuncMap{
|
var FuncMap = template.FuncMap{
|
||||||
"inc": func(i int) int {
|
"inc": func(i int) int {
|
||||||
return i + 1
|
return i + 1
|
||||||
|
@ -211,4 +216,7 @@ var FuncMap = template.FuncMap{
|
||||||
}
|
}
|
||||||
return filesize
|
return filesize
|
||||||
},
|
},
|
||||||
|
"makeCaptchaData": func(captchaID string, T languages.TemplateTfunc) captchaData {
|
||||||
|
return captchaData{captchaID, T}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,218 +19,138 @@ import (
|
||||||
*/
|
*/
|
||||||
|
|
||||||
type FaqTemplateVariables struct {
|
type FaqTemplateVariables struct {
|
||||||
Navigation Navigation
|
CommonTemplateVariables
|
||||||
Search SearchForm
|
|
||||||
T languages.TemplateTfunc
|
|
||||||
User *model.User
|
|
||||||
URL *url.URL // For parsing Url in templates
|
|
||||||
Route *mux.Route // For getting current route in templates
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type NotFoundTemplateVariables struct {
|
type NotFoundTemplateVariables struct {
|
||||||
Navigation Navigation
|
CommonTemplateVariables
|
||||||
Search SearchForm
|
|
||||||
T languages.TemplateTfunc
|
|
||||||
User *model.User
|
|
||||||
URL *url.URL // For parsing Url in templates
|
|
||||||
Route *mux.Route // For getting current route in templates
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ViewTemplateVariables struct {
|
type ViewTemplateVariables struct {
|
||||||
|
CommonTemplateVariables
|
||||||
Torrent model.TorrentJSON
|
Torrent model.TorrentJSON
|
||||||
CaptchaID string
|
CaptchaID string
|
||||||
FormErrors map[string][]string
|
FormErrors map[string][]string
|
||||||
Infos map[string][]string
|
Infos map[string][]string
|
||||||
Search SearchForm
|
|
||||||
Navigation Navigation
|
|
||||||
T languages.TemplateTfunc
|
|
||||||
User *model.User
|
|
||||||
URL *url.URL // For parsing Url in templates
|
|
||||||
Route *mux.Route // For getting current route in templates
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserRegisterTemplateVariables struct {
|
type UserRegisterTemplateVariables struct {
|
||||||
|
CommonTemplateVariables
|
||||||
RegistrationForm userForms.RegistrationForm
|
RegistrationForm userForms.RegistrationForm
|
||||||
FormErrors map[string][]string
|
FormErrors map[string][]string
|
||||||
Search SearchForm
|
|
||||||
Navigation Navigation
|
|
||||||
T languages.TemplateTfunc
|
|
||||||
User *model.User
|
|
||||||
URL *url.URL // For parsing Url in templates
|
|
||||||
Route *mux.Route // For getting current route in templates
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserProfileEditVariables struct {
|
type UserProfileEditVariables struct {
|
||||||
|
CommonTemplateVariables
|
||||||
UserProfile *model.User
|
UserProfile *model.User
|
||||||
UserForm userForms.UserForm
|
UserForm userForms.UserForm
|
||||||
FormErrors map[string][]string
|
FormErrors map[string][]string
|
||||||
FormInfos map[string][]string
|
FormInfos map[string][]string
|
||||||
Languages map[string]string
|
Languages map[string]string
|
||||||
Search SearchForm
|
|
||||||
Navigation Navigation
|
|
||||||
T languages.TemplateTfunc
|
|
||||||
User *model.User
|
|
||||||
URL *url.URL // For parsing Url in templates
|
|
||||||
Route *mux.Route // For getting current route in templates
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserVerifyTemplateVariables struct {
|
type UserVerifyTemplateVariables struct {
|
||||||
|
CommonTemplateVariables
|
||||||
FormErrors map[string][]string
|
FormErrors map[string][]string
|
||||||
Search SearchForm
|
|
||||||
Navigation Navigation
|
|
||||||
T languages.TemplateTfunc
|
|
||||||
User *model.User
|
|
||||||
URL *url.URL // For parsing Url in templates
|
|
||||||
Route *mux.Route // For getting current route in templates
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserLoginFormVariables struct {
|
type UserLoginFormVariables struct {
|
||||||
|
CommonTemplateVariables
|
||||||
LoginForm userForms.LoginForm
|
LoginForm userForms.LoginForm
|
||||||
FormErrors map[string][]string
|
FormErrors map[string][]string
|
||||||
Search SearchForm
|
|
||||||
Navigation Navigation
|
|
||||||
T languages.TemplateTfunc
|
|
||||||
User *model.User
|
|
||||||
URL *url.URL // For parsing Url in templates
|
|
||||||
Route *mux.Route // For getting current route in templates
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserProfileVariables struct {
|
type UserProfileVariables struct {
|
||||||
|
CommonTemplateVariables
|
||||||
UserProfile *model.User
|
UserProfile *model.User
|
||||||
FormInfos map[string][]string
|
FormInfos map[string][]string
|
||||||
Search SearchForm
|
|
||||||
Navigation Navigation
|
|
||||||
T languages.TemplateTfunc
|
|
||||||
User *model.User
|
|
||||||
URL *url.URL // For parsing Url in templates
|
|
||||||
Route *mux.Route // For getting current route in templates
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserProfileNotifVariables struct {
|
type UserProfileNotifVariables struct {
|
||||||
|
CommonTemplateVariables
|
||||||
Infos map[string][]string
|
Infos map[string][]string
|
||||||
Search SearchForm
|
|
||||||
Navigation Navigation
|
|
||||||
T languages.TemplateTfunc
|
|
||||||
User *model.User
|
|
||||||
URL *url.URL // For parsing Url in templates
|
|
||||||
Route *mux.Route // For getting current route in templates
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type HomeTemplateVariables struct {
|
type HomeTemplateVariables struct {
|
||||||
|
CommonTemplateVariables
|
||||||
ListTorrents []model.TorrentJSON
|
ListTorrents []model.TorrentJSON
|
||||||
Search SearchForm
|
|
||||||
Navigation Navigation
|
|
||||||
T languages.TemplateTfunc
|
|
||||||
User *model.User
|
|
||||||
URL *url.URL // For parsing Url in templates
|
|
||||||
Route *mux.Route // For getting current route in templates
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type DatabaseDumpTemplateVariables struct {
|
type DatabaseDumpTemplateVariables struct {
|
||||||
|
CommonTemplateVariables
|
||||||
ListDumps []model.DatabaseDumpJSON
|
ListDumps []model.DatabaseDumpJSON
|
||||||
GPGLink string
|
GPGLink string
|
||||||
Search SearchForm
|
|
||||||
Navigation Navigation
|
|
||||||
T languages.TemplateTfunc
|
|
||||||
User *model.User
|
|
||||||
URL *url.URL // For parsing Url in templates
|
|
||||||
Route *mux.Route // For getting current route in templates
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type UploadTemplateVariables struct {
|
type UploadTemplateVariables struct {
|
||||||
|
CommonTemplateVariables
|
||||||
Upload UploadForm
|
Upload UploadForm
|
||||||
FormErrors map[string][]string
|
FormErrors map[string][]string
|
||||||
Search SearchForm
|
|
||||||
Navigation Navigation
|
|
||||||
T languages.TemplateTfunc
|
|
||||||
User *model.User
|
|
||||||
URL *url.URL
|
|
||||||
Route *mux.Route
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ChangeLanguageVariables struct {
|
type ChangeLanguageVariables struct {
|
||||||
Search SearchForm
|
CommonTemplateVariables
|
||||||
Navigation Navigation
|
|
||||||
T languages.TemplateTfunc
|
|
||||||
Language string
|
Language string
|
||||||
Languages map[string]string
|
Languages map[string]string
|
||||||
User *model.User
|
|
||||||
URL *url.URL
|
|
||||||
Route *mux.Route
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* MODERATION Variables */
|
/* MODERATION Variables */
|
||||||
|
|
||||||
type PanelIndexVbs struct {
|
type PanelIndexVbs struct {
|
||||||
|
CommonTemplateVariables
|
||||||
Torrents []model.Torrent
|
Torrents []model.Torrent
|
||||||
TorrentReports []model.TorrentReportJson
|
TorrentReports []model.TorrentReportJson
|
||||||
Users []model.User
|
Users []model.User
|
||||||
Comments []model.Comment
|
Comments []model.Comment
|
||||||
Search SearchForm
|
|
||||||
T languages.TemplateTfunc
|
|
||||||
User *model.User
|
|
||||||
URL *url.URL // For parsing Url in templates
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type PanelTorrentListVbs struct {
|
type PanelTorrentListVbs struct {
|
||||||
|
CommonTemplateVariables
|
||||||
Torrents []model.Torrent
|
Torrents []model.Torrent
|
||||||
Search SearchForm
|
|
||||||
Navigation Navigation
|
|
||||||
T languages.TemplateTfunc
|
|
||||||
User *model.User
|
|
||||||
Errors map[string][]string
|
Errors map[string][]string
|
||||||
Infos map[string][]string
|
Infos map[string][]string
|
||||||
URL *url.URL // For parsing Url in templates
|
|
||||||
}
|
}
|
||||||
type PanelUserListVbs struct {
|
type PanelUserListVbs struct {
|
||||||
|
CommonTemplateVariables
|
||||||
Users []model.User
|
Users []model.User
|
||||||
Search SearchForm
|
|
||||||
Navigation Navigation
|
|
||||||
T languages.TemplateTfunc
|
|
||||||
User *model.User
|
|
||||||
URL *url.URL // For parsing Url in templates
|
|
||||||
}
|
}
|
||||||
type PanelCommentListVbs struct {
|
type PanelCommentListVbs struct {
|
||||||
|
CommonTemplateVariables
|
||||||
Comments []model.Comment
|
Comments []model.Comment
|
||||||
Search SearchForm
|
|
||||||
Navigation Navigation
|
|
||||||
T languages.TemplateTfunc
|
|
||||||
User *model.User
|
|
||||||
URL *url.URL // For parsing Url in templates
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type PanelTorrentEdVbs struct {
|
type PanelTorrentEdVbs struct {
|
||||||
|
CommonTemplateVariables
|
||||||
Upload UploadForm
|
Upload UploadForm
|
||||||
Search SearchForm
|
|
||||||
T languages.TemplateTfunc
|
|
||||||
User *model.User
|
|
||||||
FormErrors map[string][]string
|
FormErrors map[string][]string
|
||||||
FormInfos map[string][]string
|
FormInfos map[string][]string
|
||||||
URL *url.URL // For parsing Url in templates
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type PanelTorrentReportListVbs struct {
|
type PanelTorrentReportListVbs struct {
|
||||||
|
CommonTemplateVariables
|
||||||
TorrentReports []model.TorrentReportJson
|
TorrentReports []model.TorrentReportJson
|
||||||
Search SearchForm
|
|
||||||
Navigation Navigation
|
|
||||||
T languages.TemplateTfunc
|
|
||||||
User *model.User
|
|
||||||
URL *url.URL // For parsing Url in templates
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type PanelTorrentReassignVbs struct {
|
type PanelTorrentReassignVbs struct {
|
||||||
|
CommonTemplateVariables
|
||||||
Reassign ReassignForm
|
Reassign ReassignForm
|
||||||
Search SearchForm // unused?
|
|
||||||
T languages.TemplateTfunc
|
|
||||||
User *model.User // unused?
|
|
||||||
FormErrors map[string][]string
|
FormErrors map[string][]string
|
||||||
FormInfos map[string][]string
|
FormInfos map[string][]string
|
||||||
URL *url.URL // For parsing Url in templates
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Variables used by the upper ones
|
* Variables used by the upper ones
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
type CommonTemplateVariables struct {
|
||||||
|
Navigation Navigation
|
||||||
|
Search SearchForm
|
||||||
|
T languages.TemplateTfunc
|
||||||
|
User *model.User
|
||||||
|
URL *url.URL // for parsing URL in templates
|
||||||
|
Route *mux.Route // for getting current route in templates
|
||||||
|
}
|
||||||
|
|
||||||
type Navigation struct {
|
type Navigation struct {
|
||||||
TotalItem int
|
TotalItem int
|
||||||
MaxItemPerPage int // FIXME: shouldn't this be in SearchForm?
|
MaxItemPerPage int // FIXME: shouldn't this be in SearchForm?
|
||||||
|
@ -263,4 +183,14 @@ func GetUser(r *http.Request) *model.User {
|
||||||
return &user
|
return &user
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func NewCommonVariables(r *http.Request) CommonTemplateVariables {
|
||||||
|
return CommonTemplateVariables{
|
||||||
|
Navigation: NewNavigation(),
|
||||||
|
Search: NewSearchForm(),
|
||||||
|
T: languages.GetTfuncFromRequest(r),
|
||||||
|
User: GetUser(r),
|
||||||
|
URL: r.URL,
|
||||||
|
Route: mux.CurrentRoute(r),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -241,6 +241,7 @@ func (f *UploadForm) ExtractInfo(r *http.Request) error {
|
||||||
func (f *UploadForm) ExtractEditInfo(r *http.Request) error {
|
func (f *UploadForm) ExtractEditInfo(r *http.Request) error {
|
||||||
f.Name = r.FormValue(UploadFormName)
|
f.Name = r.FormValue(UploadFormName)
|
||||||
f.Category = r.FormValue(UploadFormCategory)
|
f.Category = r.FormValue(UploadFormCategory)
|
||||||
|
f.WebsiteLink = r.FormValue(UploadFormWebsiteLink)
|
||||||
f.Description = r.FormValue(UploadFormDescription)
|
f.Description = r.FormValue(UploadFormDescription)
|
||||||
f.Status, _ = strconv.Atoi(r.FormValue(UploadFormStatus))
|
f.Status, _ = strconv.Atoi(r.FormValue(UploadFormStatus))
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@ import (
|
||||||
"github.com/NyaaPantsu/nyaa/service/user/permission"
|
"github.com/NyaaPantsu/nyaa/service/user/permission"
|
||||||
"github.com/NyaaPantsu/nyaa/util/languages"
|
"github.com/NyaaPantsu/nyaa/util/languages"
|
||||||
msg "github.com/NyaaPantsu/nyaa/util/messages"
|
msg "github.com/NyaaPantsu/nyaa/util/messages"
|
||||||
"github.com/gorilla/mux"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func UploadHandler(w http.ResponseWriter, r *http.Request) {
|
func UploadHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
@ -125,14 +124,9 @@ func UploadGetHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
utv := UploadTemplateVariables{
|
utv := UploadTemplateVariables{
|
||||||
|
CommonTemplateVariables: NewCommonVariables(r),
|
||||||
Upload: uploadForm,
|
Upload: uploadForm,
|
||||||
FormErrors: messages.GetAllErrors(),
|
FormErrors: messages.GetAllErrors(),
|
||||||
Search: NewSearchForm(),
|
|
||||||
Navigation: NewNavigation(),
|
|
||||||
T: languages.GetTfuncFromRequest(r),
|
|
||||||
User: GetUser(r),
|
|
||||||
URL: r.URL,
|
|
||||||
Route: mux.CurrentRoute(r),
|
|
||||||
}
|
}
|
||||||
err := uploadTemplate.ExecuteTemplate(w, "index.html", utv)
|
err := uploadTemplate.ExecuteTemplate(w, "index.html", utv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -29,14 +29,9 @@ func UserRegisterFormHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
modelHelper.BindValueForm(®istrationForm, r)
|
modelHelper.BindValueForm(®istrationForm, r)
|
||||||
registrationForm.CaptchaID = captcha.GetID()
|
registrationForm.CaptchaID = captcha.GetID()
|
||||||
urtv := UserRegisterTemplateVariables{
|
urtv := UserRegisterTemplateVariables{
|
||||||
RegistrationForm: registrationForm,
|
CommonTemplateVariables: NewCommonVariables(r),
|
||||||
FormErrors: form.NewErrors(),
|
RegistrationForm: registrationForm,
|
||||||
Search: NewSearchForm(),
|
FormErrors: form.NewErrors(),
|
||||||
Navigation: NewNavigation(),
|
|
||||||
T: languages.GetTfuncFromRequest(r),
|
|
||||||
User: GetUser(r),
|
|
||||||
URL: r.URL,
|
|
||||||
Route: mux.CurrentRoute(r),
|
|
||||||
}
|
}
|
||||||
err := viewRegisterTemplate.ExecuteTemplate(w, "index.html", urtv)
|
err := viewRegisterTemplate.ExecuteTemplate(w, "index.html", urtv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -50,14 +45,9 @@ func UserLoginFormHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
modelHelper.BindValueForm(&loginForm, r)
|
modelHelper.BindValueForm(&loginForm, r)
|
||||||
|
|
||||||
ulfv := UserLoginFormVariables{
|
ulfv := UserLoginFormVariables{
|
||||||
LoginForm: loginForm,
|
CommonTemplateVariables: NewCommonVariables(r),
|
||||||
FormErrors: form.NewErrors(),
|
LoginForm: loginForm,
|
||||||
Search: NewSearchForm(),
|
FormErrors: form.NewErrors(),
|
||||||
Navigation: NewNavigation(),
|
|
||||||
T: languages.GetTfuncFromRequest(r),
|
|
||||||
User: GetUser(r),
|
|
||||||
URL: r.URL,
|
|
||||||
Route: mux.CurrentRoute(r),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err := viewLoginTemplate.ExecuteTemplate(w, "index.html", ulfv)
|
err := viewLoginTemplate.ExecuteTemplate(w, "index.html", ulfv)
|
||||||
|
@ -85,7 +75,7 @@ func UserProfileHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
if errUser != nil {
|
if errUser != nil {
|
||||||
err["errors"] = append(err["errors"], errUser.Error())
|
err["errors"] = append(err["errors"], errUser.Error())
|
||||||
}
|
}
|
||||||
htv := UserVerifyTemplateVariables{err, NewSearchForm(), NewNavigation(), T, GetUser(r), r.URL, mux.CurrentRoute(r)}
|
htv := UserVerifyTemplateVariables{NewCommonVariables(r), err}
|
||||||
errorTmpl := viewUserDeleteTemplate.ExecuteTemplate(w, "index.html", htv)
|
errorTmpl := viewUserDeleteTemplate.ExecuteTemplate(w, "index.html", htv)
|
||||||
if errorTmpl != nil {
|
if errorTmpl != nil {
|
||||||
http.Error(w, errorTmpl.Error(), http.StatusInternalServerError)
|
http.Error(w, errorTmpl.Error(), http.StatusInternalServerError)
|
||||||
|
@ -97,7 +87,7 @@ func UserProfileHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
if unfollow != nil {
|
if unfollow != nil {
|
||||||
infosForm["infos"] = append(infosForm["infos"], fmt.Sprintf(string(T("user_unfollowed_msg")), userProfile.Username))
|
infosForm["infos"] = append(infosForm["infos"], fmt.Sprintf(string(T("user_unfollowed_msg")), userProfile.Username))
|
||||||
}
|
}
|
||||||
htv := UserProfileVariables{&userProfile, infosForm, NewSearchForm(), NewNavigation(), T, currentUser, r.URL, mux.CurrentRoute(r)}
|
htv := UserProfileVariables{NewCommonVariables(r), &userProfile, infosForm}
|
||||||
|
|
||||||
err := viewProfileTemplate.ExecuteTemplate(w, "index.html", htv)
|
err := viewProfileTemplate.ExecuteTemplate(w, "index.html", htv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -105,7 +95,7 @@ func UserProfileHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
err := notFoundTemplate.ExecuteTemplate(w, "index.html", NotFoundTemplateVariables{NewNavigation(), NewSearchForm(), T, GetUser(r), r.URL, mux.CurrentRoute(r)})
|
err := notFoundTemplate.ExecuteTemplate(w, "index.html", NotFoundTemplateVariables{NewCommonVariables(r)})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
}
|
}
|
||||||
|
@ -117,21 +107,20 @@ func UserDetailsHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
vars := mux.Vars(r)
|
vars := mux.Vars(r)
|
||||||
id := vars["id"]
|
id := vars["id"]
|
||||||
currentUser := GetUser(r)
|
currentUser := GetUser(r)
|
||||||
T := languages.GetTfuncFromRequest(r)
|
|
||||||
userProfile, _, errorUser := userService.RetrieveUserForAdmin(id)
|
userProfile, _, errorUser := userService.RetrieveUserForAdmin(id)
|
||||||
if errorUser == nil && userPermission.CurrentOrAdmin(currentUser, userProfile.ID) {
|
if errorUser == nil && userPermission.CurrentOrAdmin(currentUser, userProfile.ID) {
|
||||||
if userPermission.CurrentOrAdmin(currentUser, userProfile.ID) {
|
if userPermission.CurrentOrAdmin(currentUser, userProfile.ID) {
|
||||||
b := form.UserForm{}
|
b := form.UserForm{}
|
||||||
modelHelper.BindValueForm(&b, r)
|
modelHelper.BindValueForm(&b, r)
|
||||||
availableLanguages := languages.GetAvailableLanguages()
|
availableLanguages := languages.GetAvailableLanguages()
|
||||||
htv := UserProfileEditVariables{&userProfile, b, form.NewErrors(), form.NewInfos(), availableLanguages, NewSearchForm(), NewNavigation(), T, currentUser, r.URL, mux.CurrentRoute(r)}
|
htv := UserProfileEditVariables{NewCommonVariables(r), &userProfile, b, form.NewErrors(), form.NewInfos(), availableLanguages}
|
||||||
err := viewProfileEditTemplate.ExecuteTemplate(w, "index.html", htv)
|
err := viewProfileEditTemplate.ExecuteTemplate(w, "index.html", htv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
err := notFoundTemplate.ExecuteTemplate(w, "index.html", NotFoundTemplateVariables{NewNavigation(), NewSearchForm(), T, GetUser(r), r.URL, mux.CurrentRoute(r)})
|
err := notFoundTemplate.ExecuteTemplate(w, "index.html", NotFoundTemplateVariables{NewCommonVariables(r)})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
}
|
}
|
||||||
|
@ -187,17 +176,12 @@ func UserProfileFormHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
availableLanguages := languages.GetAvailableLanguages()
|
availableLanguages := languages.GetAvailableLanguages()
|
||||||
upev := UserProfileEditVariables{
|
upev := UserProfileEditVariables{
|
||||||
UserProfile: &userProfile,
|
CommonTemplateVariables: NewCommonVariables(r),
|
||||||
UserForm: userForm,
|
UserProfile: &userProfile,
|
||||||
FormErrors: err,
|
UserForm: userForm,
|
||||||
FormInfos: infos,
|
FormErrors: err,
|
||||||
Languages: availableLanguages,
|
FormInfos: infos,
|
||||||
Search: NewSearchForm(),
|
Languages: availableLanguages,
|
||||||
Navigation: NewNavigation(),
|
|
||||||
T: T,
|
|
||||||
User: currentUser,
|
|
||||||
URL: r.URL,
|
|
||||||
Route: mux.CurrentRoute(r),
|
|
||||||
}
|
}
|
||||||
errorTmpl := viewProfileEditTemplate.ExecuteTemplate(w, "index.html", upev)
|
errorTmpl := viewProfileEditTemplate.ExecuteTemplate(w, "index.html", upev)
|
||||||
if errorTmpl != nil {
|
if errorTmpl != nil {
|
||||||
|
@ -207,7 +191,6 @@ func UserProfileFormHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
// Post Registration controller, we do some check on the form here, the rest on user service
|
// Post Registration controller, we do some check on the form here, the rest on user service
|
||||||
func UserRegisterPostHandler(w http.ResponseWriter, r *http.Request) {
|
func UserRegisterPostHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
T := languages.GetTfuncFromRequest(r)
|
|
||||||
b := form.RegistrationForm{}
|
b := form.RegistrationForm{}
|
||||||
err := form.NewErrors()
|
err := form.NewErrors()
|
||||||
if !captcha.Authenticate(captcha.Extract(r)) {
|
if !captcha.Authenticate(captcha.Extract(r)) {
|
||||||
|
@ -227,10 +210,11 @@ func UserRegisterPostHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
err["errors"] = append(err["errors"], errorUser.Error())
|
err["errors"] = append(err["errors"], errorUser.Error())
|
||||||
}
|
}
|
||||||
if len(err) == 0 {
|
if len(err) == 0 {
|
||||||
u := model.User{
|
common := NewCommonVariables(r)
|
||||||
|
common.User = &model.User{
|
||||||
Email: r.PostFormValue("email"), // indicate whether user had email set
|
Email: r.PostFormValue("email"), // indicate whether user had email set
|
||||||
}
|
}
|
||||||
htv := UserRegisterTemplateVariables{b, err, NewSearchForm(), NewNavigation(), T, &u, r.URL, mux.CurrentRoute(r)}
|
htv := UserRegisterTemplateVariables{common, b, err}
|
||||||
errorTmpl := viewRegisterSuccessTemplate.ExecuteTemplate(w, "index.html", htv)
|
errorTmpl := viewRegisterSuccessTemplate.ExecuteTemplate(w, "index.html", htv)
|
||||||
if errorTmpl != nil {
|
if errorTmpl != nil {
|
||||||
http.Error(w, errorTmpl.Error(), http.StatusInternalServerError)
|
http.Error(w, errorTmpl.Error(), http.StatusInternalServerError)
|
||||||
|
@ -241,7 +225,7 @@ func UserRegisterPostHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
if len(err) > 0 {
|
if len(err) > 0 {
|
||||||
b.CaptchaID = captcha.GetID()
|
b.CaptchaID = captcha.GetID()
|
||||||
htv := UserRegisterTemplateVariables{b, err, NewSearchForm(), NewNavigation(), T, GetUser(r), r.URL, mux.CurrentRoute(r)}
|
htv := UserRegisterTemplateVariables{NewCommonVariables(r), b, err}
|
||||||
errorTmpl := viewRegisterTemplate.ExecuteTemplate(w, "index.html", htv)
|
errorTmpl := viewRegisterTemplate.ExecuteTemplate(w, "index.html", htv)
|
||||||
if errorTmpl != nil {
|
if errorTmpl != nil {
|
||||||
http.Error(w, errorTmpl.Error(), http.StatusInternalServerError)
|
http.Error(w, errorTmpl.Error(), http.StatusInternalServerError)
|
||||||
|
@ -257,8 +241,7 @@ func UserVerifyEmailHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
if errEmail != nil {
|
if errEmail != nil {
|
||||||
err["errors"] = append(err["errors"], errEmail.Error())
|
err["errors"] = append(err["errors"], errEmail.Error())
|
||||||
}
|
}
|
||||||
T := languages.GetTfuncFromRequest(r)
|
htv := UserVerifyTemplateVariables{NewCommonVariables(r), err}
|
||||||
htv := UserVerifyTemplateVariables{err, NewSearchForm(), NewNavigation(), T, GetUser(r), r.URL, mux.CurrentRoute(r)}
|
|
||||||
errorTmpl := viewVerifySuccessTemplate.ExecuteTemplate(w, "index.html", htv)
|
errorTmpl := viewVerifySuccessTemplate.ExecuteTemplate(w, "index.html", htv)
|
||||||
if errorTmpl != nil {
|
if errorTmpl != nil {
|
||||||
http.Error(w, errorTmpl.Error(), http.StatusInternalServerError)
|
http.Error(w, errorTmpl.Error(), http.StatusInternalServerError)
|
||||||
|
@ -267,7 +250,6 @@ func UserVerifyEmailHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
// Post Login controller
|
// Post Login controller
|
||||||
func UserLoginPostHandler(w http.ResponseWriter, r *http.Request) {
|
func UserLoginPostHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
T := languages.GetTfuncFromRequest(r)
|
|
||||||
b := form.LoginForm{}
|
b := form.LoginForm{}
|
||||||
modelHelper.BindValueForm(&b, r)
|
modelHelper.BindValueForm(&b, r)
|
||||||
err := form.NewErrors()
|
err := form.NewErrors()
|
||||||
|
@ -276,7 +258,7 @@ func UserLoginPostHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
_, errorUser := userService.CreateUserAuthentication(w, r)
|
_, errorUser := userService.CreateUserAuthentication(w, r)
|
||||||
if errorUser != nil {
|
if errorUser != nil {
|
||||||
err["errors"] = append(err["errors"], errorUser.Error())
|
err["errors"] = append(err["errors"], errorUser.Error())
|
||||||
htv := UserLoginFormVariables{b, err, NewSearchForm(), NewNavigation(), T, GetUser(r), r.URL, mux.CurrentRoute(r)}
|
htv := UserLoginFormVariables{NewCommonVariables(r), b, err}
|
||||||
errorTmpl := viewLoginTemplate.ExecuteTemplate(w, "index.html", htv)
|
errorTmpl := viewLoginTemplate.ExecuteTemplate(w, "index.html", htv)
|
||||||
if errorTmpl != nil {
|
if errorTmpl != nil {
|
||||||
http.Error(w, errorTmpl.Error(), http.StatusInternalServerError)
|
http.Error(w, errorTmpl.Error(), http.StatusInternalServerError)
|
||||||
|
@ -288,7 +270,7 @@ func UserLoginPostHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(err) > 0 {
|
if len(err) > 0 {
|
||||||
htv := UserLoginFormVariables{b, err, NewSearchForm(), NewNavigation(), T, GetUser(r), r.URL, mux.CurrentRoute(r)}
|
htv := UserLoginFormVariables{NewCommonVariables(r), b, err}
|
||||||
errorTmpl := viewLoginTemplate.ExecuteTemplate(w, "index.html", htv)
|
errorTmpl := viewLoginTemplate.ExecuteTemplate(w, "index.html", htv)
|
||||||
if errorTmpl != nil {
|
if errorTmpl != nil {
|
||||||
http.Error(w, errorTmpl.Error(), http.StatusInternalServerError)
|
http.Error(w, errorTmpl.Error(), http.StatusInternalServerError)
|
||||||
|
@ -327,13 +309,12 @@ func UserNotificationsHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
if currentUser.ID > 0 {
|
if currentUser.ID > 0 {
|
||||||
messages := msg.GetMessages(r)
|
messages := msg.GetMessages(r)
|
||||||
Ts, _ := languages.GetTfuncAndLanguageFromRequest(r)
|
Ts, _ := languages.GetTfuncAndLanguageFromRequest(r)
|
||||||
T := languages.GetTfuncFromRequest(r)
|
|
||||||
if r.URL.Query()["clear"] != nil {
|
if r.URL.Query()["clear"] != nil {
|
||||||
notifierService.DeleteAllNotifications(currentUser.ID)
|
notifierService.DeleteAllNotifications(currentUser.ID)
|
||||||
messages.AddInfo("infos", Ts("notifications_cleared"))
|
messages.AddInfo("infos", Ts("notifications_cleared"))
|
||||||
currentUser.Notifications = []model.Notification{}
|
currentUser.Notifications = []model.Notification{}
|
||||||
}
|
}
|
||||||
htv := UserProfileNotifVariables{messages.GetAllInfos(), NewSearchForm(), NewNavigation(), T, currentUser, r.URL, mux.CurrentRoute(r)}
|
htv := UserProfileNotifVariables{NewCommonVariables(r), messages.GetAllInfos()}
|
||||||
err := viewProfileNotifTemplate.ExecuteTemplate(w, "index.html", htv)
|
err := viewProfileNotifTemplate.ExecuteTemplate(w, "index.html", htv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
@ -341,4 +322,4 @@ func UserNotificationsHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
} else {
|
} else {
|
||||||
NotFoundHandler(w, r)
|
NotFoundHandler(w, r)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,6 @@ import (
|
||||||
"github.com/NyaaPantsu/nyaa/service/torrent"
|
"github.com/NyaaPantsu/nyaa/service/torrent"
|
||||||
"github.com/NyaaPantsu/nyaa/service/user/permission"
|
"github.com/NyaaPantsu/nyaa/service/user/permission"
|
||||||
"github.com/NyaaPantsu/nyaa/util"
|
"github.com/NyaaPantsu/nyaa/util"
|
||||||
"github.com/NyaaPantsu/nyaa/util/languages"
|
|
||||||
"github.com/NyaaPantsu/nyaa/util/log"
|
"github.com/NyaaPantsu/nyaa/util/log"
|
||||||
msg "github.com/NyaaPantsu/nyaa/util/messages"
|
msg "github.com/NyaaPantsu/nyaa/util/messages"
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
|
@ -44,8 +43,7 @@ func ViewHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
if userPermission.NeedsCaptcha(user) {
|
if userPermission.NeedsCaptcha(user) {
|
||||||
captchaID = captcha.GetID()
|
captchaID = captcha.GetID()
|
||||||
}
|
}
|
||||||
T := languages.GetTfuncFromRequest(r)
|
htv := ViewTemplateVariables{NewCommonVariables(r), b, captchaID, messages.GetAllErrors(), messages.GetAllInfos()}
|
||||||
htv := ViewTemplateVariables{b, captchaID, messages.GetAllErrors(), messages.GetAllInfos(), NewSearchForm(), NewNavigation(), T, user, r.URL, mux.CurrentRoute(r)}
|
|
||||||
|
|
||||||
err = viewTemplate.ExecuteTemplate(w, "index.html", htv)
|
err = viewTemplate.ExecuteTemplate(w, "index.html", htv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -3,26 +3,26 @@
|
||||||
<ul class="nav navbar-nav navbar-right badgemenu">
|
<ul class="nav navbar-nav navbar-right badgemenu">
|
||||||
<li class="dropdown">
|
<li class="dropdown">
|
||||||
{{if gt .ID 0}}
|
{{if gt .ID 0}}
|
||||||
<a href="{{ genRoute "user_profile" "id" (print .ID) "username" .Username }}" class="dropdown-toggle profile-image" data-toggle="dropdown">
|
<a href="{{ genRoute "user_profile" "id" (print .ID) "username" .Username }}" class="dropdown-toggle profile-image" data-toggle="dropdown">
|
||||||
<img src="https://www.gravatar.com/avatar/{{ .MD5 }}?s=50" class="img-circle special-img"> {{ .Username }} <span class="badge">{{ .GetUnreadNotifications }}</span><b class="caret"></b></a>
|
<img src="https://www.gravatar.com/avatar/{{ .MD5 }}?s=50" class="img-circle special-img"> {{ .Username }} <span class="badge">{{ .GetUnreadNotifications }}</span><b class="caret"></b></a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><a href="{{ genRoute "user_profile" "id" (print .ID) "username" .Username }}"><i class="fa fa-cog"></i> {{call $.T "profile"}}</a></li>
|
<li><a href="{{ genRoute "user_profile" "id" (print .ID) "username" .Username }}"><i class="fa fa-cog"></i> {{call $.T "profile"}}</a></li>
|
||||||
<li><a href="{{ genRoute "user_notifications" }}"><i class="fa fa-cog"></i> {{ call $.T "my_notifications"}} <span class="badge">{{ .GetUnreadNotifications }}</span></a></li>
|
<li><a href="{{ genRoute "user_notifications" }}"><i class="fa fa-cog"></i> {{ call $.T "my_notifications"}} <span class="badge">{{ .GetUnreadNotifications }}</span></a></li>
|
||||||
<li><a href="{{ genRoute "user_profile_edit" "id" (print .ID) "username" .Username }}"><i class="fa fa-cog"></i> {{call $.T "settings"}}</a></li>
|
<li><a href="{{ genRoute "user_profile_edit" "id" (print .ID) "username" .Username }}"><i class="fa fa-cog"></i> {{call $.T "settings"}}</a></li>
|
||||||
<li class="divider"></li>
|
<li class="divider"></li>
|
||||||
{{if HasAdmin . }}<li><a href="{{ genRoute "mod_index" }}"><i class="fa fa-cog"></i> {{call $.T "moderation"}}</a></li><li class="divider"></li>{{end}}
|
{{if HasAdmin . }}<li><a href="{{ genRoute "mod_index" }}"><i class="fa fa-cog"></i> {{call $.T "moderation"}}</a></li><li class="divider"></li>{{end}}
|
||||||
<li><a href="{{ genRoute "user_logout" }}"><i class="fa fa-sign-out"></i> {{ call $.T "sign_out"}}</a></li>
|
<li><a href="{{ genRoute "user_logout" }}"><i class="fa fa-sign-out"></i> {{ call $.T "sign_out"}}</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<a href="#" class="dropdown-toggle profile-image" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
|
<a href="#" class="dropdown-toggle profile-image" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
|
||||||
<span class="hidden-md hidden-sm">{{ call $.T "member" }}</span>
|
<span class="hidden-md hidden-sm">{{ call $.T "member" }}</span>
|
||||||
<span class="glyphicon glyphicon-user visible-md-inline"></span>
|
<span class="glyphicon glyphicon-user visible-md-inline"></span>
|
||||||
<span class="caret"></span>
|
<span class="caret"></span>
|
||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><a href="{{ genRoute "user_login" }}"><i class="fa fa-sign-out"></i> {{ call $.T "sign_in"}}</a></li>
|
<li><a href="{{ genRoute "user_login" }}"><i class="fa fa-sign-out"></i> {{ call $.T "sign_in"}}</a></li>
|
||||||
<li><a href="{{ genRoute "user_register" }}"><i class="fa fa-cog"></i> {{ call $.T "sign_up"}}</a></li>
|
<li><a href="{{ genRoute "user_register" }}"><i class="fa fa-cog"></i> {{ call $.T "sign_up"}}</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
{{end}}
|
{{end}}
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
{{define "captcha"}}
|
{{define "captcha"}}
|
||||||
{{with .Upload}}
|
|
||||||
{{/* unset if user doesn't need captcha */}}
|
{{/* unset if user doesn't need captcha */}}
|
||||||
{{if ne .CaptchaID ""}}
|
{{if ne .CaptchaID ""}}
|
||||||
<div class="form-group captcha-container">
|
<div class="form-group captcha-container">
|
||||||
|
@ -10,4 +9,3 @@
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
|
||||||
|
|
|
@ -33,7 +33,13 @@
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td class="nowrap date-short">{{.Date}}</td>
|
<td class="nowrap date-short">{{.Date}}</td>
|
||||||
<td class="nowrap">{{.Filesize}}</td>
|
<td class="nowrap">
|
||||||
|
{{if ne .Filesize "Unknown"}}
|
||||||
|
{{.Filesize}}
|
||||||
|
{{else}}
|
||||||
|
{{ call $.T "unknown"}}
|
||||||
|
{{end}}
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="{{.Magnet}}" title="{{ call $.T "magnet_link" }}">
|
<a href="{{.Magnet}}" title="{{ call $.T "magnet_link" }}">
|
||||||
<span class="glyphicon glyphicon-magnet" aria-hidden="true"></span>
|
<span class="glyphicon glyphicon-magnet" aria-hidden="true"></span>
|
||||||
|
|
|
@ -64,6 +64,10 @@
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="website_link">{{call $.T "website_link"}}</label>
|
||||||
|
<input name="website_link" id="website_link" class="form-control" type="text" value="{{.WebsiteLink}}">
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="desc">{{call $.T "torrent_description"}}</label>
|
<label for="desc">{{call $.T "torrent_description"}}</label>
|
||||||
<p class="help-block">{{call $.T "description_markdown_notice"}}</p>
|
<p class="help-block">{{call $.T "description_markdown_notice"}}</p>
|
||||||
|
|
|
@ -73,7 +73,13 @@ Your browser does not support the audio element.
|
||||||
</td>
|
</td>
|
||||||
{{end}}
|
{{end}}
|
||||||
<td class="hidden-xs nowrap date-short">{{.Date}}</td>
|
<td class="hidden-xs nowrap date-short">{{.Date}}</td>
|
||||||
<td class="hidden-xs nowrap">{{.Filesize}}</td>
|
<td class="hidden-xs nowrap">
|
||||||
|
{{if ne .Filesize "Unknown"}}
|
||||||
|
{{.Filesize}}
|
||||||
|
{{else}}
|
||||||
|
{{ call $.T "unknown"}}
|
||||||
|
{{end}}
|
||||||
|
</td>
|
||||||
<td class="hidden-xs nowrap">
|
<td class="hidden-xs nowrap">
|
||||||
<a href="{{.Magnet}}" title="Magnet link">
|
<a href="{{.Magnet}}" title="Magnet link">
|
||||||
<span class="glyphicon glyphicon-magnet" aria-hidden="true"></span>
|
<span class="glyphicon glyphicon-magnet" aria-hidden="true"></span>
|
||||||
|
|
|
@ -68,17 +68,17 @@
|
||||||
<label for="remake">{{call $.T "mark_as_remake"}}</label>
|
<label for="remake">{{call $.T "mark_as_remake"}}</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="website_link">{{call $.T "website_link"}}</label>
|
||||||
|
<input name="website_link" id="website_link" class="form-control" type="text" value="{{.WebsiteLink}}">
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="desc">{{call $.T "torrent_description"}}</label>
|
<label for="desc">{{call $.T "torrent_description"}}</label>
|
||||||
<p class="help-block">{{call $.T "description_markdown_notice"}}</p>
|
<p class="help-block">{{call $.T "description_markdown_notice"}}</p>
|
||||||
<textarea name="desc" id="desc" class="form-control torrent-desc" rows="15">{{.Description}}</textarea>
|
<textarea name="desc" id="desc" class="form-control torrent-desc" rows="15">{{.Description}}</textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
|
||||||
<label for="website_link">{{call $.T "website_link"}}</label>
|
|
||||||
<input name="website_link" id="website_link" class="form-control" type="text" value="{{.WebsiteLink}}">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{block "captcha" $}}{{end}}
|
{{block "captcha" (makeCaptchaData .CaptchaID $.T)}}{{end}}
|
||||||
|
|
||||||
<button type="submit" class="btn btn-success">{{call $.T "upload"}}</button>
|
<button type="submit" class="btn btn-success">{{call $.T "upload"}}</button>
|
||||||
<br />
|
<br />
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{block "captcha" .}}{{end}}
|
{{block "captcha" (makeCaptchaData .CaptchaID $.T)}}{{end}}
|
||||||
|
|
||||||
<hr class="colorgraph">
|
<hr class="colorgraph">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
|
@ -70,8 +70,14 @@
|
||||||
<h4>{{call $.T "date"}}</h4>
|
<h4>{{call $.T "date"}}</h4>
|
||||||
<p class="date-full">{{.Date}}</p>
|
<p class="date-full">{{.Date}}</p>
|
||||||
<hr>
|
<hr>
|
||||||
<h4>{{call $.T "size"}}</h4>
|
<h4>{{ call $.T "size"}}</h4>
|
||||||
<p>{{.Filesize}}</p>
|
<p>
|
||||||
|
{{if ne .Filesize "Unknown"}}
|
||||||
|
{{.Filesize}}
|
||||||
|
{{else}}
|
||||||
|
{{ call $.T "unknown"}}
|
||||||
|
{{end}}
|
||||||
|
</p>
|
||||||
<hr>
|
<hr>
|
||||||
{{if ne .WebsiteLink ""}}
|
{{if ne .WebsiteLink ""}}
|
||||||
<h4>{{call $.T "link"}}</h4>
|
<h4>{{call $.T "link"}}</h4>
|
||||||
|
@ -93,7 +99,7 @@
|
||||||
{{else}}
|
{{else}}
|
||||||
<div class="col-md-4">{{.Seeders}}</div>
|
<div class="col-md-4">{{.Seeders}}</div>
|
||||||
<div class="col-md-4">{{.Leechers}}</div>
|
<div class="col-md-4">{{.Leechers}}</div>
|
||||||
<div class="col-md-4"><span class="completed" style="">{{.Completed}}</span></div>
|
<div class="col-md-4"><span class="completed">{{.Completed}}</span></div>
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -189,7 +195,7 @@
|
||||||
<label for="comment">{{ if gt .User.ID 0}} {{call $.T "submit_a_comment_as_username" .User.Username}} {{else}} {{call $.T "submit_a_comment_as_anonymous"}} {{end}}</label>
|
<label for="comment">{{ if gt .User.ID 0}} {{call $.T "submit_a_comment_as_username" .User.Username}} {{else}} {{call $.T "submit_a_comment_as_anonymous"}} {{end}}</label>
|
||||||
<textarea name="comment" class="form-control" rows="5"></textarea>
|
<textarea name="comment" class="form-control" rows="5"></textarea>
|
||||||
</div>
|
</div>
|
||||||
{{block "captcha" .}}{{end}}
|
{{block "captcha" (makeCaptchaData .CaptchaID $.T)}}{{end}}
|
||||||
<button type="submit" class="btn btn-success">{{call $.T "submit" }}</button>
|
<button type="submit" class="btn btn-success">{{call $.T "submit" }}</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -211,7 +217,7 @@
|
||||||
<input type="radio" name="report_type" value="spam" id="spam" required> <label for="spam">{{ call $.T "spam_garbage" }}</label><br />
|
<input type="radio" name="report_type" value="spam" id="spam" required> <label for="spam">{{ call $.T "spam_garbage" }}</label><br />
|
||||||
<input type="radio" name="report_type" value="wrongcat" id="wrongcat" required> <label for="wrongcat">{{ call $.T "wrong_category" }}</label><br />
|
<input type="radio" name="report_type" value="wrongcat" id="wrongcat" required> <label for="wrongcat">{{ call $.T "wrong_category" }}</label><br />
|
||||||
<input type="radio" name="report_type" value="dup" id="dup" required> <label for="dup">{{ call $.T "duplicate_deprecated" }}</label><br />
|
<input type="radio" name="report_type" value="dup" id="dup" required> <label for="dup">{{ call $.T "duplicate_deprecated" }}</label><br />
|
||||||
{{block "captcha" .}}{{end}}
|
{{block "captcha" (makeCaptchaData .CaptchaID $.T)}}{{end}}
|
||||||
<button type="submit" class="btn btn-default">{{ call $.T "report_btn" }}</button>
|
<button type="submit" class="btn btn-default">{{ call $.T "report_btn" }}</button>
|
||||||
</form> <br />
|
</form> <br />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -479,6 +479,10 @@
|
||||||
"id": "art_manga",
|
"id": "art_manga",
|
||||||
"translation": "Art - Manga"
|
"translation": "Art - Manga"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "art_pictures",
|
||||||
|
"translation": "Art - Pictures"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "real_life",
|
"id": "real_life",
|
||||||
"translation": "Real Life"
|
"translation": "Real Life"
|
||||||
|
|
|
@ -679,6 +679,10 @@
|
||||||
"id": "delete",
|
"id": "delete",
|
||||||
"translation": "Supprimer"
|
"translation": "Supprimer"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "website_link",
|
||||||
|
"translation": "Lien du site web"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "files",
|
"id": "files",
|
||||||
"translation": "Fichiers"
|
"translation": "Fichiers"
|
||||||
|
@ -758,5 +762,21 @@
|
||||||
{
|
{
|
||||||
"id": "no_database_dumps_available",
|
"id": "no_database_dumps_available",
|
||||||
"translation": "Aucune sauvegarde de base de données n'est disponible en ce moment."
|
"translation": "Aucune sauvegarde de base de données n'est disponible en ce moment."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "clear_notifications",
|
||||||
|
"translation": "Effacer les notifications"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "notifications_cleared",
|
||||||
|
"translation": "Notifications supprimées !"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "my_notifications",
|
||||||
|
"translation": "Mes Notifications"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "new_torrent_uploaded",
|
||||||
|
"translation": "Nouveau torrent : \"%s\" de %s"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -69,7 +69,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "terms_conditions_full",
|
"id": "terms_conditions_full",
|
||||||
"translation": "Некоторое дерьмо."
|
"translation": "Здесь будет магия и дружба."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "remember_me",
|
"id": "remember_me",
|
||||||
|
@ -117,7 +117,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "follow",
|
"id": "follow",
|
||||||
"translation": "Следить"
|
"translation": "Подписаться"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "unfollow",
|
"id": "unfollow",
|
||||||
|
@ -125,7 +125,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "user_followed_msg",
|
"id": "user_followed_msg",
|
||||||
"translation": "Вы отслеживаете %s!"
|
"translation": "Вы подписались на %s!"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "user_unfollowed_msg",
|
"id": "user_unfollowed_msg",
|
||||||
|
@ -137,7 +137,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "see_more_torrents_from",
|
"id": "see_more_torrents_from",
|
||||||
"translation": "Смотреть другие торренты %s "
|
"translation": "Посмотреть другие торренты %s "
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "category",
|
"id": "category",
|
||||||
|
@ -179,9 +179,13 @@
|
||||||
"id": "faq",
|
"id": "faq",
|
||||||
"translation": "FAQ"
|
"translation": "FAQ"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "fun",
|
||||||
|
"translation": "Fun"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "fap",
|
"id": "fap",
|
||||||
"translation": "Фап"
|
"translation": "Fap"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "advanced_search",
|
"id": "advanced_search",
|
||||||
|
@ -209,7 +213,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "member",
|
"id": "member",
|
||||||
"translation": "Членство"
|
"translation": "Пользователь"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "sign_in",
|
"id": "sign_in",
|
||||||
|
@ -225,7 +229,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "notice_keep_seeding",
|
"id": "notice_keep_seeding",
|
||||||
"translation": "УВЕДОМЛЕНИЕ: УДЕРЖИВАЙ РАЗДАЧУ И ВКЛЮЧАЙ DHT ТЫ ТОРМОЗ"
|
"translation": "ОСТАВАЙТЕСЬ НА РАЗДАЧЕ И ВКЛЮЧИТЕ DHT!"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "official_nyaapocalipse_faq",
|
"id": "official_nyaapocalipse_faq",
|
||||||
|
@ -257,7 +261,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "is_everything_lost",
|
"id": "is_everything_lost",
|
||||||
"translation": "Все потеряно?"
|
"translation": "Все пропало?"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "in_short_no",
|
"id": "in_short_no",
|
||||||
|
@ -265,7 +269,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "are_some_things_lost",
|
"id": "are_some_things_lost",
|
||||||
"translation": "Некоторые вещи потеряны?"
|
"translation": "Что-нибудь все же потерялось?"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "answer_is_nyaa_db_lost",
|
"id": "answer_is_nyaa_db_lost",
|
||||||
|
@ -277,7 +281,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "how_are_we_recovering",
|
"id": "how_are_we_recovering",
|
||||||
"translation": "Как мы выздоравливаем?"
|
"translation": "Как идет процесс восстановления?"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "answer_how_are_we_recovering",
|
"id": "answer_how_are_we_recovering",
|
||||||
|
@ -317,11 +321,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "answer_which_trackers_do_you_recommend",
|
"id": "answer_which_trackers_do_you_recommend",
|
||||||
"translation": "Если ваша торрент-загрузка запрещена из-за трекеров, вам нужно добавить некоторые из них:"
|
"translation": "У нас теперь появился свой собственный трекер doko.moe, добавьте его наверх списка перед загрузкой. Вам стоит еще добавить эти, просто на случай, если что-то пойдет не так."
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "other_trackers",
|
|
||||||
"translation": "Но тебе стоит еще добавить эти, просто на случай, если что-то пойдет не так"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "how_can_i_help",
|
"id": "how_can_i_help",
|
||||||
|
@ -337,7 +337,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "why_written_in_go",
|
"id": "why_written_in_go",
|
||||||
"translation": "Почему ваше дерьмо написано на Go?"
|
"translation": "Почему это дерьмо написано на Go?"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "authors_favorite_language",
|
"id": "authors_favorite_language",
|
||||||
|
@ -459,6 +459,42 @@
|
||||||
"id": "software_games",
|
"id": "software_games",
|
||||||
"translation": "Софт - Игры"
|
"translation": "Софт - Игры"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "art",
|
||||||
|
"translation": "Арт"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "art_anime",
|
||||||
|
"translation": "Арт - Аниме"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "art_doujinshi",
|
||||||
|
"translation": "Арт - Додзинси"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "art_games",
|
||||||
|
"translation": "Арт - Игры"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "art_manga",
|
||||||
|
"translation": "Арт - Манга"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "art_pictures",
|
||||||
|
"translation": "Арт - Картинки"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "real_life",
|
||||||
|
"translation": "Real Life"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "real_life_photobooks_and_pictures",
|
||||||
|
"translation": "Real Life - Фотокниги и картинки"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "real_life_videos",
|
||||||
|
"translation": "Real Life - Видео"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "torrent_description",
|
"id": "torrent_description",
|
||||||
"translation": "Описание торрента"
|
"translation": "Описание торрента"
|
||||||
|
@ -517,7 +553,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "submit_a_comment_as_anonymous",
|
"id": "submit_a_comment_as_anonymous",
|
||||||
"translation": "Отправить комментарий как Анонимный"
|
"translation": "Отправить анонимный комментарий"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "submit",
|
"id": "submit",
|
||||||
|
@ -541,7 +577,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "banned",
|
"id": "banned",
|
||||||
"translation": "Banned"
|
"translation": "Забанен"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "default",
|
"id": "default",
|
||||||
|
@ -647,6 +683,14 @@
|
||||||
"id": "delete",
|
"id": "delete",
|
||||||
"translation": "Удалить"
|
"translation": "Удалить"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "files",
|
||||||
|
"translation": "Файлы"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "filename",
|
||||||
|
"translation": "Имя файла"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "uploaded_by",
|
"id": "uploaded_by",
|
||||||
"translation": "Загрузил"
|
"translation": "Загрузил"
|
||||||
|
@ -698,5 +742,25 @@
|
||||||
{
|
{
|
||||||
"id": "cancel",
|
"id": "cancel",
|
||||||
"translation": "Отменить"
|
"translation": "Отменить"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "please_include_our_tracker",
|
||||||
|
"translation": "Пожалуйста добавьте udp://tracker.doko.moe:6969 в список трекеров."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "unknown",
|
||||||
|
"translation": "Неизвестно"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "last_scraped",
|
||||||
|
"translation": "Обновлялось в: "
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "server_status_link",
|
||||||
|
"translation": "Узнать о состоянии сервера можно здесь"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "no_database_dumps_available",
|
||||||
|
"translation": "Сейчас нет доступных дампов базы"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -678,6 +678,10 @@
|
||||||
{
|
{
|
||||||
"id": "delete",
|
"id": "delete",
|
||||||
"translation": "ลบ"
|
"translation": "ลบ"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "website_link",
|
||||||
|
"translation": "ลิงค์เว็บ"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "files",
|
"id": "files",
|
||||||
|
@ -758,5 +762,21 @@
|
||||||
{
|
{
|
||||||
"id": "no_database_dumps_available",
|
"id": "no_database_dumps_available",
|
||||||
"translation": "ยังไม่มีไฟล์ดัมพ์ฐานข้อมูลในขณะนี้"
|
"translation": "ยังไม่มีไฟล์ดัมพ์ฐานข้อมูลในขณะนี้"
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
"id": "clear_notifications",
|
||||||
|
"translation": "ล้างการแจ้งเตือน"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "notifications_cleared",
|
||||||
|
"translation": "ลบการแจ้งเตือนแล้ว!"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "my_notifications",
|
||||||
|
"translation": "การแจ้งเตือนของฉัน"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "new_torrent_uploaded",
|
||||||
|
"translation": "ทอร์เรนท์ใหม่: \"%s\" จาก %s"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -377,7 +377,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "anime_raw",
|
"id": "anime_raw",
|
||||||
"translation": "動畫 - Raw"
|
"translation": "動畫 - 生肉"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "audio",
|
"id": "audio",
|
||||||
|
@ -401,7 +401,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "literature_raw",
|
"id": "literature_raw",
|
||||||
"translation": "文學 - Raw"
|
"translation": "文學 - 生肉"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "literature_non_english_translated",
|
"id": "literature_non_english_translated",
|
||||||
|
@ -425,7 +425,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "live_action_raw",
|
"id": "live_action_raw",
|
||||||
"translation": "真人電影 - Raw"
|
"translation": "真人電影 - 生肉"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "pictures",
|
"id": "pictures",
|
||||||
|
|
Référencer dans un nouveau ticket