Heroku using nginx, reverted public and some fixes
This commit is contained in:
parent
8ece2c2b25
commit
1b29950d89
15 changed files with 38 additions and 33 deletions
|
|
@ -11,19 +11,26 @@ class SettingsController {
|
|||
$latte->render(Misc::getView('settings'), new SettingsTemplate);
|
||||
}
|
||||
|
||||
static private function redirect() {
|
||||
$url = Misc::url('/settings');
|
||||
header("Location: {$url}");
|
||||
}
|
||||
|
||||
static public function proxy() {
|
||||
if (in_array(Cookies::PROXY, $_POST)) {
|
||||
foreach (Cookies::PROXY as $proxy_element) {
|
||||
Cookies::set($proxy_element, $_POST[$proxy_element]);
|
||||
}
|
||||
}
|
||||
$url = Misc::url('/settings');
|
||||
header("Location: {$url}");
|
||||
self::redirect();
|
||||
}
|
||||
|
||||
static public function api() {
|
||||
$_POST['legacy'] ?? Cookies::set('api-legacy', '1');
|
||||
$url = Misc::url('/settings');
|
||||
header("Location: {$url}");
|
||||
$legacy = 'off';
|
||||
if (isset($_POST['api-legacy'])) {
|
||||
$legacy = 'on';
|
||||
}
|
||||
Cookies::set('api-legacy', $legacy);
|
||||
self::redirect();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,8 +78,7 @@ class Misc {
|
|||
}
|
||||
|
||||
// Legacy mode
|
||||
$_COOKIE['enable_legacy'] ?? $legacy = true; // User level
|
||||
$legacy = self::env('FORCE_LEGACY', false); // Instance level (has priority over user)
|
||||
$legacy = self::env('FORCE_LEGACY', false) || isset($_COOKIE['api-legacy']) && $_COOKIE['api-legacy'] === 'on';
|
||||
|
||||
return $legacy === false ? new \TikScraper\Api($options, $cacheEngine) : new \TikScraper\Legacy($options, $cacheEngine);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue