Skip to content

Commit

Permalink
Merge pull request #5436 from LinneyS/patch-1
Browse files Browse the repository at this point in the history
getting onlyoffice address from the app
  • Loading branch information
kulmann authored Jul 1, 2021
2 parents 1130ba4 + ac3a68c commit 87e6d18
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 87e6d18

Please sign in to comment.