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

87 commits

Auteur SHA1 Message Date
akuma06 2646bc2db8 This is a prelimenary work
Showing how we can remove services, preventing cyclic imports and lessing the number of imports.
Now db is in models. Db and models are highly tightened, according to go standards, you should put them in the same package.
In models, there are folders separating the different methods used to modify the models. For example, if you want to create a user, you have to use /models (for the user struct) and /models/user (for creating a user.
However, if you want to delete a torrent, you just have to import /models and do torrent.Delete(definitely bool).

By the way packages in models are the plural name of a model. For example, you have torrent.go for a torrent model and its package torrents for db stuff related functions (Find, Create, Some helpers)
2017-06-29 00:44:07 +02:00
akuma06 0c990447eb Fix for API request hidden torrents
Usernames were not hidden when doing api request
2017-06-24 10:53:22 +02:00
akuma06 bda946bbfe Fix description in API search/RSS (#1053)
* Fix description in API search/RSS

There were no descriptions in torrents in API/RSS search on dev. The cause was that ES didn't have the field description in it.

You should reindex after the merge

* Forgot to commit this
2017-06-23 08:54:31 +10:00
akuma06 c9c2b8bf46 Fix nul pointer dereference in TorrentJSON 2017-06-17 03:46:49 +02:00
sfan5 abcdfd426b Move scrape results to separate table (#980) 2017-06-16 01:13:09 +02:00
sfan5 93bc6e9cdb Fix stats properly (ES-only) 2017-06-16 01:01:14 +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
pantsudev 948e7ce8c4 Add unique constraint to hash, email and username 2017-06-14 16:42:15 +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
PantsuDev a5274cc926
Start anidb integration 2017-06-08 09:17:11 +10:00
akuma06 01a3143a08 fix uploaderid when torrent is hidden (#930)
Added a new function template to generate a link for uploaders name
In the view we have the actual uploaderID and uploaderName now
2017-06-06 00:06:04 +02: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
PantsuDev fa88e255ba
Revert "Start adding anidb support"
This reverts commit 7d4c88861e.
2017-06-04 20:06:55 +10:00
PantsuDev 7d4c88861e
Start adding anidb support 2017-06-04 15:47:24 +10: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
akuma06 2a9fb43432 Just changed for displaying renchon 2017-05-27 20:50:40 +02:00
akuma06 3775e9dfb5 Torrent Hidden Option (to test before merging)
* Added a check on username and userId when converting torrent to JSON
* Added a checkbox for hidden in modepanel, torrent user edit and upload
* Added a Hidden field bool in torrent model and upload form
2017-05-27 20:33:40 +02:00
tomleb d6c50f5640 TorrentJSON.ID is uint now, fix weird page sorting (#769)
* TorrentJSON.ID is uint now, fix weird page sorting

The bug was that ES would sort by ID in a weird manner because the id
was a string. The id is now a uint.

* Resolved the conflict for future merging
2017-05-27 11:54:41 +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 b4b1b1c26a
go fmt all the code 2017-05-24 17:11:13 +10:00
akuma06 efe6ea833a Fix 2 2017-05-22 09:28:08 +02:00
akuma06 07c120407e Finished 2017-05-22 00:22:42 +02:00
sfan5 67ec4d5787 Format unknown filesizes in a better way 2017-05-21 14:34:32 +02:00
akuma06 4cbbb95e4f Notification for Users (WIP) 2017-05-20 20:53:05 +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
sfan5 a3fa6df938 Remove bugs (#643)
* Fix S/L/D columns wasting huge amounts of space

Partially reverts 0c9cdfa8bf.

* Move last scrape below seed-bar

Also fixes the very misleading indentation

* Show category name on view page too

* Fix fucked up login page (fixes #640)

* Fix empty page on login w/o pass (fixes #634)

* Fix incorrectly colored error text in day mode

* Better readable footer in night mode

* Prepare having old uploader names on sukebei and various fixes for sukebei

* Different HTML title for sukebei
2017-05-20 20:45:27 +10:00
tomleb 7eee47b0d3 Fix bug, remove literals (#629)
* Use ModeratorDir variable

* Rename cookieHelper to cookie_helper for consistency

* Use named constant instead of literals

* Fix ability to upload when uploads are disabled

The old code let people upload under the right conditions when uploads
were disabled. (ie: User is banned and config.AdminAreStillAllowedTo is
false)

* Increase timeout (fixes #517)

* Fix inconsistent indentation *.{js, css} (fix #583)

* Fix negative page

Temporary fix. The issue was that going to a negative page caused the
sql query to have a negative offset. This caused an error in the
database query.

We need to cleanup this code, but this will work for now.

* Fix wrong PG_DATA directory due to upgrade to 9.6

* Add server status link to FAQ

* Fix failing tests

* Clarify group_vars/all and hosts doc

* Add a wrapper to protect /mod route

* Fix login page not showing form errors
2017-05-20 09:10:16 +10:00
Ramon Dantas a64c3c5b71 Minor fixes. (#575)
* Sort Comments by Date and Files by Name on viewTorrent

* Make comments start at 1, not 0.
2017-05-17 21:16:40 +10:00
PantsuDev 70f87e7aac finish repo transfer 2017-05-17 15:58:40 +10:00
akuma06 9cdfc00762 Number of comments
Issue #553
2017-05-17 00:05:16 +02:00
Eliot Whalan cec71bd759 Add in support for commenting on sukebei 2017-05-16 12:53:02 +10:00
Ramon Dantas f351c2b047 Store torrent FileList info as bencoded data. (#530)
Use this instead of joining with forward-slashes because it's possible
that a torrent uses "foo/bar" as a filename or part of the directory list.
2017-05-16 07:45:47 +10:00
ElegantMonkey 839e6068df Add FileList view to view.html template
Also added the code for FileList loading on torrentService.
2017-05-14 10:19:19 -03:00
ElegantMonkey 80034bb52b Also read file lists from metadata, fix Length == 0 2017-05-13 23:12:18 -03:00
akuma06 9f2d0f1962 New translation function and time depends on translation 2017-05-11 13:15:52 +02:00
sfan5 64622c3601 Make comment date display consistent with other date displays 2017-05-11 11:37:10 +02:00
Eliot Whalan fec023e404 Add display of seeders/peers/completed to view 2017-05-11 09:31:10 +10:00
Jeff Becker c6427ba600 Merge remote-tracking branch 'origin/master' into scraper 2017-05-10 18:08:10 -04:00
Jeff Becker 604cf57677 make it work 2017-05-10 18:06:21 -04:00
sfan5 9c562018e5 Link to user page from comment section 2017-05-10 23:53:30 +02:00
sfan5 64473e68ad Fix magnet links 2017-05-10 22:11:37 +02:00
ayame-git 1bf4012eb2 yea.. 2017-05-10 21:42:20 +03:00
Jeff Becker 0f582c1197 Merge remote-tracking branch 'origin/master' into scraper 2017-05-10 13:29:56 -04:00
Jeff Becker 1089883ed5 initial 2017-05-10 13:29:35 -04:00
akuma06 032688f532 Fixed 2017-05-10 16:43:50 +02:00