WIP
3
.dockerignore
Normal file
@@ -0,0 +1,3 @@
|
||||
*.md
|
||||
*.example
|
||||
|
||||
11
.gitignore
vendored
@@ -1,14 +1,13 @@
|
||||
/.idea
|
||||
/.vscode
|
||||
.idea/
|
||||
.vscode/
|
||||
downloaded/
|
||||
/src/commit
|
||||
/src/cache/*
|
||||
/src/vendor
|
||||
/src/views/custom.twig
|
||||
|
||||
commit
|
||||
*.log
|
||||
.env
|
||||
*.m3u
|
||||
*.m3u.*
|
||||
*.m3u8
|
||||
*.m3u8.*
|
||||
|
||||
!/**/.gitkeep
|
||||
|
||||
@@ -4,8 +4,8 @@ networks:
|
||||
|
||||
services:
|
||||
|
||||
php:
|
||||
container_name: iptv-php
|
||||
svc-main:
|
||||
container_name: iptv-svc-main
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
@@ -20,8 +20,9 @@ services:
|
||||
- ./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
|
||||
- ./log/php:/var/log/php:rw
|
||||
- ./src:/var/www:rw
|
||||
- ./playlists.ini:/var/www/config/playlists.ini:ro
|
||||
- ./src/svc-main:/var/www:rw
|
||||
- ./commit:/var/www/commit:ro
|
||||
- ./playlists.ini:/var/www/playlists.ini:ro
|
||||
|
||||
nginx:
|
||||
container_name: iptv-nginx
|
||||
@@ -31,12 +32,12 @@ services:
|
||||
- iptv
|
||||
volumes:
|
||||
- /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
|
||||
- ./src:/var/www:ro
|
||||
- ./src/svc-main:/var/www:ro
|
||||
ports:
|
||||
- '8080:80'
|
||||
links:
|
||||
- php
|
||||
- svc-main
|
||||
depends_on:
|
||||
- php
|
||||
- svc-main
|
||||
|
||||
@@ -20,7 +20,7 @@ server {
|
||||
}
|
||||
location ~ \.php$ {
|
||||
try_files $uri /index.php =404;
|
||||
fastcgi_pass php:9000;
|
||||
fastcgi_pass svc-main:9000;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
fastcgi_index index.php;
|
||||
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 && \
|
||||
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
|
||||
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
|
||||
|
||||
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 && \
|
||||
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
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
# хук пробрасывает хэш свежего коммита в контейнер
|
||||
# для его отображения в подвале страницы
|
||||
git rev-parse HEAD > src/commit
|
||||
git rev-parse HEAD > commit
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
# для его отображения в подвале страницы и очищает
|
||||
# кеш шаблонов twig после слияния веток
|
||||
# главным образом необходимо при git pull
|
||||
git rev-parse HEAD > src/commit
|
||||
docker exec -ti iptv-php rm -rf cache/views
|
||||
git rev-parse HEAD > commit
|
||||
docker exec -ti svc-main rm -rf cache/views
|
||||
|
||||
4
iptv
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
# 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
|
||||
CMD="docker compose -f $CONFIG" # docker-compose command
|
||||
APP_URL='http://localhost:8080/'
|
||||
@@ -29,6 +29,6 @@ case "$1" in
|
||||
'restart' ) $CMD stop && $CMD start ;; # restart 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" ;;
|
||||
'hooks' ) ./hooks/post-commit && cp hooks/* .git/hooks ;;
|
||||
'hooks' ) сp -f hooks/* .git/hooks ;;
|
||||
* ) docker exec -ti $CONTAINER $* ;; # exec anything else in container
|
||||
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; )";
|
||||
DL_DIR="$TOOLS_DIR/downloaded"
|
||||
INI_FILE="$(dirname "$TOOLS_DIR")/playlists.ini"
|
||||
INI_FILE="$(dirname "$TOOLS_DIR")/../../playlists.ini"
|
||||
|
||||
rm -rf "$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": {
|
||||
"php": "^8.2",
|
||||
"php": "^8.4",
|
||||
"ext-json": "*",
|
||||
"ext-curl": "*",
|
||||
"ext-fileinfo": "*",
|
||||
@@ -10,10 +10,12 @@
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "app/"
|
||||
"Core\\": "core/",
|
||||
"Controllers\\": "controllers/",
|
||||
"Exceptions\\": "exceptions/"
|
||||
},
|
||||
"files": [
|
||||
"app/helpers.php"
|
||||
"helpers.php"
|
||||
]
|
||||
},
|
||||
"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",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "3cbd8253b2f0790d682e38f308df6e7f",
|
||||
"content-hash": "1aaea4609092e8a88074f050dab42323",
|
||||
"packages": [
|
||||
{
|
||||
"name": "mikecao/flight",
|
||||
"version": "v3.12.0",
|
||||
"version": "v3.13.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/flightphp/core.git",
|
||||
"reference": "63fbf9b0316969e8aa6c318f8479d1ed0578f9b4"
|
||||
"reference": "1307e8a39d89fadba69d0c2dad53b6e0da83fd96"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/flightphp/core/zipball/63fbf9b0316969e8aa6c318f8479d1ed0578f9b4",
|
||||
"reference": "63fbf9b0316969e8aa6c318f8479d1ed0578f9b4",
|
||||
"url": "https://api.github.com/repos/flightphp/core/zipball/1307e8a39d89fadba69d0c2dad53b6e0da83fd96",
|
||||
"reference": "1307e8a39d89fadba69d0c2dad53b6e0da83fd96",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -26,7 +26,7 @@
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-pdo_sqlite": "*",
|
||||
"flightphp/runway": "^0.2.0",
|
||||
"flightphp/runway": "^0.2.3 || ^1.0",
|
||||
"league/container": "^4.2",
|
||||
"level-2/dice": "^4.0",
|
||||
"phpstan/extension-installer": "^1.3",
|
||||
@@ -73,22 +73,22 @@
|
||||
"homepage": "http://flightphp.com",
|
||||
"support": {
|
||||
"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",
|
||||
"version": "v3.5.0",
|
||||
"version": "v3.5.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/deprecation-contracts.git",
|
||||
"reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1"
|
||||
"reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1",
|
||||
"reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1",
|
||||
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6",
|
||||
"reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -126,7 +126,7 @@
|
||||
"description": "A generic function and convention to trigger deprecation notices",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.0"
|
||||
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -142,20 +142,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-04-18T09:32:20+00:00"
|
||||
"time": "2024-09-25T14:20:29+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/dotenv",
|
||||
"version": "v7.1.5",
|
||||
"version": "v7.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/dotenv.git",
|
||||
"reference": "6d966200b399fa59759286f3fc7c919f0677c449"
|
||||
"reference": "28347a897771d0c28e99b75166dd2689099f3045"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/dotenv/zipball/6d966200b399fa59759286f3fc7c919f0677c449",
|
||||
"reference": "6d966200b399fa59759286f3fc7c919f0677c449",
|
||||
"url": "https://api.github.com/repos/symfony/dotenv/zipball/28347a897771d0c28e99b75166dd2689099f3045",
|
||||
"reference": "28347a897771d0c28e99b75166dd2689099f3045",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -200,7 +200,7 @@
|
||||
"environment"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/dotenv/tree/v7.1.5"
|
||||
"source": "https://github.com/symfony/dotenv/tree/v7.2.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -216,7 +216,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-09-17T09:16:35+00:00"
|
||||
"time": "2024-11-27T11:18:42+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-ctype",
|
||||
@@ -455,16 +455,16 @@
|
||||
},
|
||||
{
|
||||
"name": "twig/twig",
|
||||
"version": "v3.14.0",
|
||||
"version": "v3.16.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/twigphp/Twig.git",
|
||||
"reference": "126b2c97818dbff0cdf3fbfc881aedb3d40aae72"
|
||||
"reference": "475ad2dc97d65d8631393e721e7e44fb544f0561"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/twigphp/Twig/zipball/126b2c97818dbff0cdf3fbfc881aedb3d40aae72",
|
||||
"reference": "126b2c97818dbff0cdf3fbfc881aedb3d40aae72",
|
||||
"url": "https://api.github.com/repos/twigphp/Twig/zipball/475ad2dc97d65d8631393e721e7e44fb544f0561",
|
||||
"reference": "475ad2dc97d65d8631393e721e7e44fb544f0561",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -475,6 +475,7 @@
|
||||
"symfony/polyfill-php81": "^1.29"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpstan/phpstan": "^2.0",
|
||||
"psr/container": "^1.0|^2.0",
|
||||
"symfony/phpunit-bridge": "^5.4.9|^6.4|^7.0"
|
||||
},
|
||||
@@ -518,7 +519,7 @@
|
||||
],
|
||||
"support": {
|
||||
"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": [
|
||||
{
|
||||
@@ -530,20 +531,21 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-09-09T17:55:12+00:00"
|
||||
"time": "2024-11-29T08:27:05+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": [],
|
||||
"stability-flags": {},
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
"php": "^8.2",
|
||||
"ext-json": "*",
|
||||
"ext-curl": "*"
|
||||
"ext-curl": "*",
|
||||
"ext-fileinfo": "*"
|
||||
},
|
||||
"platform-dev": [],
|
||||
"platform-dev": {},
|
||||
"plugin-api-version": "2.6.0"
|
||||
}
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Controllers;
|
||||
namespace Controllers;
|
||||
|
||||
use App\Core\IniFile;
|
||||
use App\Core\Playlist;
|
||||
use App\Exceptions\PlaylistNotFoundException;
|
||||
use Core\IniFile;
|
||||
use Core\Playlist;
|
||||
use Exception;
|
||||
use Exceptions\PlaylistNotFoundException;
|
||||
use Flight;
|
||||
use Random\RandomException;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Controllers;
|
||||
namespace Controllers;
|
||||
|
||||
use Exception;
|
||||
use Flight;
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Controllers;
|
||||
namespace Controllers;
|
||||
|
||||
use App\Core\ChannelLogo;
|
||||
use App\Exceptions\PlaylistNotFoundException;
|
||||
use Core\ChannelLogo;
|
||||
use Exception;
|
||||
use Exceptions\PlaylistNotFoundException;
|
||||
use Flight;
|
||||
|
||||
/**
|
||||
@@ -2,9 +2,8 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Core;
|
||||
namespace Core;
|
||||
|
||||
use App\Extensions\TwigFunctions;
|
||||
use Flight;
|
||||
use Twig\Environment;
|
||||
use Twig\Extension\DebugExtension;
|
||||
@@ -22,7 +21,7 @@ final class Bootstrapper
|
||||
*/
|
||||
public static function bootSettings(): void
|
||||
{
|
||||
$config = require_once config_path('app.php');
|
||||
$config = require_once root_path('config.php');
|
||||
foreach ($config as $key => $value) {
|
||||
Flight::set($key, $value);
|
||||
}
|
||||
@@ -67,7 +66,7 @@ final class Bootstrapper
|
||||
*/
|
||||
public static function bootRoutes(): void
|
||||
{
|
||||
$routes = require_once config_path('routes.php');
|
||||
$routes = require_once root_path('routes.php');
|
||||
foreach ($routes as $route => $handler) {
|
||||
Flight::route($route, $handler);
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Core;
|
||||
namespace Core;
|
||||
|
||||
class ChannelLogo implements \Stringable
|
||||
{
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Core;
|
||||
namespace Core;
|
||||
|
||||
use App\Exceptions\PlaylistNotFoundException;
|
||||
use Exception;
|
||||
use Exceptions\PlaylistNotFoundException;
|
||||
|
||||
/**
|
||||
* Класс для работы с ini-файлом плейлистов
|
||||
@@ -40,7 +40,7 @@ class IniFile
|
||||
*/
|
||||
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->rawIni = parse_ini_file($filepath, true);
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Core;
|
||||
namespace Core;
|
||||
|
||||
use Exception;
|
||||
use Random\RandomException;
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Extensions;
|
||||
namespace Core;
|
||||
|
||||
use Twig\Extension\AbstractExtension;
|
||||
use Twig\TwigFunction;
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Exceptions;
|
||||
namespace Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
||||
@@ -17,17 +17,6 @@ function root_path(string $path = ''): string
|
||||
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
|
||||
*
|
||||
|
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);
|
||||
|
||||
use App\Core\Bootstrapper;
|
||||
use Core\Bootstrapper;
|
||||
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);
|
||||
|
||||
use App\Controllers\HomeController;
|
||||
use App\Controllers\PlaylistController;
|
||||
use Controllers\HomeController;
|
||||
use Controllers\PlaylistController;
|
||||
|
||||
return [
|
||||
'GET /' => [HomeController::class, 'index'],
|
||||