Auto patch API

This commit is contained in:
Pablo Ferreiro 2022-01-04 00:18:13 +01:00
parent c700036aa2
commit c8d6516dd7
No known key found for this signature in database
GPG key ID: 41FBCE65B779FA24
8 changed files with 23 additions and 9 deletions

1
.gitignore vendored
View file

@ -3,3 +3,4 @@
/vendor /vendor
/cache/views/* /cache/views/*
!/cache/views/.gitkeep !/cache/views/.gitkeep
/.new_api

View file

@ -37,7 +37,7 @@ location /tiktok-viewer/.env {
``` ```
## Known issues ## 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 ## TODO
* Allow searching for just one video using the ID * Allow searching for just one video using the ID

View file

@ -10,5 +10,10 @@
"steampixel/simple-php-router": "^0.7.0", "steampixel/simple-php-router": "^0.7.0",
"latte/latte": "^2.10", "latte/latte": "^2.10",
"vlucas/phpdotenv": "^5.4" "vlucas/phpdotenv": "^5.4"
},
"scripts": {
"post-install-cmd": [
"php fix_api.php"
]
} }
} }

7
fix_api.php Normal file
View file

@ -0,0 +1,7 @@
<?php
if (!file_exists(__DIR__ . '/.new_api')) {
$new_api = file_get_contents('https://raw.githubusercontent.com/attend-dunce/TikTok-API-PHP/master/lib/TikTok/Api.php');
file_put_contents(__DIR__ . '/vendor/ssovit/tiktok-api/lib/TikTok/Api.php', $new_api);
file_put_contents(__DIR__ . '/.new_api', 'DO NOT DELETE! This file proves that you have patched the API');
echo('Patched API!');
}

View file

@ -11,6 +11,7 @@ $domains = [
"v16-webapp.tiktok.com" "v16-webapp.tiktok.com"
], ],
"audio" => [ "audio" => [
"sf16-ies-music-va.tiktokcdn.com" "sf16-ies-music-va.tiktokcdn.com",
"sf77-ies-music-va.tiktokcdn.com"
], ],
]; ];

View file

@ -3,10 +3,8 @@ require __DIR__ . "/vendor/autoload.php";
use Steampixel\Route; use Steampixel\Route;
// LOAD DOTENV // LOAD DOTENV
if (file_exists(__DIR__ . '/.env')) { $dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__); $dotenv->safeLoad();
$dotenv->load();
}
// -- HELPERS -- // // -- HELPERS -- //
function getSubdir(): string { function getSubdir(): string {

View file

@ -1,7 +1,7 @@
<footer class="footer"> <footer class="footer">
<div class="content"> <div class="content">
<p class="has-text-centered"> <p class="has-text-centered">
Made with <span style="color: #e25555;">&#9829;</span> in <a href="https://github.com/pablouser1/tiktok-viewer">Github</a> Made with <span style="color: #e25555;">&#9829;</span> in <a href="https://github.com/pablouser1/tiktok-alt-frontend">Github</a>
</p> </p>
</div> </div>
</footer> </footer>

View file

@ -4,8 +4,10 @@
{include 'components/head.latte', title: 'Home'} {include 'components/head.latte', title: 'Home'}
<body> <body>
{include 'components/navbar.latte'} <section class="hero is-fullheight">
<section class="hero is-fullheight-with-navbar"> <div class="hero-head">
{include 'components/navbar.latte'}
</div>
<div class="hero-body"> <div class="hero-body">
<div class="container has-text-centered"> <div class="container has-text-centered">
<p class="title">Welcome to TikTok Alt-Frontend!</p> <p class="title">Welcome to TikTok Alt-Frontend!</p>