-
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Vitor Mattos <[email protected]>
- Loading branch information
1 parent
6b38535
commit 9ef99db
Showing
12 changed files
with
232 additions
and
128 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* SPDX-FileCopyrightText: 2024 LibreCode coop and contributors | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
|
||
namespace OCA\Libresign\Listener; | ||
|
||
use OCA\Files\Event\LoadAdditionalScriptsEvent; | ||
use OCA\Libresign\AppInfo\Application; | ||
use OCA\Libresign\Handler\CertificateEngine\Handler as CertificateEngineHandler; | ||
use OCP\App\IAppManager; | ||
use OCP\EventDispatcher\Event; | ||
use OCP\EventDispatcher\IEventListener; | ||
use OCP\Util; | ||
|
||
/** | ||
* @template-implements IEventListener<LoadAdditionalScriptsEvent> | ||
*/ | ||
class LoadAdditionalListener implements IEventListener { | ||
public function __construct( | ||
private IAppManager $appManager, | ||
private CertificateEngineHandler $certificateEngineHandler, | ||
) { | ||
} | ||
public function handle(Event $event): void { | ||
if (!($event instanceof LoadAdditionalScriptsEvent)) { | ||
return; | ||
} | ||
|
||
if (!$this->appManager->isEnabledForUser('libresign')) { | ||
return; | ||
} | ||
|
||
if (!$this->certificateEngineHandler->getEngine()->isSetupOk()) { | ||
return; | ||
} | ||
|
||
if (class_exists('\OCA\Files\App')) { | ||
Util::addInitScript(Application::APP_ID, 'libresign-init'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.