diff options
author | Sergey Linnik <sergey.linnik@onlyoffice.com> | 2017-04-28 16:28:13 +0300 |
---|---|---|
committer | Sergey Linnik <sergey.linnik@onlyoffice.com> | 2017-04-28 17:06:19 +0300 |
commit | a78f156d8acbd8a13a697c136bfd9401355178d1 (patch) | |
tree | 44d58883ab664ffb58566337d585f7feb2a4c608 | |
parent | 77a0ddeb8a9a7c88e29390f6b51af8eaa33a30e8 (diff) |
using internal url
-rw-r--r-- | controller/settingscontroller.php | 5 | ||||
-rw-r--r-- | js/settings.js | 3 | ||||
-rw-r--r-- | lib/appconfig.php | 5 | ||||
-rw-r--r-- | lib/documentservice.php | 4 |
4 files changed, 11 insertions, 6 deletions
diff --git a/controller/settingscontroller.php b/controller/settingscontroller.php index c85448b..2e57169 100644 --- a/controller/settingscontroller.php +++ b/controller/settingscontroller.php @@ -89,7 +89,7 @@ class SettingsController extends Controller { public function index() { $data = [ "documentserver" => $this->config->GetDocumentServerUrl(), - "documentserverInternal" => $this->config->GetDocumentServerInternalUrl(), + "documentserverInternal" => $this->config->GetDocumentServerInternalUrl(true), "secret" => $this->config->GetDocumentServerSecret() ]; return new TemplateResponse($this->appName, "settings", $data, "blank"); @@ -115,7 +115,8 @@ class SettingsController extends Controller { return [ "documentserver" => $this->config->GetDocumentServerUrl(), - "documentserverInternal" => $this->config->GetDocumentServerInternalUrl(), + "documentserverInternal" => $this->config->GetDocumentServerInternalUrl(true), + "secret" => $this->config->GetDocumentServerSecret(), "error" => $error ]; } diff --git a/js/settings.js b/js/settings.js index 2b2b5b0..759e480 100644 --- a/js/settings.js +++ b/js/settings.js @@ -54,7 +54,7 @@ $("#onlyofficeInternalUrl, #onlyofficeSecret").val(""); } - var onlyofficeSecret = $("#onlyofficeSecret:visible").val(); + var onlyofficeSecret = $("#onlyofficeSecret:visible").val() || ""; var onlyofficeInternalUrl = ($("#onlyofficeInternalUrl:visible").val() || "").trim(); $.ajax({ @@ -69,6 +69,7 @@ if (response && response.documentserver != null) { $("#onlyofficeUrl").val(response.documentserver); $("#onlyofficeInternalUrl").val(response.documentserverInternal); + $("#onlyofficeSecret").val(response.secret); var message = response.error diff --git a/lib/appconfig.php b/lib/appconfig.php index 1004331..6523057 100644 --- a/lib/appconfig.php +++ b/lib/appconfig.php @@ -170,11 +170,14 @@ class AppConfig { * * @return string */ - public function GetDocumentServerInternalUrl() { + public function GetDocumentServerInternalUrl($origin) { $url = $this->config->getAppValue($this->appName, $this->_documentserverInternal, ""); if (empty($url)) { $url = $this->predefDocumentServerInternalUrl; } + if (!$origin && empty($url)) { + $url = $this->GetDocumentServerUrl(); + } return $url; } diff --git a/lib/documentservice.php b/lib/documentservice.php index 71f0f6f..8435ab2 100644 --- a/lib/documentservice.php +++ b/lib/documentservice.php @@ -138,7 +138,7 @@ class DocumentService { $document_revision_id = self::GenerateRevisionId($document_revision_id); - $documentServerUrl = $this->config->GetDocumentServerUrl(); + $documentServerUrl = $this->config->GetDocumentServerInternalUrl(false); if (empty($documentServerUrl)) { throw new \Exception($this->trans->t("ONLYOFFICE app not configured. Please contact admin")); @@ -266,7 +266,7 @@ class DocumentService { */ function CommandRequest($method) { - $documentServerUrl = $this->config->GetDocumentServerUrl(); + $documentServerUrl = $this->config->GetDocumentServerInternalUrl(false); if (empty($documentServerUrl)) { throw new \Exception($this->trans->t("ONLYOFFICE app not configured. Please contact admin")); |