Commit Graph

11 Commits

Author SHA1 Message Date
A nyaa developer 532439356f nuke comments (#577)
* nuke comments

* improve update_comment_count_db
2019-08-13 13:15:16 -07:00
TheAMM 885cccca40 Cache url_for calls with lru_cache
This commit adds a caching_url_for using functools.lru_cache (currently
with maxsize at 4096 entries) and replaces flask.url_for with it, as
there is no harm in doing so.

This greatly improves template generation speed, from ~115ms to ~75ms on
the front page (using the simple benchmark introduced in the previous
commit).
2019-04-08 19:28:26 +02:00
TheAMM bf090c0fab torrents: clean up & optimize magnets further
Removes the specialized template ES magnet creator, since create_magnet()
can use both Torrents and ES objects. Search results will get the
properly escaped magnets, now.
Slightly optimizes the tracker adding and string joins.
RIP base32, wonder how many bad clients will break with sha1.
2018-07-21 22:06:58 +03:00
Andrew Zhao f6735219f0 Fix keyError from pop (#407)
Remind me not to ever merge anything ever again
2017-11-06 23:52:25 +02:00
Andrew Zhao c0be2571e1 Reset page offset when updating search parameters (#406)
Updating the search query parameters should reset to the first page
2017-11-06 10:13:55 +02: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
A nyaa developer f8a314df4f Better bans (#341)
* better bans

* put jinja2 template into correct file
2017-08-25 18:53:35 -04:00
Kfir Hadas 87dd95f1e0 Refactor into an app factory [2 of 2] (#322)
* Replace all `from nyaa import app` imports with `app = flask.current_app` (or `from flask import current_app as app` where possible)
* Add a separate config object for top-level and class statements as `nyaa.extensions.config`
Required because those codes don't have app context at the time of evaluation/execution.
* Remove `routes.py` file and register all blueprints in `nyaa/__init__.py`
* Refactor `nyaa/__init__.py` into an app factory
* Update tools
* Update tests (temporary, will be replaced)
2017-08-01 21:02:08 +03:00
Kfir Hadas 0181d6cb33 Prepare for app factory [1 of 2] (#315)
* Move db, assets, debug toolbar and fix_paginate into nyaa.extensions
* Change all `from nyaa import db` imports to `from nyaa.extensions import db`
* Move `nyaa.torrents.create_magnet_from_es_info` context processor into template-utils blueprint
* Fix tools (wrap in `with app.app_context():` where needed)
2017-07-30 20:35:16 +03:00
Kfir Hadas c539795fdc Move the remaining template_global into 'template-utils' blueprint 2017-07-27 14:14:00 +03:00
Kfir Hadas f3b923ccca Move template filters and globals into blueprint (#301)
* Move 8 of 9 template filters and globals into a blueprint

* Rename nyaa.filters -> nyaa.template_utils

* Fix import sorting
2017-07-27 14:14:00 +03:00