diff --git a/.docker/Dockerfile b/.docker/Dockerfile deleted file mode 100644 index 1f503fa..0000000 --- a/.docker/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -FROM ubuntu:18.04 - -ENV LANG=en_US.utf-8 LC_ALL=en_US.utf-8 DEBIAN_FRONTEND=noninteractive -RUN apt-get -y update - -COPY ./ /nyaa/ -RUN cat /nyaa/config.example.py /nyaa/.docker/nyaa-config-partial.py > /nyaa/config.py - -# Requirements for running the Flask app -RUN apt-get -y install build-essential git python3 python3-pip libmysqlclient-dev curl -# Helpful stuff for the docker entrypoint.sh script -RUN apt-get -y install mariadb-client netcat - -WORKDIR /nyaa -RUN pip3 install -r requirements.txt - -CMD ["/nyaa/.docker/entrypoint.sh"] diff --git a/.docker/README.md b/.docker/README.md deleted file mode 100644 index b710dfa..0000000 --- a/.docker/README.md +++ /dev/null @@ -1,48 +0,0 @@ -# Nyaa on Docker -> [!CAUTION] -> Docker deployment is out of date and currently unsupported in NyaaV3. - -Docker infrastructure is provided to ease setting up a dev environment - -## Quickstart - -Get started by running (from the root of the project): - - docker-compose -f .docker/full-stack.yml -p nyaa build nyaa-flask - docker-compose -f .docker/full-stack.yml -p nyaa up -d - -This builds the Flask app container, then starts up the project. You can then go -to [localhost:8080](http://localhost:8080/) (note that some of the -services are somewhat slow to start so it may not be available for 30s or so). - -You can shut it down with: - - docker-compose -f .docker/full-stack.yml -p nyaa down - -## Details - -The environment includes: - - [nginx frontend](http://localhost:8080/) (on port 8080) - - uwsgi running the flask app - - the ES<>MariaDB sync process - - MariaDB - - ElasticSearch - - [Kibana](http://localhost:8080/kibana/) (at /kibana/) - -MariaDB, ElasticSearch, the sync process, and uploaded torrents will -persistently store their data in volumes which makes future start ups faster. - -To make it more useful to develop with, you can copy `.docker/full-stack.yml` and -edit the copy and uncomment the `- "${NYAA_SRC_DIR}:/nyaa"` line, then -`export NYAA_SRC_DIR=$(pwd)` and start up the environment using the new compose -file: - - cp -a .docker/full-stack.yml .docker/local-dev.yml - cat config.example.py .docker/nyaa-config-partial.py > ./config.py - $EDITOR .docker/local-dev.yml - export NYAA_SRC_DIR=$(pwd) - docker-compose -f .docker/local-dev.yml -p nyaa up -d - -This will mount the local copy of the project files into the Flask container, -which combined with live-reloading in uWSGI should let you make changes and see -them take effect immediately (technically with a ~2 second delay). diff --git a/.docker/entrypoint-sync.sh b/.docker/entrypoint-sync.sh deleted file mode 100755 index b58b646..0000000 --- a/.docker/entrypoint-sync.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -# set +x - -pushd /nyaa - -echo 'Waiting for MySQL to start up' -while ! echo HELO | nc mariadb 3306 &>/dev/null; do - sleep 1 -done -echo 'DONE' - -echo 'Waiting for ES to start up' -while ! echo HELO | nc elasticsearch 9200 &>/dev/null; do - sleep 1 -done -echo 'DONE' - -echo 'Waiting for ES to be ready' -while ! curl -s -XGET 'elasticsearch:9200/_cluster/health?pretty=true&wait_for_status=green' &>/dev/null; do - sleep 1 -done -echo 'DONE' - -echo 'Waiting for sync data file to exist' -while ! [ -f /elasticsearch-sync/pos.json ]; do - sleep 1 -done -echo 'DONE' - -echo 'Starting the sync process' -/usr/bin/python3 /nyaa/sync_es.py /nyaa/.docker/es_sync_config.json diff --git a/.docker/entrypoint.sh b/.docker/entrypoint.sh deleted file mode 100755 index 7688739..0000000 --- a/.docker/entrypoint.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash - -# set +x - -pushd /nyaa - -echo 'Waiting for MySQL to start up' -while ! echo HELO | nc mariadb 3306 &>/dev/null; do - sleep 1 -done -echo 'DONE' - -if ! [ -f /elasticsearch-sync/flag-db_create ]; then - python3 ./db_create.py - touch /elasticsearch-sync/flag-db_create -fi - -if ! [ -f /elasticsearch-sync/flag-db_migrate ]; then - python3 ./db_migrate.py stamp head - touch /elasticsearch-sync/flag-db_migrate -fi - -echo 'Waiting for ES to start up' -while ! echo HELO | nc elasticsearch 9200 &>/dev/null; do - sleep 1 -done -echo 'DONE' - -echo 'Waiting for ES to be ready' -while ! curl -s -XGET 'elasticsearch:9200/_cluster/health?pretty=true&wait_for_status=green' &>/dev/null; do - sleep 1 -done -echo 'DONE' - -if ! [ -f /elasticsearch-sync/flag-create_es ]; then - # @source create_es.sh - # create indices named "nyaa" and "sukebei", these are hardcoded - curl -v -XPUT 'elasticsearch:9200/nyaa?pretty' -H"Content-Type: application/yaml" --data-binary @es_mapping.yml - curl -v -XPUT 'elasticsearch:9200/sukebei?pretty' -H"Content-Type: application/yaml" --data-binary @es_mapping.yml - touch /elasticsearch-sync/flag-create_es -fi - -if ! [ -f /elasticsearch-sync/flag-import_to_es ]; then - python3 ./import_to_es.py | tee /elasticsearch-sync/import.out - grep -A1 'Save the following' /elasticsearch-sync/import.out | tail -1 > /elasticsearch-sync/pos.json - touch /elasticsearch-sync/flag-import_to_es -fi - -echo 'Starting the Flask app' -/usr/local/bin/uwsgi /nyaa/.docker/uwsgi.config.ini diff --git a/.docker/es_sync_config.json b/.docker/es_sync_config.json deleted file mode 100644 index a6c7f9e..0000000 --- a/.docker/es_sync_config.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "save_loc": "/elasticsearch-sync/pos.json", - "mysql_host": "mariadb", - "mysql_port": 3306, - "mysql_user": "nyaadev", - "mysql_password": "ZmtB2oihHFvc39JaEDoF", - "database": "nyaav3", - "internal_queue_depth": 10000, - "es_chunk_size": 10000, - "flush_interval": 5 -} diff --git a/.docker/full-stack.yml b/.docker/full-stack.yml deleted file mode 100644 index f2fb11b..0000000 --- a/.docker/full-stack.yml +++ /dev/null @@ -1,71 +0,0 @@ ---- - -version: "3" -services: - nginx: - image: nginx:1.15-alpine - ports: - - '8080:80' - volumes: - - './nginx.conf:/etc/nginx/nginx.conf:ro' - - '../nyaa/static:/nyaa-static:ro' - depends_on: - - nyaa-flask - - kibana - - nyaa-flask: - image: local/nyaa:devel - volumes: - - 'nyaa-torrents:/nyaa-torrents' - - 'nyaa-sync-data:/elasticsearch-sync' - ## Uncomment this line to have to mount the local dir to the running - ## instance for live changes (after setting NYAA_SRC_DIR env var) - # - "${NYAA_SRC_DIR}:/nyaa" - depends_on: - - mariadb - - elasticsearch - build: - context: ../ - dockerfile: ./.docker/Dockerfile - - nyaa-sync: - image: local/nyaa:devel - volumes: - - 'nyaa-sync-data:/elasticsearch-sync' - command: /nyaa/.docker/entrypoint-sync.sh - depends_on: - - mariadb - - elasticsearch - restart: on-failure - - mariadb: - image: mariadb:10.0 - volumes: - - './mariadb-init-sql:/docker-entrypoint-initdb.d:ro' - - '../configs/my.cnf:/etc/mysql/conf.d/50-binlog.cnf:ro' - - 'mariadb-data:/var/lib/mysql' - environment: - - MYSQL_RANDOM_ROOT_PASSWORD=yes - - MYSQL_USER=nyaadev - - MYSQL_PASSWORD=ZmtB2oihHFvc39JaEDoF - - MYSQL_DATABASE=nyaav3 - - elasticsearch: - image: elasticsearch:6.5.4 - volumes: - - elasticsearch-data:/usr/share/elasticsearch/data - depends_on: - - mariadb - - kibana: - image: kibana:6.5.4 - volumes: - - './kibana.config.yml:/usr/share/kibana/config/kibana.yml:ro' - depends_on: - - elasticsearch - -volumes: - nyaa-torrents: - nyaa-sync-data: - mariadb-data: - elasticsearch-data: diff --git a/.docker/kibana.config.yml b/.docker/kibana.config.yml deleted file mode 100644 index da9dc09..0000000 --- a/.docker/kibana.config.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- - -server.name: kibana -server.host: 'kibana' -server.basePath: /kibana -# server.rewriteBasePath: true -# server.defaultRoute: /kibana/app/kibana -elasticsearch.url: http://elasticsearch:9200 -xpack.monitoring.ui.container.elasticsearch.enabled: true diff --git a/.docker/mariadb-init-sql/.gitignore b/.docker/mariadb-init-sql/.gitignore deleted file mode 100644 index aecee65..0000000 --- a/.docker/mariadb-init-sql/.gitignore +++ /dev/null @@ -1 +0,0 @@ -!*.sql diff --git a/.docker/mariadb-init-sql/50-grant-binlog-access.sql b/.docker/mariadb-init-sql/50-grant-binlog-access.sql deleted file mode 100644 index 81fac03..0000000 --- a/.docker/mariadb-init-sql/50-grant-binlog-access.sql +++ /dev/null @@ -1,3 +0,0 @@ -GRANT REPLICATION SLAVE ON *.* TO 'nyaadev'@'%'; -GRANT REPLICATION CLIENT ON *.* TO 'nyaadev'@'%'; -FLUSH PRIVILEGES; diff --git a/.docker/nginx.conf b/.docker/nginx.conf deleted file mode 100644 index 27f3757..0000000 --- a/.docker/nginx.conf +++ /dev/null @@ -1,59 +0,0 @@ - -user nginx; -worker_processes 1; - -error_log /var/log/nginx/error.log warn; -pid /var/run/nginx.pid; - - -events { - worker_connections 1024; -} - - -http { - include /etc/nginx/mime.types; - default_type application/octet-stream; - charset utf-8; - - log_format main '$remote_addr - $remote_user [$time_local] "$request" ' - '$status $body_bytes_sent "$http_referer" ' - '"$http_user_agent" "$http_x_forwarded_for"'; - - access_log /var/log/nginx/access.log main; - - sendfile on; - #tcp_nopush on; - - keepalive_timeout 65; - - gzip on; - - server { - listen 80; - server_name localhost default; - - location /static { - alias /nyaa-static; - } - - # fix kibana redirecting to localhost/kibana (without the port) - rewrite ^/kibana$ http://$http_host/kibana/ permanent; - location /kibana/ { - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection 'upgrade'; - proxy_cache_bypass $http_upgrade; - - proxy_set_header Host 'kibana'; - proxy_set_header X-Real-IP $remote_addr; - - proxy_pass http://kibana:5601/; - } - - location / { - include /etc/nginx/uwsgi_params; - uwsgi_pass nyaa-flask:5000; - } - } -} diff --git a/.docker/nyaa-config-partial.py b/.docker/nyaa-config-partial.py deleted file mode 100644 index 65a7616..0000000 --- a/.docker/nyaa-config-partial.py +++ /dev/null @@ -1,10 +0,0 @@ -# This is only a partial config file that will be appended to the end of -# config.example.py to build the full config for the docker environment - -SITE_NAME = 'Nyaa [DEVEL]' -GLOBAL_SITE_NAME = 'nyaa.devel' -SQLALCHEMY_DATABASE_URI = ('mysql://nyaadev:ZmtB2oihHFvc39JaEDoF@mariadb/nyaav3?charset=utf8mb4') -# MAIN_ANNOUNCE_URL = 'http://chihaya:6881/announce' -# TRACKER_API_URL = 'http://chihaya:6881/api' -BACKUP_TORRENT_FOLDER = '/nyaa-torrents' -ES_HOSTS = ['elasticsearch:9200'] diff --git a/.docker/uwsgi.config.ini b/.docker/uwsgi.config.ini deleted file mode 100644 index 7e8d620..0000000 --- a/.docker/uwsgi.config.ini +++ /dev/null @@ -1,34 +0,0 @@ -[uwsgi] -# socket = [addr:port] -socket = 0.0.0.0:5000 -#chmod-socket = 664 - -die-on-term = true - -# logging -#disable-logging = True -#logger = file:uwsgi.log - -# Base application directory -chdir = /nyaa - -# WSGI module and callable -# module = [wsgi_module_name]:[application_callable_name] -module = WSGI:app - -# master = [master process (true of false)] -master = true - -# debugging -catch-exceptions = true - -# performance -processes = 4 -buffer-size = 8192 - -loop = gevent -socket-timeout = 10 -gevent = 1000 -gevent-monkey-patch = true - -py-autoreload = 2 diff --git a/.github/issue_template.md b/.github/issue_template.md deleted file mode 100644 index 6419727..0000000 --- a/.github/issue_template.md +++ /dev/null @@ -1,3 +0,0 @@ -Describe your issue/feature request here (you can remove all this text). Describe well and include images if relevant. - -Please make sure to skim through the existing issues, as your issue/request/etc. may have already been noted! diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml deleted file mode 100644 index 72b55e1..0000000 --- a/.github/workflows/codeql.yml +++ /dev/null @@ -1,100 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL Advanced" - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - schedule: - - cron: '37 6 * * 4' - -jobs: - analyze: - name: Analyze (${{ matrix.language }}) - # Runner size impacts CodeQL analysis time. To learn more, please see: - # - https://gh.io/recommended-hardware-resources-for-running-codeql - # - https://gh.io/supported-runners-and-hardware-resources - # - https://gh.io/using-larger-runners (GitHub.com only) - # Consider using larger runners or machines with greater resources for possible analysis time improvements. - runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} - permissions: - # required for all workflows - security-events: write - - # required to fetch internal or private CodeQL packs - packages: read - - # only required for workflows in private repositories - actions: read - contents: read - - strategy: - fail-fast: false - matrix: - include: - - language: javascript-typescript - build-mode: none - - language: python - build-mode: none - # CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' - # Use `c-cpp` to analyze code written in C, C++ or both - # Use 'java-kotlin' to analyze code written in Java, Kotlin or both - # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both - # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, - # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. - # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how - # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - # Add any setup steps before running the `github/codeql-action/init` action. - # This includes steps like installing compilers or runtimes (`actions/setup-node` - # or others). This is typically only required for manual builds. - # - name: Setup runtime (example) - # uses: actions/setup-example@v1 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 - with: - languages: ${{ matrix.language }} - build-mode: ${{ matrix.build-mode }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - - # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality - - # If the analyze step fails for one of the languages you are analyzing with - # "We were unable to automatically build your code", modify the matrix above - # to set the build mode to "manual" for that language. Then modify this step - # to build your code. - # ℹ️ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - if: matrix.build-mode == 'manual' - shell: bash - run: | - echo 'If you are using a "manual" build mode for one or more of the' \ - 'languages you are analyzing, replace this with the commands to build' \ - 'your code, for example:' - echo ' make bootstrap' - echo ' make release' - exit 1 - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 - with: - category: "/language:${{matrix.language}}" diff --git a/.gitignore b/.gitignore index 4fe76c2..f815666 100644 --- a/.gitignore +++ b/.gitignore @@ -14,14 +14,13 @@ __pycache__ # Databases *.sql -/test.db +/synthoria.db # Webserver /uwsgi.sock # Application /install/* -/config.py /es_sync_config.json /test_torrent_batch diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8c6f6c2..0000000 --- a/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -language: python - -python: "3.13" - -dist: jammy - -matrix: - fast_finish: true - -cache: pip - -services: - mysql - -before_install: - - mysql -u root -e 'CREATE DATABASE nyaav3 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;' - -install: - - pip install -r requirements.txt - - pip install pytest-cov - - sed "s/mysql:\/\/test:test123@/mysql:\/\/root:@/" config.example.py > config.py - - ./db_create.py - - ./db_migrate.py stamp head - -script: - - ./dev.py test --cov=nyaa --cov-report=term tests - - ./dev.py lint - -notifications: - email: false diff --git a/README.md b/README.md index b00ea62..4fa7a78 100644 --- a/README.md +++ b/README.md @@ -1,138 +1,19 @@ -# NyaaV3 [![python](https://img.shields.io/badge/Python-3.13-3776AB.svg?style=flat&logo=python&logoColor=white)](https://www.python.org) ![Maintenance](https://img.shields.io/maintenance/yes/2025) +# Synthoria Archive [![python](https://img.shields.io/badge/Python-3.13-3776AB.svg?style=flat&logo=python&logoColor=white)](https://www.python.org) ![Maintenance](https://img.shields.io/badge/maintained-passively-yellow) +Spaghetti code based on [NyaaV3](https://github.com/sb745/NyaaV3) -## Setting up for development -This project uses Python 3.13. The codebase has been updated from the original Python 3.7 version to use modern Python features and updated dependencies. -This guide assumes you are using Linux and are somewhat capable with the commandline. -Running Nyaa on Windows may be possible, but it's currently unsupported. - -### Major changes from NyaaV2 -- Updated from Python 3.7 to Python 3.13 -- Updated all dependencies to their latest versions -- Modernized code patterns for Flask 3.0 and SQLAlchemy 2.0 -- Replaced deprecated Flask-Script, orderedset and `flask.Markup` with Flask CLI, orderly-set and markupsafe -- Implemented mail error handling - -### Code Quality -- Before we get any deeper, remember to follow PEP8 style guidelines and run `python dev.py lint` before committing to see a list of warnings/problems. - - You may also use `python dev.py fix && python dev.py isort` to automatically fix some of the issues reported by the previous command. -- Other than PEP8, try to keep your code clean and easy to understand, as well. It's only polite! - -### Running tests -The `tests` folder contains tests for the the `nyaa` module and the webserver. To run the tests: -- Make sure that you are in the Python virtual environment. -- Run `python dev.py test` while in the repository directory. - -### Setting up Pyenv -pyenv eases the use of different Python versions, and as not all Linux distros offer 3.13 packages, it's right up our alley. -- Install [dependencies](https://github.com/pyenv/pyenv/wiki/Common-build-problems) -- Install [pyenv](https://github.com/pyenv/pyenv/blob/master/README.md#installation) -- Install [pyenv-virtualenv](https://github.com/pyenv/pyenv-virtualenv/blob/master/README.md) -- Install Python 3.13 with `pyenv` and create a virtualenv for the project: - - `pyenv install 3.13.2` - - `pyenv virtualenv 3.13.2 nyaa` - - `pyenv activate nyaa` -- Install dependencies with `pip install -r requirements.txt` -- Copy `config.example.py` into `config.py` - - Change `SITE_FLAVOR` in your `config.py` depending on which instance you want to host - -### Setting up MySQL/MariaDB database -> [!WARNING] -> You *may* use SQLite but it is currently untested and unsupported. -- Enable `USE_MYSQL` flag in config.py -- Install MariaDB by following instructions [here](https://downloads.mariadb.org/mariadb/repositories/) -- Run the following commands logged in as your root db user (substitute for your own `config.py` values if desired): - - `CREATE USER 'test'@'localhost' IDENTIFIED BY 'test123';` - - `GRANT ALL PRIVILEGES ON *.* TO 'test'@'localhost';` - - `FLUSH PRIVILEGES;` - - `CREATE DATABASE nyaav3 DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;` - -### Finishing up -- Run `python db_create.py` to create the database and import categories - - Follow the advice of `db_create.py` and run `python db_migrate.py stamp head` to mark the database version for Alembic -- Start the dev server with `python run.py` -- When you are finished developing, deactivate your virtualenv with `pyenv deactivate` or `source deactivate` (or just close your shell session) - -You're now ready for simple testing and development! -Continue below to learn about database migrations and enabling the advanced search engine, Elasticsearch. - - -## Database migrations -> [!WARNING] -> The database migration feature has been updated but will no longer be supported in NyaaV3. -- Database migrations are done with [Flask-Migrate](https://flask-migrate.readthedocs.io/), a wrapper around [Alembic](http://alembic.zzzcomputing.com/en/latest/). -- The migration system has been updated to use Flask CLI instead of the deprecated Flask-Script. -- If someone has made changes in the database schema and included a new migration script: - - If your database has never been marked by Alembic (you're on a database from before the migrations), run `python db_migrate.py db stamp head` before pulling the new migration script(s). - - If you already have the new scripts, check the output of `python db_migrate.py db history` instead and choose a hash that matches your current database state, then run `python db_migrate.py db stamp `. - - Update your branch (eg. `git fetch && git rebase origin/master`) - - Run `python db_migrate.py db upgrade head` to run the migration. Done! -- If *you* have made a change in the database schema: - - Save your changes in `models.py` and ensure the database schema matches the previous version (ie. your new tables/columns are not added to the live database) - - Run `python db_migrate.py db migrate -m "Short description of changes"` to automatically generate a migration script for the changes - - Check the script (`migrations/versions/...`) and make sure it works! Alembic may not able to notice all changes. - - Run `python db_migrate.py db upgrade` to run the migration and verify the upgrade works. - - (Run `python db_migrate.py db downgrade` to verify the downgrade works as well, then upgrade again) - - -## Setting up and enabling Elasticsearch - -### Installing Elasticsearch -- Install JDK with `sudo apt-get install openjdk-8-jdk` -- Install Elasticsearch - - [From packages](https://www.elastic.co/guide/en/elasticsearch/reference/current/deb.html) - - Enable the service: - - `sudo systemctl enable elasticsearch.service` - - `sudo systemctl start elasticsearch.service` - - or [simply extracting the archives and running the files](https://www.elastic.co/guide/en/elasticsearch/reference/current/_installation.html), if you don't feel like permanently installing ES -- Run `curl -XGET 'localhost:9200'` and make sure ES is running -- Install [Kibana](https://www.elastic.co/products/kibana) as a search debug frontend for ES (*optional*) - -### Enabling MySQL Binlogging -- Edit your MariaDB/MySQL server configuration and add the following under `[mariadb]`: - ``` - log-bin - server_id=1 - log-basename=master1 - binlog-format=row - ``` -- Restart MariaDB/MySQL (`sudo service mysql restart`) -- Copy the example configuration (`es_sync_config.example.json`) as `es_sync_config.json` and adjust options in it to your liking (verify the connection options!) -- Connect to mysql as root - - Verify that the result of `SHOW VARIABLES LIKE 'binlog_format';` is `ROW` - - Execute `GRANT REPLICATION SLAVE ON *.* TO 'username'@'localhost';` to allow your configured user access to the binlog - -### Setting up ES -- Run `./create_es.sh` to create the indices for the torrents: `nyaa` and `sukebei` - - The output should show `acknowledged: true` twice -- Stop the Nyaa app if you haven't already -- Run `python import_to_es.py` to import all the torrents (on nyaa and sukebei) into the ES indices. - - This may take some time to run if you have plenty of torrents in your database. - -Enable the `USE_ELASTIC_SEARCH` flag in `config.py` and (re)start the application. -Elasticsearch should now be functional! The ES indices won't be updated "live" with the current setup, continue below for instructions on how to hook Elasticsearch up to MySQL binlog. - -However, take note that binglog is not necessary for simple ES testing and development; you can simply run `import_to_es.py` from time to time to reindex all the torrents. - - -### Setting up sync_es.py -`sync_es.py` keeps the Elasticsearch indices updated by reading the binlog and pushing the changes to the ES indices. -- Make sure `es_sync_config.json` is configured with the user you grated the `REPLICATION` permissions -- Run `import_to_es.py` and copy the outputted JSON into the file specified by `save_loc` in your `es_sync_config.json` -- Run `sync_es.py` as-is *or*, for actual deployment, set it up as a service and run it, preferably as the system/root - - Make sure `sync_es.py` runs within the venv with the right dependencies! - -You're done! The script should now be feeding updates from the database to Elasticsearch. -Take note, however, that the specified ES index refresh interval is 30 seconds, which may feel like a long time on local development. Feel free to adjust it or [poke Elasticsearch yourself!](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-refresh.html) +## Documentation +> [!IMPORTANT] +> No support will be given for running this software. For documentation and instructions please check the original [NyaaV3](https://github.com/sb745/NyaaV3) repo. ## License This project is licensed under the GNU General Public License v3.0 (GPL-3.0). See the [LICENSE](LICENSE) file for more details. ## Disclaimer > [!CAUTION] -> **This project was created as a learning experience, and while it's a torrent tracker, I can't control how people choose to use it.** +> **This project was created as a learning experience, and while it's a torrent tracker, we can't control how people choose to use it.** By using this software, you're agreeing to a few things: -- I'm not responsible for any legal issues that might come up from using this tracker, especially if it's used to share copyrighted content without permission. +- We're not responsible for any legal issues that might come up from using this tracker, especially if it's used to share copyrighted content without permission. - It's your responsibility to make sure you're following the laws in your area when using this software. **Please use this project wisely and stay on the right side of the law.** Happy coding! diff --git a/config.example.py b/config.py similarity index 75% rename from config.example.py rename to config.py index 6904e4b..2491be4 100644 --- a/config.example.py +++ b/config.py @@ -1,65 +1,43 @@ import os import re -DEBUG = True +DEBUG = False -###################### -## Maintenance mode ## -###################### - -# A read-only maintenance mode, in which the database is not modified MAINTENANCE_MODE = False -# 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 -# Block *anonymous* uploads completely -RAID_MODE_LIMIT_UPLOADS = False -# Message prepended to the full error message (account.py) +RAID_MODE_LIMIT_UPLOADS = True RAID_MODE_UPLOADS_MESSAGE = 'Anonymous uploads are currently disabled.' # Require manual activation for newly registered accounts -RAID_MODE_LIMIT_REGISTER = False +RAID_MODE_LIMIT_REGISTER = True # Message prepended to the full error message (account.py) -RAID_MODE_REGISTER_MESSAGE = 'Registration is currently being limited.' +RAID_MODE_REGISTER_MESSAGE = 'Registration is currently limited.' -############# -## General ## -############# +SITE_NAME = 'Synthoria Archive' +GLOBAL_SITE_NAME = 'Synthoria Archive' -# What the site identifies itself as. This affects templates, not database stuff. -SITE_NAME = 'Nyaa' -# What the both sites are labeled under (used for eg. email subjects) -GLOBAL_SITE_NAME = 'Nyaa.si' - -# 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':'***'} +EXTERNAL_URLS = {'fap':'***', 'main':'archive.synthoria.moe'} # Secret keys for Flask CSRF_SESSION_KEY = '***' SECRET_KEY = '***' # Session cookie configuration -SESSION_COOKIE_NAME = 'nyaav3_session' +SESSION_COOKIE_NAME = 'synthoria_session' SESSION_COOKIE_SECURE = True SESSION_COOKIE_HTTPONLY = True SESSION_COOKIE_SAMESITE = 'Lax' -# Present a recaptcha for anonymous uploaders USE_RECAPTCHA = False -# Require email validation USE_EMAIL_VERIFICATION = False -# Use MySQL or Sqlite3 (mostly deprecated) USE_MYSQL = True # Show seeds/peers/completions in torrent list/page ENABLE_SHOW_STATS = True -# Enable password recovery (by reset link to given email address) -# Depends on email support! -ALLOW_PASSWORD_RESET = True +ALLOW_PASSWORD_RESET = False # A list of strings or compiled regexes to deny registering emails by. # Regexes will be .search()'d against emails, @@ -81,17 +59,16 @@ EMAIL_SERVER_BLACKLIST = ( ) - # Recaptcha keys (https://www.google.com/recaptcha) -RECAPTCHA_PUBLIC_KEY = '***' -RECAPTCHA_PRIVATE_KEY = '***' +# RECAPTCHA_PUBLIC_KEY = '***' +# RECAPTCHA_PRIVATE_KEY = '***' BASE_DIR = os.path.abspath(os.path.dirname(__file__)) if USE_MYSQL: - SQLALCHEMY_DATABASE_URI = ('mysql://test:test123@localhost/nyaav3?charset=utf8mb4') + SQLALCHEMY_DATABASE_URI = ('mysql://synthuser:synthpass@localhost/synthoria?charset=utf8mb4') else: SQLALCHEMY_DATABASE_URI = ( - 'sqlite:///' + os.path.join(BASE_DIR, 'test.db') + '?check_same_thread=False') + 'sqlite:///' + os.path.join(BASE_DIR, 'synthoria.db') + '?check_same_thread=False') ########### ## EMAIL ## @@ -117,12 +94,12 @@ SMTP_PASSWORD = '***' MAX_FILES_VIEW = 1000 # Verify uploaded torrents have the given tracker in them? -ENFORCE_MAIN_ANNOUNCE_URL = False -MAIN_ANNOUNCE_URL = 'http://127.0.0.1:6881/announce' +ENFORCE_MAIN_ANNOUNCE_URL = True +MAIN_ANNOUNCE_URL = 'https://tracker.synthoria.moe:6969/announce' # Tracker API integration - don't mind this -TRACKER_API_URL = 'http://127.0.0.1:6881/api' -TRACKER_API_AUTH = 'topsecret' +# TRACKER_API_URL = 'http://127.0.0.1:6881/api' +# TRACKER_API_AUTH = 'topsecret' ############# ## Account ## @@ -147,7 +124,7 @@ ACCOUNT_RECAPTCHA_AGE = 7 * 24 * 3600 # A week # Seconds after which an IP is allowed to register another account # (0 disables the limitation) -PER_IP_ACCOUNT_COOLDOWN = 24 * 3600 +PER_IP_ACCOUNT_COOLDOWN = 72 * 3600 # Backup original .torrent uploads BACKUP_TORRENT_FOLDER = 'torrents' @@ -192,19 +169,19 @@ EDITING_TIME_LIMIT = 0 # Whether to use Gravatar or just always use the default avatar # (Useful if run as development instance behind NAT/firewall) -ENABLE_GRAVATAR = True +ENABLE_GRAVATAR = False ########################## ## Trusted Requirements ## ########################## # Minimum number of uploads the user needs to have in order to apply for trusted -TRUSTED_MIN_UPLOADS = 10 +TRUSTED_MIN_UPLOADS = 3 # Minimum number of cumulative downloads the user needs to have across their # torrents in order to apply for trusted -TRUSTED_MIN_DOWNLOADS = 10000 +TRUSTED_MIN_DOWNLOADS = 0 # Number of days an applicant needs to wait before re-applying -TRUSTED_REAPPLY_COOLDOWN = 90 +TRUSTED_REAPPLY_COOLDOWN = 30 ########### ## Cache ## @@ -231,3 +208,6 @@ CACHE_THRESHOLD = 8192 # To actually make this work across multiple worker processes, use redis # RATELIMIT_STORAGE_URL="redis://host:port" RATELIMIT_KEY_PREFIX="nyaaratelimit_" + +# Use this to show the commit hash in the footer (see layout.html) +# COMMIT_HASH="[enter your commit hash here]"; \ No newline at end of file diff --git a/db_create.py b/db_create.py index 0eaad9f..54f3900 100755 --- a/db_create.py +++ b/db_create.py @@ -14,12 +14,14 @@ from nyaa.extensions import db app = create_app('config') NYAA_CATEGORIES: List[Tuple[str, List[str]]] = [ - ('Anime', ['Anime Music Video', 'English-translated', 'Non-English-translated', 'Raw']), - ('Audio', ['Lossless', 'Lossy']), - ('Literature', ['English-translated', 'Non-English-translated', 'Raw']), - ('Live Action', ['English-translated', 'Idol/Promotional Video', 'Non-English-translated', 'Raw']), + ('Voicebanks', ['VOCALOID', 'UTAU', 'Synthesizer V', 'CeVIO', 'Piapro Studio', 'NEUTRINO', 'Other']), + ('Software', ['Synthesizers', 'Plugins', 'Tools', 'Applications', 'Games', 'Other']), + ('Voice Sequences', ['VSQ/VSQx', 'UST', 'MIDI', 'Other']), + ('Reclists', ['Japanese', 'English', 'Chinese', 'Korean', 'Spanish', 'Other']), ('Pictures', ['Graphics', 'Photos']), - ('Software', ['Applications', 'Games']), + ('Audio', ['Songs', 'Demos', 'Other']), + ('Video', ['Music Videos', 'Promo Videos', 'Demos', 'Other']), + ('Lyrics', ['Japanese', 'English', 'Chinese', 'Korean', 'Spanish', 'Other']), ] diff --git a/db_migrate.py b/db_migrate.py deleted file mode 100755 index 928ea1d..0000000 --- a/db_migrate.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -Database migration script for Nyaa. -Compatible with Python 3.13 and Flask-Migrate 4.0. -""" -import sys -from typing import List - -from flask_migrate import Migrate -from flask.cli import FlaskGroup - -from nyaa import create_app -from nyaa.extensions import db - -app = create_app('config') -migrate = Migrate(app, db) - -def create_cli_app(): - return app - -cli = FlaskGroup(create_app=create_cli_app) - -if __name__ == "__main__": - # Patch sys.argv to default to 'db' - if len(sys.argv) > 1 and sys.argv[1] not in ['--help', '-h']: - if sys.argv[1] not in ['db', 'routes', 'shell', 'run']: - args: List[str] = sys.argv.copy() - args.insert(1, 'db') - sys.argv = args - - cli() diff --git a/import_to_es.py b/import_to_es.py index fbd25b2..52bb9b9 100755 --- a/import_to_es.py +++ b/import_to_es.py @@ -1,6 +1,6 @@ #!/usr/bin/env python """ -Bulk load torents from mysql into elasticsearch `nyaav3` index, +Bulk load torents from mysql into elasticsearch `synthoria` index, which is assumed to already exist. This is a one-shot deal, so you'd either need to complement it with a cron job or some binlog-reading thing (TODO) diff --git a/lint.sh b/lint.sh deleted file mode 100755 index af1a6f8..0000000 --- a/lint.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# Lint checker/fixer -# This script is deprecated, but still works. - -function auto_fix() { - ./dev.py fix && ./dev.py isort -} - - -function check_lint() { - ./dev.py lint -} - -# MAIN -action=auto_fix # default action -for arg in "$@" -do - case "$arg" in - "-h" | "--help") - echo "+ ========================= +" - echo "+ This script is deprecated +" - echo "+ Please use ./dev.py +" - echo "+ ========================= +" - echo "" - echo "Lint checker/fixer" - echo "" - echo "Usage: $0 [-c|--check] [-h|--help]" - echo " No arguments : Check and auto-fix some warnings/errors" - echo " -c | --check : only check lint (don't auto-fix)" - echo " -h | --help : show this help and exit" - exit 0; - ;; - "-c" | "--check") - action=check_lint - ;; - esac -done - -${action} # run selected action -if [[ $? -ne 0 ]]; then exit 1; fi diff --git a/migrations/README b/migrations/README deleted file mode 100644 index e9c5557..0000000 --- a/migrations/README +++ /dev/null @@ -1,4 +0,0 @@ -> [!WARNING] -> No longer supported in NyaaV3. - -Generic single-database configuration. \ No newline at end of file diff --git a/migrations/alembic.ini b/migrations/alembic.ini deleted file mode 100644 index f8ed480..0000000 --- a/migrations/alembic.ini +++ /dev/null @@ -1,45 +0,0 @@ -# A generic, single database configuration. - -[alembic] -# template used to generate migration files -# file_template = %%(rev)s_%%(slug)s - -# set to 'true' to run the environment during -# the 'revision' command, regardless of autogenerate -# revision_environment = false - - -# Logging configuration -[loggers] -keys = root,sqlalchemy,alembic - -[handlers] -keys = console - -[formatters] -keys = generic - -[logger_root] -level = WARN -handlers = console -qualname = - -[logger_sqlalchemy] -level = WARN -handlers = -qualname = sqlalchemy.engine - -[logger_alembic] -level = INFO -handlers = -qualname = alembic - -[handler_console] -class = StreamHandler -args = (sys.stderr,) -level = NOTSET -formatter = generic - -[formatter_generic] -format = %(levelname)-5.5s [%(name)s] %(message)s -datefmt = %H:%M:%S diff --git a/migrations/env.py b/migrations/env.py deleted file mode 100644 index 4593816..0000000 --- a/migrations/env.py +++ /dev/null @@ -1,87 +0,0 @@ -from __future__ import with_statement -from alembic import context -from sqlalchemy import engine_from_config, pool -from logging.config import fileConfig -import logging - -# this is the Alembic Config object, which provides -# access to the values within the .ini file in use. -config = context.config - -# Interpret the config file for Python logging. -# This line sets up loggers basically. -fileConfig(config.config_file_name) -logger = logging.getLogger('alembic.env') - -# add your model's MetaData object here -# for 'autogenerate' support -# from myapp import mymodel -# target_metadata = mymodel.Base.metadata -from flask import current_app -config.set_main_option('sqlalchemy.url', - current_app.config.get('SQLALCHEMY_DATABASE_URI')) -target_metadata = current_app.extensions['migrate'].db.metadata - -# other values from the config, defined by the needs of env.py, -# can be acquired: -# my_important_option = config.get_main_option("my_important_option") -# ... etc. - - -def run_migrations_offline(): - """Run migrations in 'offline' mode. - - This configures the context with just a URL - and not an Engine, though an Engine is acceptable - here as well. By skipping the Engine creation - we don't even need a DBAPI to be available. - - Calls to context.execute() here emit the given string to the - script output. - - """ - url = config.get_main_option("sqlalchemy.url") - context.configure(url=url) - - with context.begin_transaction(): - context.run_migrations() - - -def run_migrations_online(): - """Run migrations in 'online' mode. - - In this scenario we need to create an Engine - and associate a connection with the context. - - """ - - # this callback is used to prevent an auto-migration from being generated - # when there are no changes to the schema - # reference: http://alembic.readthedocs.org/en/latest/cookbook.html - def process_revision_directives(context, revision, directives): - if getattr(config.cmd_opts, 'autogenerate', False): - script = directives[0] - if script.upgrade_ops.is_empty(): - directives[:] = [] - logger.info('No changes in schema detected.') - - engine = engine_from_config(config.get_section(config.config_ini_section), - prefix='sqlalchemy.', - poolclass=pool.NullPool) - - connection = engine.connect() - context.configure(connection=connection, - target_metadata=target_metadata, - process_revision_directives=process_revision_directives, - **current_app.extensions['migrate'].configure_args) - - try: - with context.begin_transaction(): - context.run_migrations() - finally: - connection.close() - -if context.is_offline_mode(): - run_migrations_offline() -else: - run_migrations_online() diff --git a/migrations/script.py.mako b/migrations/script.py.mako deleted file mode 100644 index 2c01563..0000000 --- a/migrations/script.py.mako +++ /dev/null @@ -1,24 +0,0 @@ -"""${message} - -Revision ID: ${up_revision} -Revises: ${down_revision | comma,n} -Create Date: ${create_date} - -""" -from alembic import op -import sqlalchemy as sa -${imports if imports else ""} - -# revision identifiers, used by Alembic. -revision = ${repr(up_revision)} -down_revision = ${repr(down_revision)} -branch_labels = ${repr(branch_labels)} -depends_on = ${repr(depends_on)} - - -def upgrade(): - ${upgrades if upgrades else "pass"} - - -def downgrade(): - ${downgrades if downgrades else "pass"} diff --git a/migrations/versions/1add911660a6_admin_log_added.py b/migrations/versions/1add911660a6_admin_log_added.py deleted file mode 100644 index 1bfcb17..0000000 --- a/migrations/versions/1add911660a6_admin_log_added.py +++ /dev/null @@ -1,44 +0,0 @@ -"""Admin log added - -Revision ID: 1add911660a6 -Revises: 7f064e009cab -Create Date: 2017-06-29 02:57:39.715965 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '1add911660a6' -down_revision = '7f064e009cab' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table('nyaa_adminlog', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('created_time', sa.DateTime(), nullable=True), - sa.Column('log', sa.String(length=1024), nullable=False), - sa.Column('admin_id', sa.Integer(), nullable=False), - sa.ForeignKeyConstraint(['admin_id'], ['users.id'], ), - sa.PrimaryKeyConstraint('id') - ) - op.create_table('sukebei_adminlog', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('created_time', sa.DateTime(), nullable=True), - sa.Column('log', sa.String(length=1024), nullable=False), - sa.Column('admin_id', sa.Integer(), nullable=False), - sa.ForeignKeyConstraint(['admin_id'], ['users.id'], ), - sa.PrimaryKeyConstraint('id') - ) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_table('sukebei_adminlog') - op.drop_table('nyaa_adminlog') - # ### end Alembic commands ### diff --git a/migrations/versions/2bceb2cb4d7c_add_comment_count_to_torrent.py b/migrations/versions/2bceb2cb4d7c_add_comment_count_to_torrent.py deleted file mode 100644 index 3114e27..0000000 --- a/migrations/versions/2bceb2cb4d7c_add_comment_count_to_torrent.py +++ /dev/null @@ -1,52 +0,0 @@ -"""Add comment_count to Torrent - -Revision ID: 2bceb2cb4d7c -Revises: d0eeb8049623 -Create Date: 2017-05-26 15:07:21.114331 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '2bceb2cb4d7c' -down_revision = 'd0eeb8049623' -branch_labels = None -depends_on = None - -COMMENT_UPDATE_SQL = '''UPDATE {0}_torrents - SET comment_count = ( - SELECT COUNT(*) FROM {0}_comments - WHERE {0}_torrents.id = {0}_comments.torrent_id - );''' - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column('nyaa_torrents', sa.Column('comment_count', sa.Integer(), nullable=False)) - op.create_index(op.f('ix_nyaa_torrents_comment_count'), 'nyaa_torrents', ['comment_count'], unique=False) - - op.add_column('sukebei_torrents', sa.Column('comment_count', sa.Integer(), nullable=False)) - op.create_index(op.f('ix_sukebei_torrents_comment_count'), 'sukebei_torrents', ['comment_count'], unique=False) - # ### end Alembic commands ### - - connection = op.get_bind() - - print('Updating comment counts on nyaa_torrents...') - connection.execute(sa.sql.text(COMMENT_UPDATE_SQL.format('nyaa'))) - print('Done.') - - print('Updating comment counts on sukebei_torrents...') - connection.execute(sa.sql.text(COMMENT_UPDATE_SQL.format('sukebei'))) - print('Done.') - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_index(op.f('ix_nyaa_torrents_comment_count'), table_name='nyaa_torrents') - op.drop_column('nyaa_torrents', 'comment_count') - - op.drop_index(op.f('ix_sukebei_torrents_comment_count'), table_name='sukebei_torrents') - op.drop_column('sukebei_torrents', 'comment_count') - # ### end Alembic commands ### diff --git a/migrations/versions/3001f79b7722_add_torrents.uploader_ip.py b/migrations/versions/3001f79b7722_add_torrents.uploader_ip.py deleted file mode 100644 index 52fe0ba..0000000 --- a/migrations/versions/3001f79b7722_add_torrents.uploader_ip.py +++ /dev/null @@ -1,30 +0,0 @@ -"""Add uploader_ip column to torrents table. - -Revision ID: 3001f79b7722 -Revises: -Create Date: 2017-05-21 18:01:35.472717 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '3001f79b7722' -down_revision = '97ddefed1834' -branch_labels = None -depends_on = None - -TABLE_PREFIXES = ('nyaa', 'sukebei') - - -def upgrade(): - - for prefix in TABLE_PREFIXES: - op.add_column(prefix + '_torrents', sa.Column('uploader_ip', sa.Binary(), nullable=True)) - # ### end Alembic commands ### - - -def downgrade(): - for prefix in TABLE_PREFIXES: - op.drop_column(prefix + '_torrents', 'uploader_ip') diff --git a/migrations/versions/500117641608_add_bans.py b/migrations/versions/500117641608_add_bans.py deleted file mode 100644 index d26f4ec..0000000 --- a/migrations/versions/500117641608_add_bans.py +++ /dev/null @@ -1,38 +0,0 @@ -"""Add bans table - -Revision ID: 500117641608 -Revises: b79d2fcafd88 -Create Date: 2017-08-17 01:44:39.205126 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '500117641608' -down_revision = 'b79d2fcafd88' -branch_labels = None -depends_on = None - - -def upgrade(): - op.create_table('bans', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('created_time', sa.DateTime(), nullable=True), - sa.Column('admin_id', sa.Integer(), nullable=False), - sa.Column('user_id', sa.Integer(), nullable=True), - sa.Column('user_ip', sa.Binary(length=16), nullable=True), - sa.Column('reason', sa.String(length=2048), nullable=False), - sa.ForeignKeyConstraint(['admin_id'], ['users.id'], ), - sa.ForeignKeyConstraint(['user_id'], ['users.id'], ), - sa.PrimaryKeyConstraint('id'), - ) - op.create_index('user_ip_16', 'bans', ['user_ip'], unique=True, mysql_length=16) - op.create_index('user_ip_4', 'bans', ['user_ip'], unique=True, mysql_length=4) - - -def downgrade(): - op.drop_index('user_ip_4', table_name='bans') - op.drop_index('user_ip_16', table_name='bans') - op.drop_table('bans') diff --git a/migrations/versions/5cbcee17bece_add_trusted_applications.py b/migrations/versions/5cbcee17bece_add_trusted_applications.py deleted file mode 100644 index 29167cb..0000000 --- a/migrations/versions/5cbcee17bece_add_trusted_applications.py +++ /dev/null @@ -1,47 +0,0 @@ -"""Add trusted applications - -Revision ID: 5cbcee17bece -Revises: 8a6a7662eb37 -Create Date: 2018-11-05 15:16:07.497898 - -""" -from alembic import op -import sqlalchemy as sa -import sqlalchemy_utils - - -# revision identifiers, used by Alembic. -revision = '5cbcee17bece' -down_revision = '8a6a7662eb37' -branch_labels = None -depends_on = None - - -def upgrade(): - op.create_table('trusted_applications', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('submitter_id', sa.Integer(), nullable=False, index=True), - sa.Column('created_time', sa.DateTime(), nullable=True), - sa.Column('closed_time', sa.DateTime(), nullable=True), - sa.Column('why_want', sa.String(length=4000), nullable=False), - sa.Column('why_give', sa.String(length=4000), nullable=False), - sa.Column('status', sa.Integer(), nullable=False), - sa.ForeignKeyConstraint(['submitter_id'], ['users.id'], ), - sa.PrimaryKeyConstraint('id') - ) - op.create_table('trusted_reviews', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('reviewer_id', sa.Integer(), nullable=False), - sa.Column('app_id', sa.Integer(), nullable=False), - sa.Column('created_time', sa.DateTime(), nullable=True), - sa.Column('comment', sa.String(length=4000), nullable=False), - sa.Column('recommendation', sa.Integer(), nullable=False), - sa.ForeignKeyConstraint(['app_id'], ['trusted_applications.id'], ), - sa.ForeignKeyConstraint(['reviewer_id'], ['users.id'], ), - sa.PrimaryKeyConstraint('id') - ) - - -def downgrade(): - op.drop_table('trusted_reviews') - op.drop_table('trusted_applications') diff --git a/migrations/versions/6cc823948c5a_add_trackerapi.py b/migrations/versions/6cc823948c5a_add_trackerapi.py deleted file mode 100644 index d40e954..0000000 --- a/migrations/versions/6cc823948c5a_add_trackerapi.py +++ /dev/null @@ -1,40 +0,0 @@ -"""Add trackerapi table - -Revision ID: 6cc823948c5a -Revises: b61e4f6a88cc -Create Date: 2018-02-11 20:57:15.244171 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '6cc823948c5a' -down_revision = 'b61e4f6a88cc' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table('nyaa_trackerapi', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('info_hash', sa.BINARY(length=20), nullable=False), - sa.Column('method', sa.String(length=255), nullable=False), - sa.PrimaryKeyConstraint('id') - ) - op.create_table('sukebei_trackerapi', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('info_hash', sa.BINARY(length=20), nullable=False), - sa.Column('method', sa.String(length=255), nullable=False), - sa.PrimaryKeyConstraint('id') - ) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_table('sukebei_trackerapi') - op.drop_table('nyaa_trackerapi') - # ### end Alembic commands ### diff --git a/migrations/versions/7f064e009cab_add_report_table.py b/migrations/versions/7f064e009cab_add_report_table.py deleted file mode 100644 index 3e3992e..0000000 --- a/migrations/versions/7f064e009cab_add_report_table.py +++ /dev/null @@ -1,56 +0,0 @@ -"""Add Report table - -Revision ID: 7f064e009cab -Revises: 2bceb2cb4d7c -Create Date: 2017-05-29 16:50:28.720980 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '7f064e009cab' -down_revision = '2bceb2cb4d7c' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table('nyaa_reports', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('created_time', sa.DateTime(), nullable=True), - sa.Column('reason', sa.String(length=255), nullable=False), - - # sqlalchemy_utils.types.choice.ChoiceType() - sa.Column('status', sa.Integer(), nullable=False), - - sa.Column('torrent_id', sa.Integer(), nullable=False), - sa.Column('user_id', sa.Integer(), nullable=True), - sa.ForeignKeyConstraint(['torrent_id'], ['nyaa_torrents.id'], ondelete='CASCADE'), - sa.ForeignKeyConstraint(['user_id'], ['users.id'], ), - sa.PrimaryKeyConstraint('id') - ) - op.create_table('sukebei_reports', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('created_time', sa.DateTime(), nullable=True), - sa.Column('reason', sa.String(length=255), nullable=False), - - # sqlalchemy_utils.types.choice.ChoiceType() - sa.Column('status', sa.Integer(), nullable=False), - - sa.Column('torrent_id', sa.Integer(), nullable=False), - sa.Column('user_id', sa.Integer(), nullable=True), - sa.ForeignKeyConstraint(['torrent_id'], ['sukebei_torrents.id'], ondelete='CASCADE'), - sa.ForeignKeyConstraint(['user_id'], ['users.id'], ), - sa.PrimaryKeyConstraint('id') - ) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_table('sukebei_reports') - op.drop_table('nyaa_reports') - # ### end Alembic commands ### diff --git a/migrations/versions/8a6a7662eb37_add_user_preferences_table.py b/migrations/versions/8a6a7662eb37_add_user_preferences_table.py deleted file mode 100644 index 48ca434..0000000 --- a/migrations/versions/8a6a7662eb37_add_user_preferences_table.py +++ /dev/null @@ -1,39 +0,0 @@ -"""Add user preferences table - -Revision ID: 8a6a7662eb37 -Revises: f703f911d4ae -Create Date: 2018-11-20 17:02:26.408532 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '8a6a7662eb37' -down_revision = 'f703f911d4ae' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table('user_preferences', - sa.Column('user_id', sa.Integer(), nullable=False), - sa.Column('hide_comments', sa.Boolean(), server_default=sa.sql.expression.false(), nullable=False), - sa.ForeignKeyConstraint(['user_id'], ['users.id'], ondelete='CASCADE'), - sa.PrimaryKeyConstraint('user_id') - ) - - connection = op.get_bind() - - print('Populating user_preferences...') - connection.execute(sa.sql.text('INSERT INTO user_preferences (user_id) SELECT id FROM users')) - print('Done.') - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_table('user_preferences') - # ### end Alembic commands ### diff --git a/migrations/versions/97ddefed1834_initial_database_state.py b/migrations/versions/97ddefed1834_initial_database_state.py deleted file mode 100644 index fcb1dcb..0000000 --- a/migrations/versions/97ddefed1834_initial_database_state.py +++ /dev/null @@ -1,166 +0,0 @@ -"""Initial database state - -Revision ID: 97ddefed1834 -Revises: -Create Date: 2017-05-26 18:46:14.440040 - -""" -from alembic import op -import sqlalchemy as sa -import sqlalchemy_utils -from sqlalchemy.dialects import mysql - -# revision identifiers, used by Alembic. -revision = '97ddefed1834' -down_revision = None -branch_labels = None -depends_on = None - -TABLE_PREFIXES = ('nyaa', 'sukebei') - -def upgrade(): - # Shared tables - op.create_table('users', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('username', sa.String(length=32, collation='ascii_general_ci'), nullable=False), - sa.Column('email', sqlalchemy_utils.types.email.EmailType(length=255), nullable=True), - - # These are actually PasswordType, UserStatusType and UserLevelType, - # but database-wise binary and integers are what's being used - sa.Column('password_hash', sa.Binary(length=255), nullable=False), - sa.Column('status', sa.Integer(), nullable=False), - sa.Column('level', sa.Integer(), nullable=False), - - sa.Column('created_time', sa.DateTime(), nullable=True), - sa.Column('last_login_date', sa.DateTime(), nullable=True), - sa.Column('last_login_ip', sa.Binary(), nullable=True), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('email'), - sa.UniqueConstraint('username') - ) - - op.create_table('trackers', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('uri', sa.String(length=255, collation='utf8_general_ci'), nullable=False), - sa.Column('disabled', sa.Boolean(), nullable=False), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('uri') - ) - - # Nyaa and Sukebei - for prefix in TABLE_PREFIXES: - # Main categories - op.create_table(prefix + '_main_categories', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('name', sa.String(length=64), nullable=False), - sa.PrimaryKeyConstraint('id') - ) - # Sub categories - op.create_table(prefix + '_sub_categories', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('main_category_id', sa.Integer(), nullable=False), - sa.Column('name', sa.String(length=64), nullable=False), - sa.ForeignKeyConstraint(['main_category_id'], [prefix + '_main_categories.id'], ), - sa.PrimaryKeyConstraint('id', 'main_category_id') - ) - # Main torrent table - op.create_table(prefix + '_torrents', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('info_hash', sa.BINARY(length=20), nullable=False), - sa.Column('display_name', sa.String(length=255, collation='utf8_general_ci'), nullable=False), - sa.Column('torrent_name', sa.String(length=255), nullable=False), - sa.Column('information', sa.String(length=255), nullable=False), - sa.Column('description', mysql.TEXT(collation='utf8mb4_bin'), nullable=False), - sa.Column('filesize', sa.BIGINT(), nullable=False), - sa.Column('encoding', sa.String(length=32), nullable=False), - sa.Column('flags', sa.Integer(), nullable=False), - sa.Column('uploader_id', sa.Integer(), nullable=True), - sa.Column('has_torrent', sa.Boolean(), nullable=False), - sa.Column('created_time', sa.DateTime(), nullable=False), - sa.Column('updated_time', sa.DateTime(), nullable=False), - sa.Column('main_category_id', sa.Integer(), nullable=False), - sa.Column('sub_category_id', sa.Integer(), nullable=False), - sa.Column('redirect', sa.Integer(), nullable=True), - sa.ForeignKeyConstraint(['main_category_id', 'sub_category_id'], [prefix + '_sub_categories.main_category_id', prefix + '_sub_categories.id'], ), - sa.ForeignKeyConstraint(['main_category_id'], [prefix + '_main_categories.id'], ), - sa.ForeignKeyConstraint(['redirect'], [prefix + '_torrents.id'], ), - sa.ForeignKeyConstraint(['uploader_id'], ['users.id'], ), - sa.PrimaryKeyConstraint('id') - ) - op.create_index(op.f('ix_' + prefix + '_torrents_display_name'), prefix + '_torrents', ['display_name'], unique=False) - op.create_index(op.f('ix_' + prefix + '_torrents_filesize'), prefix + '_torrents', ['filesize'], unique=False) - op.create_index(op.f('ix_' + prefix + '_torrents_flags'), prefix + '_torrents', ['flags'], unique=False) - op.create_index(op.f('ix_' + prefix + '_torrents_info_hash'), prefix + '_torrents', ['info_hash'], unique=True) - op.create_index(prefix + '_uploader_flag_idx', prefix + '_torrents', ['uploader_id', 'flags'], unique=False) - - # Statistics for torrents - op.create_table(prefix + '_statistics', - sa.Column('torrent_id', sa.Integer(), nullable=False), - sa.Column('seed_count', sa.Integer(), nullable=False), - sa.Column('leech_count', sa.Integer(), nullable=False), - sa.Column('download_count', sa.Integer(), nullable=False), - sa.Column('last_updated', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['torrent_id'], [prefix + '_torrents.id'], ondelete='CASCADE'), - sa.PrimaryKeyConstraint('torrent_id') - ) - op.create_index(op.f('ix_' + prefix + '_statistics_download_count'), prefix + '_statistics', ['download_count'], unique=False) - op.create_index(op.f('ix_' + prefix + '_statistics_leech_count'), prefix + '_statistics', ['leech_count'], unique=False) - op.create_index(op.f('ix_' + prefix + '_statistics_seed_count'), prefix + '_statistics', ['seed_count'], unique=False) - - # Trackers relationships for torrents - op.create_table(prefix + '_torrent_trackers', - sa.Column('torrent_id', sa.Integer(), nullable=False), - sa.Column('tracker_id', sa.Integer(), nullable=False), - sa.Column('order', sa.Integer(), nullable=False), - sa.ForeignKeyConstraint(['torrent_id'], [prefix + '_torrents.id'], ondelete='CASCADE'), - sa.ForeignKeyConstraint(['tracker_id'], ['trackers.id'], ondelete='CASCADE'), - sa.PrimaryKeyConstraint('torrent_id', 'tracker_id') - ) - op.create_index(op.f('ix_' + prefix + '_torrent_trackers_order'), prefix + '_torrent_trackers', ['order'], unique=False) - - # Torrent filelists - op.create_table(prefix + '_torrents_filelist', - sa.Column('torrent_id', sa.Integer(), nullable=False), - sa.Column('filelist_blob', mysql.MEDIUMBLOB(), nullable=True), - sa.ForeignKeyConstraint(['torrent_id'], [prefix + '_torrents.id'], ondelete='CASCADE'), - sa.PrimaryKeyConstraint('torrent_id'), - mysql_row_format='COMPRESSED' - ) - - # Torrent info_dicts - op.create_table(prefix + '_torrents_info', - sa.Column('torrent_id', sa.Integer(), nullable=False), - sa.Column('info_dict', mysql.MEDIUMBLOB(), nullable=True), - sa.ForeignKeyConstraint(['torrent_id'], [prefix + '_torrents.id'], ondelete='CASCADE'), - sa.PrimaryKeyConstraint('torrent_id'), - mysql_row_format='COMPRESSED' - ) - # ### end Alembic commands ### - - -def downgrade(): - # Note: this may fail. It's better to just drop all tables instead (or reset the database) - - # Nyaa and Sukebei - for prefix in TABLE_PREFIXES: - op.drop_table(prefix + '_torrents_info') - op.drop_table(prefix + '_torrents_filelist') - op.drop_index(op.f('ix_' + prefix + '_torrent_trackers_order'), table_name=prefix + '_torrent_trackers') - op.drop_table(prefix + '_torrent_trackers') - op.drop_index(op.f('ix_' + prefix + '_statistics_seed_count'), table_name=prefix + '_statistics') - op.drop_index(op.f('ix_' + prefix + '_statistics_leech_count'), table_name=prefix + '_statistics') - op.drop_index(op.f('ix_' + prefix + '_statistics_download_count'), table_name=prefix + '_statistics') - op.drop_table(prefix + '_statistics') - op.drop_table(prefix + '_torrents') - op.drop_index(prefix + '_uploader_flag_idx', table_name=prefix + '_torrents') - op.drop_index(op.f('ix_' + prefix + '_torrents_info_hash'), table_name=prefix + '_torrents') - op.drop_index(op.f('ix_' + prefix + '_torrents_flags'), table_name=prefix + '_torrents') - op.drop_index(op.f('ix_' + prefix + '_torrents_filesize'), table_name=prefix + '_torrents') - op.drop_index(op.f('ix_' + prefix + '_torrents_display_name'), table_name=prefix + '_torrents') - op.drop_table(prefix + '_sub_categories') - op.drop_table(prefix + '_main_categories') - - # Shared tables - op.drop_table('users') - op.drop_table('trackers') - # ### end Alembic commands ### diff --git a/migrations/versions/b61e4f6a88cc_del_torrents_info.py b/migrations/versions/b61e4f6a88cc_del_torrents_info.py deleted file mode 100644 index e3bd4de..0000000 --- a/migrations/versions/b61e4f6a88cc_del_torrents_info.py +++ /dev/null @@ -1,57 +0,0 @@ -"""Remove bencoded info dicts from mysql - -Revision ID: b61e4f6a88cc -Revises: cf7bf6d0e6bd -Create Date: 2017-08-29 01:45:08.357936 - -""" -from alembic import op -import sqlalchemy as sa -from sqlalchemy.dialects import mysql -import sys - -# revision identifiers, used by Alembic. -revision = 'b61e4f6a88cc' -down_revision = 'cf7bf6d0e6bd' -branch_labels = None -depends_on = None - - -def upgrade(): - print("--- WARNING ---") - print("This migration drops the torrent_info tables.") - print("You will lose all of your .torrent files if you have not converted them beforehand.") - print("Use the migration script at utils/infodict_mysql2file.py") - print("Type OKAY and hit Enter to continue, CTRL-C to abort.") - print("--- WARNING ---") - try: - if input() != "OKAY": - sys.exit(1) - except KeyboardInterrupt: - sys.exit(1) - - op.drop_table('sukebei_torrents_info') - op.drop_table('nyaa_torrents_info') - - -def downgrade(): - op.create_table('nyaa_torrents_info', - sa.Column('info_dict', mysql.MEDIUMBLOB(), nullable=True), - sa.Column('torrent_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False), - sa.ForeignKeyConstraint(['torrent_id'], ['nyaa_torrents.id'], name='nyaa_torrents_info_ibfk_1', ondelete='CASCADE'), - sa.PrimaryKeyConstraint('torrent_id'), - mysql_collate='utf8_bin', - mysql_default_charset='utf8', - mysql_engine='InnoDB', - mysql_row_format='COMPRESSED' - ) - op.create_table('sukebei_torrents_info', - sa.Column('info_dict', mysql.MEDIUMBLOB(), nullable=True), - sa.Column('torrent_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False), - sa.ForeignKeyConstraint(['torrent_id'], ['sukebei_torrents.id'], name='sukebei_torrents_info_ibfk_1', ondelete='CASCADE'), - sa.PrimaryKeyConstraint('torrent_id'), - mysql_collate='utf8_bin', - mysql_default_charset='utf8', - mysql_engine='InnoDB', - mysql_row_format='COMPRESSED' - ) diff --git a/migrations/versions/b79d2fcafd88_comment_text.py b/migrations/versions/b79d2fcafd88_comment_text.py deleted file mode 100644 index ec582ab..0000000 --- a/migrations/versions/b79d2fcafd88_comment_text.py +++ /dev/null @@ -1,33 +0,0 @@ -"""Change comment text field from VARCHAR(255) to mysql.TEXT - -Revision ID: b79d2fcafd88 -Revises: ffd23e570f92 -Create Date: 2017-08-14 18:57:44.165168 - -""" -from alembic import op -import sqlalchemy as sa -from sqlalchemy.dialects import mysql - -# revision identifiers, used by Alembic. -revision = 'b79d2fcafd88' -down_revision = 'ffd23e570f92' -branch_labels = None -depends_on = None - -TABLE_PREFIXES = ('nyaa', 'sukebei') - -def upgrade(): - for prefix in TABLE_PREFIXES: - op.alter_column(prefix + '_comments', 'text', - existing_type=mysql.VARCHAR(charset='utf8mb4', collation='utf8mb4_bin', length=255), - type_=mysql.TEXT(collation='utf8mb4_bin'), - existing_nullable=False) - - -def downgrade(): - for prefix in TABLE_PREFIXES: - op.alter_column(prefix + '_comments', 'text', - existing_type=mysql.TEXT(collation='utf8mb4_bin'), - type_=mysql.VARCHAR(charset='utf8mb4', collation='utf8mb4_bin', length=255), - existing_nullable=False) diff --git a/migrations/versions/cf7bf6d0e6bd_add_edited_time_to_comments.py b/migrations/versions/cf7bf6d0e6bd_add_edited_time_to_comments.py deleted file mode 100644 index 11f7ccb..0000000 --- a/migrations/versions/cf7bf6d0e6bd_add_edited_time_to_comments.py +++ /dev/null @@ -1,30 +0,0 @@ -"""Add edited_time to Comments - -Revision ID: cf7bf6d0e6bd -Revises: 500117641608 -Create Date: 2017-10-28 15:32:12.687378 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = 'cf7bf6d0e6bd' -down_revision = '500117641608' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column('nyaa_comments', sa.Column('edited_time', sa.DateTime(), nullable=True)) - op.add_column('sukebei_comments', sa.Column('edited_time', sa.DateTime(), nullable=True)) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_column('sukebei_comments', 'edited_time') - op.drop_column('nyaa_comments', 'edited_time') - # ### end Alembic commands ### diff --git a/migrations/versions/d0eeb8049623_add_comments.py b/migrations/versions/d0eeb8049623_add_comments.py deleted file mode 100644 index 47e2a7a..0000000 --- a/migrations/versions/d0eeb8049623_add_comments.py +++ /dev/null @@ -1,37 +0,0 @@ -"""Add comments table. - -Revision ID: d0eeb8049623 -Revises: 3001f79b7722 -Create Date: 2017-05-22 22:58:12.039149 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = 'd0eeb8049623' -down_revision = '3001f79b7722' -branch_labels = None -depends_on = None - -TABLE_PREFIXES = ('nyaa', 'sukebei') - - -def upgrade(): - for prefix in TABLE_PREFIXES: - op.create_table(prefix + '_comments', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('torrent_id', sa.Integer(), nullable=False), - sa.Column('user_id', sa.Integer(), nullable=True), - sa.Column('created_time', sa.DateTime(), nullable=True), - sa.Column('text', sa.String(length=255, collation='utf8mb4_bin'), nullable=False), - sa.ForeignKeyConstraint(['torrent_id'], [prefix + '_torrents.id'], ondelete='CASCADE'), - sa.ForeignKeyConstraint(['user_id'], ['users.id'], ondelete='CASCADE'), - sa.PrimaryKeyConstraint('id') - ) - - -def downgrade(): - for prefix in TABLE_PREFIXES: - op.drop_table(prefix + '_comments') diff --git a/migrations/versions/f69d7fec88d6_add_rangebans.py b/migrations/versions/f69d7fec88d6_add_rangebans.py deleted file mode 100644 index 9011744..0000000 --- a/migrations/versions/f69d7fec88d6_add_rangebans.py +++ /dev/null @@ -1,40 +0,0 @@ -"""add rangebans - -Revision ID: f69d7fec88d6 -Revises: 6cc823948c5a -Create Date: 2018-06-01 14:01:49.596007 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = 'f69d7fec88d6' -down_revision = '6cc823948c5a' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table('rangebans', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('cidr_string', sa.String(length=18), nullable=False), - sa.Column('masked_cidr', sa.BigInteger(), nullable=False), - sa.Column('mask', sa.BigInteger(), nullable=False), - sa.Column('enabled', sa.Boolean(), nullable=False), - sa.Column('temp', sa.DateTime(), nullable=True), - sa.PrimaryKeyConstraint('id') - ) - op.create_index(op.f('ix_rangebans_mask'), 'rangebans', ['mask'], unique=False) - op.create_index(op.f('ix_rangebans_masked_cidr'), 'rangebans', ['masked_cidr'], unique=False) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_index(op.f('ix_rangebans_masked_cidr'), table_name='rangebans') - op.drop_index(op.f('ix_rangebans_mask'), table_name='rangebans') - op.drop_table('rangebans') - # ### end Alembic commands ### diff --git a/migrations/versions/f703f911d4ae_add_registration_ip.py b/migrations/versions/f703f911d4ae_add_registration_ip.py deleted file mode 100644 index 784415d..0000000 --- a/migrations/versions/f703f911d4ae_add_registration_ip.py +++ /dev/null @@ -1,28 +0,0 @@ -"""add registration IP - -Revision ID: f703f911d4ae -Revises: f69d7fec88d6 -Create Date: 2018-07-09 13:04:50.652781 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = 'f703f911d4ae' -down_revision = 'f69d7fec88d6' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column('users', sa.Column('registration_ip', sa.Binary(), nullable=True)) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_column('users', 'registration_ip') - # ### end Alembic commands ### diff --git a/migrations/versions/ffd23e570f92_add_is_webseed_to_trackers.py b/migrations/versions/ffd23e570f92_add_is_webseed_to_trackers.py deleted file mode 100644 index 61db4b7..0000000 --- a/migrations/versions/ffd23e570f92_add_is_webseed_to_trackers.py +++ /dev/null @@ -1,24 +0,0 @@ -"""Add is_webseed to Trackers - -Revision ID: ffd23e570f92 -Revises: 1add911660a6 -Create Date: 2017-07-29 19:03:58.244769 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = 'ffd23e570f92' -down_revision = '1add911660a6' -branch_labels = None -depends_on = None - - -def upgrade(): - op.add_column('trackers', sa.Column('is_webseed', sa.Boolean(), nullable=False)) - - -def downgrade(): - op.drop_column('trackers', 'is_webseed') diff --git a/nyaa/__init__.py b/nyaa/__init__.py index e62ec22..e6c249d 100644 --- a/nyaa/__init__.py +++ b/nyaa/__init__.py @@ -26,7 +26,7 @@ def create_app(config: Any) -> Flask: app.config.from_object(config) # Session cookie configuration - app.config['SESSION_COOKIE_NAME'] = 'nyaav3_session' + app.config['SESSION_COOKIE_NAME'] = 'synthoria_session' app.config['SESSION_COOKIE_SECURE'] = True app.config['SESSION_COOKIE_HTTPONLY'] = True app.config['SESSION_COOKIE_SAMESITE'] = 'Lax' diff --git a/nyaa/static/css/main.css b/nyaa/static/css/main.css index 0ecd081..73f56f6 100644 --- a/nyaa/static/css/main.css +++ b/nyaa/static/css/main.css @@ -577,7 +577,7 @@ body.dark .panel-deleted > .panel-heading { .torrent-list .hdr-date, .torrent-list .hdr-downloads, - .torrent-list td: nth-of-type(5), + .torrent-list td:nth-of-type(5), .torrent-list td:nth-of-type(8) { display: none; } diff --git a/nyaa/static/favicon.png b/nyaa/static/favicon.png deleted file mode 100644 index 4a14d5f..0000000 Binary files a/nyaa/static/favicon.png and /dev/null differ diff --git a/nyaa/static/img/avatar/default.png b/nyaa/static/img/avatar/default.png index e4bc337..e6d2fee 100644 Binary files a/nyaa/static/img/avatar/default.png and b/nyaa/static/img/avatar/default.png differ diff --git a/nyaa/static/img/icons/nyaa/1_1.png b/nyaa/static/img/icons/nyaa/1_1.png index b25c560..997e517 100644 Binary files a/nyaa/static/img/icons/nyaa/1_1.png and b/nyaa/static/img/icons/nyaa/1_1.png differ diff --git a/nyaa/static/img/icons/nyaa/1_2.png b/nyaa/static/img/icons/nyaa/1_2.png index 2580af5..997e517 100644 Binary files a/nyaa/static/img/icons/nyaa/1_2.png and b/nyaa/static/img/icons/nyaa/1_2.png differ diff --git a/nyaa/static/img/icons/nyaa/1_3.png b/nyaa/static/img/icons/nyaa/1_3.png index b5aec84..997e517 100644 Binary files a/nyaa/static/img/icons/nyaa/1_3.png and b/nyaa/static/img/icons/nyaa/1_3.png differ diff --git a/nyaa/static/img/icons/nyaa/1_4.png b/nyaa/static/img/icons/nyaa/1_4.png index a5750bc..997e517 100644 Binary files a/nyaa/static/img/icons/nyaa/1_4.png and b/nyaa/static/img/icons/nyaa/1_4.png differ diff --git a/nyaa/static/img/icons/nyaa/1_5.png b/nyaa/static/img/icons/nyaa/1_5.png new file mode 100644 index 0000000..997e517 Binary files /dev/null and b/nyaa/static/img/icons/nyaa/1_5.png differ diff --git a/nyaa/static/img/icons/nyaa/1_6.png b/nyaa/static/img/icons/nyaa/1_6.png new file mode 100644 index 0000000..997e517 Binary files /dev/null and b/nyaa/static/img/icons/nyaa/1_6.png differ diff --git a/nyaa/static/img/icons/nyaa/1_7.png b/nyaa/static/img/icons/nyaa/1_7.png new file mode 100644 index 0000000..997e517 Binary files /dev/null and b/nyaa/static/img/icons/nyaa/1_7.png differ diff --git a/nyaa/static/img/icons/nyaa/2_1.png b/nyaa/static/img/icons/nyaa/2_1.png index 3aef4ac..997e517 100644 Binary files a/nyaa/static/img/icons/nyaa/2_1.png and b/nyaa/static/img/icons/nyaa/2_1.png differ diff --git a/nyaa/static/img/icons/nyaa/2_2.png b/nyaa/static/img/icons/nyaa/2_2.png index a45d97b..997e517 100644 Binary files a/nyaa/static/img/icons/nyaa/2_2.png and b/nyaa/static/img/icons/nyaa/2_2.png differ diff --git a/nyaa/static/img/icons/nyaa/2_3.png b/nyaa/static/img/icons/nyaa/2_3.png new file mode 100644 index 0000000..997e517 Binary files /dev/null and b/nyaa/static/img/icons/nyaa/2_3.png differ diff --git a/nyaa/static/img/icons/nyaa/2_4.png b/nyaa/static/img/icons/nyaa/2_4.png new file mode 100644 index 0000000..997e517 Binary files /dev/null and b/nyaa/static/img/icons/nyaa/2_4.png differ diff --git a/nyaa/static/img/icons/nyaa/2_5.png b/nyaa/static/img/icons/nyaa/2_5.png new file mode 100644 index 0000000..997e517 Binary files /dev/null and b/nyaa/static/img/icons/nyaa/2_5.png differ diff --git a/nyaa/static/img/icons/nyaa/2_6.png b/nyaa/static/img/icons/nyaa/2_6.png new file mode 100644 index 0000000..997e517 Binary files /dev/null and b/nyaa/static/img/icons/nyaa/2_6.png differ diff --git a/nyaa/static/img/icons/nyaa/3_1.png b/nyaa/static/img/icons/nyaa/3_1.png index d78a910..997e517 100644 Binary files a/nyaa/static/img/icons/nyaa/3_1.png and b/nyaa/static/img/icons/nyaa/3_1.png differ diff --git a/nyaa/static/img/icons/nyaa/3_2.png b/nyaa/static/img/icons/nyaa/3_2.png index ce38885..997e517 100644 Binary files a/nyaa/static/img/icons/nyaa/3_2.png and b/nyaa/static/img/icons/nyaa/3_2.png differ diff --git a/nyaa/static/img/icons/nyaa/3_3.png b/nyaa/static/img/icons/nyaa/3_3.png index 9d78c05..997e517 100644 Binary files a/nyaa/static/img/icons/nyaa/3_3.png and b/nyaa/static/img/icons/nyaa/3_3.png differ diff --git a/nyaa/static/img/icons/nyaa/3_4.png b/nyaa/static/img/icons/nyaa/3_4.png new file mode 100644 index 0000000..997e517 Binary files /dev/null and b/nyaa/static/img/icons/nyaa/3_4.png differ diff --git a/nyaa/static/img/icons/nyaa/4_1.png b/nyaa/static/img/icons/nyaa/4_1.png index 54bafbc..997e517 100644 Binary files a/nyaa/static/img/icons/nyaa/4_1.png and b/nyaa/static/img/icons/nyaa/4_1.png differ diff --git a/nyaa/static/img/icons/nyaa/4_2.png b/nyaa/static/img/icons/nyaa/4_2.png index 7863b0e..997e517 100644 Binary files a/nyaa/static/img/icons/nyaa/4_2.png and b/nyaa/static/img/icons/nyaa/4_2.png differ diff --git a/nyaa/static/img/icons/nyaa/4_3.png b/nyaa/static/img/icons/nyaa/4_3.png index 1637f81..997e517 100644 Binary files a/nyaa/static/img/icons/nyaa/4_3.png and b/nyaa/static/img/icons/nyaa/4_3.png differ diff --git a/nyaa/static/img/icons/nyaa/4_4.png b/nyaa/static/img/icons/nyaa/4_4.png index 4fdda69..997e517 100644 Binary files a/nyaa/static/img/icons/nyaa/4_4.png and b/nyaa/static/img/icons/nyaa/4_4.png differ diff --git a/nyaa/static/img/icons/nyaa/4_5.png b/nyaa/static/img/icons/nyaa/4_5.png new file mode 100644 index 0000000..997e517 Binary files /dev/null and b/nyaa/static/img/icons/nyaa/4_5.png differ diff --git a/nyaa/static/img/icons/nyaa/4_6.png b/nyaa/static/img/icons/nyaa/4_6.png new file mode 100644 index 0000000..997e517 Binary files /dev/null and b/nyaa/static/img/icons/nyaa/4_6.png differ diff --git a/nyaa/static/img/icons/nyaa/5_1.png b/nyaa/static/img/icons/nyaa/5_1.png index 8ac0fe6..997e517 100644 Binary files a/nyaa/static/img/icons/nyaa/5_1.png and b/nyaa/static/img/icons/nyaa/5_1.png differ diff --git a/nyaa/static/img/icons/nyaa/5_2.png b/nyaa/static/img/icons/nyaa/5_2.png index 0a6ba5c..997e517 100644 Binary files a/nyaa/static/img/icons/nyaa/5_2.png and b/nyaa/static/img/icons/nyaa/5_2.png differ diff --git a/nyaa/static/img/icons/nyaa/6_1.png b/nyaa/static/img/icons/nyaa/6_1.png index 79fe8e5..997e517 100644 Binary files a/nyaa/static/img/icons/nyaa/6_1.png and b/nyaa/static/img/icons/nyaa/6_1.png differ diff --git a/nyaa/static/img/icons/nyaa/6_2 .png b/nyaa/static/img/icons/nyaa/6_2 .png new file mode 100644 index 0000000..997e517 Binary files /dev/null and b/nyaa/static/img/icons/nyaa/6_2 .png differ diff --git a/nyaa/static/img/icons/nyaa/6_2.png b/nyaa/static/img/icons/nyaa/6_2.png deleted file mode 100644 index 6ceba49..0000000 Binary files a/nyaa/static/img/icons/nyaa/6_2.png and /dev/null differ diff --git a/nyaa/static/img/icons/nyaa/6_3.png b/nyaa/static/img/icons/nyaa/6_3.png new file mode 100644 index 0000000..997e517 Binary files /dev/null and b/nyaa/static/img/icons/nyaa/6_3.png differ diff --git a/nyaa/static/img/icons/nyaa/7_1.png b/nyaa/static/img/icons/nyaa/7_1.png new file mode 100644 index 0000000..997e517 Binary files /dev/null and b/nyaa/static/img/icons/nyaa/7_1.png differ diff --git a/nyaa/static/img/icons/nyaa/7_2.png b/nyaa/static/img/icons/nyaa/7_2.png new file mode 100644 index 0000000..997e517 Binary files /dev/null and b/nyaa/static/img/icons/nyaa/7_2.png differ diff --git a/nyaa/static/img/icons/nyaa/7_3.png b/nyaa/static/img/icons/nyaa/7_3.png new file mode 100644 index 0000000..997e517 Binary files /dev/null and b/nyaa/static/img/icons/nyaa/7_3.png differ diff --git a/nyaa/static/img/icons/nyaa/7_4.png b/nyaa/static/img/icons/nyaa/7_4.png new file mode 100644 index 0000000..997e517 Binary files /dev/null and b/nyaa/static/img/icons/nyaa/7_4.png differ diff --git a/nyaa/static/img/icons/nyaa/8_1.png b/nyaa/static/img/icons/nyaa/8_1.png new file mode 100644 index 0000000..997e517 Binary files /dev/null and b/nyaa/static/img/icons/nyaa/8_1.png differ diff --git a/nyaa/static/img/icons/nyaa/8_2.png b/nyaa/static/img/icons/nyaa/8_2.png new file mode 100644 index 0000000..997e517 Binary files /dev/null and b/nyaa/static/img/icons/nyaa/8_2.png differ diff --git a/nyaa/static/img/icons/nyaa/8_3.png b/nyaa/static/img/icons/nyaa/8_3.png new file mode 100644 index 0000000..997e517 Binary files /dev/null and b/nyaa/static/img/icons/nyaa/8_3.png differ diff --git a/nyaa/static/img/icons/nyaa/8_4.png b/nyaa/static/img/icons/nyaa/8_4.png new file mode 100644 index 0000000..997e517 Binary files /dev/null and b/nyaa/static/img/icons/nyaa/8_4.png differ diff --git a/nyaa/static/img/icons/nyaa/8_5.png b/nyaa/static/img/icons/nyaa/8_5.png new file mode 100644 index 0000000..997e517 Binary files /dev/null and b/nyaa/static/img/icons/nyaa/8_5.png differ diff --git a/nyaa/static/img/icons/nyaa/8_6.png b/nyaa/static/img/icons/nyaa/8_6.png new file mode 100644 index 0000000..997e517 Binary files /dev/null and b/nyaa/static/img/icons/nyaa/8_6.png differ diff --git a/nyaa/static/img/icons/sukebei/1_1.png b/nyaa/static/img/icons/sukebei/1_1.png deleted file mode 100644 index 4558da5..0000000 Binary files a/nyaa/static/img/icons/sukebei/1_1.png and /dev/null differ diff --git a/nyaa/static/img/icons/sukebei/1_2.png b/nyaa/static/img/icons/sukebei/1_2.png deleted file mode 100644 index 4af1345..0000000 Binary files a/nyaa/static/img/icons/sukebei/1_2.png and /dev/null differ diff --git a/nyaa/static/img/icons/sukebei/1_3.png b/nyaa/static/img/icons/sukebei/1_3.png deleted file mode 100644 index 24d4c7f..0000000 Binary files a/nyaa/static/img/icons/sukebei/1_3.png and /dev/null differ diff --git a/nyaa/static/img/icons/sukebei/1_4.png b/nyaa/static/img/icons/sukebei/1_4.png deleted file mode 100644 index 2c106b9..0000000 Binary files a/nyaa/static/img/icons/sukebei/1_4.png and /dev/null differ diff --git a/nyaa/static/img/icons/sukebei/1_5.png b/nyaa/static/img/icons/sukebei/1_5.png deleted file mode 100644 index b2a7326..0000000 Binary files a/nyaa/static/img/icons/sukebei/1_5.png and /dev/null differ diff --git a/nyaa/static/img/icons/sukebei/2_1.png b/nyaa/static/img/icons/sukebei/2_1.png deleted file mode 100644 index 4f715f1..0000000 Binary files a/nyaa/static/img/icons/sukebei/2_1.png and /dev/null differ diff --git a/nyaa/static/img/icons/sukebei/2_2.png b/nyaa/static/img/icons/sukebei/2_2.png deleted file mode 100644 index 1cea34f..0000000 Binary files a/nyaa/static/img/icons/sukebei/2_2.png and /dev/null differ diff --git a/nyaa/static/pinned-tab.svg b/nyaa/static/pinned-tab.svg deleted file mode 100644 index 28034c3..0000000 --- a/nyaa/static/pinned-tab.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - diff --git a/nyaa/static/search-sukebei.xml b/nyaa/static/search-sukebei.xml deleted file mode 100644 index f2d7dad..0000000 --- a/nyaa/static/search-sukebei.xml +++ /dev/null @@ -1,14 +0,0 @@ - -Sukebei (Nyaa.si) - -Search torrents on Sukebei (Nyaa.si). -UTF-8 -data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAHmElEQVRYw8WXXYxdVRXHf2vvc849537MvTOdmQ4zUygtpS0FIWL4iBEE9cGqAU0gojHBxAef9MFETXwhRmM00ReNia8kmhh9g0R8kISYiFjAKqYNhZa2Qzud7897zz0fey8fzqVzoS2UJ3Zyc25y99nrt/7rv9feV+J7v6t8hCMAmHn4B+BK1nrwYWmSmtDuGIoSapGhfnSCe6Ys+9KMn/xq8Yr5cSz0+1WU9NgvK4BW3XJhuQThQxFMjVtanZBGM4SmoTvbpD+XYls1FnslYQA2EAiUVkPo3JbQfrCBnU9ZfzXn+LGBAllWUrrrDxxa2LuvQdauI6Js1UJIDJIbwpplxAhrnZgbn9xNs2NwiWAbBp8IpVHKXZbG7SX8dgDQqMFo3bDW8x8YfM+UpdjVYS6pEwfQMxAZCEuwfUgbMXXxrDuPaUf0IwgC8B6kAELBGoPB7Hjg9IJjdswQRZZ+rqS5p3BVpkkEtVpAGFuKZsJc2CKwkCiIDqrmwQuYHKwFV8BiKRCAsaAGVEBM9d2LQcTuALRCh8tz+hoTJyGmVWMxs2RBwGoY4YxBQogUYgXjoXTgqT4CiICUEGTw13khSwzSALWAqZ7qgBJUBB8MKTBvRin6FqzFZh7XD8EKlAIi2AhCD1arwIVCU5SOZiR5l17cwqihIKDplLQniAEJwJuBCgMlGKigZgigdLZKQRXnDYgfvKngwJcBTqAsoKGOvfTYfnuT5dTTbAjx4RG6GtARz2SoXOhbbAAagNjqWUk/kGsAchlAnUKo1SwHhO8U1gCKlp5CDXtGCqZ7K5y6WFw2ZS+FJkKA56Fpz2JmOdODpF+t7mylgBjIBUYtZMVAjcscrsoU0aqojqohlIAqOE+Nkhm3wen54t2NKIS6lDx8g9J1hhcXBAP4HPpdaBSK5Mp6Hx4IlMdrnrQAimEAtIJQrWyVQyyeelBCZpiqO+6MNzl9PsW9p1GluRI6z9ltwzNnDVLx0i/hwY5jv3VMqfJo3fOzScidkBXg3VAJqmwFFEwN9rS61Cws5BF3tdfJu543Nq7eIrMS+r0SXxciFK9C5uBLN3oS4zHe8PUZ5eHdlkLhlW1PWyAvZQegYTNGGpZdsedcGrNZBFgXMKGbnFv44BZ5aKRkcsLxr0V4o2uZbSqlQj0Qvn1QWcmF1Ux5etETldAMhI1Cd0owYjMaps9aatnqwlrPsr/eZWX7/YPXY8ON0zUO70m4tFmSltWhdKjtmQgLasbzn0VHwyp/nvMciaGXw1wq+GEPNGsxvTJkslUymRQ8MLPNqYX8ioAiEBolsp5WIgQGfFZwcFfAha7lzDp8dsbzi/uUvIA/vBXx1PGI584r97cVxfDCsmWvKr8eHwIwpIjPiQKYTDJee7u8asaqUHghd4Y0U/JCKb3y6rzn2GLAZKx87QDsblpeW7e8vqp8YgLun4SXl+DHx+GxMeXpfbAnHDLhcs8w3jSsbjuWtz645hMjljCArZ5jeQNeX/aIwsGOcs8NBiPC7x4yPHfOsTvxzLYCnp2Db92kPHlAWM6VUnUHYLSubKRKVvrrCB4wMRpxaq5H6aEeCf84H9DzsK8tTDUqd9/QNHzziMGrcnxJeeIWODxmcF4ZCYVTm24HYKX7/jeROBScVwoHzhWsrHlKD9bA7M2jvLQaIiE8ckCueLdfKIdGhXpY/WaNYIEXN+1wH7j2aETCSN2ytFn5opsJogVguWNvwptbwkSUgRVaYTBo9kM7JTJXrFk65fiyDnfCaw/nlW6/5J3qVF3b0qkLa0XEnihjNspoaMbf5+T6LqJW+NEhuT6AYlDnHXooHExPRiRlj0whzlPGJWNtu7jqGl5hK1eOL/nLhb4wUPQ6FIB6zTI5sjO1HQvqISs8DfG8tVDQxHFkQvjnhSrEySXPwrbn3IZHFeqhsK9tLhfo8Nj7eCC0VZYAVpSVLcdUJ2ArrU6yZmzppg7n4OJSykhiuGUm4ZM3BTz1glK3JRsZnN1QujlcGLHcOmYYr8tlRU6tm6sDPPbxmEfvbnLsbI/nT+Rc2ihBYTNVJKixd6TERoZurvRKQ2c04ct3Nbht2jDdEvY0PeupMtGwjDdgqatsZMM7TOkXjmfPypUABycN3z/aZv/uiM9/LOGHR5U/Hsv4+V9S5rc9G7nlwmaMJPC5Wy37d1mO3hHQ7Xs+s99wft3znXuFzFmWujAaDS6tKjSjyk8vX3T86d89/rv6HgWSEJ64r8H+3dFloCgQvnF/zBfujPj9Sxm3zwScnHecWHT85rE6AG8ue0pf1TMrlHbHsrDlOTAunF4uiULDagrfe95xcs2QnVvFW2C8tWPCqRgkF75yd/OqRhyrGw5NWUILzRr89IsJzisgWPGERlnteg5MVCC7WwYRYbptSQs4s+7Z6pasn7rExZWCotPgHPEOwMmTBZ86XGN27Np9aXmz5G8nMh65s0Y7MdjBrTYtDP+bd9y8693vnlhwPHOyYCyGzQwevxXeXi7JSiX1AQe0P7wNDV+9t3HN4KpwftXzxD0x7USG7AR54fn0LSF2aEOfWfG8PFdyZNKSO5huCAcmQ+o1w1hD6GPIL21UR/xH/ff8/7zueff8JH+eAAAAAElFTkSuQmCC - - - - - - -https://sukebei.nyaa.si/ - diff --git a/nyaa/static/search.xml b/nyaa/static/search.xml index 763d2ab..c4bb7fe 100644 --- a/nyaa/static/search.xml +++ b/nyaa/static/search.xml @@ -1,14 +1,14 @@ Nyaa.si -Search torrents on Nyaa.si. +Search torrents on Synthoria Archive. UTF-8 data:image/png;base64,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 - + - -https://nyaa.si/ + +https://archive.synthoria.moe/ \ No newline at end of file diff --git a/nyaa/templates/help.html b/nyaa/templates/help.html index 4cc8266..04976aa 100644 --- a/nyaa/templates/help.html +++ b/nyaa/templates/help.html @@ -10,20 +10,20 @@ {{ linkable_header("Torrent Colors", "torrent-colors") }}
- Green entries (trusted) are: + Green (trusted) entries are: - Red entries (remake) are torrents that match any of the following: + Red (repack) entries are torrents that match any of the following: - Orange entries are: + Orange (collection) entries are: Grey entries are: - {% set nyaa_cats = [('1_0', 'Anime', 'Anime'), - ('1_1', '- Anime Music Video', 'Anime - AMV'), - ('1_2', '- English-translated', 'Anime - English'), - ('1_3', '- Non-English-translated', 'Anime - Non-English'), - ('1_4', '- Raw', 'Anime - Raw'), - ('2_0', 'Audio', 'Audio'), - ('2_1', '- Lossless', 'Audio - Lossless'), - ('2_2', '- Lossy', 'Audio - Lossy'), - ('3_0', 'Literature', 'Literature'), - ('3_1', '- English-translated', 'Literature - English'), - ('3_2', '- Non-English-translated', 'Literature - Non-English'), - ('3_3', '- Raw', 'Literature - Raw'), - ('4_0', 'Live Action', 'Live Action'), - ('4_1', '- English-translated', 'Live Action - English'), - ('4_2', '- Idol/Promotional Video', 'Live Action - Idol/PV'), - ('4_3', '- Non-English-translated', 'Live Action - Non-English'), - ('4_4', '- Raw', 'Live Action - Raw'), + {% set nyaa_cats = [('1_0', 'Voicebanks', 'Voicebanks'), + ('1_1', '- VOCALOID', 'Voicebanks - VOCALOID'), + ('1_2', '- UTAU', 'Voicebanks - UTAU'), + ('1_3', '- Synthesizer V', 'Voicebanks - SynthV'), + ('1_4', '- CeVIO', 'Voicebanks - CeVIO'), + ('1_5', '- Piapro Studio', 'Voicebanks - Piapro Studio'), + ('1_6', '- NEUTRINO', 'Voicebanks - NEUTRINO'), + ('1_7', '- Other', 'Voicebanks - Other'), + ('2_0', 'Software', 'Software'), + ('2_1', '- Synthesizers', 'Software - Synthesizers'), + ('2_2', '- Plugins', 'Software - Plugins'), + ('2_3', '- Tools', 'Software - Tools'), + ('2_4', '- Applications', 'Software - Applications'), + ('2_5', '- Games', 'Software - Games'), + ('2_6', '- Other', 'Software - Other'), + ('3_0', 'Voice Sequences', 'Voice Sequences'), + ('3_1', '- VSQ/VSQx', 'Voice Sequences - VSQ/VSQx'), + ('3_2', '- UST', 'Voice Sequences - UST'), + ('3_3', '- MIDI', 'Voice Sequences - MIDI'), + ('3_4', '- Other', 'Voice Sequences - Other'), + ('4_0', 'Reclists', 'Reclists'), + ('4_1', '- Japanese', 'Reclists - Japanese'), + ('4_2', '- English', 'Reclists - English'), + ('4_3', '- Chinese', 'Reclists - Chinese'), + ('4_4', '- Korean', 'Reclists - Korean'), + ('4_5', '- Spanish', 'Reclists - Spanish'), + ('4_6', '- Other', 'Reclists - Other'), ('5_0', 'Pictures', 'Pictures'), ('5_1', '- Graphics', 'Pictures - Graphics'), ('5_2', '- Photos', 'Pictures - Photos'), - ('6_0', 'Software', 'Software'), - ('6_1', '- Applications', 'Software - Apps'), - ('6_2', '- Games', 'Software - Games')] + ('6_0', 'Audio', 'Audio'), + ('6_1', '- Songs', 'Audio - Songs'), + ('6_2', '- Demos', 'Audio - Demos'), + ('6_3', '- Other', 'Audio - Other'), + ('7_0', 'Video', 'Video'), + ('7_1', '- Music Videos', 'Video - Music Videos'), + ('7_2', '- Promo Videos', 'Video - Promo Videos'), + ('7_3', '- Demos', 'Video - Demos'), + ('7_4', '- Other', 'Video - Other'), + ('8_0', 'Lyrics', 'Lyrics'), + ('8_1', '- Japanese', 'Lyrics - Japanese'), + ('8_2', '- English', 'Lyrics - English'), + ('8_3', '- Chinese', 'Lyrics - Chinese'), + ('8_4', '- Korean', 'Lyrics - Korean'), + ('8_5', '- Spanish', 'Lyrics - Spanish'), + ('8_6', '- Other', 'Lyrics - Other')] %} {% set suke_cats = [('1_0', 'Art', 'Art'), @@ -237,7 +260,7 @@ @@ -271,7 +294,7 @@ @@ -331,7 +354,7 @@ diff --git a/nyaa/templates/rules.html b/nyaa/templates/rules.html index feceb6a..63305a4 100644 --- a/nyaa/templates/rules.html +++ b/nyaa/templates/rules.html @@ -4,85 +4,22 @@

Site Rules

- {# Spoilers: Your account will be banned if you repeatedly post these without using the [spoiler] tag properly. #} -

Breaking any of the rules on this page may result in being banned

-

Shitposting and Trolling: Your account will be banned if you keep this up. Repeatedly making inaccurate/false reports falls under this rule as well.

+

Breaking any of the rules on this page may result in getting banned

+

Shitposting and trolling: Your account will be banned if you keep this up. Repeatedly making inaccurate/false reports falls under this rule as well.

Bumping: Your account will be banned if you keep deleting and reposting your torrents.

-

Flooding: If you have five or more releases of the same type to release in one go, make a batch torrent containing all of them.

URL redirection services: These are removed on sight along with their torrents.

Advertising: No.

-

Content restrictions: This site is for content that originates from and/or is specific to China, Japan, and/or Korea.

-

Other content is not allowed without exceptions and will be removed.


-

{{ config.EXTERNAL_URLS['main'] }} is for work-safe content only. The following rules apply:

+

Malware: No.

+

Content restrictions: This site is for content related to voice synthesizers. Other content is prohibited without exceptions and will be removed.

+

Synthoria is dedicated to hosting and preserving legal torrents only. We do not facilitate piracy in any form. This website is not a platform for pirated materials, and we encourage users to respect the intellectual property rights of creators and owners.

+

This platform may host content that does not strictly adhere to the End User License Agreement (EULA) of certain voice synthesizers. While we allow such content to be shared, we emphasize that users who download and use this content do so at their own risk. By using this content, users acknowledge that they are responsible for ensuring compliance with the relevant EULA and any applicable laws. We do not condone or encourage any violation of EULAs or laws, and we disclaim any liability for any consequences arising from the use of such content.

+

Notes concerning uploading other people's work:

  • -

    No pornography of any kind.

    +

    Do not upload cracked or pirated voice synthesizers or voicebanks. Only official, legal, or open-source content is allowed.

  • -

    No extreme visual content. This means no scat, gore, or any other of such things.

    -
  • -
  • -

    Troll torrents are not allowed. These will be removed on sight.

    -
  • -

-

{{ config.EXTERNAL_URLS['fap'] }} is the place for non-work-safe content only. Still, the following rules apply:

-
    -
  • -

    No extreme real life visual content. This means no scat, gore, bestiality, or any other of such things.

    -
  • -
  • -

    Absolutely no real life child pornography of any kind.

    -
  • -
  • -

    Troll torrents are not allowed. These will be removed on sight.

    -
  • -

-

Torrent information: Text files (.txt) or info files (.nfo) for torrent or release group information are preferred.

-

Torrents containing (.chm) or (.url) files may be removed.


-

Upper limits on video resolution based on source:

-
    -
  • -

    DVD source video is limited to 1024x576p.

    -
  • -
  • -

    Web source video is limited to 1920x1080p or source resolution, whichever is lower.

    -
  • -
  • -

    TV source video is by default limited to 1920x1080p. SD channels, however, are limited to 480p.

    -
  • -
  • -

    Blu-ray source video is limited to 1920x1080p.

    -
  • -
  • -

    UHD source video is limited to 3840x2160p.

    -
  • -

-

Naturally, untouched sources are not bound by these limits. Leaks are also not subject to any resolution limits.


-

Finally, a few notes concerning tagging and using other people's work:

-
    -
  • -

    Do not add your own tag(s) when reuploading an original release.

    -
  • -
  • -

    Unless you are reuploading an original release, you should either avoid using tags that are not your own or make it extremely clear to everyone that you are the one responsible for the upload.

    -
  • -
  • -

    If these policies are not obeyed, then those torrents will be removed if reported by a group or person commonly seen as the owner of the tag(s). This especially applies to remake torrents.

    -
  • -
  • -

    Although only hinted at above, we may remove troll torrents tagged with A-sucks, B-is-slow, or such if reported by A or B.

    -
  • -
  • -

    Remakes which are utterly bit rate-starved are not allowed.

    -
  • -
  • -

    Remakes which add watermarks or such are not allowed.

    -
  • -
  • -

    Remakes which reencode video to XviD or worse are not allowed.

    -
  • -
  • -

    Remakes of JPG/PNG-based releases are not allowed without exceptions since there is most often no point in making such.

    +

    Do not upload voicebanks where the author has explicitly stated that redistribution is prohibited.

diff --git a/nyaa/templates/upload.html b/nyaa/templates/upload.html index 1ca14a7..853448a 100644 --- a/nyaa/templates/upload.html +++ b/nyaa/templates/upload.html @@ -86,20 +86,20 @@
-