Compare commits
47 Commits
dev-style-
...
dev-franke
| Author | SHA1 | Date | |
|---|---|---|---|
| c763d67fcb | |||
| e85ae5ac95 | |||
| 794189d70a | |||
| 34d9029b7c | |||
| 168bf04550 | |||
| 81eb2d1f62 | |||
| f5102b859f | |||
| a9c6abe06b | |||
| 764fef37e5 | |||
| 565481aa5a | |||
| 64b7d4c963 | |||
| 9eb7079ea6 | |||
| bd92480958 | |||
| 079a7e2cb5 | |||
| 295f68cb92 | |||
| a2a1154a22 | |||
| 3074b2d5f1 | |||
| 4638f3765a | |||
| 70189b95e1 | |||
| c47b1fc23f | |||
| f39e307bc4 | |||
| 3c965aa1ec | |||
| bd4ce76177 | |||
| fd0853d6f0 | |||
| 53ad80c90b | |||
| fb47cf9d6b | |||
| eac586d946 | |||
| ae0e416cdd | |||
| a64ac6b2cb | |||
| 1881247bf2 | |||
| 0337d7530a | |||
| 9b9240c35b | |||
| a568cb7c86 | |||
| daafeb79b7 | |||
| bc8c214c99 | |||
| d5f0098280 | |||
| 4cb9fd0810 | |||
| 7bc8720377 | |||
| cc4942a537 | |||
| c4f416af37 | |||
| 2c31485964 | |||
| 5d5d66bd79 | |||
| ce6fda257b | |||
| 7afc845343 | |||
| 546039aa43 | |||
| e6196ce078 | |||
| eecd5444a6 |
12
.env
@@ -15,7 +15,7 @@
|
|||||||
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
|
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
|
||||||
|
|
||||||
###> symfony/framework-bundle ###
|
###> symfony/framework-bundle ###
|
||||||
APP_ENV=dev
|
APP_ENV=prod
|
||||||
APP_SECRET=
|
APP_SECRET=
|
||||||
###< symfony/framework-bundle ###
|
###< symfony/framework-bundle ###
|
||||||
|
|
||||||
@@ -26,12 +26,18 @@ APP_SECRET=
|
|||||||
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
|
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
|
||||||
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4"
|
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4"
|
||||||
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
|
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
|
||||||
DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8"
|
# DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8"
|
||||||
###< doctrine/doctrine-bundle ###
|
|
||||||
|
|
||||||
|
###< doctrine/doctrine-bundle ###
|
||||||
|
MERCURE_JWT_SECRET="!ChangeThisMercureHubJWTSecretKey!"
|
||||||
###> symfony/messenger ###
|
###> symfony/messenger ###
|
||||||
# Choose one of the transports below
|
# Choose one of the transports below
|
||||||
# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages
|
# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages
|
||||||
# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages
|
# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages
|
||||||
MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
|
MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
|
||||||
###< symfony/messenger ###
|
###< symfony/messenger ###
|
||||||
|
|
||||||
|
REDIS_HOST=redis://redis
|
||||||
|
|
||||||
|
MOVIES_PATH=/var/download/movies
|
||||||
|
TVSHOWS_PATH=/var/download/tvshows
|
||||||
|
|||||||
8
.env.dev
@@ -1,8 +0,0 @@
|
|||||||
DATABASE_URL="mysql://root:password@database:3306/app?serverVersion=10.6.19.2-MariaDB&charset=utf8mb4"
|
|
||||||
APP_SECRET=70169beadfbc8101c393cbfbba27a313
|
|
||||||
|
|
||||||
DOWNLOAD_DIR=./movies
|
|
||||||
MERCURE_URL=http://mercure/.well-known/mercure
|
|
||||||
MERCURE_PUBLIC_URL=https://dev.caldwell.digital/hub/.well-known/mercure
|
|
||||||
MERCURE_JWT_SECRET="!ChangeThisMercureHubJWTSecretKey!"
|
|
||||||
MONITOR_FREQUENCY="* * * * *"
|
|
||||||
31
.env.dist
@@ -1,31 +0,0 @@
|
|||||||
APP_ENV=%%app_env%%
|
|
||||||
APP_SECRET="%%app_secret%%"
|
|
||||||
DATABASE_URL="%%db_url%%"
|
|
||||||
DOWNLOAD_DIR=%%download_dir%%
|
|
||||||
REAL_DEBRID_KEY="%%rd_key%%"
|
|
||||||
TMDB_API=%%tmdb_api%%
|
|
||||||
MERCURE_URL=%%mercure_url%%
|
|
||||||
MERCURE_PUBLIC_URL=%%mercure_public_url%%
|
|
||||||
MERCURE_JWT_SECRET="%%mercure_jwt_secret%%"
|
|
||||||
JELLYFIN_URL=%%jellyfin_url%%
|
|
||||||
JELLYFIN_TOKEN=%%jellyfin_token%%
|
|
||||||
REDIS_HOST="%%redis_host%%"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LDAP_HOST=
|
|
||||||
LDAP_PORT=
|
|
||||||
LDAP_ENCRYPTION=
|
|
||||||
LDAP_BASE_DN=
|
|
||||||
LDAP_BIND_USER=
|
|
||||||
LDAP_BIND_PASS=
|
|
||||||
LDAP_DN_STRING=
|
|
||||||
LDAP_UID_KEY="uid"
|
|
||||||
|
|
||||||
# LDAP group that identifies an Admin
|
|
||||||
# Users with this LDAP group will automatically
|
|
||||||
# get the admin role in this system.
|
|
||||||
LDAP_ADMIN_ROLE_DN="cn=admins,cn=groups,cn=accounts,dc=caldwell,dc=local"
|
|
||||||
LDAP_EMAIL_ATTRIBUTE=mail
|
|
||||||
LDAP_USERNAME_ATTRIBUTE=uid
|
|
||||||
LDAP_NAME_ATTRIBUTE=displayname
|
|
||||||
20
Dockerfile
@@ -1,10 +1,14 @@
|
|||||||
FROM registry.caldwell.digital/library/php:8.4-apache
|
FROM dunglas/frankenphp
|
||||||
|
|
||||||
RUN apt-get update && \
|
ENV SERVER_NAME=":80"
|
||||||
apt-get install libldap2-dev -y && \
|
ENV CADDY_GLOBAL_OPTIONS="auto_https off"
|
||||||
rm -rf /var/lib/apt/lists/* && \
|
ENV APP_RUNTIME="Runtime\\FrankenPhpSymfony\\Runtime"
|
||||||
docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ && \
|
|
||||||
docker-php-ext-install ldap
|
|
||||||
|
|
||||||
COPY ./bash/vhost.conf /etc/apache2/sites-enabled/vhost.conf
|
RUN install-php-extensions \
|
||||||
RUN rm /etc/apache2/sites-enabled/000-default.conf
|
pdo_mysql \
|
||||||
|
gd \
|
||||||
|
intl \
|
||||||
|
zip \
|
||||||
|
opcache
|
||||||
|
|
||||||
|
HEALTHCHECK --interval=3s --timeout=3s --retries=10 CMD [ "php", "/app/bin/console", "startup:status" ]
|
||||||
|
|||||||
@@ -7,5 +7,5 @@ RUN apt-get update && \
|
|||||||
docker-php-ext-install ldap
|
docker-php-ext-install ldap
|
||||||
|
|
||||||
COPY --chown=www-data:www-data . /var/www
|
COPY --chown=www-data:www-data . /var/www
|
||||||
COPY ./bash/vhost.conf /etc/apache2/sites-enabled/vhost.conf
|
COPY bash/nginx.conf /etc/apache2/sites-enabled/vhost.conf
|
||||||
RUN rm /etc/apache2/sites-enabled/000-default.conf
|
RUN rm /etc/apache2/sites-enabled/000-default.conf
|
||||||
|
|||||||
57
README.md
@@ -1,13 +1,50 @@
|
|||||||
# Caldwell Digital - Symfony Template
|
# Torsearch
|
||||||
Get up and running quickly with this Symfony framework template!
|
Torsearch is a "media acquisition tool" that works strictly with Real Debrid. Torsearch makes it easy to search for
|
||||||
|
and download your favorite movies and tv shows. You can think of it like Stremio, but without the streaming. Why the
|
||||||
|
comparison to Stremio? That's because Torsearch uses the same source for media files that Stremio uses: Torrentio
|
||||||
|
(hence the name: Torsearch).
|
||||||
|
|
||||||
|
After two failed attempts at running a media server, I decided to hang up my hat and give up my dream of a self-hosted
|
||||||
|
media server. I figured the days of torrenting were mostly over and everybody ranting & raving about their media collections
|
||||||
|
must be going to Walmart and buying up the bucket of old movies they have. That's until I stumbled across Stremio.
|
||||||
|
|
||||||
|
At first, it seemed too good to be true, but I was yearning for something just sketchy enough to try out. What could
|
||||||
|
go wrong with handing over my card information to an unknown organization across the pond? At the end of the day,
|
||||||
|
the cost benefit analysis landed in my favor, and about 30 minutes after purchasing my Real Debrid subscription and
|
||||||
|
setting up Stremio, I was in business.
|
||||||
|
|
||||||
|
My mind was blown. I might not have the most "cultured" taste in media, but it had everything I searched for and more! After
|
||||||
|
watching a few movies, I noticed the "Copy Download Link" button. "What's this lil guy do?" I asked myself. Duh, it
|
||||||
|
downloads the f*****g movie. And there's the 💡flashing over my head. There's gotta be a way to automate this, I told myself.
|
||||||
|
|
||||||
|
After a month of studying Stremio's code and lots of tinkering, I finally figured it out. Torrentio is the magic behind
|
||||||
|
the scenes. You feed it a Real Debrid API key and an IMDB ID, and it gives you a list of results to download that media.
|
||||||
|
Easy peasy.
|
||||||
|
|
||||||
|
In about an hour I had a proof of concept working. It wasn't pretty, but it wasn't supposed to be. That proof-of-concept
|
||||||
|
has blossomed into the beautiful Torsearch that I've been using nearly every day since then. The code in this repo
|
||||||
|
is a complete re-write of the proof-of-concept that started out ugly and ended up even uglier. Knowing the core functionality
|
||||||
|
required to make it work, I was able to re-write the app with some design patterns in place.
|
||||||
|
|
||||||
|
## Pics or didn't happen
|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
|
## Features
|
||||||
|
- Search for Movies & TV Shows by their name
|
||||||
|
- Download directly to your NAS
|
||||||
|
- Monitor TV Shows for new episodes and automatically download them
|
||||||
|
- Browse popular media and view its download options
|
||||||
|
- LDAP or local auth (OIDC coming soon)
|
||||||
|
|
||||||
|
## Features on the roadmap
|
||||||
|
- Requests - allow users to request new media
|
||||||
|
- OIDC auth
|
||||||
|
- Prometheus logging
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
1. Run `source bash/get_certs.sh` to grab the wildcard certs
|
1. Clone the repo
|
||||||
2. Set the docker image tag in the `bash/build.sh` file
|
|
||||||
3. Set the docker image tag in the `deploy.compose.yml` file
|
|
||||||
4. run `composer install`
|
|
||||||
|
|
||||||
## Optional steps
|
|
||||||
1. Set phing vars
|
|
||||||
2. Update the project name in `build.xml`
|
|
||||||
3. Set a custom development hostname in `bash/vhost.conf`
|
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
echo "> Building ${IMG} for linux/amd64"
|
echo "> Building ${IMG} for linux/amd64"
|
||||||
docker buildx build --platform linux/amd64 -f Dockerfile.prod -t ${IMG} .
|
docker buildx build --platform linux/amd64 -f Dockerfile.app -t "${IMG}-app" .
|
||||||
|
docker buildx build --platform linux/amd64 -f Dockerfile.worker -t "${IMG}-worker" .
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
echo "> Building ${IMG} for linux/arm/v8"
|
echo "> Building ${IMG} for linux/arm/v8"
|
||||||
docker buildx build --platform linux/arm/v8 -f Dockerfile.prod -t ${IMG} .
|
docker buildx build --platform linux/arm/v8 -f Dockerfile.app -t "${IMG}-app" .
|
||||||
|
docker buildx build --platform linux/arm/v8 -f Dockerfile.app -t "${IMG}-worker" .
|
||||||
@@ -1,2 +1,3 @@
|
|||||||
echo "> Pushing ${IMG}"
|
echo "> Pushing ${IMG}"
|
||||||
docker push ${IMG}
|
docker push "${IMG}-app"
|
||||||
|
docker push "${IMG}-worker"
|
||||||
@@ -2,5 +2,5 @@ dev.caldwell.digital:443
|
|||||||
|
|
||||||
tls /etc/ssl/wildcard.crt /etc/ssl/wildcard.pem
|
tls /etc/ssl/wildcard.crt /etc/ssl/wildcard.pem
|
||||||
|
|
||||||
reverse_proxy php:80
|
reverse_proxy app:80
|
||||||
|
|
||||||
|
|||||||
12
bash/entrypoint.sh
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Sleep for a second to ensure DB is awake and ready
|
||||||
|
SLEEP_TIME=$(shuf -i 2-4 -n 1)
|
||||||
|
echo "> Sleeping for ${SLEEP_TIME} seconds to wait for the database"
|
||||||
|
sleep $SLEEP_TIME
|
||||||
|
|
||||||
|
# Provision database
|
||||||
|
php /app/bin/console doctrine:migrations:migrate --no-interaction
|
||||||
|
php /app/bin/console db:seed
|
||||||
|
|
||||||
|
exec docker-php-entrypoint "$@"
|
||||||
32
bash/nginx.conf
Executable file
@@ -0,0 +1,32 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
listen [::]:80;
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
|
root /var/www/public;
|
||||||
|
|
||||||
|
location /hub/ {
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_redirect off;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_pass http://mercure/;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
location / {
|
||||||
|
# try to serve file directly, fallback to index.php
|
||||||
|
try_files $uri /index.php$is_args$args;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
fastcgi_pass unix:/run/php-fpm.sock;
|
||||||
|
fastcgi_split_path_info ^(.+\.php)(/.*)$;
|
||||||
|
fastcgi_buffers 16 16k;
|
||||||
|
fastcgi_buffer_size 32k;
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
||||||
|
fastcgi_param DOCUMENT_ROOT $realpath_root;
|
||||||
|
internal;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
<VirtualHost *:80>
|
|
||||||
ServerName localhost
|
|
||||||
|
|
||||||
DocumentRoot /var/www/public
|
|
||||||
DirectoryIndex /index.php
|
|
||||||
|
|
||||||
<LocationMatch "/hub/">
|
|
||||||
ProxyPass http://mercure:80/
|
|
||||||
ProxyPassReverse http://mercure:80/
|
|
||||||
</LocationMatch>
|
|
||||||
|
|
||||||
<Directory /var/www/public>
|
|
||||||
AllowOverride None
|
|
||||||
Order Allow,Deny
|
|
||||||
Allow from All
|
|
||||||
|
|
||||||
FallbackResource /index.php
|
|
||||||
</Directory>
|
|
||||||
|
|
||||||
<Directory /var/www/public/bundles>
|
|
||||||
FallbackResource disabled
|
|
||||||
</Directory>
|
|
||||||
</VirtualHost>
|
|
||||||
44
compose.yml
@@ -12,6 +12,26 @@ services:
|
|||||||
- $PWD/bash/caddy:/etc/caddy
|
- $PWD/bash/caddy:/etc/caddy
|
||||||
- $PWD/bash/certs:/etc/ssl
|
- $PWD/bash/certs:/etc/ssl
|
||||||
|
|
||||||
|
app:
|
||||||
|
build: .
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
FRANKENPHP_CONFIG: "worker /app/public/index.php"
|
||||||
|
volumes:
|
||||||
|
- $PWD:/app
|
||||||
|
tty: true
|
||||||
|
depends_on:
|
||||||
|
database:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
|
worker:
|
||||||
|
build: .
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- $PWD:/app
|
||||||
|
tty: true
|
||||||
|
command: php /app/bin/console messenger:consume async -vv
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis:latest
|
image: redis:latest
|
||||||
volumes:
|
volumes:
|
||||||
@@ -19,25 +39,6 @@ services:
|
|||||||
command: redis-server --maxmemory 512MB
|
command: redis-server --maxmemory 512MB
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
php:
|
|
||||||
build: .
|
|
||||||
volumes:
|
|
||||||
- ./:/var/www
|
|
||||||
|
|
||||||
worker:
|
|
||||||
build: .
|
|
||||||
volumes:
|
|
||||||
- ./:/var/www
|
|
||||||
- ./var/download:/var/download
|
|
||||||
command: php ./bin/console messenger:consume async -vvv --time-limit=3600
|
|
||||||
|
|
||||||
scheduler:
|
|
||||||
build: .
|
|
||||||
volumes:
|
|
||||||
- ./:/var/www
|
|
||||||
- ./var/download:/var/download
|
|
||||||
command: php ./bin/console messenger:consume scheduler_monitor -vv --time-limit=3600
|
|
||||||
|
|
||||||
mercure:
|
mercure:
|
||||||
image: dunglas/mercure
|
image: dunglas/mercure
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
@@ -67,6 +68,11 @@ services:
|
|||||||
MYSQL_USERNAME: app
|
MYSQL_USERNAME: app
|
||||||
MYSQL_PASSWORD: password
|
MYSQL_PASSWORD: password
|
||||||
MYSQL_ROOT_PASSWORD: password
|
MYSQL_ROOT_PASSWORD: password
|
||||||
|
healthcheck:
|
||||||
|
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
|
||||||
|
interval: 5s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 10
|
||||||
|
|
||||||
adminer:
|
adminer:
|
||||||
image: adminer
|
image: adminer
|
||||||
|
|||||||
@@ -11,15 +11,18 @@
|
|||||||
"aimeos/map": "^3.12",
|
"aimeos/map": "^3.12",
|
||||||
"doctrine/dbal": "^3",
|
"doctrine/dbal": "^3",
|
||||||
"doctrine/doctrine-bundle": "^2.14",
|
"doctrine/doctrine-bundle": "^2.14",
|
||||||
|
"doctrine/doctrine-fixtures-bundle": "^4.1",
|
||||||
"doctrine/doctrine-migrations-bundle": "^3.4",
|
"doctrine/doctrine-migrations-bundle": "^3.4",
|
||||||
"doctrine/orm": "^3.3",
|
"doctrine/orm": "^3.3",
|
||||||
"dragonmantank/cron-expression": "^3.4",
|
"dragonmantank/cron-expression": "^3.4",
|
||||||
|
"league/pipeline": "^1.1",
|
||||||
"nesbot/carbon": "^3.9",
|
"nesbot/carbon": "^3.9",
|
||||||
"nihilarr/parse-torrent-name": "^0.0.1",
|
"nihilarr/parse-torrent-name": "^0.0.1",
|
||||||
"nyholm/psr7": "*",
|
"nyholm/psr7": "*",
|
||||||
"p3k/emoji-detector": "^1.2",
|
"p3k/emoji-detector": "^1.2",
|
||||||
"php-tmdb/api": "^4.1",
|
"php-tmdb/api": "^4.1",
|
||||||
"predis/predis": "^2.4",
|
"predis/predis": "^2.4",
|
||||||
|
"runtime/frankenphp-symfony": "^0.2.0",
|
||||||
"symfony/asset": "7.2.*",
|
"symfony/asset": "7.2.*",
|
||||||
"symfony/console": "7.2.*",
|
"symfony/console": "7.2.*",
|
||||||
"symfony/doctrine-messenger": "7.2.*",
|
"symfony/doctrine-messenger": "7.2.*",
|
||||||
@@ -87,7 +90,7 @@
|
|||||||
"post-update-cmd": [
|
"post-update-cmd": [
|
||||||
"@auto-scripts"
|
"@auto-scripts"
|
||||||
],
|
],
|
||||||
"sym": "docker compose exec php ./bin/console"
|
"sym": "docker compose exec app ./bin/console"
|
||||||
},
|
},
|
||||||
"conflict": {
|
"conflict": {
|
||||||
"symfony/symfony": "*"
|
"symfony/symfony": "*"
|
||||||
|
|||||||
279
composer.lock
generated
@@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "c179718ee29dbe018b93ea7d46764931",
|
"content-hash": "c4ad1f54b8dd44fb55097f631c945460",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "1tomany/rich-bundle",
|
"name": "1tomany/rich-bundle",
|
||||||
@@ -446,6 +446,89 @@
|
|||||||
],
|
],
|
||||||
"time": "2025-03-22T10:17:19+00:00"
|
"time": "2025-03-22T10:17:19+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "doctrine/data-fixtures",
|
||||||
|
"version": "2.0.2",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/doctrine/data-fixtures.git",
|
||||||
|
"reference": "f7f1e12d6bceb58c204b3e77210a103c1c57601e"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/doctrine/data-fixtures/zipball/f7f1e12d6bceb58c204b3e77210a103c1c57601e",
|
||||||
|
"reference": "f7f1e12d6bceb58c204b3e77210a103c1c57601e",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"doctrine/persistence": "^3.1 || ^4.0",
|
||||||
|
"php": "^8.1",
|
||||||
|
"psr/log": "^1.1 || ^2 || ^3"
|
||||||
|
},
|
||||||
|
"conflict": {
|
||||||
|
"doctrine/dbal": "<3.5 || >=5",
|
||||||
|
"doctrine/orm": "<2.14 || >=4",
|
||||||
|
"doctrine/phpcr-odm": "<1.3.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"doctrine/coding-standard": "^12",
|
||||||
|
"doctrine/dbal": "^3.5 || ^4",
|
||||||
|
"doctrine/mongodb-odm": "^1.3.0 || ^2.0.0",
|
||||||
|
"doctrine/orm": "^2.14 || ^3",
|
||||||
|
"ext-sqlite3": "*",
|
||||||
|
"fig/log-test": "^1",
|
||||||
|
"phpstan/phpstan": "^1.10",
|
||||||
|
"phpunit/phpunit": "^10.5.3",
|
||||||
|
"symfony/cache": "^6.4 || ^7",
|
||||||
|
"symfony/var-exporter": "^6.4 || ^7"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"alcaeus/mongo-php-adapter": "For using MongoDB ODM 1.3 with PHP 7 (deprecated)",
|
||||||
|
"doctrine/mongodb-odm": "For loading MongoDB ODM fixtures",
|
||||||
|
"doctrine/orm": "For loading ORM fixtures",
|
||||||
|
"doctrine/phpcr-odm": "For loading PHPCR ODM fixtures"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Doctrine\\Common\\DataFixtures\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Jonathan Wage",
|
||||||
|
"email": "jonwage@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Data Fixtures for all Doctrine Object Managers",
|
||||||
|
"homepage": "https://www.doctrine-project.org",
|
||||||
|
"keywords": [
|
||||||
|
"database"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/doctrine/data-fixtures/issues",
|
||||||
|
"source": "https://github.com/doctrine/data-fixtures/tree/2.0.2"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://www.doctrine-project.org/sponsorship.html",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://www.patreon.com/phpdoctrine",
|
||||||
|
"type": "patreon"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdata-fixtures",
|
||||||
|
"type": "tidelift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2025-01-21T13:21:31+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "doctrine/dbal",
|
"name": "doctrine/dbal",
|
||||||
"version": "3.9.4",
|
"version": "3.9.4",
|
||||||
@@ -727,6 +810,92 @@
|
|||||||
],
|
],
|
||||||
"time": "2025-03-22T17:28:21+00:00"
|
"time": "2025-03-22T17:28:21+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "doctrine/doctrine-fixtures-bundle",
|
||||||
|
"version": "4.1.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/doctrine/DoctrineFixturesBundle.git",
|
||||||
|
"reference": "a06db6b81ff20a2980bf92063d80c013bb8b4b7c"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/doctrine/DoctrineFixturesBundle/zipball/a06db6b81ff20a2980bf92063d80c013bb8b4b7c",
|
||||||
|
"reference": "a06db6b81ff20a2980bf92063d80c013bb8b4b7c",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"doctrine/data-fixtures": "^2.0",
|
||||||
|
"doctrine/doctrine-bundle": "^2.2",
|
||||||
|
"doctrine/orm": "^2.14.0 || ^3.0",
|
||||||
|
"doctrine/persistence": "^2.4 || ^3.0 || ^4.0",
|
||||||
|
"php": "^8.1",
|
||||||
|
"psr/log": "^2 || ^3",
|
||||||
|
"symfony/config": "^6.4 || ^7.0",
|
||||||
|
"symfony/console": "^6.4 || ^7.0",
|
||||||
|
"symfony/dependency-injection": "^6.4 || ^7.0",
|
||||||
|
"symfony/deprecation-contracts": "^2.1 || ^3",
|
||||||
|
"symfony/doctrine-bridge": "^6.4.16 || ^7.1.9",
|
||||||
|
"symfony/http-kernel": "^6.4 || ^7.0"
|
||||||
|
},
|
||||||
|
"conflict": {
|
||||||
|
"doctrine/dbal": "< 3"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"doctrine/coding-standard": "13.0.0",
|
||||||
|
"phpstan/phpstan": "2.1.11",
|
||||||
|
"phpunit/phpunit": "^10.5.38 || 11.4.14"
|
||||||
|
},
|
||||||
|
"type": "symfony-bundle",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Doctrine\\Bundle\\FixturesBundle\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Fabien Potencier",
|
||||||
|
"email": "fabien@symfony.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Doctrine Project",
|
||||||
|
"homepage": "https://www.doctrine-project.org"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Symfony DoctrineFixturesBundle",
|
||||||
|
"homepage": "https://www.doctrine-project.org",
|
||||||
|
"keywords": [
|
||||||
|
"Fixture",
|
||||||
|
"persistence"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/doctrine/DoctrineFixturesBundle/issues",
|
||||||
|
"source": "https://github.com/doctrine/DoctrineFixturesBundle/tree/4.1.0"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://www.doctrine-project.org/sponsorship.html",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://www.patreon.com/phpdoctrine",
|
||||||
|
"type": "patreon"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdoctrine-fixtures-bundle",
|
||||||
|
"type": "tidelift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2025-03-26T10:56:26+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "doctrine/doctrine-migrations-bundle",
|
"name": "doctrine/doctrine-migrations-bundle",
|
||||||
"version": "3.4.1",
|
"version": "3.4.1",
|
||||||
@@ -1623,6 +1792,62 @@
|
|||||||
],
|
],
|
||||||
"time": "2025-01-26T21:29:45+00:00"
|
"time": "2025-01-26T21:29:45+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "league/pipeline",
|
||||||
|
"version": "1.1.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/thephpleague/pipeline.git",
|
||||||
|
"reference": "9069ddfdbd5582f8a563e00cffdbeffb9a0acd01"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/thephpleague/pipeline/zipball/9069ddfdbd5582f8a563e00cffdbeffb9a0acd01",
|
||||||
|
"reference": "9069ddfdbd5582f8a563e00cffdbeffb9a0acd01",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": "^8.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "^9.0 || ^10.0 || ^11.5"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"League\\Pipeline\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Frank de Jonge",
|
||||||
|
"email": "info@frenky.net",
|
||||||
|
"role": "Author"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Woody Gilk",
|
||||||
|
"email": "woody.gilk@gmail.com",
|
||||||
|
"role": "Maintainer"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "A plug and play pipeline implementation.",
|
||||||
|
"keywords": [
|
||||||
|
"composition",
|
||||||
|
"design pattern",
|
||||||
|
"pattern",
|
||||||
|
"pipeline",
|
||||||
|
"sequential"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/thephpleague/pipeline/issues",
|
||||||
|
"source": "https://github.com/thephpleague/pipeline/tree/1.1.0"
|
||||||
|
},
|
||||||
|
"time": "2025-02-06T08:48:15+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "nesbot/carbon",
|
"name": "nesbot/carbon",
|
||||||
"version": "3.9.1",
|
"version": "3.9.1",
|
||||||
@@ -3075,6 +3300,58 @@
|
|||||||
},
|
},
|
||||||
"time": "2021-10-29T13:26:27+00:00"
|
"time": "2021-10-29T13:26:27+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "runtime/frankenphp-symfony",
|
||||||
|
"version": "0.2.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/php-runtime/frankenphp-symfony.git",
|
||||||
|
"reference": "56822c3631d9522a3136a4c33082d006bdfe4bad"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/php-runtime/frankenphp-symfony/zipball/56822c3631d9522a3136a4c33082d006bdfe4bad",
|
||||||
|
"reference": "56822c3631d9522a3136a4c33082d006bdfe4bad",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=8.1",
|
||||||
|
"symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0",
|
||||||
|
"symfony/http-kernel": "^5.4 || ^6.0 || ^7.0",
|
||||||
|
"symfony/runtime": "^5.4 || ^6.0 || ^7.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "^9.5"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Runtime\\FrankenPhpSymfony\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Kévin Dunglas",
|
||||||
|
"email": "kevin@dunglas.dev"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "FrankenPHP runtime for Symfony",
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/php-runtime/frankenphp-symfony/issues",
|
||||||
|
"source": "https://github.com/php-runtime/frankenphp-symfony/tree/0.2.0"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://github.com/nyholm",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2023-12-12T12:06:11+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/asset",
|
"name": "symfony/asset",
|
||||||
"version": "v7.2.0",
|
"version": "v7.2.0",
|
||||||
|
|||||||
@@ -17,4 +17,5 @@ return [
|
|||||||
Symfony\Bundle\MercureBundle\MercureBundle::class => ['all' => true],
|
Symfony\Bundle\MercureBundle\MercureBundle::class => ['all' => true],
|
||||||
Symfony\UX\Turbo\TurboBundle::class => ['all' => true],
|
Symfony\UX\Turbo\TurboBundle::class => ['all' => true],
|
||||||
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
|
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
|
||||||
|
Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true],
|
||||||
];
|
];
|
||||||
|
|||||||
1
config/dist/ldap.security.yaml
vendored
@@ -38,6 +38,7 @@ security:
|
|||||||
# Easy way to control access for large sections of your site
|
# Easy way to control access for large sections of your site
|
||||||
# Note: Only the *first* access control that matches will be used
|
# Note: Only the *first* access control that matches will be used
|
||||||
access_control:
|
access_control:
|
||||||
|
- { path: ^/getting-started, roles: PUBLIC_ACCESS }
|
||||||
- { path: ^/register, roles: PUBLIC_ACCESS }
|
- { path: ^/register, roles: PUBLIC_ACCESS }
|
||||||
- { path: ^/login, roles: PUBLIC_ACCESS }
|
- { path: ^/login, roles: PUBLIC_ACCESS }
|
||||||
- { path: ^/, roles: ROLE_USER } # Or ROLE_ADMIN, ROLE_SUPER_ADMIN,
|
- { path: ^/, roles: ROLE_USER } # Or ROLE_ADMIN, ROLE_SUPER_ADMIN,
|
||||||
|
|||||||
1
config/dist/local.security.yaml
vendored
@@ -36,6 +36,7 @@ security:
|
|||||||
# Easy way to control access for large sections of your site
|
# Easy way to control access for large sections of your site
|
||||||
# Note: Only the *first* access control that matches will be used
|
# Note: Only the *first* access control that matches will be used
|
||||||
access_control:
|
access_control:
|
||||||
|
- { path: ^/getting-started, roles: PUBLIC_ACCESS }
|
||||||
- { path: ^/register, roles: PUBLIC_ACCESS }
|
- { path: ^/register, roles: PUBLIC_ACCESS }
|
||||||
- { path: ^/login, roles: PUBLIC_ACCESS }
|
- { path: ^/login, roles: PUBLIC_ACCESS }
|
||||||
- { path: ^/, roles: ROLE_USER } # Or ROLE_ADMIN, ROLE_SUPER_ADMIN,
|
- { path: ^/, roles: ROLE_USER } # Or ROLE_ADMIN, ROLE_SUPER_ADMIN,
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ framework:
|
|||||||
|
|
||||||
# Redis
|
# Redis
|
||||||
app: cache.adapter.redis
|
app: cache.adapter.redis
|
||||||
default_redis_provider: '%env(REDIS_HOST)%'
|
default_redis_provider: '%app.cache.redis.host%'
|
||||||
|
|
||||||
# APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues)
|
# APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues)
|
||||||
#app: cache.adapter.apcu
|
#app: cache.adapter.apcu
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
mercure:
|
mercure:
|
||||||
hubs:
|
hubs:
|
||||||
default:
|
default:
|
||||||
url: '%env(MERCURE_URL)%'
|
url: '%app.mercure.url%'
|
||||||
public_url: '%env(MERCURE_PUBLIC_URL)%'
|
public_url: '%app.mercure.public_url%'
|
||||||
jwt:
|
jwt:
|
||||||
secret: '%env(MERCURE_JWT_SECRET)%'
|
secret: '%env(MERCURE_JWT_SECRET)%'
|
||||||
publish: '*'
|
publish: '*'
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ framework:
|
|||||||
'App\Monitor\Action\Command\MonitorTvSeasonCommand': async
|
'App\Monitor\Action\Command\MonitorTvSeasonCommand': async
|
||||||
'App\Monitor\Action\Command\MonitorTvShowCommand': async
|
'App\Monitor\Action\Command\MonitorTvShowCommand': async
|
||||||
'App\Monitor\Action\Command\MonitorMovieCommand': async
|
'App\Monitor\Action\Command\MonitorMovieCommand': async
|
||||||
|
'App\Torrentio\Action\Command\GetTvShowOptionsCommand': async
|
||||||
|
|
||||||
# when@test:
|
# when@test:
|
||||||
# framework:
|
# framework:
|
||||||
|
|||||||
@@ -19,13 +19,11 @@ security:
|
|||||||
security: false
|
security: false
|
||||||
main:
|
main:
|
||||||
lazy: true
|
lazy: true
|
||||||
provider: app_ldap
|
provider: app_local
|
||||||
form_login_ldap:
|
form_login:
|
||||||
login_path: app_login
|
login_path: app_login
|
||||||
check_path: app_login
|
check_path: app_login
|
||||||
enable_csrf: true
|
enable_csrf: true
|
||||||
service: Symfony\Component\Ldap\Ldap
|
|
||||||
dn_string: '%env(LDAP_DN_STRING)%'
|
|
||||||
logout:
|
logout:
|
||||||
path: app_logout
|
path: app_logout
|
||||||
|
|
||||||
@@ -38,6 +36,7 @@ security:
|
|||||||
# Easy way to control access for large sections of your site
|
# Easy way to control access for large sections of your site
|
||||||
# Note: Only the *first* access control that matches will be used
|
# Note: Only the *first* access control that matches will be used
|
||||||
access_control:
|
access_control:
|
||||||
|
- { path: ^/getting-started, roles: PUBLIC_ACCESS }
|
||||||
- { path: ^/register, roles: PUBLIC_ACCESS }
|
- { path: ^/register, roles: PUBLIC_ACCESS }
|
||||||
- { path: ^/login, roles: PUBLIC_ACCESS }
|
- { path: ^/login, roles: PUBLIC_ACCESS }
|
||||||
- { path: ^/, roles: ROLE_USER } # Or ROLE_ADMIN, ROLE_SUPER_ADMIN,
|
- { path: ^/, roles: ROLE_USER } # Or ROLE_ADMIN, ROLE_SUPER_ADMIN,
|
||||||
|
|||||||
@@ -4,11 +4,22 @@
|
|||||||
# Put parameters here that don't need to change on each machine where the app is deployed
|
# Put parameters here that don't need to change on each machine where the app is deployed
|
||||||
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
|
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
|
||||||
parameters:
|
parameters:
|
||||||
|
# Media
|
||||||
media.default_movies_dir: movies
|
media.default_movies_dir: movies
|
||||||
media.default_tvshows_dir: tvshows
|
media.default_tvshows_dir: tvshows
|
||||||
media.movies_path: '/var/download/%env(default:media.default_movies_dir:MOVIES_PATH)%'
|
media.movies_path: '%env(default:media.default_movies_dir:MOVIES_PATH)%'
|
||||||
media.tvshows_path: '/var/download/%env(default:media.default_tvshows_dir:TVSHOWS_PATH)%'
|
media.tvshows_path: '/var/download/%env(default:media.default_tvshows_dir:TVSHOWS_PATH)%'
|
||||||
|
|
||||||
|
# Mercure
|
||||||
|
app.mercure.url: 'http://mercure/.well-known/mercure'
|
||||||
|
app.mercure.public_url: '%env(APP_URL)%/hub/.well-known/mercure'
|
||||||
|
|
||||||
|
# Cache
|
||||||
|
app.cache.adapter: '%env(default:app.cache.adapter.default:CACHE_ADAPTER)%'
|
||||||
|
app.cache.redis.host: '%env(default:app.cache.redis.host.default:REDIS_HOST)%'
|
||||||
|
app.cache.adapter.default: 'filesystem'
|
||||||
|
app.cache.redis.host.default: 'redis://redis'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
# default configuration for services in *this* file
|
# default configuration for services in *this* file
|
||||||
_defaults:
|
_defaults:
|
||||||
@@ -36,6 +47,7 @@ services:
|
|||||||
# LDAP
|
# LDAP
|
||||||
App\User\Framework\Security\LdapUserProvider:
|
App\User\Framework\Security\LdapUserProvider:
|
||||||
arguments:
|
arguments:
|
||||||
|
$registerLdapUserHandler: '@App\User\Action\Handler\RegisterLdapUserHandler'
|
||||||
$userRepository: '@App\User\Framework\Repository\UserRepository'
|
$userRepository: '@App\User\Framework\Repository\UserRepository'
|
||||||
$ldap: '@Symfony\Component\Ldap\LdapInterface'
|
$ldap: '@Symfony\Component\Ldap\LdapInterface'
|
||||||
$baseDn: '%env(LDAP_BASE_DN)%'
|
$baseDn: '%env(LDAP_BASE_DN)%'
|
||||||
|
|||||||
@@ -1,30 +1,41 @@
|
|||||||
services:
|
services:
|
||||||
php:
|
app:
|
||||||
image: registry.caldwell.digital/home/torsearch/app:${TAG}
|
image: registry.caldwell.digital/home/torsearch-app:latest
|
||||||
ports:
|
ports:
|
||||||
- "8001:80"
|
- '8001:80'
|
||||||
deploy:
|
deploy:
|
||||||
replicas: 2
|
replicas: 2
|
||||||
|
depends_on:
|
||||||
|
- database
|
||||||
|
|
||||||
|
|
||||||
worker:
|
worker:
|
||||||
image: registry.caldwell.digital/home/torsearch/app:${TAG}
|
image: registry.caldwell.digital/home/torsearch-worker:latest
|
||||||
volumes:
|
volumes:
|
||||||
- /mnt/media/downloads:/var/download
|
- /mnt/media/downloads/movies:/var/download/movies
|
||||||
command: php ./bin/console messenger:consume async -v --time-limit=3600 --limit=10
|
- /mnt/media/downloads/tvshows:/var/download/tvshows
|
||||||
|
restart: always
|
||||||
|
command: -vv
|
||||||
deploy:
|
deploy:
|
||||||
replicas: 2
|
replicas: 4
|
||||||
|
depends_on:
|
||||||
|
- app
|
||||||
|
|
||||||
|
|
||||||
scheduler:
|
scheduler:
|
||||||
image: registry.caldwell.digital/home/torsearch/app:${TAG}
|
image: registry.caldwell.digital/home/torsearch-scheduler:latest
|
||||||
volumes:
|
volumes:
|
||||||
- /mnt/media/downloads:/var/download
|
- ./downloads:/var/download
|
||||||
command: php ./bin/console messenger:consume scheduler_monitor -vv --time-limit=3600
|
restart: always
|
||||||
|
depends_on:
|
||||||
|
- app
|
||||||
|
|
||||||
|
|
||||||
mercure:
|
mercure:
|
||||||
image: dunglas/mercure
|
image: dunglas/mercure
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- "3000:80"
|
- "3001:80"
|
||||||
environment:
|
environment:
|
||||||
SERVER_NAME: ':80'
|
SERVER_NAME: ':80'
|
||||||
MERCURE_PUBLISHER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'
|
MERCURE_PUBLISHER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'
|
||||||
@@ -37,6 +48,34 @@ services:
|
|||||||
- mercure_data:/data
|
- mercure_data:/data
|
||||||
- mercure_config:/config
|
- mercure_config:/config
|
||||||
|
|
||||||
|
|
||||||
|
database:
|
||||||
|
image: mariadb:10.11.2
|
||||||
|
volumes:
|
||||||
|
- mysql:/var/lib/mysql
|
||||||
|
environment:
|
||||||
|
MYSQL_DATABASE: app
|
||||||
|
MYSQL_USERNAME: app
|
||||||
|
MYSQL_PASSWORD: password
|
||||||
|
MYSQL_ROOT_PASSWORD: password
|
||||||
|
healthcheck:
|
||||||
|
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
|
||||||
|
interval: 5s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 10
|
||||||
|
|
||||||
|
|
||||||
|
redis:
|
||||||
|
image: redis:latest
|
||||||
|
volumes:
|
||||||
|
- redis_data:/data
|
||||||
|
command: redis-server --maxmemory 512MB
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
|
mysql:
|
||||||
mercure_config:
|
mercure_config:
|
||||||
mercure_data:
|
mercure_data:
|
||||||
|
redis_data:
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ assets
|
|||||||
bash
|
bash
|
||||||
bin
|
bin
|
||||||
config
|
config
|
||||||
|
docker
|
||||||
migrations
|
migrations
|
||||||
public
|
public
|
||||||
src
|
src
|
||||||
|
|||||||
22
docker/Dockerfile.app
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
FROM dunglas/frankenphp
|
||||||
|
|
||||||
|
ENV FRANKENPHP_CONFIG="worker /app/public/index.php 20"
|
||||||
|
ENV SERVER_NAME=":80"
|
||||||
|
ENV CADDY_GLOBAL_OPTIONS="auto_https off"
|
||||||
|
ENV APP_RUNTIME="Runtime\\FrankenPhpSymfony\\Runtime"
|
||||||
|
|
||||||
|
RUN install-php-extensions \
|
||||||
|
pdo_mysql \
|
||||||
|
gd \
|
||||||
|
intl \
|
||||||
|
zip \
|
||||||
|
opcache
|
||||||
|
|
||||||
|
COPY . /app
|
||||||
|
COPY --chmod=775 ./bash/entrypoint.sh /usr/local/bin/docker-entrypoint
|
||||||
|
|
||||||
|
ENTRYPOINT [ "/usr/local/bin/docker-entrypoint" ]
|
||||||
|
|
||||||
|
CMD [ "frankenphp", "run", "--config", "/etc/caddy/Caddyfile" ]
|
||||||
|
|
||||||
|
HEALTHCHECK --interval=3s --timeout=3s --retries=10 CMD [ "php", "/app/bin/console", "startup:status" ]
|
||||||
16
docker/Dockerfile.scheduler
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
FROM dunglas/frankenphp
|
||||||
|
|
||||||
|
ENV SERVER_NAME=":80"
|
||||||
|
ENV CADDY_GLOBAL_OPTIONS="auto_https off"
|
||||||
|
ENV APP_RUNTIME="Runtime\\FrankenPhpSymfony\\Runtime"
|
||||||
|
|
||||||
|
RUN install-php-extensions \
|
||||||
|
pdo_mysql \
|
||||||
|
gd \
|
||||||
|
intl \
|
||||||
|
zip \
|
||||||
|
opcache
|
||||||
|
|
||||||
|
COPY . /app
|
||||||
|
|
||||||
|
ENTRYPOINT [ "php", "/app/bin/console", "messenger:consume", "schedule_monitor" ]
|
||||||
18
docker/Dockerfile.worker
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
FROM dunglas/frankenphp:php8.4-alpine
|
||||||
|
|
||||||
|
ENV SERVER_NAME=":80"
|
||||||
|
ENV CADDY_GLOBAL_OPTIONS="auto_https off"
|
||||||
|
ENV APP_RUNTIME="Runtime\\FrankenPhpSymfony\\Runtime"
|
||||||
|
|
||||||
|
RUN install-php-extensions \
|
||||||
|
pdo_mysql \
|
||||||
|
gd \
|
||||||
|
intl \
|
||||||
|
zip \
|
||||||
|
opcache
|
||||||
|
|
||||||
|
COPY . /app
|
||||||
|
|
||||||
|
ENTRYPOINT [ "php", "/app/bin/console", "messenger:consume", "async" ]
|
||||||
|
|
||||||
|
HEALTHCHECK --interval=3s --timeout=3s --retries=10 CMD return 0
|
||||||
9
docker/app/supervisord.conf
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
[program:messenger-consume]
|
||||||
|
command=php /var/www/bin/console messenger:consume async --time-limit=3600
|
||||||
|
user=nobody
|
||||||
|
numprocs=2
|
||||||
|
startsecs=0
|
||||||
|
autostart=true
|
||||||
|
autorestart=true
|
||||||
|
startretries=10
|
||||||
|
process_name=%(program_name)s_%(process_num)02d
|
||||||
57
docs/examples/.env
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
# App must be served over HTTPS (requirement of Mercure)
|
||||||
|
# Either serve behind an SSL terminating reverse proxy
|
||||||
|
# or pass your certificates into the 'app' container.
|
||||||
|
# Please omit any trailing slashes. The APP_URL is
|
||||||
|
# used to generate the Mercure URL behind the scenes.
|
||||||
|
APP_URL="https://torsearch.idocode.io"
|
||||||
|
APP_SECRET="70169beadfbc8101c393cbfbba27a313"
|
||||||
|
APP_ENV=prod
|
||||||
|
|
||||||
|
# Use the DATABASE_URL below to use the MariaDB container
|
||||||
|
# provided in the example.compose.yml file, or remove this
|
||||||
|
# line and fill in the details of your own MySQL/MariaDB server
|
||||||
|
DATABASE_URL="mysql://root:password@database:3306/app?serverVersion=10.6.19.2-MariaDB&charset=utf8mb4"
|
||||||
|
|
||||||
|
# Fill in your MySQL/MariaDB connection details
|
||||||
|
#DATABASE_URL="mysql://<mysql user>:<mysql pass>@<mysql host>:3306/<mysql db name>?serverVersion=10.6.19.2-MariaDB&charset=utf8mb4"
|
||||||
|
|
||||||
|
# Enter your Real Debrid API key
|
||||||
|
# This key is never saved anywhere
|
||||||
|
# else and is passed to Torrentio
|
||||||
|
# to retrieve download options
|
||||||
|
#REAL_DEBRID_KEY=""
|
||||||
|
|
||||||
|
# Enter you TMDB API key
|
||||||
|
# This is used to provide rich search results
|
||||||
|
# when searching for media and rendering the
|
||||||
|
# Popular Movies and TV Shows section.
|
||||||
|
#TMDB_API=
|
||||||
|
|
||||||
|
REAL_DEBRID_KEY="QYYBR7OSQ4VEFKWASDEZ2B4VO67KHUJY6IWOT7HHA7ATXO7QCYDQ"
|
||||||
|
TMDB_API=eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiI0ZTJjYjJhOGUzOGJhNjdiNjVhOGU1NGM0ZWI1MzhmOCIsIm5iZiI6MTczNzkyNjA0NC41NjQsInN1YiI6IjY3OTZhNTljYzdiMDFiNzJjNzIzZWM5YiIsInNjb3BlcyI6WyJhcGlfcmVhZCJdLCJ2ZXJzaW9uIjoxfQ.e8DbNe9qrSBC1y-ANRv-VWBAtls-ZS2r7aNCiI68mpw
|
||||||
|
|
||||||
|
|
||||||
|
MERCURE_JWT_SECRET="!ChangeThisMercureHubJWTSecretKey!"
|
||||||
|
|
||||||
|
# Use your own Redis instance or use the
|
||||||
|
# below value to use the container included
|
||||||
|
# in the example compose.yml file.
|
||||||
|
REDIS_HOST="redis://redis"
|
||||||
|
|
||||||
|
# LDAP Config: To use LDAP, enter the below fields
|
||||||
|
# and run 'php bin/console config:set auth.method ldap'
|
||||||
|
LDAP_HOST=
|
||||||
|
LDAP_PORT=
|
||||||
|
LDAP_ENCRYPTION=
|
||||||
|
LDAP_BASE_DN=
|
||||||
|
LDAP_BIND_USER=
|
||||||
|
LDAP_BIND_PASS=
|
||||||
|
LDAP_DN_STRING=
|
||||||
|
LDAP_UID_KEY="uid"
|
||||||
|
# LDAP group that identifies an Admin
|
||||||
|
# Users with this LDAP group will automatically
|
||||||
|
# get the admin role in this system.
|
||||||
|
LDAP_ADMIN_ROLE_DN=""
|
||||||
|
LDAP_EMAIL_ATTRIBUTE=mail
|
||||||
|
LDAP_USERNAME_ATTRIBUTE=uid
|
||||||
|
LDAP_NAME_ATTRIBUTE=displayname
|
||||||
108
docs/examples/compose.yml
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
services:
|
||||||
|
# The "entrypoint" into the application. This reverse proxy
|
||||||
|
# proxies traffic back to their respective services. If not
|
||||||
|
# running behind a reverse proxy inject your SSL certificates
|
||||||
|
# into this container.
|
||||||
|
# This container runs the actual web app in a php:8.4-fpm
|
||||||
|
# base container.
|
||||||
|
app:
|
||||||
|
image: code.caldwell.digital/home/torsearch-app:latest
|
||||||
|
ports:
|
||||||
|
- '8006:80'
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
depends_on:
|
||||||
|
database:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
|
# Downloads happen in this container. Replicate this
|
||||||
|
# container to run multiple downloads simultaneously.
|
||||||
|
# Map your "movies" folder to /var/download/movies
|
||||||
|
# Map your "TV shows" folder to /var/download/tvshows
|
||||||
|
# If your folders are on another machine, use an NFS volume.
|
||||||
|
# This container runs a Symfony worker process.
|
||||||
|
# See: https://symfony.com/doc/current/messenger.html
|
||||||
|
worker:
|
||||||
|
image: code.caldwell.digital/home/torsearch-worker:latest
|
||||||
|
volumes:
|
||||||
|
- /mnt/media/downloads/movies:/var/download/movies
|
||||||
|
- /mnt/media/downloads/tvshows:/var/download/tvshows
|
||||||
|
command: -vvv
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
restart: always
|
||||||
|
depends_on:
|
||||||
|
app:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
|
# This container handles the monitoring for new media. When new
|
||||||
|
# monitors are added, jobs are periodically dispatched to this
|
||||||
|
# container, and the desired media is searched for and downloaded.
|
||||||
|
# This container runs a Symfony worker process.
|
||||||
|
# See: https://symfony.com/doc/current/messenger.html
|
||||||
|
scheduler:
|
||||||
|
image: code.caldwell.digital/home/torsearch-scheduler:latest
|
||||||
|
volumes:
|
||||||
|
- ./downloads:/var/download
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
restart: always
|
||||||
|
depends_on:
|
||||||
|
app:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
|
# This container facilitates viewing the progress of downloads
|
||||||
|
# in realtime. It also handles sending alerts and notifications.
|
||||||
|
# The MERCURE_PUBLISHER_JWT key & MERCURE_SUBSCRIBER_JWT_KEY should
|
||||||
|
# match the MERCURE_JWT_SECRET environment variable.
|
||||||
|
mercure:
|
||||||
|
image: dunglas/mercure
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "3001:80"
|
||||||
|
environment:
|
||||||
|
SERVER_NAME: ':80'
|
||||||
|
MERCURE_PUBLISHER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'
|
||||||
|
MERCURE_SUBSCRIBER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'
|
||||||
|
MERCURE_EXTRA_DIRECTIVES: |
|
||||||
|
cors_origins *
|
||||||
|
anonymous
|
||||||
|
command: /usr/bin/caddy run --config /etc/caddy/dev.Caddyfile
|
||||||
|
volumes:
|
||||||
|
- mercure_data:/data
|
||||||
|
- mercure_config:/config
|
||||||
|
|
||||||
|
database:
|
||||||
|
image: mariadb:10.11.2
|
||||||
|
volumes:
|
||||||
|
- mysql:/var/lib/mysql
|
||||||
|
environment:
|
||||||
|
MYSQL_DATABASE: app
|
||||||
|
MYSQL_USERNAME: app
|
||||||
|
MYSQL_PASSWORD: password
|
||||||
|
MYSQL_ROOT_PASSWORD: password
|
||||||
|
healthcheck:
|
||||||
|
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
|
||||||
|
interval: 5s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 10
|
||||||
|
|
||||||
|
redis:
|
||||||
|
image: redis:latest
|
||||||
|
volumes:
|
||||||
|
- redis_data:/data
|
||||||
|
command: redis-server --maxmemory 512MB
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
# **Optional**
|
||||||
|
# Provides a simple method of viewing the database
|
||||||
|
adminer:
|
||||||
|
image: adminer
|
||||||
|
ports:
|
||||||
|
- "8081:8080"
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
mysql:
|
||||||
|
mercure_config:
|
||||||
|
mercure_data:
|
||||||
|
redis_data:
|
||||||
115
docs/examples/swarm.compose.yml
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
services:
|
||||||
|
# The "entrypoint" into the application. This reverse proxy
|
||||||
|
# proxies traffic back to their respective services. If not
|
||||||
|
# running behind a reverse proxy inject your SSL certificates
|
||||||
|
# into this container.
|
||||||
|
# This container runs the actual web app in a php:8.4-fpm
|
||||||
|
# base container.
|
||||||
|
app:
|
||||||
|
image: code.caldwell.digital/home/torsearch-app:latest
|
||||||
|
ports:
|
||||||
|
- '8006:80'
|
||||||
|
configs:
|
||||||
|
- env_file
|
||||||
|
deploy:
|
||||||
|
replicas: 2
|
||||||
|
depends_on:
|
||||||
|
- database
|
||||||
|
|
||||||
|
# Downloads happen in this container. Replicate this
|
||||||
|
# container to run multiple downloads simultaneously.
|
||||||
|
# Map your "movies" folder to /var/download/movies
|
||||||
|
# Map your "TV shows" folder to /var/download/tvshows
|
||||||
|
# If your folders are on another machine, use an NFS volume.
|
||||||
|
# This container runs a Symfony worker process.
|
||||||
|
# See: https://symfony.com/doc/current/messenger.html
|
||||||
|
worker:
|
||||||
|
image: code.caldwell.digital/home/torsearch-worker:latest
|
||||||
|
configs:
|
||||||
|
- source: env_file
|
||||||
|
target: /app/bin/.env.local
|
||||||
|
volumes:
|
||||||
|
- /mnt/media/downloads/movies:/var/download/movies
|
||||||
|
- /mnt/media/downloads/tvshows:/var/download/tvshows
|
||||||
|
restart: always
|
||||||
|
command: -vv
|
||||||
|
deploy:
|
||||||
|
replicas: 4
|
||||||
|
depends_on:
|
||||||
|
- app
|
||||||
|
|
||||||
|
# This container handles the monitoring for new media. When new
|
||||||
|
# monitors are added, jobs are periodically dispatched to this
|
||||||
|
# container, and the desired media is searched for and downloaded.
|
||||||
|
# This container runs a Symfony worker process.
|
||||||
|
# See: https://symfony.com/doc/current/messenger.html
|
||||||
|
scheduler:
|
||||||
|
image: code.caldwell.digital/home/torsearch-scheduler:latest
|
||||||
|
configs:
|
||||||
|
- env_file
|
||||||
|
volumes:
|
||||||
|
- ./downloads:/var/download
|
||||||
|
restart: always
|
||||||
|
depends_on:
|
||||||
|
- app
|
||||||
|
|
||||||
|
# This container facilitates viewing the progress of downloads
|
||||||
|
# in realtime. It also handles sending alerts and notifications.
|
||||||
|
# The MERCURE_PUBLISHER_JWT key & MERCURE_SUBSCRIBER_JWT_KEY should
|
||||||
|
# match the MERCURE_JWT_SECRET environment variable.
|
||||||
|
mercure:
|
||||||
|
image: dunglas/mercure
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "3001:80"
|
||||||
|
environment:
|
||||||
|
SERVER_NAME: ':80'
|
||||||
|
MERCURE_PUBLISHER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'
|
||||||
|
MERCURE_SUBSCRIBER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'
|
||||||
|
MERCURE_EXTRA_DIRECTIVES: |
|
||||||
|
cors_origins *
|
||||||
|
anonymous
|
||||||
|
command: /usr/bin/caddy run --config /etc/caddy/dev.Caddyfile
|
||||||
|
volumes:
|
||||||
|
- mercure_data:/data
|
||||||
|
- mercure_config:/config
|
||||||
|
|
||||||
|
database:
|
||||||
|
image: mariadb:10.11.2
|
||||||
|
volumes:
|
||||||
|
- mysql:/var/lib/mysql
|
||||||
|
environment:
|
||||||
|
MYSQL_DATABASE: app
|
||||||
|
MYSQL_USERNAME: app
|
||||||
|
MYSQL_PASSWORD: password
|
||||||
|
MYSQL_ROOT_PASSWORD: password
|
||||||
|
healthcheck:
|
||||||
|
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
|
||||||
|
interval: 5s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 10
|
||||||
|
|
||||||
|
redis:
|
||||||
|
image: redis:latest
|
||||||
|
volumes:
|
||||||
|
- redis_data:/data
|
||||||
|
command: redis-server --maxmemory 512MB
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
# **Optional**
|
||||||
|
# Provides a simple method of viewing the database
|
||||||
|
adminer:
|
||||||
|
image: adminer
|
||||||
|
ports:
|
||||||
|
- "8081:8080"
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
mysql:
|
||||||
|
mercure_config:
|
||||||
|
mercure_data:
|
||||||
|
redis_data:
|
||||||
|
|
||||||
|
configs:
|
||||||
|
env_file:
|
||||||
|
file: $PWD/.env
|
||||||
|
|
||||||
BIN
docs/img/torsearch_filter_download.png
Normal file
|
After Width: | Height: | Size: 200 KiB |
BIN
docs/img/torsearch_homepage.png
Normal file
|
After Width: | Height: | Size: 421 KiB |
BIN
docs/img/torsearch_inception_results.png
Normal file
|
After Width: | Height: | Size: 654 KiB |
BIN
docs/img/torsearch_monitor.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
docs/img/torsearch_severance.png
Normal file
|
After Width: | Height: | Size: 568 KiB |
BIN
docs/img/torsearch_severance_episodes.png
Normal file
|
After Width: | Height: | Size: 889 KiB |
BIN
docs/img/torsearch_severance_media.png
Normal file
|
After Width: | Height: | Size: 643 KiB |
BIN
docs/img/torsearch_severance_results.png
Normal file
|
After Width: | Height: | Size: 438 KiB |
35
migrations/Version20250519193350.php
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace DoctrineMigrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20250519193350 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this up() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql(<<<'SQL'
|
||||||
|
ALTER TABLE preference ADD type VARCHAR(255) DEFAULT NULL
|
||||||
|
SQL);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql(<<<'SQL'
|
||||||
|
ALTER TABLE preference DROP type
|
||||||
|
SQL);
|
||||||
|
}
|
||||||
|
}
|
||||||
171
src/Command/SeedDatabaseCommand.php
Normal file
@@ -0,0 +1,171 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Command;
|
||||||
|
|
||||||
|
use App\User\Framework\Repository\PreferenceOptionRepository;
|
||||||
|
use App\User\Framework\Repository\PreferencesRepository;
|
||||||
|
use Symfony\Component\Console\Attribute\AsCommand;
|
||||||
|
use Symfony\Component\Console\Command\Command;
|
||||||
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
|
|
||||||
|
#[AsCommand(
|
||||||
|
name: 'db:seed',
|
||||||
|
description: 'Seed the database with required data.',
|
||||||
|
)]
|
||||||
|
class SeedDatabaseCommand extends Command
|
||||||
|
{
|
||||||
|
private PreferencesRepository $preferenceRepository;
|
||||||
|
private PreferenceOptionRepository $preferenceOptionRepository;
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
PreferencesRepository $preferenceRepository,
|
||||||
|
PreferenceOptionRepository $preferenceOptionRepository,
|
||||||
|
) {
|
||||||
|
parent::__construct();
|
||||||
|
$this->preferenceRepository = $preferenceRepository;
|
||||||
|
$this->preferenceOptionRepository = $preferenceOptionRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||||
|
{
|
||||||
|
$io = new SymfonyStyle($input, $output);
|
||||||
|
|
||||||
|
$this->seedPreferences($io);
|
||||||
|
$this->seedPreferenceOptions($io);
|
||||||
|
|
||||||
|
return Command::SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function seedPreferences(SymfonyStyle $io)
|
||||||
|
{
|
||||||
|
$io->info('[SeedDatabaseCommand] > Seeding preferences...');
|
||||||
|
$preferences = $this->getPreferences();
|
||||||
|
|
||||||
|
foreach ($preferences as $preference) {
|
||||||
|
if ($this->preferenceRepository->find($preference['id'])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->preferenceRepository->getEntityManager()->persist((new \App\User\Framework\Entity\Preference())
|
||||||
|
->setId($preference['id'])
|
||||||
|
->setName($preference['name'])
|
||||||
|
->setDescription($preference['description'])
|
||||||
|
->setEnabled($preference['enabled'])
|
||||||
|
->setType($preference['type'])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->preferenceRepository->getEntityManager()->flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getPreferences(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[
|
||||||
|
'id' => 'codec',
|
||||||
|
'name' => 'Codec',
|
||||||
|
'description' => null,
|
||||||
|
'enabled' => true,
|
||||||
|
'type' => 'media',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'id' => 'resolution',
|
||||||
|
'name' => 'Resolution',
|
||||||
|
'description' => null,
|
||||||
|
'enabled' => true,
|
||||||
|
'type' => 'media',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'id' => 'language',
|
||||||
|
'name' => 'Language',
|
||||||
|
'description' => null,
|
||||||
|
'enabled' => true,
|
||||||
|
'type' => 'media',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'id' => 'provider',
|
||||||
|
'name' => 'Provider',
|
||||||
|
'description' => null,
|
||||||
|
'enabled' => true,
|
||||||
|
'type' => 'media',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'id' => 'movie_folder',
|
||||||
|
'name' => 'Create new folder for Movies',
|
||||||
|
'description' => 'When downloading a movie, store it in a new folder in your base \'movies\' folder. (e.g.: .../movies/Inception/Inception.2160p.h265.mkv)',
|
||||||
|
'enabled' => true,
|
||||||
|
'type' => 'download'
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function seedPreferenceOptions(SymfonyStyle $io)
|
||||||
|
{
|
||||||
|
$io->info('[SeedDatabaseCommand] > Seeding preference options...');
|
||||||
|
$options = $this->getPreferenceOptions();
|
||||||
|
|
||||||
|
foreach ($options as $option) {
|
||||||
|
if ($this->preferenceOptionRepository->findBy([
|
||||||
|
'preference' => $option['preference_id'],
|
||||||
|
'name' => $option['name'],
|
||||||
|
'value' => $option['value'],
|
||||||
|
'enabled' => $option['enabled'],
|
||||||
|
])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$this->preferenceOptionRepository->getEntityManager()->persist(
|
||||||
|
(new \App\User\Framework\Entity\PreferenceOption())
|
||||||
|
->setPreference($this->preferenceRepository->find($option['preference_id']))
|
||||||
|
->setName($option['name'])
|
||||||
|
->setValue($option['value'])
|
||||||
|
->setEnabled($option['enabled'])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->preferenceOptionRepository->getEntityManager()->flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getPreferenceOptions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[
|
||||||
|
'preference_id' => 'resolution',
|
||||||
|
'name' => '720p',
|
||||||
|
'value' => '720p',
|
||||||
|
'enabled' => true
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'preference_id' => 'resolution',
|
||||||
|
'name' => '1080p',
|
||||||
|
'value' => '1080p',
|
||||||
|
'enabled' => true
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'preference_id' => 'resolution',
|
||||||
|
'name' => '2160p',
|
||||||
|
'value' => '2160p',
|
||||||
|
'enabled' => true
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'preference_id' => 'codec',
|
||||||
|
'name' => '-',
|
||||||
|
'value' => '-',
|
||||||
|
'enabled' => true
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'preference_id' => 'codec',
|
||||||
|
'name' => 'h264',
|
||||||
|
'value' => 'h264',
|
||||||
|
'enabled' => true
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'preference_id' => 'codec',
|
||||||
|
'name' => 'h265/HEVC',
|
||||||
|
'value' => 'h265',
|
||||||
|
'enabled' => true
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
48
src/Command/StartupStatusCommand.php
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Command;
|
||||||
|
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Symfony\Component\Console\Attribute\AsCommand;
|
||||||
|
use Symfony\Component\Console\Command\Command;
|
||||||
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
|
|
||||||
|
#[AsCommand(
|
||||||
|
name: 'startup:status',
|
||||||
|
description: 'Add a short description for your command',
|
||||||
|
)]
|
||||||
|
class StartupStatusCommand extends Command
|
||||||
|
{
|
||||||
|
private EntityManagerInterface $entityManager;
|
||||||
|
|
||||||
|
public function __construct(EntityManagerInterface $entityManager)
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
$this->entityManager = $entityManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||||
|
{
|
||||||
|
$io = new SymfonyStyle($input, $output);
|
||||||
|
|
||||||
|
$ready = true;
|
||||||
|
$messengerTableExists = $this->doesMessengerTableExist();
|
||||||
|
|
||||||
|
if (false === $messengerTableExists) {
|
||||||
|
$ready = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (true === $ready) ? Command::SUCCESS : Command::FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function doesMessengerTableExist()
|
||||||
|
{
|
||||||
|
return $this->entityManager->getConnection()
|
||||||
|
->createSchemaManager()
|
||||||
|
->tablesExist('messenger_messages');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,18 +6,20 @@ use App\Search\Action\Handler\GetMediaInfoHandler;
|
|||||||
use App\Search\Action\Handler\SearchHandler;
|
use App\Search\Action\Handler\SearchHandler;
|
||||||
use App\Search\Action\Input\GetMediaInfoInput;
|
use App\Search\Action\Input\GetMediaInfoInput;
|
||||||
use App\Search\Action\Input\SearchInput;
|
use App\Search\Action\Input\SearchInput;
|
||||||
use Carbon\Carbon;
|
use App\Tmdb\TmdbResult;
|
||||||
|
use App\Torrentio\Action\Command\GetMovieOptionsCommand;
|
||||||
|
use App\Torrentio\Action\Command\GetTvShowOptionsCommand;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use Symfony\Component\Messenger\MessageBusInterface;
|
||||||
use Symfony\Component\Routing\Attribute\Route;
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
use Symfony\Contracts\Cache\CacheInterface;
|
|
||||||
use Symfony\Contracts\Cache\ItemInterface;
|
|
||||||
|
|
||||||
final class SearchController extends AbstractController
|
final class SearchController extends AbstractController
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private SearchHandler $searchHandler,
|
private SearchHandler $searchHandler,
|
||||||
private GetMediaInfoHandler $getMediaInfoHandler,
|
private GetMediaInfoHandler $getMediaInfoHandler,
|
||||||
|
private MessageBusInterface $bus,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
#[Route('/search', name: 'app_search', methods: ['GET'])]
|
#[Route('/search', name: 'app_search', methods: ['GET'])]
|
||||||
@@ -36,6 +38,8 @@ final class SearchController extends AbstractController
|
|||||||
GetMediaInfoInput $input,
|
GetMediaInfoInput $input,
|
||||||
): Response {
|
): Response {
|
||||||
$result = $this->getMediaInfoHandler->handle($input->toCommand());
|
$result = $this->getMediaInfoHandler->handle($input->toCommand());
|
||||||
|
$this->warmDownloadOptionCache($result->media);
|
||||||
|
|
||||||
return $this->render('search/result.html.twig', [
|
return $this->render('search/result.html.twig', [
|
||||||
'results' => $result,
|
'results' => $result,
|
||||||
'filter' => [
|
'filter' => [
|
||||||
@@ -48,4 +52,32 @@ final class SearchController extends AbstractController
|
|||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function warmDownloadOptionCache(TmdbResult $result)
|
||||||
|
{
|
||||||
|
if ($result->mediaType === 'tvshows') {
|
||||||
|
// dispatches a job to get the download options
|
||||||
|
// for each episode and load them in cache
|
||||||
|
foreach ($result->episodes as $season => $episodes) {
|
||||||
|
// Only do the first 2 seasons, so we reduce
|
||||||
|
// getting rate-limited by Torrentio
|
||||||
|
if ($season > 2) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
foreach ($episodes as $episode) {
|
||||||
|
$this->bus->dispatch(new GetTvShowOptionsCommand(
|
||||||
|
tmdbId: $result->tmdbId,
|
||||||
|
imdbId: $result->imdbId,
|
||||||
|
season: $season,
|
||||||
|
episode: $episode['episode_number'],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} elseif ($result->mediaType === 'movies') {
|
||||||
|
$this->bus->dispatch(new GetMovieOptionsCommand(
|
||||||
|
$result->tmdbId,
|
||||||
|
$result->imdbId,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,8 +37,6 @@ readonly class DownloadMediaHandler implements HandlerInterface
|
|||||||
$download = $this->downloadRepository->find($command->downloadId);
|
$download = $this->downloadRepository->find($command->downloadId);
|
||||||
}
|
}
|
||||||
|
|
||||||
dump($download);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->downloadRepository->updateStatus($download->getId(), 'In Progress');
|
$this->downloadRepository->updateStatus($download->getId(), 'In Progress');
|
||||||
|
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ use App\Message\DownloadTvShowMessage;
|
|||||||
interface DownloaderInterface
|
interface DownloaderInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param string $baseDir
|
* @param string $mediaType
|
||||||
* @param string $title
|
* @param string $title
|
||||||
* @param string $url
|
* @param string $url
|
||||||
* @return void
|
* @return void
|
||||||
* Downloads the requested file.
|
* Downloads the requested file.
|
||||||
*/
|
*/
|
||||||
public function download(string $baseDir, string $title, string $url, ?int $downloadId): void;
|
public function download(string $mediaType, string $title, string $url, ?int $downloadId): void;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Download\Downloader;
|
namespace App\Download\Downloader;
|
||||||
|
|
||||||
use App\Download\Framework\Entity\Download;
|
use App\Download\Framework\Entity\Download;
|
||||||
|
use App\Monitor\Service\MediaFiles;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Symfony\Component\Process\Exception\ProcessFailedException;
|
use Symfony\Component\Process\Exception\ProcessFailedException;
|
||||||
use Symfony\Component\Process\Process;
|
use Symfony\Component\Process\Process;
|
||||||
@@ -11,25 +12,26 @@ class ProcessDownloader implements DownloaderInterface
|
|||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private EntityManagerInterface $entityManager,
|
private EntityManagerInterface $entityManager,
|
||||||
|
private MediaFiles $mediaFiles,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function download(string $baseDir, string $title, string $url, ?int $downloadId): void
|
public function download(string $mediaType, string $title, string $url, ?int $downloadId): void
|
||||||
{
|
{
|
||||||
/** @var Download $downloadEntity */
|
/** @var Download $downloadEntity */
|
||||||
$downloadEntity = $this->entityManager->getRepository(Download::class)->find($downloadId);
|
$downloadEntity = $this->entityManager->getRepository(Download::class)->find($downloadId);
|
||||||
$downloadEntity->setProgress(0);
|
$downloadEntity->setProgress(0);
|
||||||
$this->entityManager->flush();
|
$this->entityManager->flush();
|
||||||
|
|
||||||
$process = new Process([
|
$downloadPreferences = $downloadEntity->getUser()->getDownloadPreferences();
|
||||||
'/bin/sh',
|
$path = $this->getDownloadPath($mediaType, $title, $downloadPreferences);
|
||||||
'/var/www/bash/app/wget_download.sh',
|
|
||||||
$baseDir,
|
$process = (new Process([
|
||||||
$title,
|
'wget',
|
||||||
$url
|
$url
|
||||||
]);
|
]))->setWorkingDirectory($path);
|
||||||
|
|
||||||
$process->setTimeout(1800); // 30 min
|
$process->setTimeout(1800); // 30 min
|
||||||
$process->setIdleTimeout(600); // 10 min
|
$process->setIdleTimeout(600); // 10 min
|
||||||
@@ -61,4 +63,20 @@ class ProcessDownloader implements DownloaderInterface
|
|||||||
|
|
||||||
$this->entityManager->flush();
|
$this->entityManager->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getDownloadPath(string $mediaType, string $title, array $downloadPreferences): string
|
||||||
|
{
|
||||||
|
if ($mediaType === 'movies') {
|
||||||
|
if ((bool) $downloadPreferences['movie_folder']->getPreferenceValue() === true) {
|
||||||
|
return $this->mediaFiles->createMovieDirectory($title);
|
||||||
|
}
|
||||||
|
return $this->mediaFiles->getMoviesPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($mediaType === 'tvshows') {
|
||||||
|
return $this->mediaFiles->createTvShowDirectory($title);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \Exception("There is no download path for media type: $mediaType");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -17,8 +17,6 @@ class ApiController extends AbstractController
|
|||||||
public function __construct(
|
public function __construct(
|
||||||
#[Autowire(service: 'twig')]
|
#[Autowire(service: 'twig')]
|
||||||
private readonly Environment $renderer,
|
private readonly Environment $renderer,
|
||||||
private readonly HubInterface $hub,
|
|
||||||
private readonly Security $security,
|
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
#[Route('/api/monitor', name: 'api_monitor', methods: ['POST'])]
|
#[Route('/api/monitor', name: 'api_monitor', methods: ['POST'])]
|
||||||
@@ -28,12 +26,12 @@ class ApiController extends AbstractController
|
|||||||
HubInterface $hub,
|
HubInterface $hub,
|
||||||
) {
|
) {
|
||||||
$command = $input->toCommand();
|
$command = $input->toCommand();
|
||||||
$command->userId = $this->security->getUser()->getId();
|
$command->userId = $this->getUser()->getId();
|
||||||
$response = $handler->handle($command);
|
$response = $handler->handle($command);
|
||||||
|
|
||||||
$hub->publish(new Update(
|
$hub->publish(new Update(
|
||||||
'alerts',
|
'alerts',
|
||||||
$this->renderer->render('Alert.stream.html.twig', [
|
$this->renderer->render('broadcast/Alert.stream.html.twig', [
|
||||||
'alert_id' => uniqid(),
|
'alert_id' => uniqid(),
|
||||||
'title' => 'Success',
|
'title' => 'Success',
|
||||||
'message' => "New monitor added for {$input->title}",
|
'message' => "New monitor added for {$input->title}",
|
||||||
|
|||||||
@@ -32,6 +32,17 @@ class MediaFiles
|
|||||||
$this->filesystem = $filesystem;
|
$this->filesystem = $filesystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPathByType(string $mediaType): string
|
||||||
|
{
|
||||||
|
if ('movies' === $mediaType) {
|
||||||
|
return $this->moviesPath;
|
||||||
|
} elseif ('tvshows' === $mediaType) {
|
||||||
|
return $this->tvShowsPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \Exception(sprintf('A path for media type %s does not exist.', $mediaType));
|
||||||
|
}
|
||||||
|
|
||||||
public function getMoviesPath(): string
|
public function getMoviesPath(): string
|
||||||
{
|
{
|
||||||
return $this->moviesPath;
|
return $this->moviesPath;
|
||||||
@@ -83,4 +94,35 @@ class MediaFiles
|
|||||||
|
|
||||||
return Map::from($results);
|
return Map::from($results);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function createMovieDirectory(string $path): string
|
||||||
|
{
|
||||||
|
$path = $this->moviesPath . DIRECTORY_SEPARATOR . $path;
|
||||||
|
|
||||||
|
if (false === $this->filesystem->exists($path)) {
|
||||||
|
$this->filesystem->mkdir($path);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function createTvShowDirectory(string $path): string
|
||||||
|
{
|
||||||
|
$path = $this->tvShowsPath . DIRECTORY_SEPARATOR . $path;
|
||||||
|
|
||||||
|
if (false === $this->filesystem->exists($path)) {
|
||||||
|
$this->filesystem->mkdir($path);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function createDirectory(string $path): string
|
||||||
|
{
|
||||||
|
if (false === $this->filesystem->exists($path)) {
|
||||||
|
$this->filesystem->mkdir($path);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $path;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,20 +4,15 @@ namespace App\Torrentio\Client;
|
|||||||
|
|
||||||
use App\Torrentio\Client\Rule\DownloadOptionFilter\Resolution;
|
use App\Torrentio\Client\Rule\DownloadOptionFilter\Resolution;
|
||||||
use App\Torrentio\Client\Rule\RuleEngine;
|
use App\Torrentio\Client\Rule\RuleEngine;
|
||||||
use App\Torrentio\MediaResult;
|
|
||||||
use App\Torrentio\Result\ResultFactory;
|
use App\Torrentio\Result\ResultFactory;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Symfony\Component\DependencyInjection\Attribute\Autowire;
|
use Symfony\Component\DependencyInjection\Attribute\Autowire;
|
||||||
use Symfony\Contracts\Cache\CacheInterface;
|
use Symfony\Contracts\Cache\CacheInterface;
|
||||||
use Symfony\Contracts\Cache\ItemInterface;
|
use Symfony\Contracts\Cache\ItemInterface;
|
||||||
|
|
||||||
/**
|
|
||||||
* ToDo: Fix
|
|
||||||
*/
|
|
||||||
class Torrentio
|
class Torrentio
|
||||||
{
|
{
|
||||||
private string $baseUrl = 'https://torrentio.strem.fun/providers%253Dyts%252Ceztv%252Crarbg%252C1337x%252Cthepiratebay%252Ckickasstorrents%252Ctorrentgalaxy%252Cmagnetdl%252Chorriblesubs%252Cnyaasi%7Csort%253Dqualitysize%7Cqualityfilter%253D480p%252Cscr%252Ccam%7Crealdebrid={realDebridKey}/stream/movie/{imdbCode}.json';
|
private string $baseUrl = 'https://torrentio.strem.fun/providers%253Dyts%252Ceztv%252Crarbg%252C1337x%252Cthepiratebay%252Ckickasstorrents%252Ctorrentgalaxy%252Cmagnetdl%252Chorriblesubs%252Cnyaasi%7Csort%253Dqualitysize%7Cqualityfilter%253D480p%252Cscr%252Ccam%7Crealdebrid={realDebridKey}/stream/movie/{imdbCode}.json';
|
||||||
// private string $baseUrl = 'https://torrentio.strem.fun/providers=yts,eztv,rarbg,1337x,thepiratebay,kickasstorrents,torrentgalaxy,magnetdl,horriblesubs|sort=qualitysize|qualityfilter=480p,cam,unknown|debridoptions=nodownloadlinks|realdebrid=QYYBR7OSQ4VEFKWASDEZ2B4VO67KHUJY6IWOT7HHA7ATXO7QCYDQ/stream/{imdbCode}.json';
|
|
||||||
|
|
||||||
private string $searchUrl;
|
private string $searchUrl;
|
||||||
|
|
||||||
@@ -44,26 +39,6 @@ class Torrentio
|
|||||||
return $this->parse($results, $filter);
|
return $this->parse($results, $filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function searchBySeriesSeason(MediaResult $series): MediaResult
|
|
||||||
{
|
|
||||||
$imdbCode = $series->imdbId;
|
|
||||||
// foreach ($series->episodes as $season => $episodes) {
|
|
||||||
// foreach ($episodes as $key => $episode) {
|
|
||||||
// $cacheKey = "torrentio.$series->imdbId.$season.{$episode['episode_number']}";
|
|
||||||
// $downloadOptions = $this->cache->get($cacheKey, function (ItemInterface $item) use ($imdbCode, $season, $episode) {
|
|
||||||
// $item->expiresAt(new \DateTimeImmutable("today 11:59 pm"));
|
|
||||||
// $response = file_get_contents(str_replace('{imdbCode}', "$imdbCode:$season:{$episode['episode_number']}", $this->searchUrl));
|
|
||||||
// return json_decode(
|
|
||||||
// $response,
|
|
||||||
// true
|
|
||||||
// );
|
|
||||||
// });
|
|
||||||
// $series->episodes[$season][$key]['download_options'] = $this->parse($downloadOptions, []);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
return $series;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function fetchEpisodeResults(string $imdbId, int $season, int $episode): array
|
public function fetchEpisodeResults(string $imdbId, int $season, int $episode): array
|
||||||
{
|
{
|
||||||
$cacheKey = "torrentio.$imdbId.$season.$episode";
|
$cacheKey = "torrentio.$imdbId.$season.$episode";
|
||||||
|
|||||||
10
src/Twig/Components/TextInput.php
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Twig\Components;
|
||||||
|
|
||||||
|
use Symfony\UX\TwigComponent\Attribute\AsTwigComponent;
|
||||||
|
|
||||||
|
#[AsTwigComponent]
|
||||||
|
final class TextInput
|
||||||
|
{
|
||||||
|
}
|
||||||
16
src/User/Action/Command/RegisterLdapUserCommand.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Action\Command;
|
||||||
|
|
||||||
|
use OneToMany\RichBundle\Contract\CommandInterface;
|
||||||
|
|
||||||
|
/** @implements CommandInterface<RegisterUserCommand> */
|
||||||
|
class RegisterLdapUserCommand implements CommandInterface
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
public string $name,
|
||||||
|
public string $email,
|
||||||
|
public string $username,
|
||||||
|
public string $password,
|
||||||
|
) {}
|
||||||
|
}
|
||||||
16
src/User/Action/Command/RegisterUserCommand.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Action\Command;
|
||||||
|
|
||||||
|
use OneToMany\RichBundle\Contract\CommandInterface;
|
||||||
|
|
||||||
|
/** @implements CommandInterface<RegisterUserCommand> */
|
||||||
|
class RegisterUserCommand implements CommandInterface
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
public ?string $name = null,
|
||||||
|
public ?string $email = null,
|
||||||
|
public ?string $username = null,
|
||||||
|
public ?string $password = null,
|
||||||
|
) {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Action\Command;
|
||||||
|
|
||||||
|
use OneToMany\RichBundle\Contract\CommandInterface;
|
||||||
|
|
||||||
|
/** @implements CommandInterface<SaveUserMediaPreferencesCommand> */
|
||||||
|
class SaveUserDownloadPreferencesCommand implements CommandInterface
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
public string $movie_folder,
|
||||||
|
) {}
|
||||||
|
}
|
||||||
57
src/User/Action/Handler/RegisterLdapUserHandler.php
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Action\Handler;
|
||||||
|
|
||||||
|
use App\User\Action\Command\RegisterLdapUserCommand;
|
||||||
|
use App\User\Action\Result\RegisterLdapUserResult;
|
||||||
|
use App\User\Framework\Entity\User;
|
||||||
|
use App\User\Framework\Entity\UserPreference;
|
||||||
|
use App\User\Framework\Repository\PreferencesRepository;
|
||||||
|
use App\User\Framework\Repository\UserRepository;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use OneToMany\RichBundle\Contract\CommandInterface as C;
|
||||||
|
use OneToMany\RichBundle\Contract\HandlerInterface;
|
||||||
|
use OneToMany\RichBundle\Contract\ResultInterface as R;
|
||||||
|
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
|
||||||
|
|
||||||
|
/** @implements HandlerInterface<RegisterLdapUserCommand, RegisterLdapUserResult> */
|
||||||
|
class RegisterLdapUserHandler implements HandlerInterface
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
private readonly EntityManagerInterface $entityManager,
|
||||||
|
private readonly PreferencesRepository $preferenceRepository,
|
||||||
|
private readonly UserPasswordHasherInterface $userPasswordHasher,
|
||||||
|
private readonly UserRepository $userRepository,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
public function handle(C $command): R
|
||||||
|
{
|
||||||
|
$user = $this->userRepository->findOneBy(['username' => $command->username]);
|
||||||
|
if (null === $user) {
|
||||||
|
$user = new User();
|
||||||
|
$user->setPassword($this->userPasswordHasher->hashPassword($user, $command->password));
|
||||||
|
}
|
||||||
|
|
||||||
|
$user->setUsername($command->username);
|
||||||
|
$user->setEmail($command->email);
|
||||||
|
$user->setName($command->name);
|
||||||
|
$this->entityManager->persist($user);
|
||||||
|
$this->entityManager->flush();
|
||||||
|
|
||||||
|
$this->setUserPreferences($user, $this->preferenceRepository->findEnabled());
|
||||||
|
$this->entityManager->flush();
|
||||||
|
|
||||||
|
return new RegisterLdapUserResult($user);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function setUserPreferences(User $user, array $preferences): void
|
||||||
|
{
|
||||||
|
foreach ($preferences as $preference) {
|
||||||
|
$user->addUserPreference((new UserPreference())
|
||||||
|
->setUser($user)
|
||||||
|
->setPreference($preference)
|
||||||
|
->setPreferenceValue(null)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
53
src/User/Action/Handler/RegisterUserHandler.php
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Action\Handler;
|
||||||
|
|
||||||
|
use App\User\Action\Command\RegisterUserCommand;
|
||||||
|
use App\User\Action\Result\RegisterUserResult;
|
||||||
|
use App\User\Action\Result\SaveUserMediaPreferencesResult;
|
||||||
|
use App\User\Framework\Entity\User;
|
||||||
|
use App\User\Framework\Entity\UserPreference;
|
||||||
|
use App\User\Framework\Repository\PreferencesRepository;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use OneToMany\RichBundle\Contract\CommandInterface as C;
|
||||||
|
use OneToMany\RichBundle\Contract\HandlerInterface;
|
||||||
|
use OneToMany\RichBundle\Contract\ResultInterface as R;
|
||||||
|
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
|
||||||
|
|
||||||
|
/** @implements HandlerInterface<RegisterUserCommand> */
|
||||||
|
class RegisterUserHandler implements HandlerInterface
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
private readonly EntityManagerInterface $entityManager,
|
||||||
|
private readonly PreferencesRepository $preferenceRepository,
|
||||||
|
private readonly UserPasswordHasherInterface $userPasswordHasher,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
public function handle(C $command): R
|
||||||
|
{
|
||||||
|
$user = new User();
|
||||||
|
|
||||||
|
$user->setUsername($command->username);
|
||||||
|
$user->setEmail($command->email);
|
||||||
|
$user->setPassword($this->userPasswordHasher->hashPassword($user, $command->password));
|
||||||
|
$user->setName($command->name);
|
||||||
|
$this->entityManager->persist($user);
|
||||||
|
$this->entityManager->flush();
|
||||||
|
|
||||||
|
$this->setUserPreferences($user, $this->preferenceRepository->findEnabled());
|
||||||
|
$this->entityManager->flush();
|
||||||
|
|
||||||
|
return new RegisterUserResult($user);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function setUserPreferences(User $user, array $preferences): void
|
||||||
|
{
|
||||||
|
foreach ($preferences as $preference) {
|
||||||
|
$user->addUserPreference((new UserPreference())
|
||||||
|
->setUser($user)
|
||||||
|
->setPreference($preference)
|
||||||
|
->setPreferenceValue(null)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Action\Handler;
|
||||||
|
|
||||||
|
use App\User\Action\Command\SaveUserMediaPreferencesCommand;
|
||||||
|
use App\User\Action\Result\SaveUserDownloadPreferencesResult;
|
||||||
|
use App\User\Action\Result\SaveUserMediaPreferencesResult;
|
||||||
|
use App\User\Framework\Entity\User;
|
||||||
|
use App\User\Framework\Entity\UserPreference;
|
||||||
|
use App\User\Framework\Repository\PreferencesRepository;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use OneToMany\RichBundle\Contract\CommandInterface as C;
|
||||||
|
use OneToMany\RichBundle\Contract\HandlerInterface;
|
||||||
|
use OneToMany\RichBundle\Contract\ResultInterface as R;
|
||||||
|
use Symfony\Bundle\SecurityBundle\Security;
|
||||||
|
|
||||||
|
/** @implements HandlerInterface<SaveUserMediaPreferencesCommand> */
|
||||||
|
class SaveUserDownloadPreferencesHandler implements HandlerInterface
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
private readonly EntityManagerInterface $entityManager,
|
||||||
|
private readonly PreferencesRepository $preferenceRepository,
|
||||||
|
private readonly Security $token,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
public function handle(C $command): R
|
||||||
|
{
|
||||||
|
/** @var User $user */
|
||||||
|
$user = $this->token->getUser();
|
||||||
|
|
||||||
|
foreach ($command as $preference => $value) {
|
||||||
|
if ($user->hasUserPreference($preference)) {
|
||||||
|
$user->updateUserPreference($preference, $value);
|
||||||
|
$this->entityManager->flush();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$preference = $this->preferenceRepository->find($preference);
|
||||||
|
|
||||||
|
$user->addUserPreference(
|
||||||
|
(new UserPreference())
|
||||||
|
->setUser($user)
|
||||||
|
->setPreference($preference)
|
||||||
|
->setPreferenceValue($value)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->entityManager->flush();
|
||||||
|
|
||||||
|
return new SaveUserDownloadPreferencesResult($user->getDownloadPreferences());
|
||||||
|
}
|
||||||
|
}
|
||||||
28
src/User/Action/Input/SaveUserDownloadPreferencesInput.php
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Action\Input;
|
||||||
|
|
||||||
|
use App\User\Action\Command\SaveUserDownloadPreferencesCommand;
|
||||||
|
use OneToMany\RichBundle\Attribute\SourceRequest;
|
||||||
|
use OneToMany\RichBundle\Attribute\SourceSecurity;
|
||||||
|
use OneToMany\RichBundle\Contract\CommandInterface as C;
|
||||||
|
use OneToMany\RichBundle\Contract\InputInterface;
|
||||||
|
|
||||||
|
/** @implements InputInterface<SaveUserDownloadPreferencesInput, SaveUserDownloadPreferencesCommand> */
|
||||||
|
class SaveUserDownloadPreferencesInput implements InputInterface
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
#[SourceSecurity]
|
||||||
|
public mixed $userId,
|
||||||
|
|
||||||
|
#[SourceRequest('movie_folder', nullify: true)]
|
||||||
|
public bool $movieFolder,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
public function toCommand(): C
|
||||||
|
{
|
||||||
|
return new SaveUserDownloadPreferencesCommand(
|
||||||
|
$this->movieFolder,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
14
src/User/Action/Result/RegisterLdapUserResult.php
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Action\Result;
|
||||||
|
|
||||||
|
use App\User\Framework\Entity\User;
|
||||||
|
use OneToMany\RichBundle\Contract\ResultInterface;
|
||||||
|
|
||||||
|
/** @implements ResultInterface */
|
||||||
|
class RegisterLdapUserResult implements ResultInterface
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
public User $user,
|
||||||
|
) {}
|
||||||
|
}
|
||||||
14
src/User/Action/Result/RegisterUserResult.php
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Action\Result;
|
||||||
|
|
||||||
|
use App\User\Framework\Entity\User;
|
||||||
|
use OneToMany\RichBundle\Contract\ResultInterface;
|
||||||
|
|
||||||
|
/** @implements ResultInterface */
|
||||||
|
class RegisterUserResult implements ResultInterface
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
public User $user,
|
||||||
|
) {}
|
||||||
|
}
|
||||||
14
src/User/Action/Result/SaveUserDownloadPreferencesResult.php
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Action\Result;
|
||||||
|
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
|
use OneToMany\RichBundle\Contract\ResultInterface;
|
||||||
|
|
||||||
|
/** @implements ResultInterface */
|
||||||
|
class SaveUserDownloadPreferencesResult implements ResultInterface
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
public array $downloadPreferences,
|
||||||
|
) {}
|
||||||
|
}
|
||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace App\User\Framework\Controller\Web;
|
namespace App\User\Framework\Controller\Web;
|
||||||
|
|
||||||
|
use App\User\Framework\Repository\UserRepository;
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Attribute\Route;
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
@@ -10,8 +12,12 @@ use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
|
|||||||
class LoginController extends AbstractController
|
class LoginController extends AbstractController
|
||||||
{
|
{
|
||||||
#[Route(path: '/login', name: 'app_login')]
|
#[Route(path: '/login', name: 'app_login')]
|
||||||
public function login(AuthenticationUtils $authenticationUtils): Response
|
public function login(AuthenticationUtils $authenticationUtils, UserRepository $userRepository): Response
|
||||||
{
|
{
|
||||||
|
if ((new ArrayCollection($userRepository->findAll()))->count() === 0) {
|
||||||
|
return $this->redirectToRoute('app_getting_started');
|
||||||
|
}
|
||||||
|
|
||||||
// get the login error if there is one
|
// get the login error if there is one
|
||||||
$error = $authenticationUtils->getLastAuthenticationError();
|
$error = $authenticationUtils->getLastAuthenticationError();
|
||||||
|
|
||||||
|
|||||||
@@ -4,17 +4,14 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\User\Framework\Controller\Web;
|
namespace App\User\Framework\Controller\Web;
|
||||||
|
|
||||||
use Aimeos\Map;
|
use App\User\Action\Handler\SaveUserDownloadPreferencesHandler;
|
||||||
use App\User\Action\Handler\SaveUserMediaPreferencesHandler;
|
use App\User\Action\Handler\SaveUserMediaPreferencesHandler;
|
||||||
|
use App\User\Action\Input\SaveUserDownloadPreferencesInput;
|
||||||
use App\User\Action\Input\SaveUserMediaPreferencesInput;
|
use App\User\Action\Input\SaveUserMediaPreferencesInput;
|
||||||
use App\User\Framework\Entity\User;
|
|
||||||
use App\User\Framework\Entity\UserPreference;
|
|
||||||
use App\User\Framework\Repository\PreferencesRepository;
|
use App\User\Framework\Repository\PreferencesRepository;
|
||||||
use App\Util\CountryCodes;
|
|
||||||
use App\Util\CountryLanguages;
|
use App\Util\CountryLanguages;
|
||||||
use App\Util\ProviderList;
|
use App\Util\ProviderList;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Bundle\SecurityBundle\Security;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Mercure\HubInterface;
|
use Symfony\Component\Mercure\HubInterface;
|
||||||
@@ -26,22 +23,14 @@ class PreferencesController extends AbstractController
|
|||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly PreferencesRepository $preferencesRepository,
|
private readonly PreferencesRepository $preferencesRepository,
|
||||||
private readonly SaveUserMediaPreferencesHandler $saveUserMediaPreferencesHandler,
|
private readonly SaveUserMediaPreferencesHandler $saveUserMediaPreferencesHandler,
|
||||||
private readonly Security $security,
|
|
||||||
private readonly HubInterface $hub,
|
private readonly HubInterface $hub,
|
||||||
|
private readonly SaveUserDownloadPreferencesHandler $saveUserDownloadPreferencesHandler,
|
||||||
) {}
|
) {}
|
||||||
#[Route('/media/preferences', 'app_media_preferences', methods: ['GET'])]
|
#[Route('/user/preferences', 'app_user_preferences', methods: ['GET'])]
|
||||||
public function mediaPreferences(): Response
|
public function mediaPreferences(): Response
|
||||||
{
|
{
|
||||||
$enabledPreferences = $this->preferencesRepository->findEnabled();
|
$mediaPreferences = $this->getUser()->getMediaPreferences();
|
||||||
|
$downloadPreferences = $this->getUser()->getDownloadPreferences();
|
||||||
if ($this->security->getUser()->getUserPreferences()->count() !== count($enabledPreferences)) {
|
|
||||||
$this->setUserPreferences($this->security->getUser(), $enabledPreferences);
|
|
||||||
}
|
|
||||||
|
|
||||||
$userPreferences = $this->security->getUser()->getUserPreferences()->toArray();
|
|
||||||
$userPreferences = Map::from($userPreferences)
|
|
||||||
->rekey(fn($preference) => $preference->getPreference()->getId());
|
|
||||||
|
|
||||||
$languages = CountryLanguages::$languages;
|
$languages = CountryLanguages::$languages;
|
||||||
sort($languages);
|
sort($languages);
|
||||||
|
|
||||||
@@ -51,19 +40,21 @@ class PreferencesController extends AbstractController
|
|||||||
'preferences' => $this->preferencesRepository->findEnabled(),
|
'preferences' => $this->preferencesRepository->findEnabled(),
|
||||||
'languages' => $languages,
|
'languages' => $languages,
|
||||||
'providers' => ProviderList::$providers,
|
'providers' => ProviderList::$providers,
|
||||||
'userPreferences' => $userPreferences->toArray(),
|
'mediaPreferences' => $mediaPreferences,
|
||||||
|
'downloadPreferences' => $downloadPreferences,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Route('/media/preferences', 'app_save_media_preferences', methods: ['POST'])]
|
#[Route('/user/preferences/media', 'app_save_media_preferences', methods: ['POST'])]
|
||||||
public function saveMediaPreferences(
|
public function saveMediaPreferences(
|
||||||
Request $request,
|
Request $request,
|
||||||
SaveUserMediaPreferencesInput $input,
|
SaveUserMediaPreferencesInput $input,
|
||||||
): Response
|
): Response
|
||||||
{
|
{
|
||||||
$userPreferences = $this->saveUserMediaPreferencesHandler->handle($input->toCommand())->userPreferences;
|
$this->saveUserMediaPreferencesHandler->handle($input->toCommand());
|
||||||
$userPreferences = Map::from($userPreferences)->rekey(fn($preference) => $preference->getPreference()->getId());
|
$mediaPreferences = $this->getUser()->getMediaPreferences();
|
||||||
|
$downloadPreferences = $this->getUser()->getDownloadPreferences();
|
||||||
|
|
||||||
$languages = CountryLanguages::$languages;
|
$languages = CountryLanguages::$languages;
|
||||||
sort($languages);
|
sort($languages);
|
||||||
@@ -83,22 +74,42 @@ class PreferencesController extends AbstractController
|
|||||||
'preferences' => $this->preferencesRepository->findEnabled(),
|
'preferences' => $this->preferencesRepository->findEnabled(),
|
||||||
'languages' => $languages,
|
'languages' => $languages,
|
||||||
'providers' => ProviderList::$providers,
|
'providers' => ProviderList::$providers,
|
||||||
'userPreferences' => $userPreferences->toArray(),
|
'mediaPreferences' => $mediaPreferences,
|
||||||
|
'downloadPreferences' => $downloadPreferences,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function setUserPreferences(User $user, array $preferences): void
|
#[Route('/user/preferences/download', 'app_save_download_preferences', methods: ['POST'])]
|
||||||
|
public function saveDownloadPreferences(
|
||||||
|
Request $request,
|
||||||
|
SaveUserDownloadPreferencesInput $input,
|
||||||
|
): Response
|
||||||
{
|
{
|
||||||
foreach ($preferences as $preference) {
|
$downloadPreferences = $this->saveUserDownloadPreferencesHandler->handle($input->toCommand())->downloadPreferences;
|
||||||
if (false === $user->hasUserPreference($preference->getId())) {
|
$mediaPreferences = $this->getUser()->getMediaPreferences();
|
||||||
$user->addUserPreference((new UserPreference())
|
|
||||||
->setUser($user)
|
$languages = CountryLanguages::$languages;
|
||||||
->setPreference($preference)
|
sort($languages);
|
||||||
->setPreferenceValue(null)
|
|
||||||
);
|
$this->hub->publish(new Update(
|
||||||
}
|
$request->getSession()->get('mercure_alert_topic'),
|
||||||
}
|
$this->renderView('broadcast/Alert.stream.html.twig', [
|
||||||
$this->preferencesRepository->getEntityManager()->flush();
|
'alert_id' => uniqid(),
|
||||||
|
'title' => 'Success',
|
||||||
|
'message' => 'Your download preferences have been saved.',
|
||||||
|
])
|
||||||
|
));
|
||||||
|
|
||||||
|
return $this->render(
|
||||||
|
'user/preferences.html.twig',
|
||||||
|
[
|
||||||
|
'preferences' => $this->preferencesRepository->findEnabled(),
|
||||||
|
'languages' => $languages,
|
||||||
|
'providers' => ProviderList::$providers,
|
||||||
|
'mediaPreferences' => $mediaPreferences,
|
||||||
|
'downloadPreferences' => $downloadPreferences,
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,43 +2,48 @@
|
|||||||
|
|
||||||
namespace App\User\Framework\Controller\Web;
|
namespace App\User\Framework\Controller\Web;
|
||||||
|
|
||||||
|
use App\User\Action\Command\RegisterUserCommand;
|
||||||
|
use App\User\Action\Handler\RegisterUserHandler;
|
||||||
use App\User\Framework\Entity\User;
|
use App\User\Framework\Entity\User;
|
||||||
use App\User\Framework\Entity\UserPreference;
|
|
||||||
use App\User\Framework\Form\RegistrationFormType;
|
use App\User\Framework\Form\RegistrationFormType;
|
||||||
|
use App\User\Framework\Pipeline\GettingStarted\AddPreferencesToDatabase;
|
||||||
|
use App\User\Framework\Pipeline\GettingStarted\GettingStartedInput;
|
||||||
|
use App\User\Framework\Pipeline\GettingStarted\MigrateDatabase;
|
||||||
use App\User\Framework\Repository\PreferencesRepository;
|
use App\User\Framework\Repository\PreferencesRepository;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use App\User\Framework\Repository\UserRepository;
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
use League\Pipeline\Pipeline;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
use Symfony\Bundle\SecurityBundle\Security;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
|
use Symfony\Component\HttpKernel\KernelInterface;
|
||||||
use Symfony\Component\Routing\Attribute\Route;
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
|
|
||||||
class RegistrationController extends AbstractController
|
class RegistrationController extends AbstractController
|
||||||
{
|
{
|
||||||
|
public function __construct(private readonly RegisterUserHandler $registerUserHandler)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
#[Route('/register', name: 'app_register')]
|
#[Route('/register', name: 'app_register')]
|
||||||
public function register(
|
public function register(
|
||||||
Request $request,
|
Request $request,
|
||||||
UserPasswordHasherInterface $userPasswordHasher,
|
Security $security,
|
||||||
EntityManagerInterface $entityManager,
|
|
||||||
PreferencesRepository $preferencesRepository,
|
|
||||||
): Response {
|
): Response {
|
||||||
$user = new User();
|
$form = $this->createForm(RegistrationFormType::class, new User());
|
||||||
$form = $this->createForm(RegistrationFormType::class, $user);
|
|
||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
|
|
||||||
if ($form->isSubmitted() && $form->isValid()) {
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
/** @var string $plainPassword */
|
$user = $this->registerUserHandler->handle(new RegisterUserCommand(
|
||||||
$plainPassword = $form->get('plainPassword')->getData();
|
name: $form->get('name')->getData(),
|
||||||
|
email: $form->get('email')->getData(),
|
||||||
|
username: $form->get('username')->getData(),
|
||||||
|
password: $form->get('plainPassword')->getData(),
|
||||||
|
));
|
||||||
|
|
||||||
// encode the plain password
|
$security->login($user->user);
|
||||||
$user->setPassword($userPasswordHasher->hashPassword($user, $plainPassword));
|
|
||||||
|
|
||||||
$entityManager->persist($user);
|
|
||||||
$entityManager->flush();
|
|
||||||
|
|
||||||
$this->setUserPreferences($user, $preferencesRepository->findEnabled());
|
|
||||||
|
|
||||||
$preferencesRepository->getEntityManager()->flush();
|
|
||||||
|
|
||||||
return $this->redirectToRoute('app_index');
|
return $this->redirectToRoute('app_index');
|
||||||
}
|
}
|
||||||
@@ -48,14 +53,30 @@ class RegistrationController extends AbstractController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function setUserPreferences(User $user, array $preferences): void
|
#[Route(path: '/getting-started', name: 'app_getting_started')]
|
||||||
|
public function gettingStarted(Request $request, Security $security, UserRepository $userRepository, PreferencesRepository $preferencesRepository, KernelInterface $kernel, LoggerInterface $logger): Response
|
||||||
{
|
{
|
||||||
foreach ($preferences as $preference) {
|
if ((new ArrayCollection($userRepository->findAll()))->count() !== 0) {
|
||||||
$user->addUserPreference((new UserPreference())
|
return $this->redirectToRoute('app_index');
|
||||||
->setUser($user)
|
|
||||||
->setPreference($preference)
|
|
||||||
->setPreferenceValue(null)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$form = $this->createForm(RegistrationFormType::class, new User());
|
||||||
|
$form->handleRequest($request);
|
||||||
|
|
||||||
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
|
$user = $this->registerUserHandler->handle(new RegisterUserCommand(
|
||||||
|
name: $form->get('name')->getData(),
|
||||||
|
email: $form->get('email')->getData(),
|
||||||
|
password: $form->get('plainPassword')->getData(),
|
||||||
|
));
|
||||||
|
|
||||||
|
$security->login($user->user);
|
||||||
|
|
||||||
|
return $this->redirectToRoute('app_index');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->render('user/getting-started.html.twig', [
|
||||||
|
'registrationForm' => $form,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ class Preference
|
|||||||
#[ORM\Column]
|
#[ORM\Column]
|
||||||
private ?string $id = null;
|
private ?string $id = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255, nullable: true)]
|
||||||
|
private ?string $type = null;
|
||||||
|
|
||||||
#[ORM\Column(length: 255, nullable: true)]
|
#[ORM\Column(length: 255, nullable: true)]
|
||||||
private ?string $name = null;
|
private ?string $name = null;
|
||||||
|
|
||||||
@@ -44,6 +47,12 @@ class Preference
|
|||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setId(string $id): static
|
||||||
|
{
|
||||||
|
$this->id = $id;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function setName(?string $name): static
|
public function setName(?string $name): static
|
||||||
{
|
{
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
@@ -51,6 +60,17 @@ class Preference
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getType(): ?string
|
||||||
|
{
|
||||||
|
return $this->type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setType(string $type): static
|
||||||
|
{
|
||||||
|
$this->type = $type;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function getDescription(): ?string
|
public function getDescription(): ?string
|
||||||
{
|
{
|
||||||
return $this->description;
|
return $this->description;
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUserPreferenceValues()
|
public function getUserPreferenceValues(string $type = 'all'): array
|
||||||
{
|
{
|
||||||
return Map::from($this->userPreferences)
|
return Map::from($this->userPreferences)
|
||||||
->rekey(fn(UserPreference $userPreference) => $userPreference->getPreference()->getId())
|
->rekey(fn(UserPreference $userPreference) => $userPreference->getPreference()->getId())
|
||||||
@@ -213,7 +213,6 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
|||||||
return $userPreference->getPreferenceValue();
|
return $userPreference->getPreferenceValue();
|
||||||
}
|
}
|
||||||
foreach ($userPreference->getPreference()->getPreferenceOptions() as $preferenceOption) {
|
foreach ($userPreference->getPreference()->getPreferenceOptions() as $preferenceOption) {
|
||||||
// dd((int) $userPreference->getPreferenceValue(), $preferenceOption->getId(), $preferenceOption->getValue());
|
|
||||||
if ($preferenceOption->getId() === (int) $userPreference->getPreferenceValue()) {
|
if ($preferenceOption->getId() === (int) $userPreference->getPreferenceValue()) {
|
||||||
return $preferenceOption->getValue();
|
return $preferenceOption->getValue();
|
||||||
}
|
}
|
||||||
@@ -273,6 +272,24 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
|||||||
return $this->downloads;
|
return $this->downloads;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getMediaPreferences()
|
||||||
|
{
|
||||||
|
return Map::from($this->userPreferences)
|
||||||
|
->rekey(fn(UserPreference $userPreference) => $userPreference->getPreference()->getId())
|
||||||
|
->filter(fn(UserPreference $userPreference) => $userPreference->getPreference()->getType() === 'media')
|
||||||
|
->toArray()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDownloadPreferences()
|
||||||
|
{
|
||||||
|
return Map::from($this->userPreferences)
|
||||||
|
->rekey(fn(UserPreference $userPreference) => $userPreference->getPreference()->getId())
|
||||||
|
->filter(fn(UserPreference $userPreference) => $userPreference->getPreference()->getType() === 'download')
|
||||||
|
->toArray()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Collection<int, Download>
|
* @return Collection<int, Download>
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
namespace App\User\Framework\Security;
|
namespace App\User\Framework\Security;
|
||||||
|
|
||||||
|
use App\User\Action\Command\RegisterLdapUserCommand;
|
||||||
|
use App\User\Action\Handler\RegisterLdapUserHandler;
|
||||||
use App\User\Framework\Entity\User;
|
use App\User\Framework\Entity\User;
|
||||||
use App\User\Framework\Repository\UserRepository;
|
use App\User\Framework\Repository\UserRepository;
|
||||||
use Symfony\Component\Ldap\Entry;
|
use Symfony\Component\Ldap\Entry;
|
||||||
@@ -45,6 +47,7 @@ class LdapUserProvider implements UserProviderInterface, PasswordUpgraderInterfa
|
|||||||
private string $displayNameAttribute;
|
private string $displayNameAttribute;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
private RegisterLdapUserHandler $registerLdapUserHandler,
|
||||||
private UserRepository $userRepository,
|
private UserRepository $userRepository,
|
||||||
private LdapInterface $ldap,
|
private LdapInterface $ldap,
|
||||||
private string $baseDn,
|
private string $baseDn,
|
||||||
@@ -159,21 +162,24 @@ class LdapUserProvider implements UserProviderInterface, PasswordUpgraderInterfa
|
|||||||
$dbUser = $this->getDbUser($identifier, $entry);
|
$dbUser = $this->getDbUser($identifier, $entry);
|
||||||
|
|
||||||
if (null === $dbUser) {
|
if (null === $dbUser) {
|
||||||
$dbUser = new User();
|
return $this->registerLdapUserHandler->handle(new RegisterLdapUserCommand(
|
||||||
$dbUser->setPassword("test");
|
name:$this->getAttributeValue($entry, $this->displayNameAttribute)[0] ?? null,
|
||||||
|
email:$this->getAttributeValue($entry, $this->emailAttribute)[0] ?? null,
|
||||||
|
username:$this->getAttributeValue($entry, $this->usernameAttribute) ?? null,
|
||||||
|
password: uniqid(),
|
||||||
|
))->user;
|
||||||
|
} else {
|
||||||
|
$dbUser
|
||||||
|
->setName($this->getAttributeValue($entry, $this->displayNameAttribute)[0] ?? null)
|
||||||
|
->setEmail($this->getAttributeValue($entry, $this->emailAttribute)[0] ?? null)
|
||||||
|
->setUsername($this->getAttributeValue($entry, $this->usernameAttribute) ?? null);
|
||||||
|
$this->userRepository->getEntityManager()->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
$dbUser
|
|
||||||
->setName( $this->getAttributeValue($entry, $this->displayNameAttribute)[0] ?? null)
|
|
||||||
->setEmail($this->getAttributeValue($entry, $this->emailAttribute)[0] ?? null)
|
|
||||||
->setUsername($this->getAttributeValue($entry, $this->usernameAttribute) ?? null);
|
|
||||||
|
|
||||||
$this->userRepository->getEntityManager()->persist($dbUser);
|
|
||||||
$this->userRepository->getEntityManager()->flush();
|
|
||||||
|
|
||||||
return $dbUser;
|
return $dbUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return User */
|
||||||
private function getDbUser(string $identifier, Entry $entry): ?UserInterface
|
private function getDbUser(string $identifier, Entry $entry): ?UserInterface
|
||||||
{
|
{
|
||||||
if (in_array($this->uidKey, ['mail', 'email'])) {
|
if (in_array($this->uidKey, ['mail', 'email'])) {
|
||||||
|
|||||||
12
symfony.lock
@@ -16,6 +16,18 @@
|
|||||||
"src/Repository/.gitignore"
|
"src/Repository/.gitignore"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"doctrine/doctrine-fixtures-bundle": {
|
||||||
|
"version": "4.1",
|
||||||
|
"recipe": {
|
||||||
|
"repo": "github.com/symfony/recipes",
|
||||||
|
"branch": "main",
|
||||||
|
"version": "3.0",
|
||||||
|
"ref": "1f5514cfa15b947298df4d771e694e578d4c204d"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"src/DataFixtures/AppFixtures.php"
|
||||||
|
]
|
||||||
|
},
|
||||||
"doctrine/doctrine-migrations-bundle": {
|
"doctrine/doctrine-migrations-bundle": {
|
||||||
"version": "3.4",
|
"version": "3.4",
|
||||||
"recipe": {
|
"recipe": {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
{% block importmap %}{{ importmap('app') }}{% endblock %}
|
{% block importmap %}{{ importmap('app') }}{% endblock %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
<body class="bg-cyan-950 flex flex-col">
|
<body class="bg-cyan-950 flex flex-col h-full">
|
||||||
<h1 class="px-4 py-4 text-3xl font-extrabold text-orange-500">Torsearch</h1>
|
<h1 class="px-4 py-4 text-3xl font-extrabold text-orange-500">Torsearch</h1>
|
||||||
<div class="flex flex-col justify-center items-center">
|
<div class="flex flex-col justify-center items-center">
|
||||||
{% block body %}{% endblock %}
|
{% block body %}{% endblock %}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
{% block importmap %}{{ importmap('app') }}{% endblock %}
|
{% block importmap %}{{ importmap('app') }}{% endblock %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
<body class="bg-neutral-700 flex flex-col backdrop-filter backdrop-blur-sm bg-opacity-100">
|
<body class="flex flex-col bg-stone-700">
|
||||||
<div class="grid grid-cols-6">
|
<div class="grid grid-cols-6">
|
||||||
<div class="col-span-1 h-screen">
|
<div class="col-span-1 h-screen">
|
||||||
<twig:NavBar />
|
<twig:NavBar />
|
||||||
|
|||||||
@@ -31,9 +31,9 @@
|
|||||||
{{ entity.title }}
|
{{ entity.title }}
|
||||||
</td>
|
</td>
|
||||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-end text-gray-800 dark:text-gray-50">
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-end text-gray-800 dark:text-gray-50">
|
||||||
<span class="p-1.5 bg-purple-600 rounded-full">
|
<div class="border-2 border-green-700 rounded-md w-full h-6 align-middle overflow-hidden">
|
||||||
<span class="mw-4 inline-block text-center text-gray-50">{{ entity.progress }}</span>
|
<div class="text-green-700 rounded-sm text-bold text-gray-950 text-center bg-green-600 h-5" style="width:{{ entity.progress }}%">{{ entity.progress }}%</div>
|
||||||
</span>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</template>
|
</template>
|
||||||
</turbo-stream>
|
</turbo-stream>
|
||||||
|
|||||||
@@ -44,9 +44,12 @@
|
|||||||
|
|
||||||
<td class="px-6 py-4 whitespace-nowrap text-sm align-middle text-gray-800 dark:text-gray-50">
|
<td class="px-6 py-4 whitespace-nowrap text-sm align-middle text-gray-800 dark:text-gray-50">
|
||||||
{% if download.progress < 100 %}
|
{% if download.progress < 100 %}
|
||||||
<div class="w-[3.25ch] h-[3.25ch] bg-purple-600 rounded-full block text-center table-cell align-middle text-xs text-gray-50">
|
<div class="border-2 border-green-700 rounded-md w-full h-6 align-middle overflow-hidden">
|
||||||
{{ download.progress }}
|
<div class="text-green-700 rounded-sm text-bold text-gray-950 text-center bg-green-600 h-5" style="width:{{ download.progress }}%">{{ download.progress }}%</div>
|
||||||
</div>
|
</div>
|
||||||
|
{# <div class="w-[3.25ch] h-[3.25ch] bg-purple-600 rounded-full block text-center table-cell align-middle text-xs text-gray-50">#}
|
||||||
|
{# {{ download.progress }}#}
|
||||||
|
{# </div>#}
|
||||||
{% else %}
|
{% else %}
|
||||||
<twig:StatusBadge color="green" status="Completed" />
|
<twig:StatusBadge color="green" status="Completed" />
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('app_media_preferences') }}"
|
<a href="{{ path('app_user_preferences') }}"
|
||||||
class="block rounded-lg px-4 py-2 text-sm font-medium text-gray-50 hover:bg-gray-100 hover:text-stone-700">
|
class="block rounded-lg px-4 py-2 text-sm font-medium text-gray-50 hover:bg-gray-100 hover:text-stone-700">
|
||||||
Preferences
|
Preferences
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
69
templates/user/getting-started.html.twig
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
{% extends 'bare.html.twig' %}
|
||||||
|
|
||||||
|
{% block title %}Getting Started — Torsearch{% endblock %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<div class="flex flex-col bg-orange-500/50 p-4 rounded-lg gap-4 min-w-96 border-orange-500 border-2 text-gray-50">
|
||||||
|
<h2 class="text-2xl text-bold text-center text-gray-50">Getting Started</h2>
|
||||||
|
<p class="mb-2">Let's get started by creating your first User.</p>
|
||||||
|
|
||||||
|
{{ form_start(registrationForm) }}
|
||||||
|
|
||||||
|
{### Start Name ###}
|
||||||
|
<label for="name" class="flex flex-col mb-2">
|
||||||
|
{{ field_label(registrationForm.name) }}
|
||||||
|
|
||||||
|
{% if form_errors(registrationForm.name) %}
|
||||||
|
<span class="w-full p-1 text-[.775rem] font-bold border-2 border-red-600 text-black bg-red-500/70 rounded-md">
|
||||||
|
{{ form_errors(registrationForm.name) }}
|
||||||
|
</span>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<input type="text"
|
||||||
|
name="{{ field_name(registrationForm.name) }}"
|
||||||
|
id="{{ field_name(registrationForm.name) }}"
|
||||||
|
value="{{ field_value(registrationForm.name) }}"
|
||||||
|
class="bg-gray-50 text-gray-50 p-1 bg-transparent border-b-2 border-orange-400" />
|
||||||
|
</label>
|
||||||
|
{# ################### #}
|
||||||
|
|
||||||
|
{### Start Email ###}
|
||||||
|
<label for="email" class="flex flex-col mb-2">
|
||||||
|
{{ field_label(registrationForm.email) }}
|
||||||
|
|
||||||
|
{% if form_errors(registrationForm.email) %}
|
||||||
|
<span class="w-full p-1 text-[.775rem] font-bold text-black bg-red-500/70 rounded-md">
|
||||||
|
{{ form_errors(registrationForm.email) }}
|
||||||
|
</span>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<input type="email"
|
||||||
|
name="{{ field_name(registrationForm.email) }}"
|
||||||
|
id="{{ field_name(registrationForm.email) }}"
|
||||||
|
value="{{ field_value(registrationForm.email) }}"
|
||||||
|
class="bg-gray-50 text-gray-50 p-1 bg-transparent border-b-2 border-orange-400" />
|
||||||
|
</label>
|
||||||
|
{# ################### #}
|
||||||
|
|
||||||
|
{### Start Password ###}
|
||||||
|
<label for="password" class="flex flex-col mb-2">
|
||||||
|
{{ field_label(registrationForm.plainPassword) }}
|
||||||
|
|
||||||
|
{% if form_errors(registrationForm.plainPassword) %}
|
||||||
|
<span class="w-full p-1 text-[.775rem] font-bold border-2 border-red-600 text-black bg-red-500/70 rounded-md">
|
||||||
|
{{ form_errors(registrationForm.plainPassword) }}
|
||||||
|
</span>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<input type="password"
|
||||||
|
name="{{ field_name(registrationForm.plainPassword) }}"
|
||||||
|
id="{{ field_name(registrationForm.plainPassword) }}"
|
||||||
|
value="{{ field_value(registrationForm.plainPassword) }}"
|
||||||
|
class="bg-gray-50 text-gray-50 p-1 bg-transparent border-b-2 border-orange-400 mb-3" />
|
||||||
|
</label>
|
||||||
|
{# ################### #}
|
||||||
|
|
||||||
|
<button type="submit" class="bg-green-600/40 px-1.5 py-1 w-full rounded-md text-gray-50 backdrop-filter backdrop-blur-sm border-2 border-green-500 hover:bg-green-700/40">Register</button>
|
||||||
|
{{ form_end(registrationForm) }}
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
@@ -3,11 +3,13 @@
|
|||||||
{% block title %}Log in — Torsearch{% endblock %}
|
{% block title %}Log in — Torsearch{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<div class="flex flex-col bg-orange-500 bg-opacity-60 border-orange-500 border-2 p-4 rounded-lg gap-2 min-w-96 text-gray-50">
|
<div class="flex flex-col bg-orange-500/50 p-4 rounded-lg gap-4 min-w-96 border-orange-500 border-2 text-gray-50">
|
||||||
<h2 class="text-xl font-bold">Login</h2>
|
<h2 class="text-xl font-bold">Login</h2>
|
||||||
<form method="post" class="flex flex-col gap-2">
|
<form method="post" class="flex flex-col gap-2">
|
||||||
{% if error %}
|
{% if error %}
|
||||||
<div class="bg-red-400 border-red-600 rounded p-2 text-red-600">{{ error.messageKey|trans(error.messageData, 'security') }}</div>
|
<div class="w-full p-1 mb-3 font-bold text-black bg-red-500/70 rounded-md">
|
||||||
|
{{ error.messageKey|trans(error.messageData, 'security') }}
|
||||||
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if app.user %}
|
{% if app.user %}
|
||||||
@@ -16,15 +18,15 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<label for="username" class="mb-2 flex flex-col">
|
<label for="username" class="flex flex-col mb-2">
|
||||||
User
|
User
|
||||||
<input type=""
|
<input type="text"
|
||||||
value="{{ last_username }}"
|
|
||||||
name="_username"
|
name="_username"
|
||||||
id="username"
|
id="username"
|
||||||
class="bg-gray-50 text-gray-950 p-1 rounded-md"
|
value="{{ last_username }}"
|
||||||
autocomplete="email"
|
class="bg-gray-50 text-gray-50 p-1 bg-transparent border-b-2 border-orange-400"
|
||||||
required autofocus>
|
required autofocus
|
||||||
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label for="password" class="mb-2 flex flex-col">
|
<label for="password" class="mb-2 flex flex-col">
|
||||||
@@ -32,7 +34,7 @@
|
|||||||
<input type="password"
|
<input type="password"
|
||||||
name="_password"
|
name="_password"
|
||||||
id="password"
|
id="password"
|
||||||
class="bg-gray-50 text-gray-950 p-1 rounded-md"
|
class="bg-gray-50 text-gray-50 p-1 bg-transparent border-b-2 border-orange-400"
|
||||||
autocomplete="current-password"
|
autocomplete="current-password"
|
||||||
required>
|
required>
|
||||||
</label>
|
</label>
|
||||||
@@ -43,8 +45,7 @@
|
|||||||
<label for="_remember_me">Remember me</label>
|
<label for="_remember_me">Remember me</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" class="bg-green-600/40 px-1.5 py-1 w-full rounded-md text-gray-50 backdrop-filter backdrop-blur-sm border-2 border-green-500 hover:bg-green-700/40">
|
||||||
<button class="bg-green-600 px-1.5 py-1 rounded-md text-gray-50" type="submit">
|
|
||||||
Sign in
|
Sign in
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -3,55 +3,78 @@
|
|||||||
{% block h2 %}Preferences{% endblock %}
|
{% block h2 %}Preferences{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<div class="p-4 flex flex-col">
|
<div class="p-4 flex flex-row gap-2">
|
||||||
<twig:Card title="Choose your preferences">
|
<twig:Card title="Media Preferences" class="w-full">
|
||||||
<p class="text-gray-50 mb-2">Define a set of filters to apply to your media download option results.</p>
|
<p class="text-gray-50 mb-2">Define a filter to be pre-applied to your download options.</p>
|
||||||
<form id="media_preferences" class="flex flex-col max-w-64" name="media_preferences" method="post" action="{{ path('app_media_preferences') }}">
|
<form id="media_preferences" class="flex flex-col max-w-64" name="media_preferences" method="post" action="{{ path('app_save_media_preferences') }}">
|
||||||
|
|
||||||
<label class="text-gray-50" for="resolution">Resolution</label>
|
<label class="text-gray-50" for="resolution">Resolution</label>
|
||||||
<select class="p-1.5 rounded-md mb-2" name="resolution" id="resolution" value="{{ userPreferences['resolution'].getPreferenceValue() }}">
|
<select class="p-1.5 rounded-md mb-2" name="resolution" id="resolution" value="{{ mediaPreferences['resolution'].getPreferenceValue() }}">
|
||||||
{% for pref in userPreferences['resolution'].getPreference().getPreferenceOptions() %}
|
<option class="text-gray-800"
|
||||||
|
value=""
|
||||||
|
{{ mediaPreferences['resolution'] is null ? "selected" }}
|
||||||
|
>n/a</option>
|
||||||
|
|
||||||
|
{% for pref in mediaPreferences['resolution'].getPreference().getPreferenceOptions() %}
|
||||||
<option class="text-gray-800"
|
<option class="text-gray-800"
|
||||||
value="{{ pref.id }}"
|
value="{{ pref.id }}"
|
||||||
{{ pref.id == userPreferences['resolution'].getPreferenceValue() ? "selected" }}
|
{{ pref.id == mediaPreferences['resolution'].getPreferenceValue() ? "selected" }}
|
||||||
>{{ pref.name }}</option>
|
>{{ pref.name }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<label class="text-gray-50" for="codec">Codec</label>
|
<label class="text-gray-50" for="codec">Codec</label>
|
||||||
<select class="p-1.5 rounded-md mb-2" name="codec" id="codec" value="{{ userPreferences['codec'].getPreferenceValue() }}">
|
<select class="p-1.5 rounded-md mb-2" name="codec" id="codec" value="{{ mediaPreferences['codec'].getPreferenceValue() }}">
|
||||||
{% for pref in userPreferences['codec'].getPreference().getPreferenceOptions() %}
|
<option class="text-gray-800"
|
||||||
|
value=""
|
||||||
|
{{ mediaPreferences['codec'].getPreferenceValue() is null ? "selected" }}
|
||||||
|
>n/a</option>
|
||||||
|
{% for pref in mediaPreferences['codec'].getPreference().getPreferenceOptions() %}
|
||||||
<option class="text-gray-800"
|
<option class="text-gray-800"
|
||||||
value="{{ pref.id }}"
|
value="{{ pref.id }}"
|
||||||
{{ pref.id == userPreferences['codec'].getPreferenceValue() ? "selected" }}
|
{{ pref.id == mediaPreferences['codec'].getPreferenceValue() ? "selected" }}
|
||||||
>{{ pref.name }}</option>
|
>{{ pref.name }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<label class="text-gray-50" for="provider">Provider</label>
|
<label class="text-gray-50" for="provider">Provider</label>
|
||||||
<select class="p-1.5 rounded-md mb-2" name="provider" id="provider" value="{{ userPreferences['provider'].getPreferenceValue() }}">
|
<select class="p-1.5 rounded-md mb-2" name="provider" id="provider" value="{{ mediaPreferences['provider'].getPreferenceValue() }}">
|
||||||
<option class="text-gray-800" value=""
|
<option class="text-gray-800"
|
||||||
{{ "" == userPreferences['provider'].getPreferenceValue() ? "selected" }}
|
value=""
|
||||||
|
{{ "" == mediaPreferences['provider'].getPreferenceValue() ? "selected" }}
|
||||||
>n/a</option>
|
>n/a</option>
|
||||||
{% for provider in providers %}
|
{% for provider in providers %}
|
||||||
<option class="text-gray-800"
|
<option class="text-gray-800"
|
||||||
value="{{ provider }}"
|
value="{{ provider }}"
|
||||||
{{ provider == userPreferences['provider'].getPreferenceValue() ? "selected" }}
|
{{ provider == mediaPreferences['provider'].getPreferenceValue() ? "selected" }}
|
||||||
>{{ provider }}</option>
|
>{{ provider }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<label class="text-gray-50" for="language">Language</label>
|
<label class="text-gray-50" for="language">Language</label>
|
||||||
<select class="p-1.5 rounded-md mb-2" name="language" id="language" value="{{ userPreferences['language'].getPreferenceValue() }}">
|
<select class="p-1.5 rounded-md mb-2" name="language" id="language" value="{{ mediaPreferences['language'].getPreferenceValue() }}">
|
||||||
|
<option class="text-gray-800"
|
||||||
|
value=""
|
||||||
|
{{ mediaPreferences['language'].getPreferenceValue() is null ? "selected" }}
|
||||||
|
>n/a</option>
|
||||||
{% for language in languages %}
|
{% for language in languages %}
|
||||||
<option class="text-gray-800"
|
<option class="text-gray-800"
|
||||||
value="{{ language }}"
|
value="{{ language }}"
|
||||||
{{ language == userPreferences['language'].getPreferenceValue() ? "selected" }}
|
{{ language == mediaPreferences['language'].getPreferenceValue() ? "selected" }}
|
||||||
>{{ language }}</option>
|
>{{ language }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
|
<button class="px-1.5 py-1 max-w-20 rounded-md bg-green-600 text-white" type="submit">Submit</button>
|
||||||
|
</form>
|
||||||
|
</twig:Card>
|
||||||
|
|
||||||
|
<twig:Card title="Download Preferences" class="w-full">
|
||||||
|
<p class="text-gray-50 mb-2">Change how your downloads are stored.</p>
|
||||||
|
<form id="download_preferences" class="flex flex-col" name="download_preferences" method="post" action="{{ path('app_save_download_preferences') }}">
|
||||||
|
<div class="flex flex-row gap-2 mb-2">
|
||||||
|
<input type="hidden" name="movie_folder" id="movie_folder_hidden" value="0" />
|
||||||
|
<input type="checkbox" name="movie_folder" id="movie_folder" value="1" {{ downloadPreferences['movie_folder'].getPreferenceValue() == true ? 'checked' }} />
|
||||||
|
<label class="text-gray-50" for="movie_folder">Store movies in a new directory?</label>
|
||||||
|
</div>
|
||||||
<button class="px-1.5 py-1 max-w-20 rounded-md bg-green-600 text-white" type="submit">Submit</button>
|
<button class="px-1.5 py-1 max-w-20 rounded-md bg-green-600 text-white" type="submit">Submit</button>
|
||||||
</form>
|
</form>
|
||||||
</twig:Card>
|
</twig:Card>
|
||||||
|
|||||||