* 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
* 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
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.
* 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
* 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
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.
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.
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.
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.