diff --git a/app/Controllers/SettingsController.php b/app/Controllers/SettingsController.php
index 0d6294d..875cf72 100644
--- a/app/Controllers/SettingsController.php
+++ b/app/Controllers/SettingsController.php
@@ -12,11 +12,6 @@ class SettingsController {
$latte->render(Misc::getView('settings'), new BaseTemplate('Settings'));
}
- static private function redirect() {
- $url = Misc::url('/settings');
- header("Location: {$url}");
- }
-
static public function general() {
if (isset($_POST['theme'])) {
$theme = $_POST['theme'];
@@ -26,6 +21,15 @@ class SettingsController {
}
static public function api() {
// TODO, ADD COUNT
+ if (isset($_POST['api-test_endpoints'])) {
+ $test_endpoints = $_POST['api-test_endpoints'];
+ Cookies::set('api-test_endpoints', $test_endpoints);
+ }
self::redirect();
}
+
+ static private function redirect() {
+ $url = Misc::url('/settings');
+ header("Location: {$url}");
+ }
}
diff --git a/app/Helpers/Cookies.php b/app/Helpers/Cookies.php
index 14c2b44..cc20699 100644
--- a/app/Helpers/Cookies.php
+++ b/app/Helpers/Cookies.php
@@ -23,6 +23,10 @@ class Cookies {
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) {
setcookie($name, $value, time()+60*60*24*30, '/', '', isset($_SERVER['HTTPS']), true);
}
diff --git a/app/Helpers/Wrappers.php b/app/Helpers/Wrappers.php
index 8022c70..e8e2f30 100644
--- a/app/Helpers/Wrappers.php
+++ b/app/Helpers/Wrappers.php
@@ -19,9 +19,12 @@ class Wrappers {
return Misc::url($endpoint);
});
// Version being used
- $latte->addFunction('version', function (): string {
+ $latte->addFunction('version_frontend', function (): string {
return \Composer\InstalledVersions::getVersion('pablouser1/proxitok');
});
+ $latte->addFunction('version_scraper', function (): string {
+ return \Composer\InstalledVersions::getVersion('pablouser1/tikscraper');
+ });
$latte->addFunction('theme', function(): string {
return Cookies::theme();
});
@@ -47,7 +50,7 @@ class Wrappers {
*/
static public function api(): \TikScraper\Api {
$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' => [
'remote_url' => Misc::env('API_SIGNER_URL', ''),
'browser_url' => Misc::env('API_BROWSER_URL', ''),
diff --git a/components/settings/api.latte b/components/settings/api.latte
index 7d02d2b..ad2a51c 100644
--- a/components/settings/api.latte
+++ b/components/settings/api.latte
@@ -1,7 +1,19 @@
{embed '../form.latte', path: '/settings/api', method: 'POST', submit: true}
{block fields}
+ {var $use_endpoints = \App\Helpers\Cookies::check('api-test_endpoints', 'yes')}
-
TODO
+
+
+
+
+
+
This may help bypass rate limits
{/block}
{/embed}
diff --git a/composer.json b/composer.json
index a1fe995..fb3fb25 100644
--- a/composer.json
+++ b/composer.json
@@ -1,7 +1,7 @@
{
"name": "pablouser1/proxitok",
"description": "An alternative frontend for TikTok",
- "version": "2.3.1.0",
+ "version": "2.3.2.0",
"license": "AGPL-3.0-or-later",
"type": "project",
"authors": [
diff --git a/composer.lock b/composer.lock
index eed4825..6f659c8 100644
--- a/composer.lock
+++ b/composer.lock
@@ -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": "387c0d1d767d85d4d08fadad9b583080",
+ "content-hash": "5c6b3247dd4d2f94f65a47d2eb39717a",
"packages": [
{
"name": "bramus/router",
@@ -117,16 +117,16 @@
},
{
"name": "latte/latte",
- "version": "v2.11.4",
+ "version": "v2.11.5",
"source": {
"type": "git",
"url": "https://github.com/nette/latte.git",
- "reference": "3a5ed09d92b3bb2c428814bb919c2f8637bc49b1"
+ "reference": "89e647e51213af8a270fe9903b8735a2f6c83ad1"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/nette/latte/zipball/3a5ed09d92b3bb2c428814bb919c2f8637bc49b1",
- "reference": "3a5ed09d92b3bb2c428814bb919c2f8637bc49b1",
+ "url": "https://api.github.com/repos/nette/latte/zipball/89e647e51213af8a270fe9903b8735a2f6c83ad1",
+ "reference": "89e647e51213af8a270fe9903b8735a2f6c83ad1",
"shasum": ""
},
"require": {
@@ -195,9 +195,9 @@
],
"support": {
"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",
diff --git a/scss/yarn.lock b/scss/yarn.lock
index 46da1c9..d8f9a71 100644
--- a/scss/yarn.lock
+++ b/scss/yarn.lock
@@ -72,9 +72,9 @@ glob-parent@~5.1.2:
is-glob "^4.0.1"
immutable@^4.0.0:
- version "4.0.0"
- resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.0.0.tgz#b86f78de6adef3608395efb269a91462797e2c23"
- integrity sha512-zIE9hX70qew5qTUjSS7wi1iwj/l7+m54KWU247nhM3v806UdGj1yDndXj+IOYxxtW9zyLI+xqFNZjTuDaLUqFw==
+ version "4.1.0"
+ resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.1.0.tgz#f795787f0db780183307b9eb2091fcac1f6fafef"
+ integrity sha512-oNkuqVTA8jqG1Q6c+UglTOD1xhC1BtjKI7XkCXRkZHrN5m18/XsnUp8Q89GkQO/z+0WjonSvl0FLhDYftp46nQ==
is-binary-path@~2.1.0:
version "2.1.0"
@@ -86,7 +86,7 @@ is-binary-path@~2.1.0:
is-extglob@^2.1.1:
version "2.1.1"
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:
version "4.0.3"
@@ -118,9 +118,9 @@ readdirp@~3.6.0:
picomatch "^2.2.1"
sass@^1.46.0:
- version "1.52.1"
- resolved "https://registry.yarnpkg.com/sass/-/sass-1.52.1.tgz#554693da808543031f9423911d62c60a1acf7889"
- integrity sha512-fSzYTbr7z8oQnVJ3Acp9hV80dM1fkMN7mSD/25mpcct9F7FPBMOI8krEYALgU1aZoqGhQNhTPsuSmxjnIvAm4Q==
+ version "1.53.0"
+ resolved "https://registry.yarnpkg.com/sass/-/sass-1.53.0.tgz#eab73a7baac045cc57ddc1d1ff501ad2659952eb"
+ integrity sha512-zb/oMirbKhUgRQ0/GFz8TSAwRq2IlR29vOUJZOx0l8sV+CkHUfHa4u5nqrG+1VceZp7Jfj59SVW9ogdhTvJDcQ==
dependencies:
chokidar ">=3.0.0 <4.0.0"
immutable "^4.0.0"
diff --git a/views/about.latte b/views/about.latte
index a411465..4c214b0 100644
--- a/views/about.latte
+++ b/views/about.latte
@@ -9,7 +9,8 @@
{block content}
About this instance
- Version: {version()}
+ Frontend version: {version_frontend()}
+ Scraper version: {version_scraper()}
Why would I want to use ProxiTok?