Files
root dc299709f7 Add f7push webhook for support replies and ticket deep links.
OCS endpoint for support.f7cloud.ru, notification notifier, and ?ticket= URL opening in the client UI.
2026-05-24 12:30:02 +03:00

43 lines
922 B
PHP

<?php
declare(strict_types=1);
namespace OCA\F7Support\Service;
use OCP\IConfig;
class ConfigService {
public const APP_ID = 'f7support';
public function __construct(
private IConfig $config,
) {
}
public function isPushEnabled(): bool {
return $this->config->getAppValue(self::APP_ID, 'push_enabled', 'yes') === 'yes';
}
public function getPushWebhookSecret(): string {
return trim($this->config->getAppValue(self::APP_ID, 'push_webhook_secret', ''));
}
public function verifyPushWebhookSecret(?string $provided): bool {
if ($provided === null || $provided === '') {
return false;
}
$own = $this->getPushWebhookSecret();
if ($own !== '' && hash_equals($own, $provided)) {
return true;
}
$f7pushSecret = trim($this->config->getAppValue('f7push', 'api_secret', ''));
if ($f7pushSecret !== '' && hash_equals($f7pushSecret, $provided)) {
return true;
}
return false;
}
}