diff --git a/.editorconfig b/.editorconfig index 60cddd6..95a6c0d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -31,7 +31,7 @@ indent_size = 2 indent_style = space indent_size = 4 -[**.blade.php] +[**.latte] indent_style = tab indent_size = 2 diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..0e63d29 --- /dev/null +++ b/.env.example @@ -0,0 +1 @@ +APP_SUBDIR=/ # Subpath your app is running, defaults to / diff --git a/README.md b/README.md index 0bf57ab..588a8ad 100644 --- a/README.md +++ b/README.md @@ -20,5 +20,6 @@ php -S localhost:8080 ## Credits * [TikTok-API-PHP](https://github.com/ssovit/TikTok-API-PHP) -* [bramus/router](https://github.com/bramus/router) +* [steampixel/simple-php-router](https://github.com/steampixel/simple-php-router) +* [PHP dotenv](https://github.com/vlucas/phpdotenv) * [Bulma](https://github.com/jgthms/bulma) diff --git a/composer.json b/composer.json index b334abf..fbf65b2 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,8 @@ "php": "^8.0.0", "ext-curl": "*", "ssovit/tiktok-api": "^2.0", - "bramus/router": "^1.6", - "jenssegers/blade": "^1.4" + "steampixel/simple-php-router": "^0.7.0", + "latte/latte": "^2.10", + "vlucas/phpdotenv": "^5.4" } } diff --git a/composer.lock b/composer.lock index af3ed93..ac4fea2 100644 --- a/composer.lock +++ b/composer.lock @@ -4,88 +4,33 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a272158b7b1fb157a2096739db8a1574", + "content-hash": "e3448e649bcb2f2456c630905ae887fd", "packages": [ { - "name": "bramus/router", - "version": "1.6.1", + "name": "graham-campbell/result-type", + "version": "v1.0.4", "source": { "type": "git", - "url": "https://github.com/bramus/router.git", - "reference": "55657b76da8a0a509250fb55b9dd24e1aa237eba" + "url": "https://github.com/GrahamCampbell/Result-Type.git", + "reference": "0690bde05318336c7221785f2a932467f98b64ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bramus/router/zipball/55657b76da8a0a509250fb55b9dd24e1aa237eba", - "reference": "55657b76da8a0a509250fb55b9dd24e1aa237eba", + "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/0690bde05318336c7221785f2a932467f98b64ca", + "reference": "0690bde05318336c7221785f2a932467f98b64ca", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": "^7.0 || ^8.0", + "phpoption/phpoption": "^1.8" }, "require-dev": { - "friendsofphp/php-cs-fixer": "~2.14", - "phpunit/php-code-coverage": "~2.0", - "phpunit/phpunit": "~4.8" - }, - "type": "library", - "autoload": { - "psr-0": { - "Bramus": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bram(us) Van Damme", - "email": "bramus@bram.us", - "homepage": "http://www.bram.us" - } - ], - "description": "A lightweight and simple object oriented PHP Router", - "homepage": "https://github.com/bramus/router", - "keywords": [ - "router", - "routing" - ], - "support": { - "issues": "https://github.com/bramus/router/issues", - "source": "https://github.com/bramus/router/tree/1.6.1" - }, - "time": "2021-11-18T19:24:07+00:00" - }, - { - "name": "doctrine/inflector", - "version": "2.0.4", - "source": { - "type": "git", - "url": "https://github.com/doctrine/inflector.git", - "reference": "8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89", - "reference": "8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^8.2", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpstan/phpstan-strict-rules": "^0.12", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", - "vimeo/psalm": "^4.10" + "phpunit/phpunit": "^6.5.14 || ^7.5.20 || ^8.5.19 || ^9.5.8" }, "type": "library", "autoload": { "psr-4": { - "Doctrine\\Inflector\\": "lib/Doctrine/Inflector" + "GrahamCampbell\\ResultType\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -94,855 +39,189 @@ ], "authors": [ { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" } ], - "description": "PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.", - "homepage": "https://www.doctrine-project.org/projects/inflector.html", + "description": "An Implementation Of The Result Type", "keywords": [ - "inflection", - "inflector", - "lowercase", - "manipulation", - "php", - "plural", - "singular", - "strings", - "uppercase", - "words" + "Graham Campbell", + "GrahamCampbell", + "Result Type", + "Result-Type", + "result" ], "support": { - "issues": "https://github.com/doctrine/inflector/issues", - "source": "https://github.com/doctrine/inflector/tree/2.0.4" + "issues": "https://github.com/GrahamCampbell/Result-Type/issues", + "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.0.4" }, "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%2Finflector", - "type": "tidelift" - } - ], - "time": "2021-10-22T20:16:43+00:00" - }, - { - "name": "illuminate/bus", - "version": "v8.77.1", - "source": { - "type": "git", - "url": "https://github.com/illuminate/bus.git", - "reference": "82ed7d9d6edc625ffe5d01fe17af3e223aed1cb0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/illuminate/bus/zipball/82ed7d9d6edc625ffe5d01fe17af3e223aed1cb0", - "reference": "82ed7d9d6edc625ffe5d01fe17af3e223aed1cb0", - "shasum": "" - }, - "require": { - "illuminate/collections": "^8.0", - "illuminate/contracts": "^8.0", - "illuminate/pipeline": "^8.0", - "illuminate/support": "^8.0", - "php": "^7.3|^8.0" - }, - "suggest": { - "illuminate/queue": "Required to use closures when chaining jobs (^7.0)." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "8.x-dev" - } - }, - "autoload": { - "psr-4": { - "Illuminate\\Bus\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "description": "The Illuminate Bus package.", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "time": "2021-11-23T19:43:42+00:00" - }, - { - "name": "illuminate/collections", - "version": "v8.77.1", - "source": { - "type": "git", - "url": "https://github.com/illuminate/collections.git", - "reference": "bafdbd033a717aed94e4d023512f2c9eb3e8cd77" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/illuminate/collections/zipball/bafdbd033a717aed94e4d023512f2c9eb3e8cd77", - "reference": "bafdbd033a717aed94e4d023512f2c9eb3e8cd77", - "shasum": "" - }, - "require": { - "illuminate/contracts": "^8.0", - "illuminate/macroable": "^8.0", - "php": "^7.3|^8.0" - }, - "suggest": { - "symfony/var-dumper": "Required to use the dump method (^5.4)." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "8.x-dev" - } - }, - "autoload": { - "psr-4": { - "Illuminate\\Support\\": "" - }, - "files": [ - "helpers.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "description": "The Illuminate Collections package.", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "time": "2021-12-16T15:00:27+00:00" - }, - { - "name": "illuminate/container", - "version": "v8.77.1", - "source": { - "type": "git", - "url": "https://github.com/illuminate/container.git", - "reference": "6ac391bb27391706c5f921b85060aa2c4ca03fae" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/illuminate/container/zipball/6ac391bb27391706c5f921b85060aa2c4ca03fae", - "reference": "6ac391bb27391706c5f921b85060aa2c4ca03fae", - "shasum": "" - }, - "require": { - "illuminate/contracts": "^8.0", - "php": "^7.3|^8.0", - "psr/container": "^1.0" - }, - "provide": { - "psr/container-implementation": "1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "8.x-dev" - } - }, - "autoload": { - "psr-4": { - "Illuminate\\Container\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "description": "The Illuminate Container package.", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "time": "2021-11-17T15:04:30+00:00" - }, - { - "name": "illuminate/contracts", - "version": "v8.77.1", - "source": { - "type": "git", - "url": "https://github.com/illuminate/contracts.git", - "reference": "9baa9f781071e67d7b171775bd3be7ead13ddd29" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/illuminate/contracts/zipball/9baa9f781071e67d7b171775bd3be7ead13ddd29", - "reference": "9baa9f781071e67d7b171775bd3be7ead13ddd29", - "shasum": "" - }, - "require": { - "php": "^7.3|^8.0", - "psr/container": "^1.0", - "psr/simple-cache": "^1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "8.x-dev" - } - }, - "autoload": { - "psr-4": { - "Illuminate\\Contracts\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "description": "The Illuminate Contracts package.", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "time": "2021-12-14T14:40:44+00:00" - }, - { - "name": "illuminate/events", - "version": "v8.77.1", - "source": { - "type": "git", - "url": "https://github.com/illuminate/events.git", - "reference": "b7f06cafb6c09581617f2ca05d69e9b159e5a35d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/illuminate/events/zipball/b7f06cafb6c09581617f2ca05d69e9b159e5a35d", - "reference": "b7f06cafb6c09581617f2ca05d69e9b159e5a35d", - "shasum": "" - }, - "require": { - "illuminate/bus": "^8.0", - "illuminate/collections": "^8.0", - "illuminate/container": "^8.0", - "illuminate/contracts": "^8.0", - "illuminate/macroable": "^8.0", - "illuminate/support": "^8.0", - "php": "^7.3|^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "8.x-dev" - } - }, - "autoload": { - "psr-4": { - "Illuminate\\Events\\": "" - }, - "files": [ - "functions.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "description": "The Illuminate Events package.", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "time": "2021-09-15T14:32:50+00:00" - }, - { - "name": "illuminate/filesystem", - "version": "v8.77.1", - "source": { - "type": "git", - "url": "https://github.com/illuminate/filesystem.git", - "reference": "48f9d61b5da49f0fa8d9f28db8ae8c0d89e367a6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/illuminate/filesystem/zipball/48f9d61b5da49f0fa8d9f28db8ae8c0d89e367a6", - "reference": "48f9d61b5da49f0fa8d9f28db8ae8c0d89e367a6", - "shasum": "" - }, - "require": { - "illuminate/collections": "^8.0", - "illuminate/contracts": "^8.0", - "illuminate/macroable": "^8.0", - "illuminate/support": "^8.0", - "php": "^7.3|^8.0", - "symfony/finder": "^5.4" - }, - "suggest": { - "ext-ftp": "Required to use the Flysystem FTP driver.", - "illuminate/http": "Required for handling uploaded files (^7.0).", - "league/flysystem": "Required to use the Flysystem local and FTP drivers (^1.1).", - "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^1.0).", - "league/flysystem-cached-adapter": "Required to use the Flysystem cache (^1.0).", - "league/flysystem-sftp": "Required to use the Flysystem SFTP driver (^1.0).", - "psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0).", - "symfony/filesystem": "Required to enable support for relative symbolic links (^5.4).", - "symfony/mime": "Required to enable support for guessing extensions (^5.4)." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "8.x-dev" - } - }, - "autoload": { - "psr-4": { - "Illuminate\\Filesystem\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "description": "The Illuminate Filesystem package.", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "time": "2021-12-20T20:07:00+00:00" - }, - { - "name": "illuminate/macroable", - "version": "v8.77.1", - "source": { - "type": "git", - "url": "https://github.com/illuminate/macroable.git", - "reference": "aed81891a6e046fdee72edd497f822190f61c162" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/illuminate/macroable/zipball/aed81891a6e046fdee72edd497f822190f61c162", - "reference": "aed81891a6e046fdee72edd497f822190f61c162", - "shasum": "" - }, - "require": { - "php": "^7.3|^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "8.x-dev" - } - }, - "autoload": { - "psr-4": { - "Illuminate\\Support\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "description": "The Illuminate Macroable package.", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "time": "2021-11-16T13:57:03+00:00" - }, - { - "name": "illuminate/pipeline", - "version": "v8.77.1", - "source": { - "type": "git", - "url": "https://github.com/illuminate/pipeline.git", - "reference": "23aeff5b26ae4aee3f370835c76bd0f4e93f71d2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/illuminate/pipeline/zipball/23aeff5b26ae4aee3f370835c76bd0f4e93f71d2", - "reference": "23aeff5b26ae4aee3f370835c76bd0f4e93f71d2", - "shasum": "" - }, - "require": { - "illuminate/contracts": "^8.0", - "illuminate/support": "^8.0", - "php": "^7.3|^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "8.x-dev" - } - }, - "autoload": { - "psr-4": { - "Illuminate\\Pipeline\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "description": "The Illuminate Pipeline package.", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "time": "2021-03-26T18:39:16+00:00" - }, - { - "name": "illuminate/support", - "version": "v8.77.1", - "source": { - "type": "git", - "url": "https://github.com/illuminate/support.git", - "reference": "789b5c9a28884bc6b07841574cc86abdec7c5f68" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/illuminate/support/zipball/789b5c9a28884bc6b07841574cc86abdec7c5f68", - "reference": "789b5c9a28884bc6b07841574cc86abdec7c5f68", - "shasum": "" - }, - "require": { - "doctrine/inflector": "^1.4|^2.0", - "ext-json": "*", - "ext-mbstring": "*", - "illuminate/collections": "^8.0", - "illuminate/contracts": "^8.0", - "illuminate/macroable": "^8.0", - "nesbot/carbon": "^2.53.1", - "php": "^7.3|^8.0", - "voku/portable-ascii": "^1.4.8" - }, - "conflict": { - "tightenco/collect": "<5.5.33" - }, - "suggest": { - "illuminate/filesystem": "Required to use the composer class (^8.0).", - "league/commonmark": "Required to use Str::markdown() and Stringable::markdown() (^1.3|^2.0.2).", - "ramsey/uuid": "Required to use Str::uuid() (^4.2.2).", - "symfony/process": "Required to use the composer class (^5.4).", - "symfony/var-dumper": "Required to use the dd function (^5.4).", - "vlucas/phpdotenv": "Required to use the Env class and env helper (^5.2)." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "8.x-dev" - } - }, - "autoload": { - "psr-4": { - "Illuminate\\Support\\": "" - }, - "files": [ - "helpers.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "description": "The Illuminate Support package.", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "time": "2021-12-21T14:59:41+00:00" - }, - { - "name": "illuminate/view", - "version": "v8.77.1", - "source": { - "type": "git", - "url": "https://github.com/illuminate/view.git", - "reference": "ec853721a70c11d51c6162a58410abb319a073b1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/illuminate/view/zipball/ec853721a70c11d51c6162a58410abb319a073b1", - "reference": "ec853721a70c11d51c6162a58410abb319a073b1", - "shasum": "" - }, - "require": { - "ext-json": "*", - "illuminate/collections": "^8.0", - "illuminate/container": "^8.0", - "illuminate/contracts": "^8.0", - "illuminate/events": "^8.0", - "illuminate/filesystem": "^8.0", - "illuminate/macroable": "^8.0", - "illuminate/support": "^8.0", - "php": "^7.3|^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "8.x-dev" - } - }, - "autoload": { - "psr-4": { - "Illuminate\\View\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "description": "The Illuminate View package.", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "time": "2021-12-16T19:23:48+00:00" - }, - { - "name": "jenssegers/blade", - "version": "v1.4.0", - "source": { - "type": "git", - "url": "https://github.com/jenssegers/blade.git", - "reference": "22a3700e9fc469c19dd1c5e5bd1b9138195e421f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/jenssegers/blade/zipball/22a3700e9fc469c19dd1c5e5bd1b9138195e421f", - "reference": "22a3700e9fc469c19dd1c5e5bd1b9138195e421f", - "shasum": "" - }, - "require": { - "illuminate/view": "^5.5|^6.0|^7.0|^8.0", - "php": ">=7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0|^7.0", - "satooshi/php-coveralls": "^1.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Jenssegers\\Blade\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jens Segers", - "homepage": "https://jenssegers.com" - } - ], - "description": "The standalone version of Laravel's Blade templating engine for use outside of Laravel.", - "keywords": [ - "blade", - "laravel", - "render", - "template", - "view" - ], - "support": { - "issues": "https://github.com/jenssegers/blade/issues", - "source": "https://github.com/jenssegers/blade/tree/v1.4.0" - }, - "funding": [ - { - "url": "https://github.com/jenssegers", + "url": "https://github.com/GrahamCampbell", "type": "github" }, { - "url": "https://opencollective.com/jenssegers-blade", - "type": "open_collective" + "url": "https://tidelift.com/funding/github/packagist/graham-campbell/result-type", + "type": "tidelift" } ], - "time": "2020-09-17T08:25:26+00:00" + "time": "2021-11-21T21:41:47+00:00" }, { - "name": "nesbot/carbon", - "version": "2.55.2", + "name": "latte/latte", + "version": "v2.10.7", "source": { "type": "git", - "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "8c2a18ce3e67c34efc1b29f64fe61304368259a2" + "url": "https://github.com/nette/latte.git", + "reference": "a69d0b9598652438b5754ae5c1abc217d5003d98" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/8c2a18ce3e67c34efc1b29f64fe61304368259a2", - "reference": "8c2a18ce3e67c34efc1b29f64fe61304368259a2", + "url": "https://api.github.com/repos/nette/latte/zipball/a69d0b9598652438b5754ae5c1abc217d5003d98", + "reference": "a69d0b9598652438b5754ae5c1abc217d5003d98", "shasum": "" }, "require": { "ext-json": "*", - "php": "^7.1.8 || ^8.0", - "symfony/polyfill-mbstring": "^1.0", - "symfony/polyfill-php80": "^1.16", - "symfony/translation": "^3.4 || ^4.0 || ^5.0 || ^6.0" + "ext-tokenizer": "*", + "php": ">=7.1 <8.2" + }, + "conflict": { + "nette/application": "<2.4.1" }, "require-dev": { - "doctrine/dbal": "^2.0 || ^3.0", - "doctrine/orm": "^2.7", - "friendsofphp/php-cs-fixer": "^3.0", - "kylekatarnls/multi-tester": "^2.0", - "phpmd/phpmd": "^2.9", - "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^0.12.54", - "phpunit/phpunit": "^7.5.20 || ^8.5.14", - "squizlabs/php_codesniffer": "^3.4" + "nette/php-generator": "^3.3.4", + "nette/tester": "~2.0", + "nette/utils": "^3.0", + "phpstan/phpstan": "^0.12", + "tracy/tracy": "^2.3" + }, + "suggest": { + "ext-fileinfo": "to use filter |datastream", + "ext-iconv": "to use filters |reverse, |substring", + "ext-mbstring": "to use filters like lower, upper, capitalize, ...", + "nette/php-generator": "to use tag {templatePrint}", + "nette/utils": "to use filter |webalize" }, "bin": [ - "bin/carbon" + "bin/latte-lint" ], "type": "library", "extra": { "branch-alias": { - "dev-3.x": "3.x-dev", - "dev-master": "2.x-dev" + "dev-master": "2.10-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0-only", + "GPL-3.0-only" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" }, - "laravel": { - "providers": [ - "Carbon\\Laravel\\ServiceProvider" - ] - }, - "phpstan": { - "includes": [ - "extension.neon" - ] + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "☕ Latte: the intuitive and fast template engine for those who want the most secure PHP sites. Introduces context-sensitive escaping.", + "homepage": "https://latte.nette.org", + "keywords": [ + "context-sensitive", + "engine", + "escaping", + "html", + "nette", + "security", + "template", + "twig" + ], + "support": { + "issues": "https://github.com/nette/latte/issues", + "source": "https://github.com/nette/latte/tree/v2.10.7" + }, + "time": "2021-12-21T11:22:49+00:00" + }, + { + "name": "phpoption/phpoption", + "version": "1.8.1", + "source": { + "type": "git", + "url": "https://github.com/schmittjoh/php-option.git", + "reference": "eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15", + "reference": "eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", + "phpunit/phpunit": "^6.5.14 || ^7.5.20 || ^8.5.19 || ^9.5.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8-dev" } }, "autoload": { "psr-4": { - "Carbon\\": "src/Carbon/" + "PhpOption\\": "src/PhpOption/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "Apache-2.0" ], "authors": [ { - "name": "Brian Nesbitt", - "email": "brian@nesbot.com", - "homepage": "https://markido.com" + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh" }, { - "name": "kylekatarnls", - "homepage": "https://github.com/kylekatarnls" + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" } ], - "description": "An API extension for DateTime that supports 281 different languages.", - "homepage": "https://carbon.nesbot.com", + "description": "Option Type for PHP", "keywords": [ - "date", - "datetime", - "time" + "language", + "option", + "php", + "type" ], "support": { - "docs": "https://carbon.nesbot.com/docs", - "issues": "https://github.com/briannesbitt/Carbon/issues", - "source": "https://github.com/briannesbitt/Carbon" + "issues": "https://github.com/schmittjoh/php-option/issues", + "source": "https://github.com/schmittjoh/php-option/tree/1.8.1" }, "funding": [ { - "url": "https://opencollective.com/Carbon", - "type": "open_collective" + "url": "https://github.com/GrahamCampbell", + "type": "github" }, { - "url": "https://tidelift.com/funding/github/packagist/nesbot/carbon", + "url": "https://tidelift.com/funding/github/packagist/phpoption/phpoption", "type": "tidelift" } ], - "time": "2021-12-03T14:59:52+00:00" - }, - { - "name": "psr/container", - "version": "1.1.2", - "source": { - "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", - "shasum": "" - }, - "require": { - "php": ">=7.4.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", - "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" - ], - "support": { - "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.2" - }, - "time": "2021-11-05T16:50:12+00:00" - }, - { - "name": "psr/simple-cache", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/simple-cache.git", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\SimpleCache\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interfaces for simple caching", - "keywords": [ - "cache", - "caching", - "psr", - "psr-16", - "simple-cache" - ], - "support": { - "source": "https://github.com/php-fig/simple-cache/tree/master" - }, - "time": "2017-10-23T01:57:42+00:00" + "time": "2021-12-04T23:24:31+00:00" }, { "name": "ssovit/tiktok-api", @@ -991,98 +270,84 @@ "time": "2021-05-28T15:32:11+00:00" }, { - "name": "symfony/deprecation-contracts", - "version": "v3.0.0", + "name": "steampixel/simple-php-router", + "version": "0.7.0", "source": { "type": "git", - "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "c726b64c1ccfe2896cb7df2e1331c357ad1c8ced" + "url": "https://github.com/steampixel/simplePHPRouter.git", + "reference": "91aec2d0bca3619c0552e2bfcebb8936e6f83bb9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/c726b64c1ccfe2896cb7df2e1331c357ad1c8ced", - "reference": "c726b64c1ccfe2896cb7df2e1331c357ad1c8ced", + "url": "https://api.github.com/repos/steampixel/simplePHPRouter/zipball/91aec2d0bca3619c0552e2bfcebb8936e6f83bb9", + "reference": "91aec2d0bca3619c0552e2bfcebb8936e6f83bb9", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-0": { + "Steampixel": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christoph Stitz", + "email": "info@steampixel.de", + "homepage": "https://steampixel.de/" + }, + { + "name": "Maximilian Götz", + "email": "contact@maxbits.net", + "homepage": "https://www.maxbits.net/" + } + ], + "description": "This is a simple and small PHP router that can handel the whole url routing for your project.", + "support": { + "issues": "https://github.com/steampixel/simplePHPRouter/issues", + "source": "https://github.com/steampixel/simplePHPRouter/tree/0.7.0" + }, + "time": "2021-03-22T08:11:59+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.23.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", "shasum": "" }, "require": { - "php": ">=8.0.2" + "php": ">=7.1" + }, + "suggest": { + "ext-ctype": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "1.23-dev" }, "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, - "autoload": { - "files": [ - "function.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "A generic function and convention to trigger deprecation notices", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-11-01T23:48:49+00:00" - }, - { - "name": "symfony/finder", - "version": "v5.4.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "e77046c252be48c48a40816187ed527703c8f76c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/e77046c252be48c48a40816187ed527703c8f76c", - "reference": "e77046c252be48c48a40816187ed527703c8f76c", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-php80": "^1.16" - }, - "type": "library", "autoload": { "psr-4": { - "Symfony\\Component\\Finder\\": "" + "Symfony\\Polyfill\\Ctype\\": "" }, - "exclude-from-classmap": [ - "/Tests/" + "files": [ + "bootstrap.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1091,18 +356,24 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Finds files and directories via an intuitive fluent interface", + "description": "Symfony polyfill for ctype functions", "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], "support": { - "source": "https://github.com/symfony/finder/tree/v5.4.2" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" }, "funding": [ { @@ -1118,7 +389,7 @@ "type": "tidelift" } ], - "time": "2021-12-15T11:06:13+00:00" + "time": "2021-02-19T12:13:01+00:00" }, { "name": "symfony/polyfill-mbstring", @@ -1284,251 +555,84 @@ "time": "2021-07-28T13:41:28+00:00" }, { - "name": "symfony/translation", - "version": "v6.0.2", + "name": "vlucas/phpdotenv", + "version": "v5.4.1", "source": { "type": "git", - "url": "https://github.com/symfony/translation.git", - "reference": "a16c33f93e2fd62d259222aebf792158e9a28a77" + "url": "https://github.com/vlucas/phpdotenv.git", + "reference": "264dce589e7ce37a7ba99cb901eed8249fbec92f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/a16c33f93e2fd62d259222aebf792158e9a28a77", - "reference": "a16c33f93e2fd62d259222aebf792158e9a28a77", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/264dce589e7ce37a7ba99cb901eed8249fbec92f", + "reference": "264dce589e7ce37a7ba99cb901eed8249fbec92f", "shasum": "" }, "require": { - "php": ">=8.0.2", - "symfony/polyfill-mbstring": "~1.0", - "symfony/translation-contracts": "^2.3|^3.0" - }, - "conflict": { - "symfony/config": "<5.4", - "symfony/console": "<5.4", - "symfony/dependency-injection": "<5.4", - "symfony/http-kernel": "<5.4", - "symfony/twig-bundle": "<5.4", - "symfony/yaml": "<5.4" - }, - "provide": { - "symfony/translation-implementation": "2.3|3.0" + "ext-pcre": "*", + "graham-campbell/result-type": "^1.0.2", + "php": "^7.1.3 || ^8.0", + "phpoption/phpoption": "^1.8", + "symfony/polyfill-ctype": "^1.23", + "symfony/polyfill-mbstring": "^1.23.1", + "symfony/polyfill-php80": "^1.23.1" }, "require-dev": { - "psr/log": "^1|^2|^3", - "symfony/config": "^5.4|^6.0", - "symfony/console": "^5.4|^6.0", - "symfony/dependency-injection": "^5.4|^6.0", - "symfony/finder": "^5.4|^6.0", - "symfony/http-client-contracts": "^1.1|^2.0|^3.0", - "symfony/http-kernel": "^5.4|^6.0", - "symfony/intl": "^5.4|^6.0", - "symfony/polyfill-intl-icu": "^1.21", - "symfony/service-contracts": "^1.1.2|^2|^3", - "symfony/yaml": "^5.4|^6.0" + "bamarni/composer-bin-plugin": "^1.4.1", + "ext-filter": "*", + "phpunit/phpunit": "^7.5.20 || ^8.5.21 || ^9.5.10" }, "suggest": { - "psr/log-implementation": "To use logging capability in translator", - "symfony/config": "", - "symfony/yaml": "" - }, - "type": "library", - "autoload": { - "files": [ - "Resources/functions.php" - ], - "psr-4": { - "Symfony\\Component\\Translation\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides tools to internationalize your application", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/translation/tree/v6.0.2" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-12-25T20:10:03+00:00" - }, - { - "name": "symfony/translation-contracts", - "version": "v3.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/translation-contracts.git", - "reference": "1b6ea5a7442af5a12dba3dbd6d71034b5b234e77" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/1b6ea5a7442af5a12dba3dbd6d71034b5b234e77", - "reference": "1b6ea5a7442af5a12dba3dbd6d71034b5b234e77", - "shasum": "" - }, - "require": { - "php": ">=8.0.2" - }, - "suggest": { - "symfony/translation-implementation": "" + "ext-filter": "Required to use the boolean validator." }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" + "dev-master": "5.4-dev" } }, "autoload": { "psr-4": { - "Symfony\\Contracts\\Translation\\": "" + "Dotenv\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" }, { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Vance Lucas", + "email": "vance@vancelucas.com", + "homepage": "https://github.com/vlucas" } ], - "description": "Generic abstractions related to translation", - "homepage": "https://symfony.com", + "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" + "dotenv", + "env", + "environment" ], "support": { - "source": "https://github.com/symfony/translation-contracts/tree/v3.0.0" + "issues": "https://github.com/vlucas/phpdotenv/issues", + "source": "https://github.com/vlucas/phpdotenv/tree/v5.4.1" }, "funding": [ { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", + "url": "https://github.com/GrahamCampbell", "type": "github" }, { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "url": "https://tidelift.com/funding/github/packagist/vlucas/phpdotenv", "type": "tidelift" } ], - "time": "2021-09-07T12:43:40+00:00" - }, - { - "name": "voku/portable-ascii", - "version": "1.5.6", - "source": { - "type": "git", - "url": "https://github.com/voku/portable-ascii.git", - "reference": "80953678b19901e5165c56752d087fc11526017c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/voku/portable-ascii/zipball/80953678b19901e5165c56752d087fc11526017c", - "reference": "80953678b19901e5165c56752d087fc11526017c", - "shasum": "" - }, - "require": { - "php": ">=7.0.0" - }, - "require-dev": { - "phpunit/phpunit": "~6.0 || ~7.0 || ~9.0" - }, - "suggest": { - "ext-intl": "Use Intl for transliterator_transliterate() support" - }, - "type": "library", - "autoload": { - "psr-4": { - "voku\\": "src/voku/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Lars Moelleken", - "homepage": "http://www.moelleken.org/" - } - ], - "description": "Portable ASCII library - performance optimized (ascii) string functions for php.", - "homepage": "https://github.com/voku/portable-ascii", - "keywords": [ - "ascii", - "clean", - "php" - ], - "support": { - "issues": "https://github.com/voku/portable-ascii/issues", - "source": "https://github.com/voku/portable-ascii/tree/1.5.6" - }, - "funding": [ - { - "url": "https://www.paypal.me/moelleken", - "type": "custom" - }, - { - "url": "https://github.com/voku", - "type": "github" - }, - { - "url": "https://opencollective.com/portable-ascii", - "type": "open_collective" - }, - { - "url": "https://www.patreon.com/voku", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/voku/portable-ascii", - "type": "tidelift" - } - ], - "time": "2020-11-12T00:07:28+00:00" + "time": "2021-12-12T23:22:04+00:00" } ], "packages-dev": [], diff --git a/index.php b/index.php index 9e312d5..d1cde36 100644 --- a/index.php +++ b/index.php @@ -2,11 +2,15 @@ require __DIR__ . "/vendor/autoload.php"; require __DIR__ . "/helpers/domains.php"; require __DIR__ . "/helpers/settings_elements.php"; +use Steampixel\Route; -use Jenssegers\Blade\Blade; +// LOAD DOTENV +$dotenv = Dotenv\Dotenv::createImmutable(__DIR__); +$dotenv->load(); function getApi(array $proxy_elements): \Sovit\TikTok\Api { $options = []; + // Proxy config if (in_array($proxy_elements, $_COOKIE)) { foreach ($proxy_elements as $proxy_element) { $options[$proxy_element] = $_COOKIE[$proxy_element]; @@ -16,19 +20,27 @@ function getApi(array $proxy_elements): \Sovit\TikTok\Api { return $api; } -$router = new \Bramus\Router\Router(); +function getLatte(): \Latte\Engine { + $latte = new Latte\Engine; + $latte->setTempDirectory('./cache/views'); + return $latte; +} -$router->get('/', function () { +function getView(string $template): string { + return "./views/{$template}.latte"; +} + +Route::add('/', function () { http_response_code(302); header('Location: ./home'); }); -$router->get('/home', function () { - $blade = new Blade('./views', './cache/views'); - echo $blade->render('home'); +Route::add('/home', function () { + $latte = getLatte(); + $latte->render('./views/home.latte'); }); -$router->get('/images', function () use ($domains) { +Route::add('/images', function () use ($domains) { if (!isset($_GET['url'])) { die('You need to send a url!'); } @@ -41,13 +53,13 @@ $router->get('/images', function () use ($domains) { $img = file_get_contents($url, false, stream_context_create(['http' => ['ignore_errors' => true]])); if ($img) { header('Content-Type: image/jpeg'); - echo $img; + return $img; } else { - echo 'Error while getting image!'; + return 'Error while getting image!'; } }); -$router->get('/audios', function () use ($domains) { +Route::add('/audios', function () use ($domains) { if (!isset($_GET['url'])) { die('You need to send a url!'); } @@ -59,13 +71,13 @@ $router->get('/audios', function () use ($domains) { $audio = file_get_contents($url, false, stream_context_create(['http' => ['ignore_errors' => true]])); if ($audio) { header('Content-Type: audio/mp3'); - echo $audio; + return $audio; } else { - echo 'Error while getting audio!'; + return 'Error while getting audio!'; } }); -$router->get('/stream', function () use ($domains) { +Route::add('/stream', function () use ($domains) { if (!isset($_GET['url'])) { die('You need to send a url!'); } @@ -77,48 +89,54 @@ $router->get('/stream', function () use ($domains) { die('Not a valid URL'); } - header('Content-Disposition: attachment; filename="tiktok.mp4"'); + if (isset($_GET['download'])) { + header('Content-Disposition: attachment; filename="tiktok.mp4"'); + } $streamer = new \Sovit\TikTok\Stream(); $streamer->stream($url); }); -$router->get("/trending", function () use ($proxy_elements) { +Route::add("/trending", function () use ($proxy_elements) { $cursor = 0; if (isset($_GET['cursor']) && is_numeric($_GET['cursor'])) { $cursor = (int) $_GET['cursor']; } - $blade = new Blade('./views', './cache/views'); + $latte = getLatte(); $api = getApi($proxy_elements); $feed = $api->getTrendingFeed($cursor); if ($feed) { - echo $blade->render('trending', ['feed' => $feed]); + $latte->render(getView('trending'), ['feed' => $feed]); } else { - echo 'ERROR!'; + return 'ERROR!'; } }); -$router->get("/@([^/]+)", function (string $username) use ($proxy_elements) { +Route::add("/@([^/]+)", function (string $username) use ($proxy_elements) { $cursor = 0; if (isset($_GET['cursor']) && is_numeric($_GET['cursor'])) { $cursor = (int) $_GET['cursor']; } - $blade = new Blade('./views', './cache/views'); + $latte = getLatte(); $api = getApi($proxy_elements); $feed = $api->getUserFeed($username, $cursor); if ($feed) { - echo $blade->render('user', ['feed' => $feed]); + if ($feed->info->detail->user->privateAccount) { + http_response_code(400); + return 'Private account detected! Not supported'; + } + $latte->render(getView('user'), ['feed' => $feed]); } else { - echo 'ERROR!'; + return 'ERROR!'; } }); -$router->get("/settings", function () use ($proxy_elements) { - $blade = new Blade('./views', './cache/views'); - echo $blade->render('settings', ["proxy_elements" => $proxy_elements]); +Route::add("/settings", function () use ($proxy_elements) { + $latte = getLatte(); + $latte->render(getView('settings'), ["proxy_elements" => $proxy_elements]); }); -$router->post("/settings", function () use ($proxy_elements) { +Route::add("/settings", function () use ($proxy_elements) { if (in_array($proxy_elements, $_POST)) { foreach ($proxy_elements as $proxy_element) { setcookie($proxy_element, $_POST[$proxy_element], time()+60*60*24*30, '/', '', true, true); @@ -126,6 +144,7 @@ $router->post("/settings", function () use ($proxy_elements) { } http_response_code(302); header('Location: ./home'); -}); +}, 'POST'); -$router->run(); +$subdir = getenv('APP_SUBDIR'); +Route::run($subdir); diff --git a/views/about.blade.php b/views/about.latte similarity index 91% rename from views/about.blade.php rename to views/about.latte index e3351c1..7701f1a 100644 --- a/views/about.blade.php +++ b/views/about.latte @@ -8,7 +8,7 @@ - @include('navbar') + {include 'navbar.latte'}
@@ -19,6 +19,6 @@

TODO

- @include('footer') + {include 'footer.latte'} diff --git a/views/feed.blade.php b/views/feed.latte similarity index 59% rename from views/feed.blade.php rename to views/feed.latte index 51e0e46..d261312 100644 --- a/views/feed.blade.php +++ b/views/feed.latte @@ -1,30 +1,28 @@
- @foreach ($feed->items as $item) + {foreach $feed->items as $item} - @endforeach + {/foreach}
- @isset ($_GET['cursor']) - First - @endisset + First Back - @if ($feed->hasMore) - Next - @else + {if $feed->hasMore} + Next + {else} Next - @endif + {/if}