Commit Graph

113 Commits

Author SHA1 Message Date
Kfir Hadas 2424639bf9 Refactor routes.py 2017-07-27 14:14:00 +03:00
Kfir Hadas c539795fdc Move the remaining template_global into 'template-utils' blueprint 2017-07-27 14:14:00 +03:00
Kfir Hadas 93f94023d1 Move delete_comment and submit_report into blueprint 2017-07-27 14:14:00 +03:00
Kfir Hadas ef56e54521 Move torrent magnet and torrent download into 'torrents' blueprint 2017-07-27 14:14:00 +03:00
Kfir Hadas 9fef343c1b Move torrent edit and upload into 'torrents' blueprint
Move supporting functions and variables into other files
* nyaa.views.torrents:
  - _create_upload_category_choices
* nyaa.backend:
  - get_category_id_map
2017-07-27 14:14:00 +03:00
Kfir Hadas 9acdd14e81 Move /view/<int:torrent_id> route into 'torrents' blueprint
and update templates.
2017-07-27 14:14:00 +03:00
Kfir Hadas 42535bbdab Move 404 handler into 'main' blueprint 2017-07-27 14:14:00 +03:00
Kfir Hadas 4aac17ff23 Move 'before_request' into 'main' blueprint
Update comment in api_handler with new before_request location
2017-07-27 14:14:00 +03:00
Kfir Hadas eccb0ebdff Move '/' and '/rss' routes into 'main' blueprint
and update templates.
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
Kfir Hadas 50529920bd Move /user/activate/<payload> route into users
Move supporting functions as well:
  - get_serializer
  - get_activation_link
2017-07-27 14:14:00 +03:00
Kfir Hadas 0887dde6fc Move /user/<user_name> route into a blueprint
Move supporting functions and variables into other files
* nyaa.utils:
  - cached_function
  - chain_get
* nyaa.search:
  - DEFAULT_MAX_SEARCH_RESULT
  - DEFAULT_PER_PAGE
  - SERACH_PAGINATE_DISPLAY_MSG
  - _generate_query_string
2017-07-27 14:14:00 +03:00
Kfir Hadas 3913d8cea2 Move admin routes into blueprint
and update templates

Routes:
* /reports
* /adminlog
2017-07-27 14:14:00 +03:00
Kfir Hadas f316353176 Move account routes into blueprint (#292)
and update templates,
and remove unused imports

Routes:
* /login
* /logout
* /register
* /profile
2017-07-27 14:14:00 +03:00
Kfir Hadas 911fbc317f Move static routes into a blueprint
and update templates

Routes:
* /help
* /rules
* /xmlns/nyaa
* /about (commented out)
2017-07-27 14:14:00 +03:00
Kfir Hadas 7e16616a5d Remove unused imports 2017-07-27 14:14:00 +03:00
Kfir Hadas de8bd047d5 Apply isort on routes.py 2017-07-27 14:14:00 +03:00
Kfir Hadas fe4ac73ca2 Update torrent download route headers (#298)
- Change disposition from inline to attachment
- Add Content-Length header (by updating `_get_cached_torrent_file`)
2017-07-20 11:00:20 +03: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
Kfir Hadas c466e76471 Fix RFC822 filters + More tests (#257)
* Make rfc822 filters compatible with Windows systems.

.strftime() is relative to the system it's being run on.
UNIX has '%s' for seconds since the EPOCH, Windows doesn't (ValueError).
Solution: use .timestamp() to achieve the same result on both platforms.
This also allows us to drop the float() around it, since it returns a float.

* Start testing filters

* Add placeholders for more tests

* Make 'tests' folder a Python package

Now you can run tests with just `pytest tests`

* Update readme and travis config

* Test timesince()

* Update and organize .gitignore

Deleted: (nothing)
Added: Coverage files, .idea\

* Test filter_truthy, category_name

* Tests for backend.py

* Tests for bencode.py

* Move (empty) test_models.py to tests package

* Tests for utils.py

* Fixes for flattenDict

* Change name to `flatten_dict`
* `newkey` was assigned but never used

* Add a helper class for testing

* Show coverage on Travis

(only Travis for now...)

* Remove IDE

* Use correct assert functions

* Update README.md
2017-07-07 16:14:37 -05:00
Kfir Hadas 3b55af85f0 Fix torrent deletion log
* Fix `url referenced before assignment.`
* Fix every action logged as delete/undelete
2017-07-05 13:48:34 +03: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
nyaazi bea63315cd Merge branch 'master' into reports 2017-05-29 16:20:48 +03:00
Anna-Maria Meriniemi f02836f75e Merge pull request #194 from shm0o/url-stuff
More `url_for`
2017-05-28 02:42:42 +03:00
TheAMM b5ebebf98e Update Torrent.comment_count on comment submit/delete 2017-05-26 16:11:31 +03:00
nyaazi 5332ba1a49 Merge branch 'master' into reports 2017-05-26 15:25:02 +03:00
shm0o 18dd7cd66f static_cachebuster: build the url with url_for 2017-05-25 19:33:47 -04:00
Kfir Hadas d7181cf6a1 PEP8 2017-05-25 22:19:42 +03:00
Anna-Maria Meriniemi 0394639954 Calculate comment age clientside, show timestamp in mouseover title (#191)
Resolves outdated comment ages thanks to caching and will show timestamps in local time.
2017-05-25 21:13:35 +03:00
TheAMM bb30f6e3d2 Scroll user to their new comment after submission 2017-05-25 21:11:55 +03:00
TheAMM 1ab3d6e3eb Add cachebuster helper function for static css/js 2017-05-25 20:11:37 +03:00
TheAMM b09c61980c Add new route for torrent download, fix Content-Disposition
New route is `/download/<torrent_id>.torrent`, which will help people using tools that do not consider headers.
Old torrent download route still works.
Updated one remaining link to use url_for.

Added plain `filename="..."` to `Content-Disposition`, since it is still the most common standard with percent encoded UTF-8.
Fixes part 2 of #45
2017-05-25 11:15:45 +03:00
Kfir Hadas ebcf1dc836 PEP8 2017-05-25 09:08:18 +03: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
TheAMM aeef80edaa Clean up user search suggestion 2017-05-24 13:34:33 +03:00
ReimuHakurei 363203dfe0 Fix error on search for non-Unicode. 2017-05-24 10:14:03 +00:00
ReimuHakurei f215f0803c Add per-user filter on search page based on query. 2017-05-24 08:33:32 +00: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
katnyaa ba7e0a7c2e routes: Fix invalid call from previous merge 2017-05-23 13:47:47 +01:00
katnyaa 48df88ce71 Merge pull request #140 from FallenWarrior2k/master
Changed RSS feed to conform to RSS standards and added a namespace
2017-05-23 12:44:03 +00:00
nyaadev af61e5b1e9 some html + css changes around comments 2017-05-23 02:47:20 +02:00
nyaadev 3fc347d049 Move posting comments to view_torrent to fix displaying form errors. 2017-05-23 00:04:27 +02:00
nyaadev b7144f80f9 Make comments great again. 2017-05-22 23:38:06 +02:00
nyaadev fee55c1792 comments can be added+removed. gravatar for user avatar 2017-05-22 23:20:49 +02:00
Sn0wCrack fe6abf33c1 Added ability for users to leave anonymous comments 2017-05-22 23:19:36 +02:00
Sn0wCrack 1a9ebc19ed Added hard delete functionality 2017-05-22 23:19:36 +02:00
Sn0wCrack 6d608ab2f4 Added comments 2017-05-22 23:19:23 +02:00
TheAMM f04c3e1cf3 Remove v1 upload api and update notice 2017-05-22 22:57:37 +03:00
A nyaa developer b241dd5508 Don't generate empty torrent file for torrents without info dict (has_torrent). 2017-05-22 20:08:41 +02:00