2016-10-25 20:49:48 +02:00
|
|
|
<?php
|
2025-04-27 14:38:18 +02:00
|
|
|
|
2016-10-25 20:49:48 +02:00
|
|
|
/**
|
2024-05-27 10:08:53 +02:00
|
|
|
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2016-10-25 20:49:48 +02:00
|
|
|
*/
|
|
|
|
namespace OC\Core\Controller;
|
|
|
|
|
|
|
|
use bantu\IniGetWrapper\IniGetWrapper;
|
2024-03-01 18:37:47 +01:00
|
|
|
use OC\Authentication\Token\IProvider;
|
2017-12-01 10:36:13 +01:00
|
|
|
use OC\CapabilitiesManager;
|
2024-07-10 16:59:26 +02:00
|
|
|
use OC\Files\FilenameValidator;
|
2016-10-25 20:49:48 +02:00
|
|
|
use OC\Template\JSConfigHelper;
|
|
|
|
use OCP\App\IAppManager;
|
|
|
|
use OCP\AppFramework\Controller;
|
|
|
|
use OCP\AppFramework\Http;
|
2024-01-10 12:35:44 +01:00
|
|
|
use OCP\AppFramework\Http\Attribute\FrontpageRoute;
|
2024-07-25 13:24:59 +02:00
|
|
|
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
|
2024-01-18 10:38:37 +01:00
|
|
|
use OCP\AppFramework\Http\Attribute\OpenAPI;
|
2024-07-25 13:24:59 +02:00
|
|
|
use OCP\AppFramework\Http\Attribute\PublicPage;
|
2016-10-25 20:49:48 +02:00
|
|
|
use OCP\AppFramework\Http\DataDisplayResponse;
|
2017-04-07 15:42:43 -05:00
|
|
|
use OCP\Defaults;
|
2016-10-25 20:49:48 +02:00
|
|
|
use OCP\IConfig;
|
|
|
|
use OCP\IGroupManager;
|
2020-04-27 08:40:54 +02:00
|
|
|
use OCP\IInitialStateService;
|
2016-10-25 20:49:48 +02:00
|
|
|
use OCP\IRequest;
|
2016-09-19 15:33:30 +02:00
|
|
|
use OCP\ISession;
|
2016-10-25 20:49:48 +02:00
|
|
|
use OCP\IURLGenerator;
|
|
|
|
use OCP\IUserSession;
|
2018-01-05 13:58:28 +01:00
|
|
|
use OCP\L10N\IFactory;
|
2016-10-25 20:49:48 +02:00
|
|
|
|
2024-01-18 10:38:37 +01:00
|
|
|
#[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)]
|
2016-10-25 20:49:48 +02:00
|
|
|
class OCJSController extends Controller {
|
2022-04-12 17:55:01 +02:00
|
|
|
private JSConfigHelper $helper;
|
2016-10-25 20:49:48 +02:00
|
|
|
|
2023-06-05 18:42:42 +03:30
|
|
|
public function __construct(
|
|
|
|
string $appName,
|
|
|
|
IRequest $request,
|
|
|
|
IFactory $l10nFactory,
|
|
|
|
Defaults $defaults,
|
|
|
|
IAppManager $appManager,
|
|
|
|
ISession $session,
|
|
|
|
IUserSession $userSession,
|
|
|
|
IConfig $config,
|
|
|
|
IGroupManager $groupManager,
|
|
|
|
IniGetWrapper $iniWrapper,
|
|
|
|
IURLGenerator $urlGenerator,
|
|
|
|
CapabilitiesManager $capabilitiesManager,
|
|
|
|
IInitialStateService $initialStateService,
|
2024-03-01 18:37:47 +01:00
|
|
|
IProvider $tokenProvider,
|
2024-07-10 16:59:26 +02:00
|
|
|
FilenameValidator $filenameValidator,
|
2023-06-05 18:42:42 +03:30
|
|
|
) {
|
2016-10-25 20:49:48 +02:00
|
|
|
parent::__construct($appName, $request);
|
|
|
|
|
|
|
|
$this->helper = new JSConfigHelper(
|
2018-01-05 13:58:28 +01:00
|
|
|
$l10nFactory->get('lib'),
|
2016-10-25 20:49:48 +02:00
|
|
|
$defaults,
|
|
|
|
$appManager,
|
2016-09-19 15:33:30 +02:00
|
|
|
$session,
|
|
|
|
$userSession->getUser(),
|
2016-10-25 20:49:48 +02:00
|
|
|
$config,
|
|
|
|
$groupManager,
|
|
|
|
$iniWrapper,
|
2017-12-01 10:36:13 +01:00
|
|
|
$urlGenerator,
|
2020-04-27 08:40:54 +02:00
|
|
|
$capabilitiesManager,
|
2024-03-01 18:37:47 +01:00
|
|
|
$initialStateService,
|
2024-07-10 16:59:26 +02:00
|
|
|
$tokenProvider,
|
|
|
|
$filenameValidator,
|
2016-10-25 20:49:48 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-11-17 18:42:21 +01:00
|
|
|
* @NoTwoFactorRequired
|
2016-10-25 20:49:48 +02:00
|
|
|
*/
|
2024-07-25 13:24:59 +02:00
|
|
|
#[PublicPage]
|
|
|
|
#[NoCSRFRequired]
|
2024-01-10 12:35:44 +01:00
|
|
|
#[FrontpageRoute(verb: 'GET', url: '/core/js/oc.js')]
|
2022-04-12 17:55:01 +02:00
|
|
|
public function getConfig(): DataDisplayResponse {
|
2016-10-25 20:49:48 +02:00
|
|
|
$data = $this->helper->getConfig();
|
|
|
|
|
|
|
|
return new DataDisplayResponse($data, Http::STATUS_OK, ['Content-type' => 'text/javascript']);
|
|
|
|
}
|
|
|
|
}
|