mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 14:10:00 +00:00
minor changes
This commit is contained in:
parent
df288bfadd
commit
57a71be7b8
|
@ -35,7 +35,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="markdown-editor" id="{{ field_name }}-markdown-editor" data-field-name="{{ field_name }}">
|
<div class="markdown-editor" id="{{ field_name }}-markdown-editor" data-field-name="{{ field_name }}">
|
||||||
{{ field.label(class='control-label') }}
|
{{ 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">
|
<ul class="nav nav-tabs" role="tablist">
|
||||||
<li role="presentation" class="active">
|
<li role="presentation" class="active">
|
||||||
<a href="#{{ field_name }}-tab" role="tab" data-toggle="tab">
|
<a href="#{{ field_name }}-tab" role="tab" data-toggle="tab">
|
||||||
|
|
|
@ -9,19 +9,19 @@
|
||||||
{% from "_formhelpers.html" import render_markdown_editor %}
|
{% from "_formhelpers.html" import render_markdown_editor %}
|
||||||
|
|
||||||
<h1>Upload Torrent</h1>
|
<h1>Upload Torrent</h1>
|
||||||
|
|
||||||
{% if not g.user %}
|
{% if not g.user %}
|
||||||
<p>You are not logged in, and are uploading anonymously.</p>
|
<p>You are not logged in, and are uploading anonymously.</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
<div id="upload-drop-zone"><span>Drop here!</span></div>
|
<div id="upload-drop-zone"><span>Drop here!</span></div>
|
||||||
<form method="POST" enctype="multipart/form-data">
|
<form method="POST" enctype="multipart/form-data">
|
||||||
{{ upload_form.csrf_token }}
|
{{ 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="row">
|
||||||
<div class="col-md-10">
|
<div class="col-md-12">
|
||||||
{{ render_upload(upload_form.torrent_file, accept=".torrent") }}
|
{{ render_upload(upload_form.torrent_file, accept=".torrent") }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -29,11 +29,10 @@
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
{{ render_field(upload_form.display_name, class_='form-control', placeholder='Display name') }}
|
{{ render_field(upload_form.display_name, class_='form-control', placeholder='Display name') }}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-6">
|
||||||
{{ render_field(upload_form.category, class_='form-control')}}
|
{{ render_field(upload_form.category, class_='form-control')}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row"></div>
|
|
||||||
<div class="row form-group">
|
<div class="row form-group">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
{{ render_field(upload_form.information, class_='form-control', placeholder='Your website or IRC channel') }}
|
{{ render_field(upload_form.information, class_='form-control', placeholder='Your website or IRC channel') }}
|
||||||
|
@ -58,7 +57,6 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="hidden-xl hidden-lg"><br></div>
|
<div class="hidden-xl hidden-lg"><br></div>
|
||||||
<div class="btn-group" data-toggle="buttons">
|
<div class="btn-group" data-toggle="buttons">
|
||||||
|
|
||||||
<label class="btn btn-danger" title="This torrent is derived from another release">
|
<label class="btn btn-danger" title="This torrent is derived from another release">
|
||||||
{{ upload_form.is_remake }}
|
{{ upload_form.is_remake }}
|
||||||
<span class="glyphicon glyphicon-check"></span>
|
<span class="glyphicon glyphicon-check"></span>
|
||||||
|
@ -100,7 +98,6 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<input type="submit" value="Upload" class="btn btn-primary">
|
<input type="submit" value="Upload" class="btn btn-primary">
|
||||||
|
|
|
@ -7,6 +7,7 @@ import flask
|
||||||
from flask_paginate import Pagination
|
from flask_paginate import Pagination
|
||||||
|
|
||||||
from nyaa import models
|
from nyaa import models
|
||||||
|
from nyaa.extensions import db
|
||||||
from nyaa.search import (DEFAULT_MAX_SEARCH_RESULT, DEFAULT_PER_PAGE, SERACH_PAGINATE_DISPLAY_MSG,
|
from nyaa.search import (DEFAULT_MAX_SEARCH_RESULT, DEFAULT_PER_PAGE, SERACH_PAGINATE_DISPLAY_MSG,
|
||||||
_generate_query_string, search_db, search_elastic)
|
_generate_query_string, search_db, search_elastic)
|
||||||
from nyaa.utils import chain_get
|
from nyaa.utils import chain_get
|
||||||
|
@ -40,6 +41,12 @@ def before_request():
|
||||||
flask.session.permanent = True
|
flask.session.permanent = True
|
||||||
flask.session.modified = 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
|
# Check if user is banned on POST
|
||||||
if flask.request.method == 'POST':
|
if flask.request.method == 'POST':
|
||||||
ip = ip_address(flask.request.remote_addr).packed
|
ip = ip_address(flask.request.remote_addr).packed
|
||||||
|
|
|
@ -99,7 +99,8 @@ def edit_torrent(torrent_id):
|
||||||
flask.abort(403)
|
flask.abort(403)
|
||||||
|
|
||||||
torrent_user_level = torrent.user and torrent.user.level
|
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()
|
ban_form = forms.BanForm()
|
||||||
|
|
||||||
if flask.request.method == 'POST' and form.submit.data and form.validate():
|
if flask.request.method == 'POST' and form.submit.data and form.validate():
|
||||||
|
|
Loading…
Reference in a new issue