Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting onlyoffice address from the app #5436

Merged
merged 1 commit into from
Jul 1, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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