2017-05-12 18:51:49 +00:00
|
|
|
import os
|
2017-11-23 01:19:47 +00:00
|
|
|
import re
|
2017-05-12 18:51:49 +00:00
|
|
|
|
|
|
|
DEBUG = True
|
2017-10-04 23:05:35 +00:00
|
|
|
|
|
|
|
######################
|
|
|
|
## Maintenance mode ##
|
|
|
|
######################
|
|
|
|
|
2017-09-04 22:16:52 +00:00
|
|
|
# A read-only maintenance mode, in which the database is not modified
|
2017-10-04 23:05:35 +00:00
|
|
|
MAINTENANCE_MODE = False
|
2017-09-04 22:16:52 +00:00
|
|
|
# A maintenance message (used in layout.html template)
|
|
|
|
MAINTENANCE_MODE_MESSAGE = 'Site is currently in read-only maintenance mode.'
|
|
|
|
# Allow logging in during maintenance (without updating last login date)
|
|
|
|
MAINTENANCE_MODE_LOGINS = True
|
|
|
|
|
2019-01-02 11:40:56 +00:00
|
|
|
# Block *anonymous* uploads completely
|
|
|
|
RAID_MODE_LIMIT_UPLOADS = False
|
|
|
|
# Message prepended to the full error message (account.py)
|
|
|
|
RAID_MODE_UPLOADS_MESSAGE = 'Anonymous uploads are currently disabled.'
|
|
|
|
|
|
|
|
# Require manual activation for newly registered accounts
|
|
|
|
RAID_MODE_LIMIT_REGISTER = False
|
|
|
|
# Message prepended to the full error message (account.py)
|
|
|
|
RAID_MODE_REGISTER_MESSAGE = 'Registration is currently being limited.'
|
|
|
|
|
2017-10-04 23:05:35 +00:00
|
|
|
#############
|
|
|
|
## General ##
|
|
|
|
#############
|
|
|
|
|
|
|
|
# What the site identifies itself as. This affects templates, not database stuff.
|
|
|
|
SITE_NAME = 'Nyaa'
|
2017-10-08 00:31:32 +00:00
|
|
|
# What the both sites are labeled under (used for eg. email subjects)
|
|
|
|
GLOBAL_SITE_NAME = 'Nyaa.si'
|
2017-10-04 23:05:35 +00:00
|
|
|
|
|
|
|
# General prefix for running multiple sites, eg. most database tables are site-prefixed
|
|
|
|
SITE_FLAVOR = 'nyaa' # 'nyaa' or 'sukebei'
|
|
|
|
# Full external urls to both sites, used for site-change links
|
|
|
|
EXTERNAL_URLS = {'fap':'***', 'main':'***'}
|
|
|
|
|
|
|
|
# Secret keys for Flask
|
|
|
|
CSRF_SESSION_KEY = '***'
|
|
|
|
SECRET_KEY = '***'
|
|
|
|
|
|
|
|
# Present a recaptcha for anonymous uploaders
|
2017-05-12 18:51:49 +00:00
|
|
|
USE_RECAPTCHA = False
|
2017-10-04 23:05:35 +00:00
|
|
|
# Require email validation
|
2017-05-12 18:51:49 +00:00
|
|
|
USE_EMAIL_VERIFICATION = False
|
2017-10-04 23:05:35 +00:00
|
|
|
# Use MySQL or Sqlite3 (mostly deprecated)
|
2017-05-12 18:51:49 +00:00
|
|
|
USE_MYSQL = True
|
2017-10-04 23:05:35 +00:00
|
|
|
# Show seeds/peers/completions in torrent list/page
|
2017-05-27 23:15:39 +00:00
|
|
|
ENABLE_SHOW_STATS = True
|
2017-05-12 18:51:49 +00:00
|
|
|
|
2017-10-08 01:34:40 +00:00
|
|
|
# Enable password recovery (by reset link to given email address)
|
|
|
|
# Depends on email support!
|
|
|
|
ALLOW_PASSWORD_RESET = True
|
|
|
|
|
2017-11-23 01:19:47 +00:00
|
|
|
# A list of strings or compiled regexes to deny registering emails by.
|
|
|
|
# Regexes will be .search()'d against emails,
|
|
|
|
# while strings will be a simple 'string in email.lower()' check.
|
|
|
|
# Leave empty to disable the blacklist.
|
|
|
|
EMAIL_BLACKLIST = (
|
|
|
|
# Hotmail completely rejects "untrusted" emails,
|
|
|
|
# so it's less of a headache to blacklist them as users can't receive the mails anyway.
|
2018-01-26 23:55:35 +00:00
|
|
|
# (Hopefully) complete list of Microsoft email domains follows:
|
|
|
|
re.compile(r'(?i)@hotmail\.(co|co\.uk|com|de|dk|eu|fr|it|net|org|se)'),
|
2019-03-30 15:33:08 +00:00
|
|
|
re.compile(r'(?i)@live\.(co|co.uk|com|de|dk|eu|fr|it|net|org|se|no)'),
|
2018-01-26 23:55:35 +00:00
|
|
|
re.compile(r'(?i)@outlook\.(at|be|cl|co|co\.(id|il|nz|th)|com|com\.(ar|au|au|br|gr|pe|tr|vn)|cz|de|de|dk|dk|es|eu|fr|fr|hu|ie|in|it|it|jp|kr|lv|my|org|ph|pt|sa|se|sg|sk)'),
|
|
|
|
re.compile(r'(?i)@(msn\.com|passport\.(com|net))'),
|
2017-11-23 01:19:47 +00:00
|
|
|
# '@dodgydomain.tk'
|
|
|
|
)
|
2018-08-20 18:29:30 +00:00
|
|
|
EMAIL_SERVER_BLACKLIST = (
|
|
|
|
# Bad mailserver IPs here (MX server.com -> A mail.server.com > 11.22.33.44)
|
|
|
|
# '1.2.3.4', '11.22.33.44'
|
|
|
|
)
|
|
|
|
|
2017-11-23 01:19:47 +00:00
|
|
|
|
|
|
|
|
2017-10-04 23:05:35 +00:00
|
|
|
# Recaptcha keys (https://www.google.com/recaptcha)
|
|
|
|
RECAPTCHA_PUBLIC_KEY = '***'
|
|
|
|
RECAPTCHA_PRIVATE_KEY = '***'
|
|
|
|
|
2017-05-12 18:51:49 +00:00
|
|
|
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
|
|
|
|
if USE_MYSQL:
|
2017-05-22 22:46:26 +00:00
|
|
|
SQLALCHEMY_DATABASE_URI = ('mysql://test:test123@localhost/nyaav2?charset=utf8mb4')
|
2017-05-12 18:51:49 +00:00
|
|
|
else:
|
|
|
|
SQLALCHEMY_DATABASE_URI = (
|
|
|
|
'sqlite:///' + os.path.join(BASE_DIR, 'test.db') + '?check_same_thread=False')
|
|
|
|
|
2017-10-08 00:31:32 +00:00
|
|
|
###########
|
|
|
|
## EMAIL ##
|
|
|
|
###########
|
|
|
|
|
|
|
|
# 'smtp' or 'mailgun'
|
|
|
|
MAIL_BACKEND = 'mailgun'
|
|
|
|
MAIL_FROM_ADDRESS = 'Sender Name <sender@domain.com>'
|
|
|
|
|
|
|
|
# Mailgun settings
|
|
|
|
MAILGUN_API_BASE = 'https://api.mailgun.net/v3/YOUR_DOMAIN_NAME'
|
|
|
|
MAILGUN_API_KEY = 'YOUR_API_KEY'
|
|
|
|
|
|
|
|
# SMTP settings
|
2017-05-12 18:51:49 +00:00
|
|
|
SMTP_SERVER = '***'
|
|
|
|
SMTP_PORT = 587
|
|
|
|
SMTP_USERNAME = '***'
|
|
|
|
SMTP_PASSWORD = '***'
|
|
|
|
|
2017-10-08 00:31:32 +00:00
|
|
|
|
2017-05-12 18:51:49 +00:00
|
|
|
# The maximum number of files a torrent can contain
|
|
|
|
# until the site says "Too many files to display."
|
|
|
|
MAX_FILES_VIEW = 1000
|
|
|
|
|
2017-10-04 23:05:35 +00:00
|
|
|
# Verify uploaded torrents have the given tracker in them?
|
2017-05-12 18:51:49 +00:00
|
|
|
ENFORCE_MAIN_ANNOUNCE_URL = False
|
2017-08-06 21:55:45 +00:00
|
|
|
MAIN_ANNOUNCE_URL = 'http://127.0.0.1:6881/announce'
|
2017-10-04 23:05:35 +00:00
|
|
|
|
|
|
|
# Tracker API integration - don't mind this
|
2017-08-06 21:55:45 +00:00
|
|
|
TRACKER_API_URL = 'http://127.0.0.1:6881/api'
|
|
|
|
TRACKER_API_AUTH = 'topsecret'
|
2017-10-04 23:05:35 +00:00
|
|
|
|
|
|
|
#############
|
|
|
|
## Account ##
|
|
|
|
#############
|
|
|
|
|
2017-10-10 01:41:18 +00:00
|
|
|
# Limit torrent upload rate
|
|
|
|
RATELIMIT_UPLOADS = True
|
|
|
|
RATELIMIT_ACCOUNT_AGE = 7 * 24 * 3600
|
|
|
|
# After uploading MAX_UPLOAD_BURST torrents within UPLOAD_BURST_DURATION,
|
|
|
|
# the following uploads must be at least UPLOAD_TIMEOUT seconds after the previous upload.
|
|
|
|
MAX_UPLOAD_BURST = 5
|
|
|
|
UPLOAD_BURST_DURATION = 45 * 60
|
|
|
|
UPLOAD_TIMEOUT = 15 * 60
|
|
|
|
|
2017-08-20 00:48:08 +00:00
|
|
|
# Torrents uploaded without an account must be at least this big in total (bytes)
|
|
|
|
# Set to 0 to disable
|
|
|
|
MINIMUM_ANONYMOUS_TORRENT_SIZE = 1 * 1024 * 1024
|
2017-05-12 18:51:49 +00:00
|
|
|
|
2017-10-04 23:05:35 +00:00
|
|
|
# Minimum age for an account not to be served a captcha (seconds)
|
|
|
|
# Relies on USE_RECAPTCHA. Set to 0 to disable.
|
|
|
|
ACCOUNT_RECAPTCHA_AGE = 7 * 24 * 3600 # A week
|
|
|
|
|
|
|
|
# Backup original .torrent uploads
|
2017-05-12 18:51:49 +00:00
|
|
|
BACKUP_TORRENT_FOLDER = 'torrents'
|
2017-05-16 06:51:58 +00:00
|
|
|
|
2017-10-04 23:05:35 +00:00
|
|
|
############
|
|
|
|
## Search ##
|
|
|
|
############
|
|
|
|
|
|
|
|
# How many results should a page contain. Applies to RSS as well.
|
2017-05-16 06:51:58 +00:00
|
|
|
RESULTS_PER_PAGE = 75
|
|
|
|
|
2019-04-02 15:28:39 +00:00
|
|
|
# How many pages we'll return at most
|
|
|
|
MAX_PAGES = 100
|
|
|
|
|
2017-10-04 23:05:35 +00:00
|
|
|
# Use better searching with ElasticSearch
|
|
|
|
# See README.MD on setup!
|
2017-05-16 06:51:58 +00:00
|
|
|
USE_ELASTIC_SEARCH = False
|
2017-10-04 23:05:35 +00:00
|
|
|
# Highlight matches (for debugging)
|
2017-05-16 06:51:58 +00:00
|
|
|
ENABLE_ELASTIC_SEARCH_HIGHLIGHT = False
|
2017-10-04 23:05:35 +00:00
|
|
|
|
2017-05-27 23:15:39 +00:00
|
|
|
# Max ES search results, do not set over 10000
|
2017-05-16 06:51:58 +00:00
|
|
|
ES_MAX_SEARCH_RESULT = 1000
|
2017-10-04 23:05:35 +00:00
|
|
|
# ES index name generally (nyaa or sukebei)
|
|
|
|
ES_INDEX_NAME = SITE_FLAVOR
|
2018-07-10 05:26:23 +00:00
|
|
|
# ES hosts
|
|
|
|
ES_HOSTS = ['localhost:9200']
|
2017-11-05 14:26:30 +00:00
|
|
|
|
|
|
|
################
|
|
|
|
## Commenting ##
|
|
|
|
################
|
|
|
|
|
|
|
|
# Time limit for editing a comment after it has been posted (seconds)
|
|
|
|
# Set to 0 to disable
|
|
|
|
EDITING_TIME_LIMIT = 0
|
2018-07-10 05:20:26 +00:00
|
|
|
|
|
|
|
# Whether to use Gravatar or just always use the default avatar
|
|
|
|
# (Useful if run as development instance behind NAT/firewall)
|
|
|
|
ENABLE_GRAVATAR = True
|