RIP Legacy Mode

This commit is contained in:
Pablo Ferreiro 2022-06-04 21:04:43 +02:00
parent bdba336d3c
commit e12d26562d
No known key found for this signature in database
GPG key ID: 41FBCE65B779FA24
8 changed files with 14 additions and 33 deletions

View file

@ -1,8 +1,7 @@
# APP_PATH="/proxitok" # Relative path, PLEASE LEAVE EMPTY IF /
# APP_URL="http://localhost:8000" # Absolute path to proxitok instance
# LATTE_CACHE=/tmp/proxitok_api # Path for Latte cache, leave commented for ./cache/latte
# API CONFIG
# API_FORCE_LEGACY=true # Force legacy mode for wrapper
# API_SIGNER_URL="https://example.com" # External signing service
# API_BROWSER_URL="http://localhost:4444" # chromedriver url
# API_TEST_ENDPOINTS=true # Discomment for usage of testing TikTok endpoints, may help sometimes

View file

@ -25,10 +25,7 @@ class SettingsController {
self::redirect();
}
static public function api() {
if (isset($_POST['api-legacy'])) {
$legacy = $_POST['api-legacy'];
}
Cookies::set('api-legacy', $legacy);
// TODO, ADD COUNT
self::redirect();
}
}

View file

@ -10,13 +10,8 @@ use App\Models\RSSTemplate;
class TrendingController {
static public function get() {
$api = Wrappers::api();
$cursor = Misc::getTtwid();
// Ttwid if standard, cursor if legacy
if ($api->isLegacy()) {
$cursor = Misc::getCursor();
} else {
$cursor = Misc::getTtwid();
}
$trending = $api->trending();
$trending->feed($cursor);

View file

@ -81,8 +81,6 @@ class Wrappers {
}
}
// Legacy mode
$legacy = Misc::env('API_FORCE_LEGACY', false) || isset($_COOKIE['api-legacy']) && $_COOKIE['api-legacy'] === 'on';
return new \TikScraper\Api($options, $legacy, $cacheEngine);
return new \TikScraper\Api($options, $cacheEngine);
}
}

View file

@ -1,14 +1,7 @@
{embed '../form.latte', path: '/settings/api', method: 'POST', submit: true}
{block fields}
<div class="field">
<label class="label">Legacy mode</label>
<div class="select">
<select name="api-legacy">
<option hidden disabled selected value> -- Select an option -- </option>
<option value="on">On</option>
<option value="off">Off</option>
</select>
</div>
<p>TODO</p>
</div>
{/block}
{/embed}

View file

@ -1,7 +1,7 @@
{
"name": "pablouser1/proxitok",
"description": "An alternative frontend for TikTok",
"version": "2.3.0.1",
"version": "2.3.1.0",
"license": "AGPL-3.0-or-later",
"type": "project",
"authors": [
@ -24,7 +24,7 @@
"latte/latte": "^2.11",
"bramus/router": "^1.6",
"josegonzalez/dotenv": "dev-master",
"pablouser1/tikscraper": "^2.0"
"pablouser1/tikscraper": "^2.1"
},
"autoload": {
"psr-4": {

14
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "cfe4122df9742d32e631921902c8e213",
"content-hash": "387c0d1d767d85d4d08fadad9b583080",
"packages": [
{
"name": "bramus/router",
@ -263,16 +263,16 @@
},
{
"name": "pablouser1/tikscraper",
"version": "v2.0.2.1",
"version": "v2.1.0.1",
"source": {
"type": "git",
"url": "https://github.com/pablouser1/TikScraperPHP.git",
"reference": "979a3fda0c6f0005fd4ee28a2ade2badc6e8286d"
"reference": "443225d18f02073ea154b907f93400acd1fd49a4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pablouser1/TikScraperPHP/zipball/979a3fda0c6f0005fd4ee28a2ade2badc6e8286d",
"reference": "979a3fda0c6f0005fd4ee28a2ade2badc6e8286d",
"url": "https://api.github.com/repos/pablouser1/TikScraperPHP/zipball/443225d18f02073ea154b907f93400acd1fd49a4",
"reference": "443225d18f02073ea154b907f93400acd1fd49a4",
"shasum": ""
},
"require": {
@ -298,9 +298,9 @@
"description": "Get data from TikTok API",
"support": {
"issues": "https://github.com/pablouser1/TikScraperPHP/issues",
"source": "https://github.com/pablouser1/TikScraperPHP/tree/v2.0.2.1"
"source": "https://github.com/pablouser1/TikScraperPHP/tree/v2.1.0.1"
},
"time": "2022-06-02T09:14:57+00:00"
"time": "2022-06-04T18:53:49+00:00"
},
{
"name": "php-webdriver/webdriver",

View file

@ -10,7 +10,6 @@
{block content}
<p class="title">About this instance</p>
<p>Version: {version()}</p>
<p>Forcing Legacy mode: {isset($_ENV['API_FORCE_LEGACY']) ? 'yes' : 'no'}</p>
<hr />
<p class="title">Why would I want to use ProxiTok?</p>
<p>