mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-01-12 15:27:51 -05:00
* Implement sudo mode / reauthentication * i18n: fr * generate flags * Improvements * Remove HMAC check * Don't require reauth to access logs when signed in as admin * Notify user of bad login via notification instead --------- Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
39 lines
878 B
PHP
39 lines
878 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
final class UserJSExtension extends Minz_Extension {
|
|
public string $js_rules = '';
|
|
private const FILENAME = 'script.js';
|
|
|
|
#[\Override]
|
|
public function init(): void {
|
|
parent::init();
|
|
|
|
$this->registerTranslates();
|
|
if ($this->hasFile(self::FILENAME)) {
|
|
Minz_View::appendScript($this->getFileUrl(self::FILENAME, isStatic: false));
|
|
}
|
|
}
|
|
|
|
#[\Override]
|
|
public function handleConfigureAction(): void {
|
|
parent::init();
|
|
|
|
$this->registerTranslates();
|
|
|
|
if (FreshRSS_Auth::requestReauth()) {
|
|
return;
|
|
}
|
|
|
|
if (Minz_Request::isPost()) {
|
|
$js_rules = Minz_Request::paramString('js-rules', plaintext: true);
|
|
$this->saveFile(self::FILENAME, $js_rules);
|
|
}
|
|
|
|
$this->js_rules = '';
|
|
if ($this->hasFile(self::FILENAME)) {
|
|
$this->js_rules = htmlspecialchars($this->getFile(self::FILENAME) ?? '', ENT_NOQUOTES, 'UTF-8');
|
|
}
|
|
}
|
|
}
|