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.
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user