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

222 commits

Auteur SHA1 Message Date
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
akuma06
d35c495d59 Removing debug fmt 2017-05-24 00:23:50 +02:00
akuma06
21ac12c852 Some updates
* Added support of UGC without div tag for torrents
* Added support of basic html tags for comments (a, img, b, em, u)

Fixed:
* Bug with r *request becoming a nul pointer when loading from contextin
messages.go
2017-05-24 00:08:02 +02: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
Eliot Whalan
2e7392f46e
Fix compile error 2017-05-23 11:19:05 +10:00
Eliot Whalan
b26d788ab9
Generate api tokens on user creation 2017-05-23 11:16:57 +10:00
akuma06
4411c5d731 Fix #679
Parsing template.HTML into string and then use Sprintf make a bug.
2017-05-22 10:15:18 +02:00
akuma06
07c120407e Finished 2017-05-22 00:22:42 +02:00
akuma06
a4c23dda1f wiiiip 2017-05-21 20:20:40 +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
42de73fa78 Fixed unassigned value 2017-05-21 00:29:07 +02:00
akuma06
0390fc5215 Mostly done 2017-05-21 00:02:57 +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
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
tomleb
babf0a37f0 Cleanups and fixes (#623)
* Keep naming consistent

* Remove execute bit from files

* Default to DefaultLanguage (without passing it to the func)

* Remove commented code

* Use Content-Type to get language json

* Lines of 400 characters is dumb

* Update new repo in README

* Remove useless script since we fallback to a defaultlang

* Fix fallback language panic

* Fix uninitialized MaxPerPage when not in querystr

The issue was that the req.MaxPerPage was not set (default to 0) when
the query string didn't include "max". This makes the server query the
whole db since the resulting limit is 0.

* Fix creating empty torrents (only worked once)

* Lines of 400 characters is still dumb
2017-05-19 12:55:59 +10:00
goonyaa
5d22718abd Preload Last torrents instead of First on profile page to load them in DESC order. Should close #396 (#620) 2017-05-19 09:47:21 +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
4e61605a30 Merge branch 'dev' 2017-05-16 13:34:21 +10: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
Eliot Whalan
515f4696cc Patch scrapers to support sukebei 2017-05-15 19:32:28 +10:00
Eliot Whalan
7d5369cfe1 Make table name for torrents selectable 2017-05-15 16:24:06 +10:00
ElegantMonkey
b9904161f0 Only show added message if actually added to queue 2017-05-14 21:21:04 -03:00
ElegantMonkey
df2c9bc2f7 Fix conflicts 2017-05-14 21:19:29 -03:00
ElegantMonkey
3dced6fdf0 Use Mutex when modifying failedOperations, add exponential cooldown
Just to be safe, won't allow concurrent goroutines to modify the map.

The exponential cooldown prevents newer torrents with no seeds
blocking older ones with seeds, when there are enough failures that a
cooldown event would fill the queue with only failed torrents.
2017-05-14 19:30:56 -03:00
ElegantMonkey
a55cf2a803 Use NoCount version of GetTorrents
The normal GetTorrents version always called COUNT(*) on the query,
which consistently took around 300 ms. With the NoCount, the SELECT
queries take 5-50 ms.
2017-05-14 18:24:41 -03:00
ElegantMonkey
cae0026a67 Add fail cooldown
After a set cooldown, torrents that failed to be fetch will be able
to be fetched again. Set FailCooldown to -1 to disable.
2017-05-14 18:10:39 -03:00
Atvaark
cd844aec45 Replace 'en-us' literals with the default language
This consolidates the places where a default language has to be set.

- Removed import of the 'userService' package into the 'languages' util
  package
  This was required to prevent a cyclic import between the two packages.
- Added a 'UserRetriever' interface to read the language setting of users
  inside the 'languages' package
2017-05-14 22:10:07 +02:00
ElegantMonkey
83de593a65 Exclude failed operations from query
Instead of loading more rows to compensate for failed operations,
exclude them at the query.
2017-05-14 16:47:48 -03:00
sfan5
b930997c68 Make sorting by date date work nicely 2017-05-14 17:35:10 +02:00
ElegantMonkey
58869114d7 Don't update Length if it hasn't changed 2017-05-14 12:21:49 -03:00
ElegantMonkey
7d8cbe1393 Add Upload and Download limiters, rely on unique_index for avoiding duplicates
The FileList that is read with GetTorrents is empty, as it's only loaded with
GetTorrentById. So, always insert the new FileList on the database, and rely on
the unique_index to avoid duplications.
2017-05-14 11:35:03 -03: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
e1f1c9d0c3 Update MetainfoFetcher query logic
It used to update only torrents with NULL or 0 filesizes, setting
both their filesizes and the file lists. Now, it looks for both
NULL or 0 filesizes and empty file lists.
2017-05-14 09:05:20 -03:00
ElegantMonkey
2da2ad4214 FilesizeFetcher -> MetainfoFetcher 2017-05-14 08:20:34 -03:00
ElegantMonkey
80034bb52b Also read file lists from metadata, fix Length == 0 2017-05-13 23:12:18 -03:00
ElegantMonkey
a1dc2d3587 Add error message to log 2017-05-13 21:30:06 -03:00
akuma06
ed26ee81eb Merge branch 'dev' into dev 2017-05-14 00:55:17 +02:00