User now can use test endpoints
This commit is contained in:
parent
9acc40618a
commit
bc3777d74c
|
@ -12,11 +12,6 @@ class SettingsController {
|
||||||
$latte->render(Misc::getView('settings'), new BaseTemplate('Settings'));
|
$latte->render(Misc::getView('settings'), new BaseTemplate('Settings'));
|
||||||
}
|
}
|
||||||
|
|
||||||
static private function redirect() {
|
|
||||||
$url = Misc::url('/settings');
|
|
||||||
header("Location: {$url}");
|
|
||||||
}
|
|
||||||
|
|
||||||
static public function general() {
|
static public function general() {
|
||||||
if (isset($_POST['theme'])) {
|
if (isset($_POST['theme'])) {
|
||||||
$theme = $_POST['theme'];
|
$theme = $_POST['theme'];
|
||||||
|
@ -26,6 +21,15 @@ class SettingsController {
|
||||||
}
|
}
|
||||||
static public function api() {
|
static public function api() {
|
||||||
// TODO, ADD COUNT
|
// TODO, ADD COUNT
|
||||||
|
if (isset($_POST['api-test_endpoints'])) {
|
||||||
|
$test_endpoints = $_POST['api-test_endpoints'];
|
||||||
|
Cookies::set('api-test_endpoints', $test_endpoints);
|
||||||
|
}
|
||||||
self::redirect();
|
self::redirect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static private function redirect() {
|
||||||
|
$url = Misc::url('/settings');
|
||||||
|
header("Location: {$url}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,10 @@ class Cookies {
|
||||||
return isset($_COOKIE[$name]);
|
return isset($_COOKIE[$name]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static public function check(string $name, string $value): bool {
|
||||||
|
return self::exists($name) && $_COOKIE[$name] === $value;
|
||||||
|
}
|
||||||
|
|
||||||
static public function set(string $name, string $value) {
|
static public function set(string $name, string $value) {
|
||||||
setcookie($name, $value, time()+60*60*24*30, '/', '', isset($_SERVER['HTTPS']), true);
|
setcookie($name, $value, time()+60*60*24*30, '/', '', isset($_SERVER['HTTPS']), true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,9 +19,12 @@ class Wrappers {
|
||||||
return Misc::url($endpoint);
|
return Misc::url($endpoint);
|
||||||
});
|
});
|
||||||
// Version being used
|
// Version being used
|
||||||
$latte->addFunction('version', function (): string {
|
$latte->addFunction('version_frontend', function (): string {
|
||||||
return \Composer\InstalledVersions::getVersion('pablouser1/proxitok');
|
return \Composer\InstalledVersions::getVersion('pablouser1/proxitok');
|
||||||
});
|
});
|
||||||
|
$latte->addFunction('version_scraper', function (): string {
|
||||||
|
return \Composer\InstalledVersions::getVersion('pablouser1/tikscraper');
|
||||||
|
});
|
||||||
$latte->addFunction('theme', function(): string {
|
$latte->addFunction('theme', function(): string {
|
||||||
return Cookies::theme();
|
return Cookies::theme();
|
||||||
});
|
});
|
||||||
|
@ -47,7 +50,7 @@ class Wrappers {
|
||||||
*/
|
*/
|
||||||
static public function api(): \TikScraper\Api {
|
static public function api(): \TikScraper\Api {
|
||||||
$options = [
|
$options = [
|
||||||
'use_test_endpoints' => Misc::env('API_TEST_ENDPOINTS', false),
|
'use_test_endpoints' => Misc::env('API_TEST_ENDPOINTS', false) || isset($_COOKIE['api-test_endpoints']) && $_COOKIE['api-test_endpoints'] === 'yes',
|
||||||
'signer' => [
|
'signer' => [
|
||||||
'remote_url' => Misc::env('API_SIGNER_URL', ''),
|
'remote_url' => Misc::env('API_SIGNER_URL', ''),
|
||||||
'browser_url' => Misc::env('API_BROWSER_URL', ''),
|
'browser_url' => Misc::env('API_BROWSER_URL', ''),
|
||||||
|
|
|
@ -1,7 +1,19 @@
|
||||||
{embed '../form.latte', path: '/settings/api', method: 'POST', submit: true}
|
{embed '../form.latte', path: '/settings/api', method: 'POST', submit: true}
|
||||||
{block fields}
|
{block fields}
|
||||||
|
{var $use_endpoints = \App\Helpers\Cookies::check('api-test_endpoints', 'yes')}
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<p>TODO</p>
|
<label class="label">Use test endpoints</label>
|
||||||
|
<div class="control">
|
||||||
|
<label class="radio">
|
||||||
|
<input type="radio" name="api-test_endpoints" value="yes" n:attr="checked => $use_endpoints" />
|
||||||
|
<span>Yes</span>
|
||||||
|
</label>
|
||||||
|
<label class="radio">
|
||||||
|
<input type="radio" name="api-test_endpoints" value="no" n:attr="checked => !$use_endpoints" />
|
||||||
|
<span>No</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<p class="help">This <i>may</i> help bypass rate limits</p>
|
||||||
</div>
|
</div>
|
||||||
{/block}
|
{/block}
|
||||||
{/embed}
|
{/embed}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "pablouser1/proxitok",
|
"name": "pablouser1/proxitok",
|
||||||
"description": "An alternative frontend for TikTok",
|
"description": "An alternative frontend for TikTok",
|
||||||
"version": "2.3.1.0",
|
"version": "2.3.2.0",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"type": "project",
|
"type": "project",
|
||||||
"authors": [
|
"authors": [
|
||||||
|
|
14
composer.lock
generated
14
composer.lock
generated
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "387c0d1d767d85d4d08fadad9b583080",
|
"content-hash": "5c6b3247dd4d2f94f65a47d2eb39717a",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "bramus/router",
|
"name": "bramus/router",
|
||||||
|
@ -117,16 +117,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "latte/latte",
|
"name": "latte/latte",
|
||||||
"version": "v2.11.4",
|
"version": "v2.11.5",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/nette/latte.git",
|
"url": "https://github.com/nette/latte.git",
|
||||||
"reference": "3a5ed09d92b3bb2c428814bb919c2f8637bc49b1"
|
"reference": "89e647e51213af8a270fe9903b8735a2f6c83ad1"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/nette/latte/zipball/3a5ed09d92b3bb2c428814bb919c2f8637bc49b1",
|
"url": "https://api.github.com/repos/nette/latte/zipball/89e647e51213af8a270fe9903b8735a2f6c83ad1",
|
||||||
"reference": "3a5ed09d92b3bb2c428814bb919c2f8637bc49b1",
|
"reference": "89e647e51213af8a270fe9903b8735a2f6c83ad1",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -195,9 +195,9 @@
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/nette/latte/issues",
|
"issues": "https://github.com/nette/latte/issues",
|
||||||
"source": "https://github.com/nette/latte/tree/v2.11.4"
|
"source": "https://github.com/nette/latte/tree/v2.11.5"
|
||||||
},
|
},
|
||||||
"time": "2022-05-30T13:34:15+00:00"
|
"time": "2022-06-26T10:12:18+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "m1/env",
|
"name": "m1/env",
|
||||||
|
|
|
@ -72,9 +72,9 @@ glob-parent@~5.1.2:
|
||||||
is-glob "^4.0.1"
|
is-glob "^4.0.1"
|
||||||
|
|
||||||
immutable@^4.0.0:
|
immutable@^4.0.0:
|
||||||
version "4.0.0"
|
version "4.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.0.0.tgz#b86f78de6adef3608395efb269a91462797e2c23"
|
resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.1.0.tgz#f795787f0db780183307b9eb2091fcac1f6fafef"
|
||||||
integrity sha512-zIE9hX70qew5qTUjSS7wi1iwj/l7+m54KWU247nhM3v806UdGj1yDndXj+IOYxxtW9zyLI+xqFNZjTuDaLUqFw==
|
integrity sha512-oNkuqVTA8jqG1Q6c+UglTOD1xhC1BtjKI7XkCXRkZHrN5m18/XsnUp8Q89GkQO/z+0WjonSvl0FLhDYftp46nQ==
|
||||||
|
|
||||||
is-binary-path@~2.1.0:
|
is-binary-path@~2.1.0:
|
||||||
version "2.1.0"
|
version "2.1.0"
|
||||||
|
@ -86,7 +86,7 @@ is-binary-path@~2.1.0:
|
||||||
is-extglob@^2.1.1:
|
is-extglob@^2.1.1:
|
||||||
version "2.1.1"
|
version "2.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2"
|
resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2"
|
||||||
integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=
|
integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==
|
||||||
|
|
||||||
is-glob@^4.0.1, is-glob@~4.0.1:
|
is-glob@^4.0.1, is-glob@~4.0.1:
|
||||||
version "4.0.3"
|
version "4.0.3"
|
||||||
|
@ -118,9 +118,9 @@ readdirp@~3.6.0:
|
||||||
picomatch "^2.2.1"
|
picomatch "^2.2.1"
|
||||||
|
|
||||||
sass@^1.46.0:
|
sass@^1.46.0:
|
||||||
version "1.52.1"
|
version "1.53.0"
|
||||||
resolved "https://registry.yarnpkg.com/sass/-/sass-1.52.1.tgz#554693da808543031f9423911d62c60a1acf7889"
|
resolved "https://registry.yarnpkg.com/sass/-/sass-1.53.0.tgz#eab73a7baac045cc57ddc1d1ff501ad2659952eb"
|
||||||
integrity sha512-fSzYTbr7z8oQnVJ3Acp9hV80dM1fkMN7mSD/25mpcct9F7FPBMOI8krEYALgU1aZoqGhQNhTPsuSmxjnIvAm4Q==
|
integrity sha512-zb/oMirbKhUgRQ0/GFz8TSAwRq2IlR29vOUJZOx0l8sV+CkHUfHa4u5nqrG+1VceZp7Jfj59SVW9ogdhTvJDcQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
chokidar ">=3.0.0 <4.0.0"
|
chokidar ">=3.0.0 <4.0.0"
|
||||||
immutable "^4.0.0"
|
immutable "^4.0.0"
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
|
|
||||||
{block content}
|
{block content}
|
||||||
<p class="title">About this instance</p>
|
<p class="title">About this instance</p>
|
||||||
<p>Version: {version()}</p>
|
<p>Frontend version: {version_frontend()}</p>
|
||||||
|
<p>Scraper version: {version_scraper()}</p>
|
||||||
<hr />
|
<hr />
|
||||||
<p class="title">Why would I want to use ProxiTok?</p>
|
<p class="title">Why would I want to use ProxiTok?</p>
|
||||||
<p>
|
<p>
|
||||||
|
|
Loading…
Reference in a new issue