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

374 commits

Auteur SHA1 Message Date
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 e62ebb05ba Mass edit mod api JS (done) (#868)
* Mass Edit MOD api JS (WIP)

In continuity with the mass edit mod api, this is the javascript use of
it.
##What does it do?
* Delete of multiple torrents on index/search
* Category change of multiple torrents
* Change of owner of multiple torrents
* Lock & delete of multiple torrents

##How?
* New toolbar only visible for mods
* Checkboxes added only for mods
* Selection and click on the button in toolbar
* Nothing is submitted, you have to review the changes in a modal window
listing them.
* Then the ajax queries are initialized one at a time with a progression
bar
* You can always at any moment delete entries from the queuing list

* Improved progress bar

* Deleting part almost done

Improved modal design
All dom interactions should be done
Prepared Query for only one callback
Improved Modal to keep a link to the active modal

* Finished =D

Added some translation string

* Forgot the refreshing of the page

Just an option that can be disabled by making refreshTimeout to 0
2017-06-02 12:51:44 +10:00
akuma06 08c342e4e7 Added a check on LastID function 2017-05-31 21:07:56 +02: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
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 b5476c7d66 Merge remote-tracking branch 'refs/remotes/origin/dev' into xhr-torrent-refresh 2017-05-30 14:19:13 +02:00
akuma06 479de0eaf6 Merge pull request #840 from NyaaPantsu/csrf-secure
Csrf secure Exclusion
2017-05-30 01:17:08 +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 55867720cb Forgot that they also login through the login form
So no CSRF protection for login :/
2017-05-30 00:22:23 +02:00
akuma06 db58c2bf02 Merge branch 'csrf-secure' of https://github.com/NyaaPantsu/nyaa into csrf-secure 2017-05-30 00:18:47 +02:00
akuma06 ad7439283c CSRF Exclusion
As per suggestion of @yiiTT, CSRF is limited on users login,
registration, profile edit, comments post, torrent edit.
Uploads are not yet CSRF protected because api upload can't be used for
that
2017-05-30 00:18:43 +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 d5ad9618ac Update view_torrent_handler.go 2017-05-29 17:44:11 +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
Eliot Whalan 8cf57ad791
set max comment size 2017-05-29 21:25:36 +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
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
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
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
Eliot Whalan 57980a8ebc
make rss feeds properly validate 2017-05-27 22:05:24 +10:00
Steindór 9286653905 Nav fixes (#766)
* Update README.md

Added a link to the db dump and IRC channels.

* Minor fix

* Update README.md

* disabling email links

* Killed github autolinking

* Update README.md

* Removed database link

* fixed a FF only bug with the carets

* added a static size to pagination

* worked on the pagination widget

* fixed the arrow buttons too

* fixed appearance on pages over 1000
2017-05-27 17:16:43 +10:00
Eliot Whalan 5041bd1de1
Merge branch 'dev' of https://github.com/NyaaPantsu/nyaa into dev 2017-05-27 11:56:28 +10: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
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
Eliot Whalan 75ec79b4e1
Merge branch 'dev' of https://github.com/NyaaPantsu/nyaa into dev 2017-05-27 11:51:36 +10:00
Eliot Whalan fe77845ebf
Hopefully fix memleak 2017-05-27 11:50:31 +10:00
Eliot Whalan 04ce9e4a83
Fix bug adding torrents via magnet links 2017-05-27 11:08:18 +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 80ab45d81e New profile user menu (#761)
* Fixing user profile page

* Modified css rule word-break to break-word
* Modified torrents table in user page to look like home listing
* Made the button reset api look like a button according to actual
design
* Modified user menu to have the same spacing accross templates
* User menu is in another template file loaded dynamically

* Fixing the access to userprofile variable

* Menu needs to access the user profile with $.UserProfile
* User Notification template variable removed, instead using user
profile variable

* Reverting back theme flickering fix
2017-05-26 14:33:55 +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
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 2773fe200d Golint friendly (#747)
* Making the code Golint friendly

* No exported variables when not needed
* Same for functions
* Simplifying Templates variables with a form basic template variable
and a modelList basic template variable

* Adapted templates to new template variables

* use of .Models instead of model list
* use of .Form instead of modelform

* Small fix

* Small fix 2

Forgot $.Form

* Reverting templateDir as a var
2017-05-25 21:54:58 +02:00
akuma06 0b8a39c506 Fix error on user profile edit
* Missing ">" in a close tag
* Changing route name for apireset doing a conflict route on badgemenu
2017-05-25 18:54:34 +02:00
Eliot Whalan bc3f1aa577
start work on api reset stuff 2017-05-25 12:18:31 +10:00
Eliot Whalan 5f89f9feb2
Merge branch 'dev' of https://github.com/NyaaPantsu/nyaa into dev 2017-05-25 10:42:55 +10:00
Eliot Whalan bb7554b79a
add searching via the api 2017-05-25 10:42:35 +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 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
akuma06 93eb4d7ae1 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
2017-05-24 21:16:15 +02:00
akuma06 cf844f0d43 Merge branch 'dev' into torrent-mass-mod-edit 2017-05-24 20:29:52 +02:00
akuma06 1ffea3f39f 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.
2017-05-24 20:23:54 +02:00
Steindór da760d4131 Added a counter below the search result nav (#728)
* added pagination

* cleanup

* indentation fix

* fix
2017-05-25 00:14:24 +10: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 3527f01cc5
Rerun gofmt it again with -s 2017-05-24 17:15:07 +10:00