Commit Graph

30 Commits

Author SHA1 Message Date
Nicolas F a38e5d5b53 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-29 20:15:04 -07:00
Anna-Maria Meriniemi de1fd2f1bc [Config change] Upload ratelimit for non-trusted uploaders (#384)
* Implement upload ratelimit for non-trusted uploaders

Users may upload X torrents in Y minutes after which they
will have to wait Z minutes between uploads.

* Show torrent period count when ratelimited

* Only ratelimit new accounts
2017-10-09 18:41:18 -07:00
Anna-Maria Meriniemi 1e5f61ddf7 [Config change] Require recaptcha of new uploaders (#376)
* Reorganize config.example.py, add ACCOUNT_RECAPTCHA_AGE

* Require new accounts to pass recaptcha on upload

Based on ACCOUNT_RECAPTCHA_AGE in config.
2017-10-04 16:05:35 -07:00
nyaadev 57a71be7b8 minor changes 2017-08-31 14:20:34 +02:00
Arylide dc627bf398 Revert "upload page: use alerts, add alert about rules (#304)"
This reverts commit c5ce99c3f3.
2017-07-24 20:03:58 -07:00
Nicolas F c5ce99c3f3 upload page: use alerts, add alert about rules (#304)
This changes the tracker announce URL message to be one of those
bootstrap alert bubbles, and adds an additional warning which tells
people to read the rules and not upload off-topic crap.
2017-07-24 16:46:39 +03:00
nyaazi 5332ba1a49 Merge branch 'master' into reports 2017-05-26 15:25:02 +03:00
TheAMM 3f49f17baa Add simple OG metadata tags to templates
Hello, #185
2017-05-26 01:03:59 +03:00
ReimuHakurei 8da628136f Improve breaking of button groups. 2017-05-24 08:37:13 +00:00
TheAMM ea2e01ae2c Revert edit/upload form back to -md-, split flag buttons into two groups 2017-05-24 11:31:29 +03:00
ReimuHakurei 1eb805120e Merge branch 'master' of https://github.com/nyaadevs/nyaa 2017-05-24 05:28:40 +00:00
ReimuHakurei 0d839eca35 More layout improvements. 2017-05-24 05:28:30 +00:00
snowfag aa09191a24 Change guest anon upload glyph. 2017-05-24 00:57:07 -04:00
ReimuHakurei 4fa9972252 Merge branch 'master' of https://github.com/nyaadevs/nyaa 2017-05-24 04:08:16 +00:00
ReimuHakurei b0b77775d7 Unfuck the layout, and remove the search update info from the about box on the home page to declutter. 2017-05-24 04:04:32 +00:00
snowfag 34fe2c5c67 change glyphs for buttons. 2017-05-23 22:16:05 -04:00
snowfag fb91b2bbf8 Guest upload visual fix. 2017-05-23 21:32:02 -04:00
snowfag 4a7d8646b6 Update upload/edit buttons. 2017-05-23 21:11:58 -04:00
snowfag ad8a5c0d1c Update buttons and css. 2017-05-23 01:17:55 -04:00
TheAMM a1c024a342 Re-enable CSRF token for upload & fix API CSRF handling 2017-05-22 16:29:14 +03:00
aldacron c2438f3913 nyaadev is an idiot and broke apiv2 2017-05-21 22:10:05 -07:00
nyaadev a4c7dd7912 Add ReCaptcha to upload page if user is not logged in.
Bring back CSRF to upload form (Use the upload API)
2017-05-21 19:29:21 +02:00
TheAMM f31efcdaa1 Align fields better, move Anonymous as first flag 2017-05-20 22:50:49 +03:00
TheAMM b9d88e8960 Restructure upload.html and edit.html as well as route logic
Rename variables and reformats user/admin logic
Add an is_trusted field to upload and edit forms

Restructure fields on upload and edit pages
Add simple styling for checkboxes
Add titles (mouseover) for checkboxes with crude explanations
Show Anonymous checkbox during upload and check & disable it for guests
Show Trusted checkbox for users at or above Trusted level
Adjust description field rendering to show field label above it

Add title (mouseover) for edit icon on torrent page
Show uploader for admins on anonymous torrents
Show uploader for admins when editing others' torrents
2017-05-20 22:00:45 +03:00
Kfir Hadas e8885df2b4 Drag&Drog in upload 2017-05-17 20:14:26 +03:00
Kfir Hadas d27dd7eb51 Put tracker URL in <kbd>
Looks nicer
2017-05-17 09:23:52 +03:00
TheAMM c1df153e98 Don't enforce site tracker as first, just that it exists on the torrent
Fixes issue #42
Also adds logic for private torrents requiring site tracker as the main tracker (otherwise there's no point on uploading them on the site)
Changes upload.html wording to reflect the requirement to have the tracker, not necessarily as the first one.
2017-05-14 14:22:17 +03:00
Nathan Yam fabe0f6fec Issue #10 Add markdown preview editor
These changes add a macro that creates the relevant HTML markup for a
markdown editor. In the main.js file, we bind the relevant elements with
the marked library, so users can see their contents in a HTML format.
2017-05-14 15:33:08 +10:00
Nathan Yam d3ad2503ae Add markdown editor macro 2017-05-14 15:33:08 +10:00
nyaadev 00d65e312c Initial commit. 2017-05-12 20:51:49 +02:00