2017-05-12 20:51:49 +02:00
{% extends "layout.html" %}
{% block title %}Upload Torrent :: {{ config.SITE_NAME }}{% endblock %}
2017-05-26 01:03:59 +03:00
{% block metatags %}
< meta property = "og:description" content = "Upload a torrent to {{ config.SITE_NAME }}" >
{% endblock %}
2017-05-12 20:51:49 +02:00
{% block body %}
{% from "_formhelpers.html" import render_field %}
{% from "_formhelpers.html" import render_upload %}
2017-05-14 14:55:40 +10:00
{% from "_formhelpers.html" import render_markdown_editor %}
2017-05-12 20:51:49 +02:00
< h1 > Upload Torrent< / h1 >
2017-05-18 15:09:35 +02:00
{% if not g.user %}
2017-05-12 20:51:49 +02:00
< p > You are not logged in, and are uploading anonymously.< / p >
{% endif %}
2017-05-17 19:48:34 +03:00
< div id = "upload-drop-zone" > < span > Drop here!< / span > < / div >
2017-05-12 20:51:49 +02:00
< form method = "POST" enctype = "multipart/form-data" >
2017-05-22 16:28:06 +03:00
{{ upload_form.csrf_token }}
2017-08-31 14:19:22 +02:00
{% 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 >
2017-10-10 04:41:18 +03:00
{% if show_ratelimit %}
{% set ratelimit_class = 'danger' if upload_form.ratelimit.errors else 'warning' %}
< div class = "row" >
< div class = "col-md-12" >
< div class = "alert alert-{{ ratelimit_class }}" role = "alert" >
< div > You've reached your maximum upload rate ({{ config.MAX_UPLOAD_BURST }} per {{ config.UPLOAD_BURST_DURATION // 60}} minutes, you have < b > {{ ratelimit_count }}< / b > ) and will now have to wait {{ config.UPLOAD_TIMEOUT // 60 }} minutes between uploads.< / div >
{% if next_upload_time %}
< div > You may upload again at < b data-timestamp = "{{ next_upload_time|utc_timestamp }}" > {{ next_upload_time.strftime('%Y-%m-%d %H:%M UTC') }}< / b > .< / div >
{% else %}
< div > You may upload again now.< / div >
{% endif %}
< / div >
< / div >
< / div >
{% endif %}
Implement range bans (#478)
* Implement range bans
People connecting from banned IP ranges are unable to upload
torrents anonymously, and need to manually have their accounts
activated.
This adds a new table "rangebans", and a command line utility,
"rangeban.py", which can be used to add, list and remove rangebans
from the command line.
As an example:
./rangeban.py ban 192.168.0.0/24
This would rangeban anything in this /24.
The temporary_tor column allows automated scripts to clean out and
re-add ever-changing sets of ranges to be banned without affecting
the other ranges.
This has only been tested for IPv4.
* Revise Rangebans
Add an id column, and change "temporary_tor" to "temp". Also
index masked_cidr and mask.
* rangebans: fix enabled and the binary op
kill me
* Add enabling/disabling bans to rangeban.py
* rangebans: fail earlier on garbage arguments
* rangebans: fix linter errors
* rangeban.py: don't shadow builtin keyword 'id'
* rangebans: change temporary ban logic, column
The 'temp' column is now a nullable time column. If the field is
null, the ban is understood to be permanent. If there is a time
in there, it's understood to be the creation time of the ban.
This allows scripts to e.g. delete all temporary bans older than
a certain amount of time.
Also, rename the '_cidr_string' column to 'cidr_string', because
reasons.
* rangeban.py: use ip_address to parse CIDR subnet
* rangebans: fixes to the mask calculation and query
Both were not bugs per-se, but just technically not needed/correct.
* De-meme apparently
2018-06-30 05:15:04 +02:00
{% if upload_form.rangebanned.errors %}
< div class = "row" >
< div class = "col-md-12" >
< div class = "alert alert-danger" role = "alert" >
{% for error in upload_form.rangebanned.errors %}
< p > {{ error }}< / p >
{% endfor %}
< / div >
< / div >
< / div >
{% endif %}
2017-05-12 20:51:49 +02:00
< div class = "row" >
2017-08-31 14:19:22 +02:00
< div class = "col-md-12" >
2017-05-18 15:09:35 +02:00
{{ render_upload(upload_form.torrent_file, accept=".torrent") }}
2017-05-12 20:51:49 +02:00
< / div >
< / div >
< div class = "row" >
2017-05-24 11:31:29 +03:00
< div class = "col-md-6" >
2017-05-18 15:09:35 +02:00
{{ render_field(upload_form.display_name, class_='form-control', placeholder='Display name') }}
2017-05-12 20:51:49 +02:00
< / div >
2017-08-31 14:19:22 +02:00
< div class = "col-md-6" >
2017-05-18 15:09:35 +02:00
{{ render_field(upload_form.category, class_='form-control')}}
2017-05-12 20:51:49 +02:00
< / div >
< / div >
2017-05-20 22:00:45 +03:00
< div class = "row form-group" >
2017-05-24 11:31:29 +03:00
< div class = "col-md-6" >
2017-05-18 15:09:35 +02:00
{{ render_field(upload_form.information, class_='form-control', placeholder='Your website or IRC channel') }}
2017-05-12 20:51:49 +02:00
< / div >
2017-05-24 11:31:29 +03:00
< div class = "col-md-6" >
2017-05-23 01:17:18 -04:00
< label class = "control-label" > Torrent flags< / label > < br >
2017-08-31 14:19:22 +02:00
2017-05-24 04:04:32 +00:00
< 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 "")) }}
2017-05-24 00:57:07 -04:00
{% if not g.user %}< span class = "glyphicon glyphicon-ban-circle" > < / span > {% endif %}
2017-05-24 04:08:16 +00:00
{% if g.user %}< span class = "glyphicon glyphicon-check" > < / span > {% endif %}
{% if g.user %}< span class = "glyphicon glyphicon-unchecked" > < / span > {% endif %}
2017-05-24 04:04:32 +00:00
Anonymous
< / label >
< label class = "btn btn-grey" title = "Hide torrent from listing" >
{{ upload_form.is_hidden }}
2017-05-24 04:08:16 +00:00
< span class = "glyphicon glyphicon-check" > < / span >
< span class = "glyphicon glyphicon-unchecked" > < / span >
2017-05-24 04:04:32 +00:00
Hidden
< / label >
2017-05-24 11:31:29 +03:00
< / div >
2017-05-24 08:37:13 +00:00
< div class = "hidden-xl hidden-lg" > < br > < / div >
2017-05-24 11:31:29 +03:00
< div class = "btn-group" data-toggle = "buttons" >
2025-03-04 23:56:47 +02:00
< label class = "btn btn-danger" title = "This torrent is a repack/reencode/recompress" >
2017-05-24 04:04:32 +00:00
{{ upload_form.is_remake }}
2017-05-24 04:08:16 +00:00
< span class = "glyphicon glyphicon-check" > < / span >
< span class = "glyphicon glyphicon-unchecked" > < / span >
2025-03-05 01:52:38 +02:00
Repack
2017-05-24 04:04:32 +00:00
< / label >
2025-03-04 23:56:47 +02:00
< label class = "btn btn-warning" title = "This torrent is a collection" >
2017-05-24 04:04:32 +00:00
{{ upload_form.is_complete }}
2017-05-24 04:08:16 +00:00
< span class = "glyphicon glyphicon-check" > < / span >
< span class = "glyphicon glyphicon-unchecked" > < / span >
2017-05-24 04:04:32 +00:00
Complete
< / label >
{% if g.user.is_trusted %}
2025-03-04 23:56:47 +02:00
< label class = "btn btn-success active" title = "Mark torrent as trusted" >
2017-05-24 04:04:32 +00:00
{{ upload_form.is_trusted(checked="") }}
2017-05-24 04:08:16 +00:00
< span class = "glyphicon glyphicon-check" > < / span >
< span class = "glyphicon glyphicon-unchecked" > < / span >
2017-05-24 04:04:32 +00:00
Trusted
< / label >
{% endif %}
< / div >
2017-05-12 20:51:49 +02:00
< / div >
2017-05-20 22:00:45 +03:00
< / div >
2017-05-12 20:51:49 +02:00
< div class = "row" >
2017-05-24 11:31:29 +03:00
< div class = "col-md-12" >
2017-05-18 15:09:35 +02:00
{{ render_markdown_editor(upload_form.description, field_name='description') }}
2017-05-12 20:51:49 +02:00
< / div >
< / div >
2017-10-05 02:05:35 +03:00
{% if config.USE_RECAPTCHA and (not g.user or g.user.age < config [ ' ACCOUNT_RECAPTCHA_AGE ' ] ) % }
2017-05-18 15:09:35 +02:00
< div class = "row" >
2017-05-24 11:31:29 +03:00
< div class = "col-md-4" >
2017-05-18 15:09:35 +02:00
{% for error in upload_form.recaptcha.errors %}
{{ error }}
{% endfor %}
{{ upload_form.recaptcha }}
< / div >
< / div >
{% endif %}
< br >
2017-05-12 20:51:49 +02:00
< div class = "row" >
2017-05-24 11:31:29 +03:00
< div class = "form-group col-md-6" >
2017-05-12 20:51:49 +02:00
< input type = "submit" value = "Upload" class = "btn btn-primary" >
< / div >
< / div >
< / form >
{% endblock %}