Added parameter to disable web UI integration with local client
This commit is contained in:
Louis 2026-06-11 15:35:59 +02:00 committed by GitHub
commit 70955fbeb0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 24 additions and 10 deletions

View file

@ -26,6 +26,7 @@ class ConfigLexicon implements ILexicon {
public const GROUP_RECENT_FILES = 'group_recent_files';
public const RECENT_FILES_GROUP_MIME_TYPES = 'recent_files_group_mime_types';
public const RECENT_FILES_GROUP_TIMESPAN_MINUTES = 'recent_files_group_timespan_minutes';
public const LOCAL_CLIENT_INTEGRATION = 'local_client_integration';
#[\Override]
public function getStrictness(): Strictness {
@ -71,6 +72,13 @@ class ConfigLexicon implements ILexicon {
definition: 'Time window in minutes to group files uploaded close together in the recent files list',
lazy: false,
),
new Entry(
self::LOCAL_CLIENT_INTEGRATION,
ValueType::BOOL,
defaultRaw: true,
definition: 'Whether to enable local client integration',
lazy: false,
),
];
}

View file

@ -205,6 +205,7 @@ class ViewController extends Controller {
$this->initialState->provideInitialState('templates_enabled', true);
$this->initialState->provideInitialState('templates_path', $this->templateManager->hasTemplateDirectory() ? $this->templateManager->getTemplatePath() : false);
$this->initialState->provideInitialState('templates', $this->templateManager->listCreators());
$this->initialState->provideInitialState('localClientEnabled', $this->appConfig->getAppValueBool(ConfigLexicon::LOCAL_CLIENT_INTEGRATION));
$isTwoFactorEnabled = false;
foreach ($this->twoFactorRegistry->getProviderStates($user) as $providerId => $providerState) {

View file

@ -10,6 +10,7 @@ import IconWeb from '@mdi/svg/svg/web.svg?raw'
import { getCurrentUser } from '@nextcloud/auth'
import axios from '@nextcloud/axios'
import { DialogBuilder, showError } from '@nextcloud/dialogs'
import { loadState } from '@nextcloud/initial-state'
import { translate as t } from '@nextcloud/l10n'
import { encodePath } from '@nextcloud/paths'
import { generateOcsUrl } from '@nextcloud/router'
@ -17,6 +18,8 @@ import { isPublicShare } from '@nextcloud/sharing/public'
import { logger } from '../utils/logger.ts'
import { isSyncable } from '../utils/permissions.ts'
const localClientEnabled = loadState('files', 'localClientEnabled', true)
export const action: IFileAction = {
id: 'edit-locally',
displayName: () => t('files', 'Open locally'),
@ -34,6 +37,10 @@ export const action: IFileAction = {
return false
}
if (!localClientEnabled) {
return false
}
return isSyncable(nodes[0]!)
},

View file

@ -307,14 +307,11 @@ class ViewControllerTest extends TestCase {
'backup_codes' => true,
]);
$invokedCountProvideInitialState = $this->exactly(13);
$this->initialState->expects($invokedCountProvideInitialState)
$initialStates = [];
$this->initialState->expects(self::atLeast(13))
->method('provideInitialState')
->willReturnCallback(function ($key, $data) use ($invokedCountProvideInitialState): void {
if ($invokedCountProvideInitialState->numberOfInvocations() === 13) {
$this->assertEquals('isTwoFactorEnabled', $key);
$this->assertTrue($data);
}
->willReturnCallback(function ($key, $data) use (&$initialStates): void {
$initialStates[$key] = $data;
});
$this->config
@ -324,5 +321,6 @@ class ViewControllerTest extends TestCase {
]);
$this->viewController->index('', '', null);
$this->assertTrue($initialStates['isTwoFactorEnabled'] ?? false);
}
}

4
dist/files-init.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long