Commit Graph

54 Commits

Author SHA1 Message Date
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
Anna-Maria Meriniemi 1bc36c5a17 [Schema change] Add webseed support (BEP-19) (#317)
Store webseeds in Trackers table with is_webseed flag
Adjusts torrent creation accordingly
2017-07-30 00:00:39 +03:00
Kfir Hadas b992467dad Apply isort & flake8 (#312)
* Update isort settings
* Apply import sorting (isort) on all files in nyaa/
* Fixed Flake8 errors in nyaa/ (see PR for list)
* Add isort to lint.sh and requirements.txt
2017-07-28 20:01:19 +03:00
Kfir Hadas 99c052c85f Tiny code reformat 2017-07-27 23:29:25 +03:00
Kfir Hadas 42725d4a3c Hotfix Gravatar 2017-07-27 23:17:06 +03:00
Kfir Hadas ab6193d01d Update Gravatar (#313)
* Update help.html with a section about user avatars

* Update Gravatar implementation to use the rating feature
2017-07-27 16:03:13 -04:00
mreweilk b51045503d Fix banned display on selection box 2017-07-16 14:19:20 -04:00
Matt Kliewer 708e0da5a1 Add logging to report view and add option to disable (ban) a user for superadmins 2017-07-09 18:07:31 -05:00
mreweilk dd8cb4757e Admin Log 2.0 (#283)
* Admin log added

* Add admin log to top bar

* Fixed some admin log bugs

* Remove comment_id column because comments die when they are killed

* Fix tabs in admin log template

* Fixed sort of admin logs to be created_time desc

* Fix navbar wrapping to a new line

when 992px <= width <= 1200px

* Put reports and admin log in "Admin" dropdown

Applied ./lint.sh fixes

Fixed long lines

* Updated log to be text instead of id based to account for future deletions

* Small fix in log message formatting
2017-07-04 23:13:59 -05:00
Kfir Hadas 3165389d52 Fix lint check + update lint script (#224)
* Fix PEP8 E301 on nyaa/models.py

* Add utils/ to lint checker

* Run of lint.sh + manual fixes

As suggested https://github.com/nyaadevs/nyaa/pull/157#issuecomment-305051428

* Fix backwards tick in README

* Updated script

* Update Travis config
2017-06-01 06:40:33 -05:00
TheAMM 051f3f38d2 Clean up Torrent flag properties 2017-05-30 12:46:27 +03:00
TheAMM 2b331c307e Optimize MySQL COUNT queries and pagination
Also leaves 'Torrent.trackers' as 'select' for the joining, since we don't need it on listings
2017-05-29 18:27:34 +03:00
nyaazi 5dc8bdaf74 For the green 2017-05-29 16:24:45 +03:00
nyaazi bea63315cd Merge branch 'master' into reports 2017-05-29 16:20:48 +03:00
Anna-Maria Meriniemi d65602ee9f [DB Changes! Read PR!] Merge pull request #196 from nyaadevs/elasticsearch-comment-count
Elasticsearch comment count. Read PR #201 as well.
2017-05-27 20:12:43 +03:00
TheAMM 07cf0de6f9 Rewrite site-specific database models into declarative bases
This allows us to easily extend the bases into Nyaa and Sukebei models, with working FKs and relationships.

Note: the schema will (should!) otherwise match, however; the following index on Torrent was renamed:
uploader_flag_idx will be <prefix>_uploader_flag_idx, as we will be always creating both flavors.
The index rename should not affect SQA, but will potentially break migrations.
2017-05-27 18:14:39 +03:00
TheAMM f7ed2c06d3 Jeez fine PEP8 I get it 2017-05-27 18:10:21 +03:00
TheAMM 6c80557e39 SCHEMA CHANGE: Add comment_count to Torrent
with a helper function on Torrent to update the count.
2017-05-26 16:08:46 +03:00
nyaazi 5332ba1a49 Merge branch 'master' into reports 2017-05-26 15:25:02 +03:00
Kfir Hadas ebcf1dc836 PEP8 2017-05-25 09:08:18 +03:00
nyaadev 02c04ce893 order torrent.trackers relation 2017-05-25 00:36:49 +02:00
TheAMM 3a4280ccc5 Redirect searches with an info hash to torrent if found
Redirect will not happen on RSS or user page views (/searches).
Adds a helper to models.Torrent to search with a hex hash
Reformats "special search logic"
2017-05-24 17:34:36 +03:00
snowfag d38f30a7b7 Admins should have same userlevel_str as mods. 2017-05-24 02:18:09 -04:00
nyaadev 020a0871bd fix #173 and add avatar to mod user info
add rank color to username everywhere
some other minor changes
2017-05-24 00:28:17 +02:00
nyaadev af61e5b1e9 some html + css changes around comments 2017-05-23 02:47:20 +02:00
nyaadev 8ef6e915da shameful late edit: change comment text collation to utf8mb4 2017-05-23 00:36:53 +02:00
nyaadev b7144f80f9 Make comments great again. 2017-05-22 23:38:06 +02:00
snowfag aab3eaccaa Spruce up comments. 2017-05-22 23:20:52 +02:00
nyaadev fee55c1792 comments can be added+removed. gravatar for user avatar 2017-05-22 23:20:49 +02:00
Sn0wCrack c3a637c8eb Added date column t o comments 2017-05-22 23:19:36 +02:00
Sn0wCrack 6d608ab2f4 Added comments 2017-05-22 23:19:23 +02:00
nyaadev 9af778217b DB CHANGE: Add uploader ip address to torrent column and show on torrent view page for superadmins.
Added migration script!: remove sukebei_ lines if your local db does not have those.
Show users ip address on user page for superadmins.
Rename Admin to Moderator internally.
Moderators can now change user level to trusted.
Superadmins can make users moderator.
Improve changing user level.
2017-05-21 19:12:15 +02:00
nyaazi 92a6074fa2 Merge branch 'master' into reports 2017-05-21 18:48:45 +03:00
TheAMM 752a5a1f95 Clean up models.User.level helpers 2017-05-20 21:59:24 +03:00
nyaazi 04c9ef6685 Redundant query 2017-05-20 15:02:26 +03:00
nyaazi 73c84ce5ec Remove duplicate reports for already reviewed torrent 2017-05-20 13:58:58 +03:00
nyaazi 354736720b Implemented report action
Actions: Close report, Hide torrent, Delete torrent
2017-05-20 13:33:58 +03:00
TheAMM 95d2bff614 Add cascade to Torrent relationships for entry nuking (debugging purposes)
Doesn't change the schema, only how SQA will handle session.delete(Torrent.by_id(1337))
2017-05-20 10:16:01 +03:00
nyaazi e6083325d6 Added reports page v2 2017-05-19 20:53:47 +03:00
nyaazi 799d5914d6 Added reports page 2017-05-19 20:52:04 +03:00
nyaazi 98fbe6efb1 Adding report table, route and view. 2017-05-19 20:03:47 +03:00
TheAMM daef4a9c6a Finalize RSS ES fix 2017-05-19 19:25:48 +03:00
nyaadev 2a1f8fab87 pep8 2017-05-19 14:36:33 +02:00
TheAMM 18ebf201b8 Add a function for getting a id->category name map
Redo _create_upload_category_choices to use new function
Also removes (renames) by_id from models.SubCategory (we use composite key)
2017-05-19 15:21:20 +03:00
TheAMM 6bfb65172c Add helper functions to models.User 2017-05-18 15:28:51 +03:00
martstern 931b2b0b83 added user class display and editing 2017-05-17 06:02:15 -04:00
sharkykh 5e60847cb6 More E501 line too long - multiple files
nyaa/backend.py:75
nyaa/forms.py:129,175
nyaa/models.py:88
2017-05-16 12:43:33 +03:00
sharkykh a79c0f8a93 PEP8 (a run of lint.sh) 2017-05-16 12:42:12 +03:00
martstern eb59116429 allow admin to give trusted to users. show users their own info when logged in 2017-05-15 07:49:25 -04:00