Skip to content

Commit

Permalink
getting onlyoffice address from the app
Browse files Browse the repository at this point in the history
  • Loading branch information
LinneyS committed Jul 1, 2021
1 parent 1130ba4 commit ac3a68c
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions packages/web-integration-oc10/lib/Controller/FilesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,29 +141,16 @@ private function applyCSPOnlyOffice(ContentSecurityPolicy $csp): ContentSecurity
}

/**
* Extracts the onlyoffice document server URL from the app-config or system-config, in the same manner
* like the onlyoffice connector app:
* - https://github.com/ONLYOFFICE/onlyoffice-owncloud/blob/34f69c833ee4b00880d538aed1ecc48025ac8791/lib/appconfig.php#L379
* - https://github.com/ONLYOFFICE/onlyoffice-owncloud/blob/34f69c833ee4b00880d538aed1ecc48025ac8791/lib/appconfig.php#L278
* Extracts the onlyoffice document server URL from the app
*
* @return string
*/
private function getOnlyOfficeDocumentServerUrl(): string {
$appName = 'onlyoffice';
$documentServerKey = 'DocumentServerUrl';
$documentServerUrl = $this->config->getAppValue($appName, $documentServerKey);
if (!empty($documentServerUrl)) {
return $documentServerUrl;
}
$documentServerUrl = $this->config->getSystemValue($documentServerKey);
if (!empty($documentServerUrl)) {
return $documentServerUrl;
}
$onlyOfficeConfig = $this->config->getSystemValue($appName);
if (\is_array($onlyOfficeConfig) && \array_key_exists($documentServerKey, $onlyOfficeConfig)) {
return $onlyOfficeConfig[$documentServerKey];
if (!class_exists("\OCA\Onlyoffice\AppConfig")) {
return "";
}
return "";
$onlyofficeConfig = new \OCA\Onlyoffice\AppConfig("onlyoffice");
return $onlyofficeConfig->GetDocumentServerUrl();
}

private function applyCSPRichDocuments(ContentSecurityPolicy $csp): ContentSecurityPolicy {
Expand Down

0 comments on commit ac3a68c

Please sign in to comment.