Welcome to mirror list, hosted at ThFree Co, Russian Federation.

JavascriptController.php « Controller « lib - github.com/nextcloud/jsxc.nextcloud.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f6636ac88e19ac0a1af6dfcbfe41cde5cbb474be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php

namespace OCA\OJSXC\Controller;

use OCA\OJSXC\AppInfo\Application;
use OCA\OJSXC\Config;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\DataDownloadResponse;
use OCP\IRequest;

class JavascriptController extends Controller
{
	private $config;

	public function __construct($appName, IRequest $request, Config $config)
	{
		parent::__construct($appName, $request);

		$this->config = $config;
	}

	/**
	 * @NoAdminRequired
	 * @NoCSRFRequired
	 * @PublicPage
	 */
	public function generalConfig()
	{
		$serverType = $this->config->getAppValue(Config::XMPP_SERVER_TYPE, Application::INTERNAL);
		$startMinimized = $this->config->getBooleanAppValue(Config::XMPP_START_MINIMIZED);
		$loginFormEnable = $this->config->getBooleanAppValue(Config::XMPP_START_ON_LOGIN, true);

		$settings = [
			'serverType' => $serverType,
			'startMinimized' => $startMinimized,
			'defaultLoginFormEnable' => $loginFormEnable,
		];

		$code = 'var OJSXC_CONFIG = {}; try{OJSXC_CONFIG = JSON.parse(\''.json_encode($settings).'\');}catch(err){}';

		return new DataDownloadResponse($code, 'script', 'text/javascript');
	}
}