Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0
Graphe des révisions

180 commits

Auteur SHA1 Message Date
PantsuDev cb13bcded9 Change max to limit 2017-06-22 11:21:30 +10:00
akuma06 eaf4e23266 Fix hidden on User Profile (#1039)
When a user had hidden torrents, they were still listed on his user page even if it's not the actual user who is viewing it.
That's why I added a new function for searching which filter out hidden torrents.
Now when a user go to his own page (or a moderator), he can see all his torrents.
However if another person visit the page, only non hidden torrents will be listed.
I added the hidden parameter in ES database, it permits also to use the search instead of SQL when listing torrents on the user page. Less load time, go with the idea that we should use ES everywhere when needed.
2017-06-21 11:58:54 +10:00
PantsuDev 757b276ffa Hopefully fix torznab api 2017-06-20 17:10:47 +10:00
akuma06 2e53fa2603 Added tests on some package + simplified a little modelHelper (#1026)
Test on:
* Categories
* Util
* modelHelper

Added hum_name on PasswordConfirm
Removed Zlib <= No code is using it anymore
modelHelper now show translated errors
New Translation strings
2017-06-20 10:06:07 +10:00
akuma06 9307087024 Refine form linked up & edited buildversion to commit hash (#1025)
Added the use of the new search form made by @kipukun
Buildversion are now commit hash. Please read the readme for new build
command (or just build using package.sh).
2017-06-20 10:06:01 +10:00
akuma06 13a15b3b2c Removing reparsing of pagenum in ES 2017-06-18 01:39:11 +02:00
akuma06 fb64d13e29 Should fix no result found by ES 2017-06-18 01:23:12 +02:00
akuma06 b4add6054a Fix for cat=5070 2017-06-18 01:19:46 +02:00
akuma06 ad3a44e2f8 Torznab fix (#1019)
* Torznab fix

Added multiple category search
Fixed issues in #1017
Now category from searchParam & torrentParam are arrays of category
New Struct Categories

* Fix travis error due to database code
2017-06-18 08:30:12 +10:00
akuma06 5e65b20c89 Added two new functions for @kipukun
GetCategory categoryID  keepParent (eg: GetCategory "3" true <= for all
anime)
Modified
GetCategories to (keepParent, keepChild) (eg: GetCategories true true <=
for every catagories)
2017-06-17 04:24:30 +02:00
akuma06 cbcbeef256 Forgot subcat have attr not tags 2017-06-15 21:55:55 +02:00
akuma06 fb2c69a612 Torznab caps compatible 2017-06-15 21:54:06 +02:00
akuma06 c1270e549a EZTV and Torznab support
EZTV is fully supported afaik and can be accessed to /feed/eztv
Torznab is supported on display, miss t=caps route and can be accessed
to /feed/torznab
2017-06-15 15:43:18 +02:00
Rin Ikeda 50b4b2387e Small typo fix 2017-06-14 14:27:05 +03:00
akuma06 0662b3fb41 Audio captcha (#995)
* Megacheck friendly

applied megacheck and fixed some unwanted behaviour (markdown)

* Forgot this file

* Captcha Audio

Should make #993 happen

* Fix style issue in  comments

* Added margin auto and width on input

* Moved width on captcha div instead

* fixing width issue with audio tag

* Captcha final style fix
2017-06-14 20:10:03 +10:00
akuma06 63fbbaa491 gosimple friendly 2017-06-14 09:20:42 +02:00
akuma06 05e3391cf9 Should fix #991 2017-06-14 09:00:50 +02:00
Ramon Dantas dac4b5baf5 Add MinSize and MaxSize search parameters (#990)
Also removed some duplicate code from the search code, using the
methods in common/search.go.
2017-06-13 21:31:11 +10:00
Ramon Dantas d8e17478f8 Country flags (language) for torrents. (#970)
* Add flags for torrents

Add a new field, .Language, to the Torrent model, and a new package,
torrentLanguages, which maps languages to flags. Added also a flag icon pack
from googlei18n/region-flags, with (mostly) public domain flags from Wikipedia.

* Optimize flags

* Use FlagSprites CSS instead of .png files

* Only use flags for languages we support

* Add test for CSS flags

Ensure that we have all the flags for the languages we support.

* Add AdditionalLanguages field to config

This allows us to support additional languages for new uploaded torrents,
even if we have no translation for it.

* Minor CSS fix

* Add "other" and "multiple" torrent languages

Also removed the TorrentLanguage struct, as it wasn't much useful.

* Fix test

* Add colspan=2 to category when language is empty

Also hide the language column if empty.

* Add lang field to search.

Hopefully it works with Elasticsearch as well, but I haven't tested
(lol Java)

* Add language field to ES index and settings

* Add language column to JS template

* Add keyword type to language ES field

* Remove 'raw' from keyword

* Set "simple" analyzer on language

* Document .Language field on Torrent model
2017-06-12 09:14:26 +10:00
akuma06 ee0e611d11 Replaced hardcoded message errors in email validation
Added some translation string
Improved the way the emails and usernames are checked (less conditions)
Minor fix on clear error functions
2017-06-10 00:58:34 +02:00
sfan5 576e11bf42 Fix both error message + HTML showing on home page
Also remove util.SendError since it's not very useful.
2017-06-06 16:24:15 +02:00
akuma06 5068d83402 Merge branch 'dev' into custom-mascot 2017-06-06 00:38:20 +02:00
ElegantMonkey e10070b2a9 Add customizable mascot by URL.
Add a new setting for customizable mascots, with a new User field
MascotURL, and a corresponding cookie setting.
2017-06-05 11:32:48 -03:00
tomleb e60eceba63 Reduce number of queries, update systemd unit service (#925)
* Update/add systemd services

* Avoid roundtrip back to postgresql when doing ES search

* Use only one ES client
2017-06-05 11:33:02 +10:00
MCManuelLP f6b14e34c1 Url encode the display name
fixes #901
2017-06-04 10:24:27 +02:00
Atvaark 99ad76f76f Add web address config (#888)
* This allows changing the nyaa, sukebei and status URL via config.
  Previously only the nyaa address was configurable
* This helps testing changes locally without having to set up
  a TLS terminating proxy
* Also refactored uses of hardcoded URLs in the html templates
  The html templates will now also use the configured urls
2017-06-03 11:45:24 +10:00
akuma06 61a0ab0bc3 Added also a maxage field
Now you can provide ?maxage=nb_days to get the torrents from the last
nb_days days
2017-06-02 16:25:45 +02:00
akuma06 f41f2c3a25 Field Date Filter
* Search can be filtered out with ?fromDate=2017-05-01 and
?toDate=2017-05-12
2017-06-02 16:10:31 +02:00
akuma06 e116b30b40 Better handle of test files
After some thoughts, it is better to use the config from config files
than default ones
2017-05-31 10:49:01 +02:00
akuma06 5376b9e271 New config files (#854)
* New config files

As decided, config files are parsed at runtime.
I decided to go for YAML config files because there can be comments in
it.
There are 2 files:
* config/default_config.yml <= which shouldn't be edited unless we add a
config parameter
* config/config.yml <= which is the user-defined config. This file
shouldn't be commited

Changed every call to config.XXX to config.Conf.XXX (look to the new
stucture of config in config/types.go)

Of course, putting config parameters in config.yml overrides config in
config_default.yml. You don't have to put everything in it, just add
what you want to override.

* Fixing test

Replacing conf.New by config.Conf

* Fixing call to config.Conf to config.Config{} in test files

* Might have fixed testing with this

Printf instead of Fatalf

* Renaming config.yml in example file

* Forbid commiting config.yml

* Should be now fixed

* Do not need this file anymore
2017-05-30 21:21:57 -05:00
Steindór ffbbacb84a Maskot to cookie (#857)
* Put the mascot into the cookie as well, major js cleanup

* Update en-us.all.json

* removed redundant translation
2017-05-30 21:21:35 -05:00
akuma06 b0cf17c77c Renamed the search argument FromID instead of TorrentID 2017-05-30 14:12:42 +02:00
akuma06 402fce9f02 Api Last Torrent + xhr automatic refresh
* Added a fiel torrentID in search param
* Search can be limited to torrentID > id provided
* Templates creation through simple JS object
* XHR management through simple JS object
* Torrents object that interface with Templates and Query to get new
torrent uploaded according to the search context
2017-05-30 00:28:21 +02:00
akuma06 517b59b02f Merge pull request #837 from NyaaPantsu/csrf-secure
CSRF Support + better key for context
2017-05-29 22:15:07 +02:00
akuma06 3ec367a759 CSRF Support + better key for context
* Added new dep: gorilla/csrf
* CSRF field in forms
* CSRF variable in commontemplatevariables
* New key for messages and user context

Please change EnableSecureCSRF to false when testing locally and don't
merge config/env.go with the changes
2017-05-29 17:07:18 +02:00
John Smith 61141a1fcf
Exhaustive whitespace trimming 2017-05-29 23:43:27 +10:00
John Smith 0bdd915f9a
Let net/http gracefully close
http.Server.Shutdown gracefully closes listeners/clients, we do not have to
do it ourselves. Making util/signals accept func() instead of io.Closer
allowed for the removal of network/closer.go and util/signals/closers.go.
2017-05-29 16:29:34 +10:00
Atvaark b31e77be2e Fix infohash decoding (#813)
Calculate the info hash of the uploaded torrent file
instead of the re-encoded torrent file.

The re-encoded torrent files only contain a subset
of the original info values and thus have a different hash.
2017-05-29 07:47:47 +10:00
Eliot Whalan cdd382cd34
Merge branch 'dev' of https://github.com/NyaaPantsu/nyaa into dev 2017-05-28 19:57:38 +10:00
John Smith 8a5c4543f8
Less code. 2017-05-28 19:57:12 +10:00
John Smith 92c92e09c1
Prevent race condition.
It is possible for an os.Interrupt signal to be raised after
signals.RegisterCloser() and before startup of goroutine signals.Handle().

Race is prevented by synchronously calling signal.Notify().
2017-05-28 19:57:07 +10:00
Steindór 25562e0d54 Account theme switcher (Pls merge) (#750)
* added pagination

* cleanup

* indentation fix

* fix

* Loads theme from context

* Basic theme switching working

* working properly

* Fuck golint tbqh

* united language and theme into one settings page

* made the settings page a little nicer

* fixed it so it works properly now

* removed parts of inline js and fixed bug

* removed remains of other theme switching method

* fixed very minor bug

* fix
2017-05-27 12:08:47 -05:00
akuma06 6481e90a0c Golint friendly next (#756)
* Gofmt friendly

Keeping Go source code in line with what they preconize

* Golint Friendly Next

So I have made some variables unexported
Added comments in every function that I know what it does
Removed some deprecated stuff that I was sure of
Added a comment on possible deprecated methods "Is it deprecated?"
Changed some variable/method name according to golint recommendations

* Update filelist.go
2017-05-26 12:12:52 +02:00
Ramon Dantas 8fbdeed9f5 CSS-only tree view. (#753)
* Make tree-view work with CSS only

Changed the file list tree-view to use recursive templating instead of
an external function, and improved it so that it works with only CSS.
Striped lines won't work though.

* Remove inline-block from folder label

It breaks with the text-overflow: ellipsis.

* Rename makeFolderData to makeTreeViewData
2017-05-26 11:53:18 +10:00
tomleb f22d11b35d Elasticsearch integration (WIP) (#730)
* Update mapping to be similar to TorrentJSON

* Implement ES search for TorrentParam

* Add seeders/leechers/completed to es index

* Fix filter, use analyzer

* Use ES for the search route

* Add upload_id filtering with ES

* Create/update ES index on torrent upload/update

* Delete from ES index on Delete

* Use ES everywhere, fallback to postgres query

Use Elasticsearch to search the index whenever a call to searchByQuery
is made. Big cleanup needed, but _it werks_.

* Only fetch ids from ES, nothing else

* Use ColumnUpdate instead of Save

* Add FIXME/info to search

* Template needs []TorrentJSON not []Torrent
2017-05-26 09:48:14 +10:00
akuma06 c3211c6a14 Gofmt friendly (#752)
Keeping Go source code in line with what they preconize
2017-05-26 07:35:37 +10:00
akuma06 6edc68fe22 Deleted torrents mod done (#732)
* Torrent Mass Edit Api (WIP)

* Torrents can be deleted in mass from frontend with api post request
* Torrents status can be edited from frontend with api post request
-- Look to function doc for more info on how to use it

It is a WIP so it might not work =D

* Finished Mass mod Api

As per suggestion of @yiiTT in #720, I added:
* Changing torrents category
* Deletion of reports with deletion of a torrent
* Changing owner of multiple torrents

Commit also add some new translation strings.

* Make some changes

* Reports can now be cleared for the torrents selected without having to
delete them
* Users with no admin rights can't delete reports

* Fix moveto to status

moveto deprecated in api

* Tested and works!

Changes:
* Updates only the colomns of torrent table
* Moved categories config in config/torrents.go

* Forgot this file in last commit

* Less useless queries

The use of Save makes it that users are created and updates also all the
associatiated models. Better to just update the colomns needed (less
useless queries)

* Some Updates

* Added a new status of 5 for locking torrents
* Modifying the list torrents view for using it in deleted torrents view
* Added function to get deleted torrents
* Torrents (and reports) can be definitely deleted
* Some new translation string

* Fixing

* fix 2

* Added upload check for locked torrents

If a user owns a torrent, has deleted it and try to repload it. As long
as it has not been locked, he can.

* Fixing wrong condition in isdeleted

* Finished

* Info messages on success when deletes or lock
* Fixed double deleted_at is Null
* Added Link to view of deleted torrents
* Added new translation string
2017-05-25 02:19:05 +02:00
akuma06 97e2b9fcfe Forgot this file in last commit 2017-05-24 23:20:22 +02:00
Ramon Dantas 86447b853c Add tree-view file list (Done) (#724)
* Add tree-view file list

* Add TotalSize field to folders

* Remove bootstrap/jquery related code

* Add icons to filelist, some CSS formatting

Moved a few styles from the format string for the tree view, to CSS
(where possible). Make icons look consistent under all themes.

* Make filelist hideable again, show it when JS is disabled
2017-05-25 00:13:56 +10:00
Eliot Whalan b4b1b1c26a
go fmt all the code 2017-05-24 17:11:13 +10:00