Skip to content

Commit 68abfef

Browse files
committed
feat: Disable copy and download files actions
Signed-off-by: Louis Chemineau <[email protected]>
1 parent 2cb683d commit 68abfef

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/files.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,24 @@
44
*/
55

66
import { loadState } from '@nextcloud/initial-state'
7-
import { registerFileAction } from '@nextcloud/files'
7+
import { registerFileAction, getFileActions } from '@nextcloud/files'
88

99
import { setupWebDavDecryptionProxy } from './services/webDavProxy.ts'
1010
import downloadUnencryptedAction from './services/downloadUnencryptedAction.ts'
11+
import logger from './services/logger.ts'
1112

1213
const userConfig = loadState('end_to_end_encryption', 'userConfig', { e2eeInBrowserEnabled: false })
1314

1415
if (userConfig.e2eeInBrowserEnabled) {
1516
setupWebDavDecryptionProxy()
1617
registerFileAction(downloadUnencryptedAction)
18+
disableFileAction('download')
19+
disableFileAction('move-copy')
1720
}
21+
22+
function disableFileAction(actionId: string) {
23+
logger.debug('Disabling file action', { actionId })
24+
const actions = getFileActions()
25+
const action = actions.find(action => action.id === actionId) as any
26+
action._action.enabled = () => false
27+
}

0 commit comments

Comments
 (0)