Skip to content
Merged
Show file tree
Hide file tree
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
20 changes: 19 additions & 1 deletion docs/app_settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,26 @@ token. These credentials then can be used by the 3rd party application to make c
### Canonical webroot
Canonical webroot, in case there are multiple, for Collabora Online to use. Provide the one with least restrictions. E.g.: Use non-shibbolized webroot if this instance is accessed by both shibbolized and non-shibbolized webroots. You can ignore this setting if only one webroot is used to access this instance.

### Previews

By default Nextcloud will generate previews of Office files using the Collabora file conversion endpoint. This can be turned off through

occ config:app:set richdocuments preview_generation --type boolean --lazy --value true

### Electronic signature
From a shell running in the Nextcloud root directory, run the following `occ`
command to configure a non-default base URL for eID Easy. For example:

./occ config:app:set --value https://test.eideasy.com richdocuments esignature_base_url
occ config:app:set richdocuments esignature_base_url --type string --value https://test.eideasy.com

### UI mode

Switching between classic and tabbed view is possible as a default, however users can still change this while using Office:

occ config:app:set richdocuments uiDefaults-UIMode --type string --value classic

### Disable local editing

In case no desktop client is used on an instance you may disable the local editing button within office with:

occ config:app:set richdocuments open_local_editor --type string --value no
6 changes: 6 additions & 0 deletions lib/AppConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use OCA\Richdocuments\AppInfo\Application;
use OCA\Richdocuments\Service\FederationService;
use OCP\App\IAppManager;
use OCP\AppFramework\Services\IAppConfig;
use OCP\GlobalScale\IConfig as GlobalScaleConfig;
use OCP\IConfig;

Expand Down Expand Up @@ -55,6 +56,7 @@ class AppConfig {

public function __construct(
private IConfig $config,
private IAppConfig $appConfig,
private IAppManager $appManager,
private GlobalScaleConfig $globalScaleConfig,
) {
Expand Down Expand Up @@ -232,6 +234,10 @@ private function getFederationDomains(): array {
return array_map(fn ($url) => $this->domainOnly($url), array_merge($trustedNextcloudDomains, $trustedCollaboraDomains));
}

public function isPreviewGenerationEnabled(): bool {
return $this->appConfig->getAppValueBool('preview_generation', true);
}

private function getGSDomains(): array {
if (!$this->globalScaleConfig->isGlobalScaleEnabled()) {
return [];
Expand Down
4 changes: 3 additions & 1 deletion lib/Preview/Office.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/
namespace OCA\Richdocuments\Preview;

use OCA\Richdocuments\AppConfig;
use OCA\Richdocuments\Capabilities;
use OCA\Richdocuments\Service\RemoteService;
use OCP\Files\File;
Expand All @@ -20,14 +21,15 @@ abstract class Office implements IProviderV2 {
public function __construct(
private RemoteService $remoteService,
private LoggerInterface $logger,
private AppConfig $appConfig,
Capabilities $capabilities,
) {
$this->capabilities = $capabilities->getCapabilities()['richdocuments'] ?? [];
}

public function isAvailable(FileInfo $file): bool {
if (isset($this->capabilities['collabora']['convert-to']['available'])) {
return (bool)$this->capabilities['collabora']['convert-to']['available'];
return (bool)$this->capabilities['collabora']['convert-to']['available'] && $this->appConfig->isPreviewGenerationEnabled();
}
return false;
}
Expand Down
8 changes: 6 additions & 2 deletions tests/lib/AppConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,26 @@

use OCA\Richdocuments\AppConfig;
use OCP\App\IAppManager;
use OCP\AppFramework\Services\IAppConfig;
use OCP\GlobalScale\IConfig as IGlobalScaleConfig;
use OCP\IConfig;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;

class AppConfigTest extends TestCase {
/** @var IConfig|MockObject */
private $config;
/** @var AppConfig */
/** @var IAppConfig */
private $appConfig;

public function setUp(): void {
parent::setUp();
$this->config = $this->createMock(IConfig::class);
$this->appManager = $this->createMock(IAppManager::class);
$this->appConfig = $this->createMock(IAppConfig::class);
$this->gsConfig = $this->createMock(IGlobalScaleConfig::class);

$this->appConfig = new AppConfig($this->config, $this->appManager, $this->createMock(\OCP\GlobalScale\IConfig::class));
$this->appConfig = new AppConfig($this->config, $this->appConfig, $this->appManager, $this->gsConfig);
}

public function testGetAppValueArrayWithValues() {
Expand Down
2 changes: 2 additions & 0 deletions tests/lib/Listener/AddContentSecurityPolicyListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use OCP\App\IAppManager;
use OCP\AppFramework\Http\ContentSecurityPolicy;
use OCP\AppFramework\Http\EmptyContentSecurityPolicy;
use OCP\AppFramework\Services\IAppConfig;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\GlobalScale\IConfig as GlobalScaleConfig;
use OCP\IConfig;
Expand Down Expand Up @@ -54,6 +55,7 @@ public function setUp(): void {
$this->config = $this->getMockBuilder(AppConfig::class)
->setConstructorArgs([
$this->createMock(IConfig::class),
$this->createMock(IAppConfig::class),
$this->appManager,
$this->gsConfig,
])
Expand Down
Loading