diff --git a/appinfo/info.xml b/appinfo/info.xml index d1017b1a..e61b6af6 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -5,7 +5,7 @@ Collabora Online allows you to to work with all kinds of office documents directly in your browser. This application requires Collabora Cloudsuite to be installed on one of your servers, please read the documentation to learn more about that. Edit office documents directly in your browser. AGPL - 1.12.34 + 1.12.34_dontsellme Collabora Productivity based on work of Frank Karlitschek, Victor Dubiniuk https://github.com/nextcloud/richdocuments/issues https://github.com/nextcloud/richdocuments.git diff --git a/js/admin.js b/js/admin.js index 81e1c0cd..7efdc8e8 100644 --- a/js/admin.js +++ b/js/admin.js @@ -4,7 +4,8 @@ var documentsSettings = { save : function() { $('#wopi_apply').attr('disabled', true); var data = { - wopi_url : $('#wopi_url').val().replace(/\/$/, '') + wopi_url : $('#wopi_url').val().replace(/\/$/, ''), + wopi_internal_url : $('#wopi_internal_url').val().replace(/\/$/, '') }; OC.msg.startAction('#documents-admin-msg', t('richdocuments', 'Saving…')); diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php index 8d609c02..40bea6a2 100644 --- a/lib/Controller/SettingsController.php +++ b/lib/Controller/SettingsController.php @@ -53,6 +53,7 @@ class SettingsController extends Controller{ public function getSettings() { return new JSONResponse([ 'wopi_url' => $this->appConfig->getAppValue('wopi_url'), + 'wopi_internal_url' => $this->appConfig->getAppValue('wopi_internal_url'), 'edit_groups' => $this->appConfig->getAppValue('edit_groups'), 'doc_format' => $this->appConfig->getAppValue('doc_format'), ]); @@ -60,13 +61,15 @@ class SettingsController extends Controller{ /** * @param string $wopi_url + * @param string $wopi_internal_url * @param string $edit_groups * @param string $doc_format * @return JSONResponse */ public function setSettings($wopi_url, - $edit_groups, - $doc_format){ + $wopi_internal_url, + $edit_groups, + $doc_format) { $message = $this->l10n->t('Saved'); if ($wopi_url !== null){ @@ -77,6 +80,10 @@ class SettingsController extends Controller{ $message = $this->l10n->t('Saved with error: Collabora Online should use the same protocol as the server installation.'); } } + + if ($wopi_internal_url !== null){ + $this->appConfig->setAppValue('wopi_internal_url', $wopi_internal_url); + } if ($edit_groups !== null){ $this->appConfig->setAppValue('edit_groups', $edit_groups); diff --git a/lib/Settings/Admin.php b/lib/Settings/Admin.php index 2a837065..04e31859 100644 --- a/lib/Settings/Admin.php +++ b/lib/Settings/Admin.php @@ -47,6 +47,7 @@ class Admin implements ISettings { 'admin', [ 'wopi_url' => $this->config->getAppValue('richdocuments', 'wopi_url'), + 'wopi_internal_url' => $this->config->getAppValue('richdocuments', 'wopi_internal_url'), 'edit_groups' => $this->config->getAppValue('richdocuments', 'edit_groups'), 'doc_format' => $this->config->getAppValue('richdocuments', 'doc_format'), ], diff --git a/lib/WOPI/DiscoveryManager.php b/lib/WOPI/DiscoveryManager.php index 6f7e184c..26e890a1 100644 --- a/lib/WOPI/DiscoveryManager.php +++ b/lib/WOPI/DiscoveryManager.php @@ -77,7 +77,7 @@ class DiscoveryManager { $file = $this->appData->newFile('discovery.xml'); }*/ - $remoteHost = str_replace("hostname.host", $_SERVER["HTTP_HOST"], $this->config->getAppValue('richdocuments', 'wopi_url')); + $remoteHost = $this->config->getAppValue('richdocuments', 'wopi_internal_url'); $wopiDiscovery = $remoteHost . '/hosting/discovery'; $client = $this->clientService->newClient(); diff --git a/lib/appconfig.php b/lib/appconfig.php index 9a37f9d7..b5dba8ce 100644 --- a/lib/appconfig.php +++ b/lib/appconfig.php @@ -16,7 +16,8 @@ use \OCP\IConfig; class AppConfig{ private $appName = 'richdocuments'; private $defaults = [ - 'wopi_url' => 'https://localhost:9980' + 'wopi_url' => 'https://localhost:9980', + 'wopi_internal_url' => "https://localhost:9980" ]; private $config; diff --git a/templates/admin.php b/templates/admin.php index 244fbe8d..f9744a3a 100644 --- a/templates/admin.php +++ b/templates/admin.php @@ -6,7 +6,9 @@ script('richdocuments', 'admin');
t('URL (and port) of the Collabora Online server that provides the editing functionality as a WOPI client. If you use "hostname.host" as the host, it will be replaced with the current server name.')) ?> -
+ +
t('URL (and port) of the Collabora Online server. This entry will be used for server-side actions.')) ?> +