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

github.com/nextcloud/jsxc.nextcloud.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsualko <klaus@jsxc.org>2019-03-03 12:04:56 +0300
committersualko <klaus@jsxc.org>2019-03-03 12:04:56 +0300
commit0fcd7e2f65255e746198531d119ddce998acd6f0 (patch)
treeba32a598ef59aeaa21f70f8220dd1074923a600d /appinfo
parent7625401bbecad6a634d24ba6d32cea4a13229b6e (diff)
fix: define jsxc public path
Nextcloud uses a suffix in production which prevents an automatic detection of the public path
Diffstat (limited to 'appinfo')
-rwxr-xr-xappinfo/app.php20
-rw-r--r--appinfo/routes.php2
2 files changed, 7 insertions, 15 deletions
diff --git a/appinfo/app.php b/appinfo/app.php
index 9ee28de..b5d087d 100755
--- a/appinfo/app.php
+++ b/appinfo/app.php
@@ -2,19 +2,11 @@
use OCA\OJSXC\AppInfo\Application;
use OCA\OJSXC\Hooks;
+use OCA\OJSXC\Config;
\OCP\App::registerPersonal('ojsxc', 'settings/personal');
-$linkToGeneralConfig = \OC::$server->getURLGenerator()->linkToRoute('ojsxc.javascript.generalConfig');
-
-\OCP\Util::addHeader(
- 'script',
- [
- 'src' => $linkToGeneralConfig,
- 'nonce' => \OC::$server->getContentSecurityPolicyNonceManager()->getNonce()
- ], ''
-);
-
+OCP\Util::addScript ( 'ojsxc', 'config' );
OCP\Util::addScript ( 'ojsxc', 'libsignal/libsignal-protocol' );
OCP\Util::addScript ( 'ojsxc', 'jsxc/jsxc.bundle' );
OCP\Util::addScript ( 'ojsxc', 'bundle');
@@ -42,7 +34,7 @@ if(class_exists('\\OCP\\AppFramework\\Http\\EmptyContentSecurityPolicy')) {
$policy->addAllowedConnectDomain('\'self\'');
- $boshUrl = \OC::$server->getConfig()->getAppValue('ojsxc', 'boshUrl');
+ $boshUrl = \OC::$server->getConfig()->getAppValue('ojsxc', Config::XMPP_URL);
if(preg_match('#^(https?:)?//([a-z0-9][a-z0-9\-.]*[a-z0-9](:[0-9]+)?)/#i', $boshUrl, $matches)) {
$boshDomain = $matches[2];
@@ -50,7 +42,7 @@ if(class_exists('\\OCP\\AppFramework\\Http\\EmptyContentSecurityPolicy')) {
$policy->addAllowedConnectDomain($boshDomain);
}
- $externalServices = \OC::$server->getConfig()->getAppValue('ojsxc', 'externalServices');
+ $externalServices = \OC::$server->getConfig()->getAppValue('ojsxc', Config::EXTERNAL_SERVICES);
$externalServices = explode("|", $externalServices);
foreach($externalServices as $es) {
@@ -61,10 +53,10 @@ if(class_exists('\\OCP\\AppFramework\\Http\\EmptyContentSecurityPolicy')) {
}
$config = \OC::$server->getConfig();
-$apiSecret = $config->getAppValue('ojsxc', 'apiSecret');
+$apiSecret = $config->getAppValue('ojsxc', Config::API_SECRET);
if(!$apiSecret) {
$apiSecret = \OC::$server->getSecureRandom()->generate(23);
- $config->setAppValue('ojsxc', 'apiSecret', $apiSecret);
+ $config->setAppValue('ojsxc', Config::API_SECRET, $apiSecret);
}
if (Application::getServerType() === 'internal') {
diff --git a/appinfo/routes.php b/appinfo/routes.php
index d276547..570cd01 100644
--- a/appinfo/routes.php
+++ b/appinfo/routes.php
@@ -24,7 +24,7 @@ $application->registerRoutes($this, array(
array('name' => 'managedServer#register', 'url' => '/managedServer/register', 'verb' => 'POST'),
- array('name' => 'javascript#generalConfig', 'url' => '/js/config', 'verb' => 'GET'),
+ array('name' => 'javascript#generalConfig', 'url' => '/js/config.js', 'verb' => 'GET'),
)
));
?>