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

265 commits

Auteur SHA1 Message Date
sfan5 1dd7c9d5d3 Fix scraping on postgres 2017-06-25 13:18:03 +02:00
PantsuDev 1936c74085 Make commentlength and descriptionlength configurable 2017-06-22 10:21:59 +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
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 f31d884f6a Fixed possible whitespace in hashes
Fixed possible whitespace in hashes when uploading by magnet url when
lagnet url have a hash with whitespace
2017-06-18 03:26:46 +02:00
sfan5 abcdfd426b Move scrape results to separate table (#980) 2017-06-16 01:13:09 +02:00
kipukun 95173a0f33 Frontend v9000 (#1008)
* Should fix old uploader name in torrent view

* Fix "save changes" in modtools

* Modtool more colorful

* Fix search bar placement in modpanel

* Make colors more consistent; less would be super helpful tbqach fam

* Display the old username if it's there

* Fix some admin index html

* Add custom icons and remove png code from all CSS

* Move a good amount of cosmetic code from main to classic

* Fix some weird bug with point-events; add some global icon formatting; fix mascot fucking up

* Spruce up admin panel with icons on smaller viewports, along with adding trash icon

* 404 redesign ;^)

* Mufuyu mascot on all themes; says something slightly lewd

* Fix weird user menu bug where shit would overflow
2017-06-16 08:57:52 +10:00
akuma06 fb2c69a612 Torznab caps compatible 2017-06-15 21:54:06 +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
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 5aad3db5b9 Fixed RetrieveUserByAPITokenAndName comment 2017-06-14 09:21:31 +02:00
akuma06 63fbbaa491 gosimple friendly 2017-06-14 09:20:42 +02:00
pantsudev aa08ec9f67 Tidy up and remove useless code 2017-06-14 16:36:38 +10:00
akuma06 b0aa111511 API update completely functionnal for app usage (#987)
The api has been tested and works as intended.
Now users do not have to go on the website to get back their token, they
just have to register.
Torrents show the right stats and username on api request when search is
done
User model when converted to JSON gives us the apitoken and md5 hash of
email (for gravatar)
Verification on upload is done by token and username instead of token
only
Errors are now given in json format in the api
Global api response handler for less code redundancy and same response
pattern
Moved user auth check in cookie_helper to user.go
Fixed bug with CSRF prevention in /api
Added translation strings
2017-06-13 16:01:57 +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 b68bd9ead4 Fix required torrent name on upload 2017-06-10 20:09:25 +02: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
PantsuDev 994ea62eab
fix typos 2017-06-07 11:14:57 +10:00
akuma06 752544a52c New User status (#957)
Status for scrapped user
They can't log in and an explicit error message is shown when they try
explaining that they need to contact the moderators
They are displayed as simple members on the front-end however
2017-06-07 10:59:46 +10:00
akuma06 b61fe55f82 New upload API (#897)
* New upload API (WIP)

* update

* Last fix

* Adding changes from update.go to api.go

* fix bracket

* fix import
2017-06-05 08:19:25 -05: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
Atvaark 79fbb4085d Update vendor/github.com/anacrolix (#909)
- This fixes a bug where the torrent client didn't unlock the bolt db
  See: anacrolix/torrent/issues/158
2017-06-04 20:52:22 +10:00
John Smith ad566d672c
Comments 2017-06-03 13:57:00 +10:00
John Smith de176ee1f2
Inline 2017-06-03 13:57:00 +10: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
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
Steindór 00a885af28 changed session cookie expiry (#870) 2017-06-01 08:38:05 +10: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
Steindór bf500d9c16 Update cookie_helper.go 2017-05-30 00:50:23 +00:00
Steindór 037506e464 Merge branch 'dev' into cookie-fix2 2017-05-30 00:46:59 +00:00
bragason 2e2e5608d4 This should fix the cookie domain issues 2017-05-30 00:42:36 +00: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
akuma06 c570557477 Added Theme field in user settings 2017-05-29 15:15:04 +02:00
akuma06 bdae58cc6a Merge pull request #823 from NyaaPantsu/email-regex-improvement
Should work now for emails
2017-05-29 01:54:26 +02:00
akuma06 fb6ad2d860 Should work now for emails
It should valid every RFC valid emails.
A regex from a comment somewhere on a website, don't remember where but
I kept it (no licence on it, shared freely)
2017-05-29 00:22:42 +02: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
hamper 1a608faa44 Add website link and remake flag to api (#797) 2017-05-28 14:22:39 +10:00
akuma06 0dc4bd3c9a Torrent name when download
New Download Torrent controller when dowloading a torrent
Route download need to be set the same as in TorrentStorageLink
2017-05-28 01:29:46 +02: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 b191bd3286 Fix User Reset API (#772)
* Added a new function to only update columns of table user (less
useless query)
* Changed method to GET instead of POST because it is a link not a
button anymore
* Display of user profile if changes are successful
2017-05-27 11:54:54 +10: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 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
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