WIP
3
.dockerignore
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
*.md
|
||||||
|
*.example
|
||||||
|
|
||||||
11
.gitignore
vendored
@@ -1,14 +1,13 @@
|
|||||||
/.idea
|
.idea/
|
||||||
/.vscode
|
.vscode/
|
||||||
downloaded/
|
downloaded/
|
||||||
/src/commit
|
|
||||||
/src/cache/*
|
commit
|
||||||
/src/vendor
|
|
||||||
/src/views/custom.twig
|
|
||||||
*.log
|
*.log
|
||||||
.env
|
.env
|
||||||
*.m3u
|
*.m3u
|
||||||
*.m3u.*
|
*.m3u.*
|
||||||
*.m3u8
|
*.m3u8
|
||||||
*.m3u8.*
|
*.m3u8.*
|
||||||
|
|
||||||
!/**/.gitkeep
|
!/**/.gitkeep
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ networks:
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
|
|
||||||
php:
|
svc-main:
|
||||||
container_name: iptv-php
|
container_name: iptv-svc-main
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
environment:
|
environment:
|
||||||
@@ -20,8 +20,9 @@ services:
|
|||||||
- ./docker/php/www.conf:/usr/local/etc/php-fpm.d/www.conf:ro
|
- ./docker/php/www.conf:/usr/local/etc/php-fpm.d/www.conf:ro
|
||||||
- ./docker/php/${IPTV_ENV}.php.ini:/usr/local/etc/php/conf.d/php.ini:ro
|
- ./docker/php/${IPTV_ENV}.php.ini:/usr/local/etc/php/conf.d/php.ini:ro
|
||||||
- ./log/php:/var/log/php:rw
|
- ./log/php:/var/log/php:rw
|
||||||
- ./src:/var/www:rw
|
- ./src/svc-main:/var/www:rw
|
||||||
- ./playlists.ini:/var/www/config/playlists.ini:ro
|
- ./commit:/var/www/commit:ro
|
||||||
|
- ./playlists.ini:/var/www/playlists.ini:ro
|
||||||
|
|
||||||
nginx:
|
nginx:
|
||||||
container_name: iptv-nginx
|
container_name: iptv-nginx
|
||||||
@@ -31,12 +32,12 @@ services:
|
|||||||
- iptv
|
- iptv
|
||||||
volumes:
|
volumes:
|
||||||
- /etc/localtime:/etc/localtime:ro
|
- /etc/localtime:/etc/localtime:ro
|
||||||
- ./docker/nginx/vhost.conf:/etc/nginx/conf.d/default.conf:ro
|
- ./docker/nginx/vhost.conf:/etc/nginx/conf.d/default.conf
|
||||||
- ./log/nginx:/var/log/nginx:rw
|
- ./log/nginx:/var/log/nginx:rw
|
||||||
- ./src:/var/www:ro
|
- ./src/svc-main:/var/www:ro
|
||||||
ports:
|
ports:
|
||||||
- '8080:80'
|
- '8080:80'
|
||||||
links:
|
links:
|
||||||
- php
|
- svc-main
|
||||||
depends_on:
|
depends_on:
|
||||||
- php
|
- svc-main
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ server {
|
|||||||
}
|
}
|
||||||
location ~ \.php$ {
|
location ~ \.php$ {
|
||||||
try_files $uri /index.php =404;
|
try_files $uri /index.php =404;
|
||||||
fastcgi_pass php:9000;
|
fastcgi_pass svc-main:9000;
|
||||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||||
fastcgi_index index.php;
|
fastcgi_index index.php;
|
||||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
FROM php:8.2-fpm
|
FROM php:8.4-fpm
|
||||||
|
|
||||||
RUN apt update && \
|
RUN apt update && \
|
||||||
apt upgrade -y && \
|
apt upgrade -y && \
|
||||||
apt install -y git unzip 7zip
|
apt install -y --no-install-recommends git unzip 7zip && \
|
||||||
|
apt-get clean autoclean && \
|
||||||
|
apt-get autoremove --yes && \
|
||||||
|
rm -rf /var/lib/{apt,dpkg,cache,log}/
|
||||||
|
|
||||||
# https://pecl.php.net/package/xdebug
|
# https://pecl.php.net/package/xdebug
|
||||||
RUN pecl channel-update pecl.php.net && \
|
RUN pecl channel-update pecl.php.net && \
|
||||||
pecl install xdebug-3.3.2 unzip && \
|
pecl install xdebug-3.4.0 unzip && \
|
||||||
mkdir -p /var/log/php
|
mkdir -p /var/log/php
|
||||||
|
|
||||||
COPY --from=composer /usr/bin/composer /usr/local/bin/composer
|
COPY --from=composer /usr/bin/composer /usr/local/bin/composer
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
FROM php:8.2-fpm
|
FROM php:8.4-fpm
|
||||||
|
|
||||||
RUN apt update && \
|
RUN apt update && \
|
||||||
apt upgrade -y && \
|
apt upgrade -y && \
|
||||||
apt install -y git
|
apt install -y --no-install-recommends git && \
|
||||||
|
apt-get clean autoclean && \
|
||||||
|
apt-get autoremove --yes && \
|
||||||
|
rm -rf /var/lib/{apt,dpkg,cache,log}/
|
||||||
|
|
||||||
COPY --from=composer /usr/bin/composer /usr/local/bin/composer
|
COPY --from=composer /usr/bin/composer /usr/local/bin/composer
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# хук пробрасывает хэш свежего коммита в контейнер
|
# хук пробрасывает хэш свежего коммита в контейнер
|
||||||
# для его отображения в подвале страницы
|
# для его отображения в подвале страницы
|
||||||
git rev-parse HEAD > src/commit
|
git rev-parse HEAD > commit
|
||||||
|
|||||||
@@ -3,5 +3,5 @@
|
|||||||
# для его отображения в подвале страницы и очищает
|
# для его отображения в подвале страницы и очищает
|
||||||
# кеш шаблонов twig после слияния веток
|
# кеш шаблонов twig после слияния веток
|
||||||
# главным образом необходимо при git pull
|
# главным образом необходимо при git pull
|
||||||
git rev-parse HEAD > src/commit
|
git rev-parse HEAD > commit
|
||||||
docker exec -ti iptv-php rm -rf cache/views
|
docker exec -ti svc-main rm -rf cache/views
|
||||||
|
|||||||
4
iptv
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# https://gist.github.com/anthonyaxenov/89c99e09ddb195985707e2b24a57257d
|
# https://gist.github.com/anthonyaxenov/89c99e09ddb195985707e2b24a57257d
|
||||||
|
|
||||||
CONTAINER="iptv-php" # the name of the container in which to 'exec' something
|
CONTAINER="iptv-main" # the name of the container in which to 'exec' something
|
||||||
CONFIG="$(dirname $([ -L $0 ] && readlink -f $0 || echo $0))/docker-compose.yml" # path to compose yml file
|
CONFIG="$(dirname $([ -L $0 ] && readlink -f $0 || echo $0))/docker-compose.yml" # path to compose yml file
|
||||||
CMD="docker compose -f $CONFIG" # docker-compose command
|
CMD="docker compose -f $CONFIG" # docker-compose command
|
||||||
APP_URL='http://localhost:8080/'
|
APP_URL='http://localhost:8080/'
|
||||||
@@ -29,6 +29,6 @@ case "$1" in
|
|||||||
'restart' ) $CMD stop && $CMD start ;; # restart containers
|
'restart' ) $CMD stop && $CMD start ;; # restart containers
|
||||||
'rebuild' ) $CMD down --remove-orphans && $CMD up -d --build ;; # rebuild containers
|
'rebuild' ) $CMD down --remove-orphans && $CMD up -d --build ;; # rebuild containers
|
||||||
'open' ) open_browser $APP_URL && echo -e "\nYou're welcome!\n\t$APP_URL" ;;
|
'open' ) open_browser $APP_URL && echo -e "\nYou're welcome!\n\t$APP_URL" ;;
|
||||||
'hooks' ) ./hooks/post-commit && cp hooks/* .git/hooks ;;
|
'hooks' ) сp -f hooks/* .git/hooks ;;
|
||||||
* ) docker exec -ti $CONTAINER $* ;; # exec anything else in container
|
* ) docker exec -ti $CONTAINER $* ;; # exec anything else in container
|
||||||
esac
|
esac
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
src/config/playlists.ini
|
|
||||||
1153
playlists.ini
Normal file
0
src/cache/.gitkeep
vendored
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
TOOLS_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )";
|
TOOLS_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )";
|
||||||
DL_DIR="$TOOLS_DIR/downloaded"
|
DL_DIR="$TOOLS_DIR/downloaded"
|
||||||
INI_FILE="$(dirname "$TOOLS_DIR")/playlists.ini"
|
INI_FILE="$(dirname "$TOOLS_DIR")/../../playlists.ini"
|
||||||
|
|
||||||
rm -rf "$DL_DIR" && \
|
rm -rf "$DL_DIR" && \
|
||||||
mkdir -p "$DL_DIR" && \
|
mkdir -p "$DL_DIR" && \
|
||||||
10
src/svc-main/.gitignore
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
vendor/
|
||||||
|
cache/
|
||||||
|
|
||||||
|
views/custom.twig
|
||||||
|
playlists.ini
|
||||||
|
commit
|
||||||
|
*.log
|
||||||
|
.env
|
||||||
|
|
||||||
|
!/**/.gitkeep
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^8.2",
|
"php": "^8.4",
|
||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"ext-curl": "*",
|
"ext-curl": "*",
|
||||||
"ext-fileinfo": "*",
|
"ext-fileinfo": "*",
|
||||||
@@ -10,10 +10,12 @@
|
|||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"App\\": "app/"
|
"Core\\": "core/",
|
||||||
|
"Controllers\\": "controllers/",
|
||||||
|
"Exceptions\\": "exceptions/"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"app/helpers.php"
|
"helpers.php"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
60
src/composer.lock → src/svc-main/composer.lock
generated
@@ -4,20 +4,20 @@
|
|||||||
"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": "3cbd8253b2f0790d682e38f308df6e7f",
|
"content-hash": "1aaea4609092e8a88074f050dab42323",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "mikecao/flight",
|
"name": "mikecao/flight",
|
||||||
"version": "v3.12.0",
|
"version": "v3.13.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/flightphp/core.git",
|
"url": "https://github.com/flightphp/core.git",
|
||||||
"reference": "63fbf9b0316969e8aa6c318f8479d1ed0578f9b4"
|
"reference": "1307e8a39d89fadba69d0c2dad53b6e0da83fd96"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/flightphp/core/zipball/63fbf9b0316969e8aa6c318f8479d1ed0578f9b4",
|
"url": "https://api.github.com/repos/flightphp/core/zipball/1307e8a39d89fadba69d0c2dad53b6e0da83fd96",
|
||||||
"reference": "63fbf9b0316969e8aa6c318f8479d1ed0578f9b4",
|
"reference": "1307e8a39d89fadba69d0c2dad53b6e0da83fd96",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"ext-pdo_sqlite": "*",
|
"ext-pdo_sqlite": "*",
|
||||||
"flightphp/runway": "^0.2.0",
|
"flightphp/runway": "^0.2.3 || ^1.0",
|
||||||
"league/container": "^4.2",
|
"league/container": "^4.2",
|
||||||
"level-2/dice": "^4.0",
|
"level-2/dice": "^4.0",
|
||||||
"phpstan/extension-installer": "^1.3",
|
"phpstan/extension-installer": "^1.3",
|
||||||
@@ -73,22 +73,22 @@
|
|||||||
"homepage": "http://flightphp.com",
|
"homepage": "http://flightphp.com",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/flightphp/core/issues",
|
"issues": "https://github.com/flightphp/core/issues",
|
||||||
"source": "https://github.com/flightphp/core/tree/v3.12.0"
|
"source": "https://github.com/flightphp/core/tree/v3.13.0"
|
||||||
},
|
},
|
||||||
"time": "2024-08-22T17:05:34+00:00"
|
"time": "2024-10-30T19:52:23+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/deprecation-contracts",
|
"name": "symfony/deprecation-contracts",
|
||||||
"version": "v3.5.0",
|
"version": "v3.5.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/deprecation-contracts.git",
|
"url": "https://github.com/symfony/deprecation-contracts.git",
|
||||||
"reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1"
|
"reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1",
|
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6",
|
||||||
"reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1",
|
"reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -126,7 +126,7 @@
|
|||||||
"description": "A generic function and convention to trigger deprecation notices",
|
"description": "A generic function and convention to trigger deprecation notices",
|
||||||
"homepage": "https://symfony.com",
|
"homepage": "https://symfony.com",
|
||||||
"support": {
|
"support": {
|
||||||
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.0"
|
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.1"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -142,20 +142,20 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2024-04-18T09:32:20+00:00"
|
"time": "2024-09-25T14:20:29+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/dotenv",
|
"name": "symfony/dotenv",
|
||||||
"version": "v7.1.5",
|
"version": "v7.2.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/dotenv.git",
|
"url": "https://github.com/symfony/dotenv.git",
|
||||||
"reference": "6d966200b399fa59759286f3fc7c919f0677c449"
|
"reference": "28347a897771d0c28e99b75166dd2689099f3045"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/dotenv/zipball/6d966200b399fa59759286f3fc7c919f0677c449",
|
"url": "https://api.github.com/repos/symfony/dotenv/zipball/28347a897771d0c28e99b75166dd2689099f3045",
|
||||||
"reference": "6d966200b399fa59759286f3fc7c919f0677c449",
|
"reference": "28347a897771d0c28e99b75166dd2689099f3045",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -200,7 +200,7 @@
|
|||||||
"environment"
|
"environment"
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"source": "https://github.com/symfony/dotenv/tree/v7.1.5"
|
"source": "https://github.com/symfony/dotenv/tree/v7.2.0"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -216,7 +216,7 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2024-09-17T09:16:35+00:00"
|
"time": "2024-11-27T11:18:42+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/polyfill-ctype",
|
"name": "symfony/polyfill-ctype",
|
||||||
@@ -455,16 +455,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "twig/twig",
|
"name": "twig/twig",
|
||||||
"version": "v3.14.0",
|
"version": "v3.16.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/twigphp/Twig.git",
|
"url": "https://github.com/twigphp/Twig.git",
|
||||||
"reference": "126b2c97818dbff0cdf3fbfc881aedb3d40aae72"
|
"reference": "475ad2dc97d65d8631393e721e7e44fb544f0561"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/twigphp/Twig/zipball/126b2c97818dbff0cdf3fbfc881aedb3d40aae72",
|
"url": "https://api.github.com/repos/twigphp/Twig/zipball/475ad2dc97d65d8631393e721e7e44fb544f0561",
|
||||||
"reference": "126b2c97818dbff0cdf3fbfc881aedb3d40aae72",
|
"reference": "475ad2dc97d65d8631393e721e7e44fb544f0561",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -475,6 +475,7 @@
|
|||||||
"symfony/polyfill-php81": "^1.29"
|
"symfony/polyfill-php81": "^1.29"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
"phpstan/phpstan": "^2.0",
|
||||||
"psr/container": "^1.0|^2.0",
|
"psr/container": "^1.0|^2.0",
|
||||||
"symfony/phpunit-bridge": "^5.4.9|^6.4|^7.0"
|
"symfony/phpunit-bridge": "^5.4.9|^6.4|^7.0"
|
||||||
},
|
},
|
||||||
@@ -518,7 +519,7 @@
|
|||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/twigphp/Twig/issues",
|
"issues": "https://github.com/twigphp/Twig/issues",
|
||||||
"source": "https://github.com/twigphp/Twig/tree/v3.14.0"
|
"source": "https://github.com/twigphp/Twig/tree/v3.16.0"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -530,20 +531,21 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2024-09-09T17:55:12+00:00"
|
"time": "2024-11-29T08:27:05+00:00"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"packages-dev": [],
|
"packages-dev": [],
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
"minimum-stability": "stable",
|
"minimum-stability": "stable",
|
||||||
"stability-flags": [],
|
"stability-flags": {},
|
||||||
"prefer-stable": false,
|
"prefer-stable": false,
|
||||||
"prefer-lowest": false,
|
"prefer-lowest": false,
|
||||||
"platform": {
|
"platform": {
|
||||||
"php": "^8.2",
|
"php": "^8.2",
|
||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"ext-curl": "*"
|
"ext-curl": "*",
|
||||||
|
"ext-fileinfo": "*"
|
||||||
},
|
},
|
||||||
"platform-dev": [],
|
"platform-dev": {},
|
||||||
"plugin-api-version": "2.6.0"
|
"plugin-api-version": "2.6.0"
|
||||||
}
|
}
|
||||||
@@ -2,12 +2,12 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Controllers;
|
namespace Controllers;
|
||||||
|
|
||||||
use App\Core\IniFile;
|
use Core\IniFile;
|
||||||
use App\Core\Playlist;
|
use Core\Playlist;
|
||||||
use App\Exceptions\PlaylistNotFoundException;
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use Exceptions\PlaylistNotFoundException;
|
||||||
use Flight;
|
use Flight;
|
||||||
use Random\RandomException;
|
use Random\RandomException;
|
||||||
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Controllers;
|
namespace Controllers;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Flight;
|
use Flight;
|
||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Controllers;
|
namespace Controllers;
|
||||||
|
|
||||||
use App\Core\ChannelLogo;
|
use Core\ChannelLogo;
|
||||||
use App\Exceptions\PlaylistNotFoundException;
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use Exceptions\PlaylistNotFoundException;
|
||||||
use Flight;
|
use Flight;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Core;
|
namespace Core;
|
||||||
|
|
||||||
use App\Extensions\TwigFunctions;
|
|
||||||
use Flight;
|
use Flight;
|
||||||
use Twig\Environment;
|
use Twig\Environment;
|
||||||
use Twig\Extension\DebugExtension;
|
use Twig\Extension\DebugExtension;
|
||||||
@@ -22,7 +21,7 @@ final class Bootstrapper
|
|||||||
*/
|
*/
|
||||||
public static function bootSettings(): void
|
public static function bootSettings(): void
|
||||||
{
|
{
|
||||||
$config = require_once config_path('app.php');
|
$config = require_once root_path('config.php');
|
||||||
foreach ($config as $key => $value) {
|
foreach ($config as $key => $value) {
|
||||||
Flight::set($key, $value);
|
Flight::set($key, $value);
|
||||||
}
|
}
|
||||||
@@ -67,7 +66,7 @@ final class Bootstrapper
|
|||||||
*/
|
*/
|
||||||
public static function bootRoutes(): void
|
public static function bootRoutes(): void
|
||||||
{
|
{
|
||||||
$routes = require_once config_path('routes.php');
|
$routes = require_once root_path('routes.php');
|
||||||
foreach ($routes as $route => $handler) {
|
foreach ($routes as $route => $handler) {
|
||||||
Flight::route($route, $handler);
|
Flight::route($route, $handler);
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Core;
|
namespace Core;
|
||||||
|
|
||||||
class ChannelLogo implements \Stringable
|
class ChannelLogo implements \Stringable
|
||||||
{
|
{
|
||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Core;
|
namespace Core;
|
||||||
|
|
||||||
use App\Exceptions\PlaylistNotFoundException;
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use Exceptions\PlaylistNotFoundException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Класс для работы с ini-файлом плейлистов
|
* Класс для работы с ini-файлом плейлистов
|
||||||
@@ -40,7 +40,7 @@ class IniFile
|
|||||||
*/
|
*/
|
||||||
public function load(): void
|
public function load(): void
|
||||||
{
|
{
|
||||||
$filepath = config_path('playlists.ini');
|
$filepath = root_path('playlists.ini');
|
||||||
$this->updated_at = date('d.m.Y h:i', filemtime($filepath));
|
$this->updated_at = date('d.m.Y h:i', filemtime($filepath));
|
||||||
|
|
||||||
$this->rawIni = parse_ini_file($filepath, true);
|
$this->rawIni = parse_ini_file($filepath, true);
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Core;
|
namespace Core;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Random\RandomException;
|
use Random\RandomException;
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Extensions;
|
namespace Core;
|
||||||
|
|
||||||
use Twig\Extension\AbstractExtension;
|
use Twig\Extension\AbstractExtension;
|
||||||
use Twig\TwigFunction;
|
use Twig\TwigFunction;
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Exceptions;
|
namespace Exceptions;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
@@ -17,17 +17,6 @@ function root_path(string $path = ''): string
|
|||||||
return rtrim(sprintf('%s/%s', dirname($_SERVER['DOCUMENT_ROOT']), $path), '/');
|
return rtrim(sprintf('%s/%s', dirname($_SERVER['DOCUMENT_ROOT']), $path), '/');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return path to application configuration directory
|
|
||||||
*
|
|
||||||
* @param string $path
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
function config_path(string $path = ''): string
|
|
||||||
{
|
|
||||||
return root_path("config/$path");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns path to app cache
|
* Returns path to app cache
|
||||||
*
|
*
|
||||||
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7.2 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use App\Core\Bootstrapper;
|
use Core\Bootstrapper;
|
||||||
use Symfony\Component\Dotenv\Dotenv;
|
use Symfony\Component\Dotenv\Dotenv;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use App\Controllers\HomeController;
|
use Controllers\HomeController;
|
||||||
use App\Controllers\PlaylistController;
|
use Controllers\PlaylistController;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'GET /' => [HomeController::class, 'index'],
|
'GET /' => [HomeController::class, 'index'],
|
||||||