Skip to content

Commit f58ce7e

Browse files
committed
Added parameter to disable web UI integration with local client
Added system config parameter `web_ui_integration_local_client.enabled` to allow disabling integration with local client from web UI (i.e. when local Nextcloud clients are not used). Use ``` occ config:system:set web_ui_integration_local_client.enabled --value='true' --type=boolean ``` to enable (default if not set) and ``` occ config:system:set web_ui_integration_local_client.enabled --value='false' --type=boolean ``` to disable integration. Use added parameter to show/hide `Edit locally` option in Nextcloud Files. Related: https://help.nextcloud.com/t/how-remove-hide-edit-locally-option-in-web-interface/171999/5 Author-Change-Id: IB#1156402 Signed-off-by: Pawel Boguslawski <[email protected]>
1 parent 1549ae0 commit f58ce7e

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

apps/files/lib/Controller/ViewController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
/**
44
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
55
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
6+
* SPDX-FileCopyrightText: 2025 Informatyka Boguslawski sp. z o.o. sp.k.
67
* SPDX-License-Identifier: AGPL-3.0-only
78
*/
89
namespace OCA\Files\Controller;
@@ -196,6 +197,7 @@ public function index($dir = '', $view = '', $fileid = null, $fileNotFound = fal
196197

197198
$this->initialState->provideInitialState('templates_path', $this->templateManager->hasTemplateDirectory() ? $this->templateManager->getTemplatePath() : false);
198199
$this->initialState->provideInitialState('templates', $this->templateManager->listCreators());
200+
$this->initialState->provideInitialState('integration_local_client_enabled', ($this->config->getSystemValueBool('web_ui_integration_local_client.enabled', true)));
199201

200202
$response = new TemplateResponse(
201203
Application::APP_ID,

apps/files/src/actions/editLocallyAction.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/**
22
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
3+
* SPDX-FileCopyrightText: 2025 Informatyka Boguslawski sp. z o.o. sp.k.
34
* SPDX-License-Identifier: AGPL-3.0-or-later
45
*/
56
import { encodePath } from '@nextcloud/paths'
@@ -12,6 +13,9 @@ import axios from '@nextcloud/axios'
1213
import LaptopSvg from '@mdi/svg/svg/laptop.svg?raw'
1314
import IconWeb from '@mdi/svg/svg/web.svg?raw'
1415
import { isPublicShare } from '@nextcloud/sharing/public'
16+
import { loadState } from '@nextcloud/initial-state'
17+
18+
let integrationLocalClientEnabled = loadState<boolean>('files', 'integration_local_client_enabled', true)
1519

1620
const confirmLocalEditDialog = (
1721
localEditCallback: (openingLocally: boolean) => void = () => {},
@@ -85,6 +89,12 @@ export const action = new FileAction({
8589

8690
// Only works on single files
8791
enabled(nodes: Node[]) {
92+
93+
// Only works when enabled.
94+
if (!integrationLocalClientEnabled) {
95+
return false
96+
}
97+
8898
// Only works on single node
8999
if (nodes.length !== 1) {
90100
return false

config/config.sample.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2606,4 +2606,11 @@
26062606
* Defaults to 5.
26072607
*/
26082608
'files.chunked_upload.max_parallel_count' => 5,
2609+
2610+
/**
2611+
* Enables web UI integration with local client.
2612+
*
2613+
* Defaults to ``true``
2614+
*/
2615+
'web_ui_integration_local_client.enabled' => true,
26092616
];

0 commit comments

Comments
 (0)