minor changes

This commit is contained in:
nyaadev 2017-08-31 14:19:22 +02:00
parent df288bfadd
commit 57a71be7b8
7 changed files with 28 additions and 23 deletions

View File

@ -35,7 +35,7 @@
{% endif %}
<div class="markdown-editor" id="{{ field_name }}-markdown-editor" data-field-name="{{ field_name }}">
{{ field.label(class='control-label') }}
<a href="https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet" class="small">Markdown supported</a>
<a href="https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet" class="small" target="_blank">Markdown supported</a>
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active">
<a href="#{{ field_name }}-tab" role="tab" data-toggle="tab">

View File

@ -126,7 +126,7 @@
<a><i class="fa fa-user fa-fw"></i>Logged in as {{ g.user.username }}</a>
</li>
<li class="hidden-lg hidden-sm hidden-xs divider" role="separator">
</li>
<li>
<a href="{{ url_for('users.view_user', user_name=g.user.username) }}">
@ -200,7 +200,7 @@
('6_1', '- Applications', 'Software - Apps'),
('6_2', '- Games', 'Software - Games')]
%}
{% set suke_cats = [('1_0', 'Art', 'Art'),
('1_1', '- Anime', 'Art - Anime'),
('1_2', '- Doujinshi', 'Art - Doujinshi'),
@ -225,7 +225,7 @@
{% else %}
<form class="navbar-form navbar-right form" action="{{ url_for('main.home') }}" method="get">
{% endif %}
<input type="text" class="form-control" name="q" placeholder="{{ search_placeholder }}" value="{{ search["term"] if search is defined else '' }}">
<br>
@ -234,9 +234,9 @@
<option value="1" title="No remakes" {% if search is defined and search["quality_filter"] == "1" %}selected{% endif %}>No remakes</option>
<option value="2" title="Trusted only" {% if search is defined and search["quality_filter"] == "2" %}selected{% endif %}>Trusted only</option>
</select>
<br>
<select class="form-control" title="Category" data-width="200px" name="c">
<option value="0_0" title="All categories" {% if search is defined and search["category"] == "0_0" %}selected{% else %}selected{% endif %}>
All categories
@ -247,9 +247,9 @@
</option>
{% endfor %}
</select>
<br>
<button class="btn btn-primary form-control" type="submit">
<i class="fa fa-search fa-fw"></i> Search
</button>
@ -269,13 +269,13 @@
<option value="2" title="Trusted only" {% if search is defined and search["quality_filter"] == "2" %}selected{% endif %}>Trusted only</option>
</select>
</div>
<div class="input-group-btn nav-filter" id="navFilter-category">
<!--
On narrow viewports, there isn't enough room to fit the full stuff in the selectpicker, so we show a full-width one on wide viewports, but squish it on narrow ones.
-->
{# XXX Search breaks with multiple fields with the same name: default to the shorter one so we don't break visuals. This is a hack! #}
{#
{#
<select class="selectpicker show-tick visible-lg" title="Category" data-width="200px" name="c">
<option value="0_0" title="All categories" {% if search is defined and search["category"] == "0_0" %}selected{% else %}selected{% endif %}>
All categories
@ -285,7 +285,7 @@
{{ cat_name }}
</option>
{% endfor %}
</select>
</select>
#}
<select class="selectpicker show-tick" title="Category" data-width="130px" name="c">
<option value="0_0" title="All categories" {% if search is defined and search["category"] == "0_0" %}selected{% else %}selected{% endif %}>

View File

@ -85,5 +85,5 @@
<p>Remakes of JPG/PNG-based releases are not allowed without exceptions since there is most often no point in making such.</p>
</li>
</ul>
</div>
</div>
{% endblock %}

View File

@ -97,7 +97,7 @@
{% else %}
<td class="text-center" data-timestamp="{{ torrent.created_utc_timestamp | int }}">{{ torrent.created_time.strftime('%Y-%m-%d %H:%M') }}</td>
{% endif %}
{% if config.ENABLE_SHOW_STATS %}
{% if use_elastic %}
<td class="text-center" style="color: green;">{{ torrent.seed_count }}</td>

View File

@ -9,19 +9,19 @@
{% from "_formhelpers.html" import render_markdown_editor %}
<h1>Upload Torrent</h1>
{% if not g.user %}
<p>You are not logged in, and are uploading anonymously.</p>
{% endif %}
<div id="upload-drop-zone"><span>Drop here!</span></div>
<form method="POST" enctype="multipart/form-data">
{{ upload_form.csrf_token }}
{% if config.ENFORCE_MAIN_ANNOUNCE_URL %}<p><strong>Important:</strong> Please include <kbd>{{ config.MAIN_ANNOUNCE_URL }}</kbd> in your trackers</p>{% endif %}
{% if config.ENFORCE_MAIN_ANNOUNCE_URL %}<p><strong>Important:</strong> Please include <kbd>{{ config.MAIN_ANNOUNCE_URL }}</kbd> in your trackers.</p>{% endif %}
<p><strong>Important:</strong> Make sure you have read <strong><a href="{{ url_for('site.rules') }}">the rules</a></strong> before uploading!</p>
<br>
<div class="row">
<div class="col-md-10">
<div class="col-md-12">
{{ render_upload(upload_form.torrent_file, accept=".torrent") }}
</div>
</div>
@ -29,18 +29,17 @@
<div class="col-md-6">
{{ render_field(upload_form.display_name, class_='form-control', placeholder='Display name') }}
</div>
<div class="col-md-4">
<div class="col-md-6">
{{ render_field(upload_form.category, class_='form-control')}}
</div>
</div>
<div class="row"></div>
<div class="row form-group">
<div class="col-md-6">
{{ render_field(upload_form.information, class_='form-control', placeholder='Your website or IRC channel') }}
</div>
<div class="col-md-6">
<label class="control-label">Torrent flags</label><br>
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-default {% if not g.user %}active disabled{% endif %}" title="Upload torrent anonymously (don't display your username)">
{{ upload_form.is_anonymous(disabled=(False if g.user else ""), checked=(False if g.user else "")) }}
@ -58,7 +57,6 @@
</div>
<div class="hidden-xl hidden-lg"><br></div>
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-danger" title="This torrent is derived from another release">
{{ upload_form.is_remake }}
<span class="glyphicon glyphicon-check"></span>
@ -100,7 +98,6 @@
{% endif %}
<br>
<div class="row">
<div class="form-group col-md-6">
<input type="submit" value="Upload" class="btn btn-primary">

View File

@ -7,6 +7,7 @@ import flask
from flask_paginate import Pagination
from nyaa import models
from nyaa.extensions import db
from nyaa.search import (DEFAULT_MAX_SEARCH_RESULT, DEFAULT_PER_PAGE, SERACH_PAGINATE_DISPLAY_MSG,
_generate_query_string, search_db, search_elastic)
from nyaa.utils import chain_get
@ -40,6 +41,12 @@ def before_request():
flask.session.permanent = True
flask.session.modified = True
ip = ip_address(flask.request.remote_addr)
if user.last_login_ip != ip:
user.last_login_ip = ip.packed
db.session.add(user)
db.session.commit()
# Check if user is banned on POST
if flask.request.method == 'POST':
ip = ip_address(flask.request.remote_addr).packed

View File

@ -99,7 +99,8 @@ def edit_torrent(torrent_id):
flask.abort(403)
torrent_user_level = torrent.user and torrent.user.level
if editor and editor.is_moderator and (torrent_user_level is None or editor.level > torrent_user_level):
if editor and editor.is_moderator and \
(torrent_user_level is None or editor.level > torrent_user_level):
ban_form = forms.BanForm()
if flask.request.method == 'POST' and form.submit.data and form.validate():