From c8d6516dd740c5b5dc4034864f38828ec61eacc2 Mon Sep 17 00:00:00 2001 From: Pablo Ferreiro Date: Tue, 4 Jan 2022 00:18:13 +0100 Subject: [PATCH] Auto patch API --- .gitignore | 1 + README.md | 2 +- composer.json | 5 +++++ fix_api.php | 7 +++++++ helpers/domains.php | 3 ++- index.php | 6 ++---- views/components/footer.latte | 2 +- views/home.latte | 6 ++++-- 8 files changed, 23 insertions(+), 9 deletions(-) create mode 100644 fix_api.php diff --git a/.gitignore b/.gitignore index a33b9a5..dd83800 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /vendor /cache/views/* !/cache/views/.gitkeep +/.new_api diff --git a/README.md b/README.md index 2418db8..effa539 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ location /tiktok-viewer/.env { ``` ## Known issues -* Right now there is an error when trying to fetch the desired user, there is already a pull request not merged yet fixing this issue on the TikTokApi repo, you can check it out [here](https://github.com/ssovit/TikTok-API-PHP/pull/43) +* Right now there is an error when trying to fetch the desired user, there is already a pull request not merged yet fixing this issue on the TikTokApi repo, you can check it out [here](https://github.com/ssovit/TikTok-API-PHP/pull/43). **This is automatically patched after running composer install** ## TODO * Allow searching for just one video using the ID diff --git a/composer.json b/composer.json index 4506392..8b2a088 100644 --- a/composer.json +++ b/composer.json @@ -10,5 +10,10 @@ "steampixel/simple-php-router": "^0.7.0", "latte/latte": "^2.10", "vlucas/phpdotenv": "^5.4" + }, + "scripts": { + "post-install-cmd": [ + "php fix_api.php" + ] } } diff --git a/fix_api.php b/fix_api.php new file mode 100644 index 0000000..82eee3d --- /dev/null +++ b/fix_api.php @@ -0,0 +1,7 @@ + [ - "sf16-ies-music-va.tiktokcdn.com" + "sf16-ies-music-va.tiktokcdn.com", + "sf77-ies-music-va.tiktokcdn.com" ], ]; diff --git a/index.php b/index.php index 9f863c8..5365a0e 100644 --- a/index.php +++ b/index.php @@ -3,10 +3,8 @@ require __DIR__ . "/vendor/autoload.php"; use Steampixel\Route; // LOAD DOTENV -if (file_exists(__DIR__ . '/.env')) { - $dotenv = Dotenv\Dotenv::createImmutable(__DIR__); - $dotenv->load(); -} +$dotenv = Dotenv\Dotenv::createImmutable(__DIR__); +$dotenv->safeLoad(); // -- HELPERS -- // function getSubdir(): string { diff --git a/views/components/footer.latte b/views/components/footer.latte index 04e38df..ebb8f4d 100644 --- a/views/components/footer.latte +++ b/views/components/footer.latte @@ -1,7 +1,7 @@ diff --git a/views/home.latte b/views/home.latte index 6e573b4..71db5a1 100644 --- a/views/home.latte +++ b/views/home.latte @@ -4,8 +4,10 @@ {include 'components/head.latte', title: 'Home'} - {include 'components/navbar.latte'} -
+
+
+ {include 'components/navbar.latte'} +

Welcome to TikTok Alt-Frontend!