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

107 Révisions

Auteur SHA1 Message Date
akuma06 c6168be8b1 Tag Search + Tests + Search slight refactor [DONE] (#1342)
* Tag Search + Tests + Search slight refactor

First commit improving search. Different struct have their own file with their tests. This way of separating struct by files is inspired by the go packages I've seen so far.

Added new behaviour as discussed in #1334

* fix fallback to ES

* Added some comments to explain PG fallback + log err moved

* Refactored search

Nearly fully covered
WhereParams struct has disappeared for Query struct instead
In DB model, we use an interface implementing Query struct methods

* 1rst Refactor of Tags (WTF already?!)

Prepare Tags for the refactored system. Now there will be descriptive tags for a particular release (ecchi, BDSM, ....) and typed tags.
Typed tags are tags relevant to all torrents and can be limited to some input value. For example, video quality is a typed tag limited to some values (hd, full hd, sd, ...). In the same way, anidbid is also a typed tag but doesn't have default values.

Furthermore, the location storage of tags have changed, now accepted descriptive tags are stored in the torrents table in the column "tags" and they are separated by commas.
In the opposite, accepted typed tags can have have their own column in the torrents table. For example, anidbid, vndbid will populate the column DbID when accepted. On the other hand, videoquality will populate the same way as descriptive tags.

This behaviour depends on the callbackOnType function in tag/helpers.go

* fix for modtools :')

* Added anidb, vndb, dlsite & vmdb id fields in torrent model.
Tags don't have an accepted field anymore.
Accepted Tags are in torrent.AcceptedTags and non-accepted ones in torrrent.Tags.

New Helper + New Changelog for translation string.

* New upload/edit form for torrent tags.
Now the inputs are dynamically generated by the helper tag_form.
No more modal window in those form, only inputs.
Support of tags in API
New translation string for the  link to the modal on torrent view.
More comments in the functions for tags

* Improving how config for tags work. Adding a test on them with understandable messages.
Config for tags have now a Field attribute which is linked to the Torrent model. For example anidbid tag type has now a AnidbID field in config which is the name of the field in torrent model (AnidbID). Every new tag type need to have a field attribute with its counterpart in torrent Model.
Fixing some errors

* Fix compile error + Tests Errors

* Improve performance by caching the list of tags with an index
Adding/removing tags works/tested
New translation strings

TODO: test/fix adding tag on upload/edit

* Mini fix to display video quality
+ tags works/tested on modo edit

* Fix editing tags on modpanel

* Edit tags works

* Add translation string

* Add search backend for tags.
?tags=xxx,eee,ddd
?anidb=21
?vndb=23
?vgmdb=24
?vq=full_hd

* Fix Ajax tag Removal&Add

* Added form for descriptive tags

* Forgot to add the link between database and form for descriptive tags.

* Adding the increase/decrease pantsu for descriptive tags

* Fix #1370

* When you actually forgot to commit files after having forgotten commits
2017-08-22 11:48:10 +10:00
PantsuDev 8307b947e1 Add more trackers 2017-08-03 23:08:12 +10:00
PantsuDev 4470762051 Add more default tags 2017-08-03 12:48:51 +10:00
akuma06 94097dc2bb Fixing Double anidbID (shoud also fix twice flags) + removed pointer to config in functions. We have a singleton so don't need to pass it as argument 2017-08-02 17:12:52 +02:00
akuma06 51d7fe2ef7 Added html views + fix template test + View & JSON Controller 2017-07-29 14:43:12 +02:00
akuma06 62ea1aaf10 Adding tag post controller 2017-07-29 14:41:56 +02:00
akuma06 03ea72595d OAuth API [done] (#1275)
* Initial Commit for OAuth API

This builds and run and return the right error.
Need to test it and then adding all users as possible client

* Added mising dependency

* just compile already...

* Fixing template test

* Imrpovements

Moved db stuff in models
Added some tests
Added form in modpanel to add/update a client
Added controllers for add/update of client

* Added Forms + speed improvements

Controller oauth client listing + html
Controller oauth client delete + messages
Messages on comment delete
New ES config that disable ES if set to false. Improve load speed on local development
Fix a load config bug
Fix index admin & translation string sign_out broken by @ewhal

* Sanitize empty strig in form array + css

Multiple empty array of strings are sanitized for the oauth client create form
Added some css for the form display

* Upload and Create form works

* Fix splitting response types

* Removing required on secret when updating

* fix travis error

* Fix travis template test

* Update dependency

* Moved to jinzhu instead of azhao

* randomizen secret on creation

* Final touch on oath api

improved display name
fix grant form csrf
fix login csrf on oauth

* Fix gorm test

* fix template test

* Fixing deleted dependency issue

* Make travis faster

* Fix typo

* Fix csrf for api calls

* This shouldn't be exempt

* Removing hard coded hash

@ewhal Don't forget to replace the hash in tokens.go with another one

* Added an example on how to use OAuth middleware

* Renamed fosite utils to oauth2 utils
2017-07-28 13:46:40 +10:00
PantsuDev d9142a73c3 Fix most go lint warnings 2017-07-23 15:50:18 +10:00
akuma06 2ddb3d454e Fix config load order. Configor has a reverted config files load priority :') 2017-07-22 01:24:13 +02:00
akuma06 4714c5c0f5 Improviong dynamic load of configs by putting only one variable one 2017-07-21 01:36:25 +02:00
akuma06 5d2a911b89 Fix for config cli args 2017-07-21 01:20:04 +02:00
akuma06 713ab02450 Added configor as a new library (#1126)
* Added configor as a new library

Now config is a singleton. You only need to do config.Get() instead of doing config.Conf.

* Forgot godep save 🐤

* Fix accidental removal of }
2017-07-10 22:11:05 +10:00
akuma06 1d30065592 Update default_config.yml 2017-07-10 14:03:53 +02:00
akuma06 9f1cc004e2 Moving version number upward 2017-07-08 21:26:56 +02:00
PantsuDev 1936c74085 Make commentlength and descriptionlength configurable 2017-06-22 10:21:59 +10:00
sfan5 abcdfd426b Move scrape results to separate table (#980) 2017-06-16 01:13:09 +02:00
akuma06 93364dac77 activity log for users (#1002)
List Torrent delete log
Torrent edit log
Comment delete log
And every other logged activities
Can be filtered out by a filter tag ("edit" or "delete" supported)
Pages navigation

Can be accessed by /activities

Added some translation string
Fixed hidden username on api request
Fixed comments username on modpanel
New Activity model
New Activity handler
New Activity Service
Fixed some updating issue for ES when moderating torrents

Be aware deleting torrents and comments return the model now!
2017-06-15 12:44:46 +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
sfan5 1675b12cad Fix incorrect feed URLs (closes #971) 2017-06-08 20:08:30 +02:00
John Smith 21977ff406
Clarity 2017-06-03 13:57:00 +10: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 7dc9004e7d New Config for sukebei
Just launch with : `./nyaa -conf config/sukebei.yml`
2017-06-02 12:44:38 +02:00
Atvaark 8cab61802c Add session cookie config (#874)
This allows changing the cookie domain, maxage and the hash/encryption
keys via the config file.

If no key is provided a new one is generated on each reboot.
But if both keys are provided the session cookies are now valid even
after a server reboot.
2017-06-01 23:10:00 +10:00
tomleb ba683c3bcb Improve search and fix '*' in search box (#871)
* Improve ES search

The new performance is very good.
Some examples on my 1.5gb vm:
INFO[0153] Query 'shingeki' took 6 milliseconds.
INFO[0125] Query 'アニメ' took 17 milliseconds.
INFO[0102] Query 'shingeki -kyojin horrible ' took 12 milliseconds

Looking at the criteria we wanted here:
https://pad.riseup.net/p/i8DrilHDWRvf, it meets:

1. Fast: sub-100ms for a typical query, sub-50ms is good and sub-20ms is
optimal
2. Prefix match: "horrible" finds horriblesubs
3. Substring match? "アニメ" finds "TVアニメ"
4. Position-independent terms ("shingeki kyojin" finds the same as
"kyojin shingeki")
5. Works with short term lengths correctly and fast (no in "kyoukai no
kanata", 04 in "horrible shingeki 04" etc)
7. (nice to have) search negation: shingeki kyojin -horriblesubs

* Use match_all query instead of *, fix *
2017-06-01 08:38:29 +10:00
akuma06 9e0424ec5e Add Build version
Main version can be set in config/default_config.yml
Build version need to be set by build command: go build -ldflags "-X
main.buildversion=$(date -u +.%Y%m%d.%H%M%S)"
Or by using package.sh
Or by using the godep command: godep go build -ldflags "-X
main.buildversion=$(date -u +.%Y%m%d.%H%M%S)"
2017-05-31 12:20:06 +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
sfan5 3b6b81aa8d Fixing other peoples shit again & translation (#853)
* Fix login when running on localhost

* Translatable edit/delete buttons on view page

* Bold completed count on view page

* Don't create global variables in report button js

* Update german translation

* Update trackers (#803)

Remove baka-sub.cf as it's always broken
Add IPv6 version of leechers-paradise
2017-05-31 08:36:00 +10:00
akuma06 bd59f3afd1 Forgot to move Token config
Tokens config are now in config/tokens.go
2017-05-29 17:39:13 +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 0159579611
Copy Programmatically 2017-05-29 16:29:22 +10:00
Eliot Whalan 5bcda5c9a1
Revert "Add playbook to download /build latest nyaa, fix k-on elasticsearch issue (#821)"
This reverts commit da1e323825.
2017-05-29 08:24:04 +10:00
tomleb da1e323825 Add playbook to download /build latest nyaa, fix k-on elasticsearch issue (#821)
* Install nyaa from latest github commit

* Add install playbook, fix k-on search
2017-05-29 07:54:24 +10:00
Chris Frank fda91b3eab Update tracker config 2017-05-27 13:05:22 -04:00
akuma06 0f66ec9340 Trackers in Torrents + Missing comments + Function renaming (#768)
* Missing comments and Function renaming

* Added some missing comments
* Renamed functions to get user followers/following
* GetFollowers to get followers
* GetLikings to get who the user is following

* Renaming + Add support of previous trackers

* Renaming user.Likings in user.Followers
* Renaming user.Liked in user.Likings
* Add a new string field Trackers in torrent model
* Trackers from torrent file are now populated to the databse
* Needed trackers are added to the torrent trackers if not provided or
if trackers is empty in DB (backward compatibility)

* New check and url encoding

* No more regex for verifying tracker url
* Encodes tracker url for "&" & "?" character possibly existing in
tracker url and breaking magnet link

* Improvements

* Trackers are now encoded in torrent.ParseTrackers
* Faster check by using the for loop of checktrackers
* No more boolean, we need to check len of array returned
* torrent.Trackers can be directly used in url as they are encoded like
: tr=tracker1&tr=tracker2&tr=...
2017-05-27 00:45:18 +02: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
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 041473bfac Tested and works!
Changes:
* Updates only the colomns of torrent table
* Moved categories config in config/torrents.go
2017-05-24 22:15:38 +02:00
Eliot Whalan 3527f01cc5
Rerun gofmt it again with -s 2017-05-24 17:15:07 +10:00
Eliot Whalan b4b1b1c26a
go fmt all the code 2017-05-24 17:11:13 +10:00
Ramon Dantas 38f331a32e Make metainfo_fetcher fetch metadata only for new torrents (#694)
Added a flag on the config, that, when set, will only fetch data starting
from torrents with ID > config.LastOldTorrentID. Also updated the query
to use the config's files table, instead of hard-coding it.
2017-05-23 11:19:28 +10:00
akuma06 07c120407e Finished 2017-05-22 00:22:42 +02:00
akuma06 5639033370 Wiiiiiip 2017-05-21 19:38:39 +02:00
akuma06 32c51a57cb User Settings Notification (WIP) 2017-05-21 18:13:28 +02:00
akuma06 4cbbb95e4f Notification for Users (WIP) 2017-05-20 20:53:05 +02:00
sfan5 4c24318cb3 More sukebei fixes (#649)
* Remove useless .Table() from db usage

This is handled via TableName() already

* Optimization: omit file-list fetching for old torrents

* Use seperate tables for reports & files on sukebei

* Fix invalid pages in nav if <5 pages total
2017-05-21 00:26:22 +10:00
akuma06 2380f096f8 Forgot to add a+ 2017-05-20 14:01:58 +02:00
akuma06 369c9151f1 Merge remote-tracking branch 'refs/remotes/origin/dev' into multi-action-torrents-mod
# Conflicts:
#	router/modpanel.go
#	router/router.go
#	service/torrent/torrent.go
2017-05-20 13:58:37 +02:00
akuma06 0d5e2abf7f Added multi action on torrents 2017-05-20 13:45:15 +02:00