diff --git a/apps/comments/lib/Listener/LoadAdditionalScripts.php b/apps/comments/lib/Listener/LoadAdditionalScripts.php index e43ca5f2bbe..e82f18cfbe4 100644 --- a/apps/comments/lib/Listener/LoadAdditionalScripts.php +++ b/apps/comments/lib/Listener/LoadAdditionalScripts.php @@ -42,5 +42,6 @@ class LoadAdditionalScripts implements IEventListener { // TODO: make sure to only include the sidebar script when // we properly split it between files list and sidebar Util::addScript(Application::APP_ID, 'comments'); + Util::addInitScript(Application::APP_ID, 'init'); } } diff --git a/apps/comments/src/comments.js b/apps/comments/src/comments.js index 0c0d2b866ee..ed9db7d4725 100644 --- a/apps/comments/src/comments.js +++ b/apps/comments/src/comments.js @@ -24,6 +24,5 @@ import './app.js' import './templates.js' import './activitytabviewplugin.js' -import './actions/inlineUnreadCommentsAction.ts' window.OCA.Comments = OCA.Comments diff --git a/apps/comments/src/init.ts b/apps/comments/src/init.ts new file mode 100644 index 00000000000..448720d34d2 --- /dev/null +++ b/apps/comments/src/init.ts @@ -0,0 +1,25 @@ +/** + * @copyright Copyright (c) 2023 John Molakvoæ + * + * @author John Molakvoæ + * + * @license AGPL-3.0-or-later + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ +import { registerFileAction } from '@nextcloud/files' +import { action } from './actions/inlineUnreadCommentsAction' + +registerFileAction(action) diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php index 8fe7eea01a0..ca0760fd5e2 100644 --- a/apps/files/lib/Controller/ViewController.php +++ b/apps/files/lib/Controller/ViewController.php @@ -217,6 +217,7 @@ class ViewController extends Controller { } // Load the files we need + \OCP\Util::addInitScript('files', 'init'); \OCP\Util::addStyle('files', 'merged'); \OCP\Util::addScript('files', 'merged-index', 'files'); \OCP\Util::addScript('files', 'main'); diff --git a/apps/files/src/actions/deleteAction.ts b/apps/files/src/actions/deleteAction.ts index 04c139fe38e..18c18178cb7 100644 --- a/apps/files/src/actions/deleteAction.ts +++ b/apps/files/src/actions/deleteAction.ts @@ -20,7 +20,7 @@ * */ import { emit } from '@nextcloud/event-bus' -import { Permission, Node, View, registerFileAction, FileAction } from '@nextcloud/files' +import { Permission, Node, View, FileAction } from '@nextcloud/files' import { translate as t } from '@nextcloud/l10n' import axios from '@nextcloud/axios' import TrashCanSvg from '@mdi/svg/svg/trash-can.svg?raw' @@ -62,5 +62,3 @@ export const action = new FileAction({ order: 100, }) - -registerFileAction(action) diff --git a/apps/files/src/actions/downloadAction.ts b/apps/files/src/actions/downloadAction.ts index ce9f22450e9..0b1c88fa985 100644 --- a/apps/files/src/actions/downloadAction.ts +++ b/apps/files/src/actions/downloadAction.ts @@ -20,7 +20,7 @@ * */ import { generateUrl } from '@nextcloud/router' -import { registerFileAction, FileAction, Permission, Node, FileType, View } from '@nextcloud/files' +import { FileAction, Permission, Node, FileType, View } from '@nextcloud/files' import { translate as t } from '@nextcloud/l10n' import ArrowDownSvg from '@mdi/svg/svg/arrow-down.svg?raw' @@ -86,5 +86,3 @@ export const action = new FileAction({ order: 30, }) - -registerFileAction(action) diff --git a/apps/files/src/actions/editLocallyAction.ts b/apps/files/src/actions/editLocallyAction.ts index c8e6f295544..f52f8191df8 100644 --- a/apps/files/src/actions/editLocallyAction.ts +++ b/apps/files/src/actions/editLocallyAction.ts @@ -22,7 +22,7 @@ import { encodePath } from '@nextcloud/paths' import { generateOcsUrl } from '@nextcloud/router' import { getCurrentUser } from '@nextcloud/auth' -import { registerFileAction, FileAction, Permission, type Node } from '@nextcloud/files' +import { FileAction, Permission, type Node } from '@nextcloud/files' import { showError } from '@nextcloud/dialogs' import { translate as t } from '@nextcloud/l10n' import axios from '@nextcloud/axios' @@ -66,7 +66,3 @@ export const action = new FileAction({ order: 25, }) - -if (!/Android|iPhone|iPad|iPod/i.test(navigator.userAgent)) { - registerFileAction(action) -} diff --git a/apps/files/src/actions/favoriteAction.ts b/apps/files/src/actions/favoriteAction.ts index 1309539bad2..34d34039101 100644 --- a/apps/files/src/actions/favoriteAction.ts +++ b/apps/files/src/actions/favoriteAction.ts @@ -21,7 +21,7 @@ */ import { emit } from '@nextcloud/event-bus' import { generateUrl } from '@nextcloud/router' -import { Permission, type Node, View, registerFileAction, FileAction } from '@nextcloud/files' +import { Permission, type Node, View, FileAction } from '@nextcloud/files' import { translate as t } from '@nextcloud/l10n' import axios from '@nextcloud/axios' import Vue from 'vue' @@ -101,5 +101,3 @@ export const action = new FileAction({ order: -50, }) - -registerFileAction(action) diff --git a/apps/files/src/actions/openFolderAction.ts b/apps/files/src/actions/openFolderAction.ts index 2694667222d..f802ea4ad6d 100644 --- a/apps/files/src/actions/openFolderAction.ts +++ b/apps/files/src/actions/openFolderAction.ts @@ -20,7 +20,7 @@ * */ import { join } from 'path' -import { Permission, Node, FileType, View, registerFileAction, FileAction, DefaultType } from '@nextcloud/files' +import { Permission, Node, FileType, View, FileAction, DefaultType } from '@nextcloud/files' import { translate as t } from '@nextcloud/l10n' import FolderSvg from '@mdi/svg/svg/folder.svg?raw' @@ -66,5 +66,3 @@ export const action = new FileAction({ default: DefaultType.HIDDEN, order: -100, }) - -registerFileAction(action) diff --git a/apps/files/src/actions/openInFilesAction.ts b/apps/files/src/actions/openInFilesAction.ts index ed3b781548c..235b59046d7 100644 --- a/apps/files/src/actions/openInFilesAction.ts +++ b/apps/files/src/actions/openInFilesAction.ts @@ -20,9 +20,7 @@ * */ import { translate as t } from '@nextcloud/l10n' -import { FileType, type Node } from '@nextcloud/files' - -import { registerFileAction, FileAction, DefaultType } from '@nextcloud/files' +import { type Node, FileType, FileAction, DefaultType } from '@nextcloud/files' /** * TODO: Move away from a redirect and handle @@ -53,5 +51,3 @@ export const action = new FileAction({ order: -1000, default: DefaultType.HIDDEN, }) - -registerFileAction(action) diff --git a/apps/files/src/actions/renameAction.ts b/apps/files/src/actions/renameAction.ts index 001bedfc73a..81d6b6384b0 100644 --- a/apps/files/src/actions/renameAction.ts +++ b/apps/files/src/actions/renameAction.ts @@ -20,7 +20,7 @@ * */ import { emit } from '@nextcloud/event-bus' -import { Permission, type Node, registerFileAction, FileAction } from '@nextcloud/files' +import { Permission, type Node, FileAction } from '@nextcloud/files' import { translate as t } from '@nextcloud/l10n' import PencilSvg from '@mdi/svg/svg/pencil.svg?raw' @@ -45,5 +45,3 @@ export const action = new FileAction({ order: 10, }) - -registerFileAction(action) diff --git a/apps/files/src/actions/sidebarAction.ts b/apps/files/src/actions/sidebarAction.ts index aa265d6709a..32cd8e6d433 100644 --- a/apps/files/src/actions/sidebarAction.ts +++ b/apps/files/src/actions/sidebarAction.ts @@ -19,7 +19,7 @@ * along with this program. If not, see . * */ -import { Permission, type Node, View, registerFileAction, FileAction, FileType } from '@nextcloud/files' +import { Permission, type Node, View, FileAction, FileType } from '@nextcloud/files' import { translate as t } from '@nextcloud/l10n' import InformationSvg from '@mdi/svg/svg/information-variant.svg?raw' @@ -73,5 +73,3 @@ export const action = new FileAction({ order: -50, }) - -registerFileAction(action) diff --git a/apps/files/src/actions/viewInFolderAction.ts b/apps/files/src/actions/viewInFolderAction.ts index a5a5896df0c..c306f93b0af 100644 --- a/apps/files/src/actions/viewInFolderAction.ts +++ b/apps/files/src/actions/viewInFolderAction.ts @@ -19,7 +19,7 @@ * along with this program. If not, see . * */ -import { Node, FileType, Permission, View, registerFileAction, FileAction } from '@nextcloud/files' +import { Node, FileType, Permission, View, FileAction } from '@nextcloud/files' import { translate as t } from '@nextcloud/l10n' import FolderMoveSvg from '@mdi/svg/svg/folder-move.svg?raw' @@ -64,5 +64,3 @@ export const action = new FileAction({ order: 80, }) - -registerFileAction(action) diff --git a/apps/files/src/init.ts b/apps/files/src/init.ts new file mode 100644 index 00000000000..64e3846979e --- /dev/null +++ b/apps/files/src/init.ts @@ -0,0 +1,59 @@ +/** + * @copyright Copyright (c) 2023 John Molakvoæ + * + * @author John Molakvoæ + * + * @license AGPL-3.0-or-later + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ +import { action as deleteAction } from './actions/deleteAction' +import { action as downloadAction } from './actions/downloadAction' +import { action as editLocallyAction } from './actions/editLocallyAction' +import { action as favoriteAction } from './actions/favoriteAction' +import { action as openFolderAction } from './actions/openFolderAction' +import { action as openInFilesAction } from './actions/openInFilesAction' +import { action as renameAction } from './actions/renameAction' +import { action as sidebarAction } from './actions/sidebarAction' +import { action as viewInFolderAction } from './actions/viewInFolderAction' +import { entry as newFolderEntry } from './newMenu/newFolder' + +import registerFavoritesView from './views/favorites' +import registerRecentView from './views/recent' +import registerFilesView from './views/files' +import registerPreviewServiceWorker from './services/ServiceWorker.js' +import { addNewFileMenuEntry, registerFileAction } from '@nextcloud/files' + +// Register file actions +registerFileAction(deleteAction) +registerFileAction(downloadAction) +registerFileAction(editLocallyAction) +registerFileAction(favoriteAction) +registerFileAction(openFolderAction) +registerFileAction(openInFilesAction) +registerFileAction(renameAction) +registerFileAction(sidebarAction) +registerFileAction(viewInFolderAction) + +// Register new menu entry +addNewFileMenuEntry(newFolderEntry) + +// Register files views +registerFavoritesView() +registerFilesView() +registerRecentView() + +// Register preview service worker +registerPreviewServiceWorker() diff --git a/apps/files/src/main.ts b/apps/files/src/main.ts index 8bcfacf953a..38bec4ad087 100644 --- a/apps/files/src/main.ts +++ b/apps/files/src/main.ts @@ -1,17 +1,6 @@ import './templates.js' import './legacy/filelistSearch.js' -import './actions/deleteAction' -import './actions/downloadAction' -import './actions/editLocallyAction' -import './actions/favoriteAction' -import './actions/openFolderAction' -import './actions/openInFilesAction.js' -import './actions/renameAction' -import './actions/sidebarAction' -import './actions/viewInFolderAction' -import './newMenu/newFolder' - import Vue from 'vue' import { createPinia, PiniaVuePlugin } from 'pinia' import { getNavigation } from '@nextcloud/files' @@ -19,10 +8,6 @@ import { getRequestToken } from '@nextcloud/auth' import FilesListView from './views/FilesList.vue' import NavigationView from './views/Navigation.vue' -import registerFavoritesView from './views/favorites' -import registerRecentView from './views/recent' -import registerFilesView from './views/files' -import registerPreviewServiceWorker from './services/ServiceWorker.js' import router from './router/router' import RouterService from './services/RouterService' import SettingsModel from './models/Setting.js' @@ -80,11 +65,3 @@ const FilesList = new ListView({ pinia, }) FilesList.$mount('#app-content-vue') - -// Init legacy and new files views -registerFavoritesView() -registerFilesView() -registerRecentView() - -// Register preview service worker -registerPreviewServiceWorker() diff --git a/apps/files/src/newMenu/newFolder.ts b/apps/files/src/newMenu/newFolder.ts index 1bf178de183..33fd113b7c3 100644 --- a/apps/files/src/newMenu/newFolder.ts +++ b/apps/files/src/newMenu/newFolder.ts @@ -62,7 +62,7 @@ export const getUniqueName = (name: string, names: string[]): string => { return newName } -const entry = { +export const entry = { id: 'newFolder', displayName: t('files', 'New folder'), if: (context: Folder) => (context.permissions & Permission.CREATE) !== 0, @@ -92,5 +92,3 @@ const entry = { emit('files:node:rename', folder) }, } as Entry - -addNewFileMenuEntry(entry) diff --git a/apps/files/src/services/DavProperties.ts b/apps/files/src/services/DavProperties.ts deleted file mode 100644 index 79a80706925..00000000000 --- a/apps/files/src/services/DavProperties.ts +++ /dev/null @@ -1,130 +0,0 @@ -/** - * @copyright Copyright (c) 2023 John Molakvoæ - * - * @author John Molakvoæ - * - * @license AGPL-3.0-or-later - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - */ - -import logger from '../logger' - -type DavProperty = { [key: string]: string } - -declare global { - interface Window { - OC: any; - _nc_dav_properties: string[]; - _nc_dav_namespaces: DavProperty; - } -} - -const defaultDavProperties = [ - 'd:getcontentlength', - 'd:getcontenttype', - 'd:getetag', - 'd:getlastmodified', - 'd:quota-available-bytes', - 'd:resourcetype', - 'nc:has-preview', - 'nc:is-encrypted', - 'nc:mount-type', - 'nc:share-attributes', - 'oc:comments-unread', - 'oc:favorite', - 'oc:fileid', - 'oc:owner-display-name', - 'oc:owner-id', - 'oc:permissions', - 'oc:share-types', - 'oc:size', - 'ocs:share-permissions', -] - -const defaultDavNamespaces = { - d: 'DAV:', - nc: 'http://nextcloud.org/ns', - oc: 'http://owncloud.org/ns', - ocs: 'http://open-collaboration-services.org/ns', -} - -/** - * TODO: remove and move to @nextcloud/files - * @param prop - * @param namespace - */ -export const registerDavProperty = function(prop: string, namespace: DavProperty = { nc: 'http://nextcloud.org/ns' }): void { - if (typeof window._nc_dav_properties === 'undefined') { - window._nc_dav_properties = defaultDavProperties - window._nc_dav_namespaces = defaultDavNamespaces - } - - const namespaces = { ...window._nc_dav_namespaces, ...namespace } - - // Check duplicates - if (window._nc_dav_properties.find(search => search === prop)) { - logger.error(`${prop} already registered`, { prop }) - return - } - - if (prop.startsWith('<') || prop.split(':').length !== 2) { - logger.error(`${prop} is not valid. See example: 'oc:fileid'`, { prop }) - return - } - - const ns = prop.split(':')[0] - if (!namespaces[ns]) { - logger.error(`${prop} namespace unknown`, { prop, namespaces }) - return - } - - window._nc_dav_properties.push(prop) - window._nc_dav_namespaces = namespaces -} - -/** - * Get the registered dav properties - */ -export const getDavProperties = function(): string { - if (typeof window._nc_dav_properties === 'undefined') { - window._nc_dav_properties = defaultDavProperties - } - - return window._nc_dav_properties.map(prop => `<${prop} />`).join(' ') -} - -/** - * Get the registered dav namespaces - */ -export const getDavNameSpaces = function(): string { - if (typeof window._nc_dav_namespaces === 'undefined') { - window._nc_dav_namespaces = defaultDavNamespaces - } - - return Object.keys(window._nc_dav_namespaces).map(ns => `xmlns:${ns}="${window._nc_dav_namespaces[ns]}"`).join(' ') -} - -/** - * Get the default PROPFIND request payload - */ -export const getDefaultPropfind = function() { - return ` - - - ${getDavProperties()} - - ` -} diff --git a/apps/files/src/services/Favorites.ts b/apps/files/src/services/Favorites.ts index 633ba718560..800feb2c80a 100644 --- a/apps/files/src/services/Favorites.ts +++ b/apps/files/src/services/Favorites.ts @@ -20,14 +20,11 @@ * */ import type { ContentsWithRoot } from '@nextcloud/files' -import type { FileStat, ResponseDataDetailed, DAVResultResponseProps } from 'webdav' +import type { FileStat, ResponseDataDetailed } from 'webdav' -import { File, Folder, davParsePermissions } from '@nextcloud/files' -import { generateRemoteUrl } from '@nextcloud/router' -import { getCurrentUser } from '@nextcloud/auth' +import { Folder, getDavNameSpaces, getDavProperties, davGetDefaultPropfind } from '@nextcloud/files' -import { getClient, rootPath } from './WebdavClient' -import { getDavNameSpaces, getDavProperties, getDefaultPropfind } from './DavProperties' +import { getClient } from './WebdavClient' import { resultToNode } from './Files' const client = getClient() @@ -42,21 +39,15 @@ const reportPayload = ` ` -interface ResponseProps extends DAVResultResponseProps { - permissions: string, - fileid: number, - size: number, -} - export const getContents = async (path = '/'): Promise => { - const propfindPayload = getDefaultPropfind() + const propfindPayload = davGetDefaultPropfind() // Get root folder let rootResponse if (path === '/') { rootResponse = await client.stat(path, { details: true, - data: getDefaultPropfind(), + data: propfindPayload, }) as ResponseDataDetailed } diff --git a/apps/files/src/services/Files.ts b/apps/files/src/services/Files.ts index fba65ac44ae..c09be2d72ac 100644 --- a/apps/files/src/services/Files.ts +++ b/apps/files/src/services/Files.ts @@ -22,13 +22,12 @@ import type { ContentsWithRoot } from '@nextcloud/files' import type { FileStat, ResponseDataDetailed, DAVResultResponseProps } from 'webdav' -import { cancelable, CancelablePromise } from 'cancelable-promise' -import { File, Folder, davParsePermissions } from '@nextcloud/files' +import { CancelablePromise } from 'cancelable-promise' +import { File, Folder, davParsePermissions, davGetDefaultPropfind } from '@nextcloud/files' import { generateRemoteUrl } from '@nextcloud/router' import { getCurrentUser } from '@nextcloud/auth' import { getClient, rootPath } from './WebdavClient' -import { getDefaultPropfind } from './DavProperties' import { hashCode } from '../utils/hashUtils' import logger from '../logger' @@ -76,7 +75,7 @@ export const resultToNode = function(node: FileStat): File | Folder { export const getContents = (path = '/'): Promise => { const controller = new AbortController() - const propfindPayload = getDefaultPropfind() + const propfindPayload = davGetDefaultPropfind() return new CancelablePromise(async (resolve, reject, onCancel) => { onCancel(() => controller.abort()) diff --git a/apps/files/src/services/Recent.ts b/apps/files/src/services/Recent.ts index 7a585d28fc5..ecd43b90ecc 100644 --- a/apps/files/src/services/Recent.ts +++ b/apps/files/src/services/Recent.ts @@ -22,12 +22,11 @@ import type { ContentsWithRoot } from '@nextcloud/files' import type { FileStat, ResponseDataDetailed, DAVResultResponseProps } from 'webdav' -import { File, Folder, Permission, davParsePermissions } from '@nextcloud/files' +import { Folder, Permission, getDavNameSpaces, getDavProperties } from '@nextcloud/files' import { generateRemoteUrl } from '@nextcloud/router' import { getCurrentUser } from '@nextcloud/auth' import { getClient, rootPath } from './WebdavClient' -import { getDavNameSpaces, getDavProperties } from './DavProperties' import { resultToNode } from './Files' const client = getClient(generateRemoteUrl('dav')) diff --git a/apps/files_external/lib/Listener/LoadAdditionalListener.php b/apps/files_external/lib/Listener/LoadAdditionalListener.php index e5cb5e96d0a..5f56a14c4ce 100644 --- a/apps/files_external/lib/Listener/LoadAdditionalListener.php +++ b/apps/files_external/lib/Listener/LoadAdditionalListener.php @@ -50,6 +50,8 @@ class LoadAdditionalListener implements IEventListener { $allowUserMounting = $this->config->getAppValue('files_external', 'allow_user_mounting', 'no') === 'yes'; $this->initialState->provideInitialState('allowUserMounting', $allowUserMounting); + + Util::addInitScript(Application::APP_ID, 'init'); Util::addScript(Application::APP_ID, 'main', 'files'); } } diff --git a/apps/files_external/src/actions/enterCredentialsAction.ts b/apps/files_external/src/actions/enterCredentialsAction.ts index 49b0ab4076e..eeb2f5f8793 100644 --- a/apps/files_external/src/actions/enterCredentialsAction.ts +++ b/apps/files_external/src/actions/enterCredentialsAction.ts @@ -31,7 +31,7 @@ import axios from '@nextcloud/axios' import LoginSvg from '@mdi/svg/svg/login.svg?raw' import Vue from 'vue' -import { registerFileAction, FileAction, DefaultType } from '@nextcloud/files' +import { FileAction, DefaultType } from '@nextcloud/files' import { STORAGE_STATUS, isMissingAuthConfig } from '../utils/credentialsUtils' import { isNodeExternalStorage } from '../utils/externalStorageUtils' @@ -106,5 +106,3 @@ export const action = new FileAction({ default: DefaultType.DEFAULT, inline: () => true, }) - -registerFileAction(action) diff --git a/apps/files_external/src/actions/inlineStorageCheckAction.ts b/apps/files_external/src/actions/inlineStorageCheckAction.ts index fa2f567b1f7..46e38eab47e 100644 --- a/apps/files_external/src/actions/inlineStorageCheckAction.ts +++ b/apps/files_external/src/actions/inlineStorageCheckAction.ts @@ -32,7 +32,7 @@ import '../css/fileEntryStatus.scss' import { getStatus, type StorageConfig } from '../services/externalStorage' import { isMissingAuthConfig, STORAGE_STATUS } from '../utils/credentialsUtils' import { isNodeExternalStorage } from '../utils/externalStorageUtils' -import { registerFileAction, FileAction } from '@nextcloud/files' +import { FileAction } from '@nextcloud/files' export const action = new FileAction({ id: 'check-external-storage', @@ -92,5 +92,3 @@ export const action = new FileAction({ order: 10, }) - -registerFileAction(action) diff --git a/apps/files_external/src/actions/openInFilesAction.ts b/apps/files_external/src/actions/openInFilesAction.ts index 0359e81998d..8033caed123 100644 --- a/apps/files_external/src/actions/openInFilesAction.ts +++ b/apps/files_external/src/actions/openInFilesAction.ts @@ -25,7 +25,7 @@ import type { StorageConfig } from '../services/externalStorage' import { generateUrl } from '@nextcloud/router' import { translate as t } from '@nextcloud/l10n' -import { registerFileAction, FileAction, DefaultType } from '@nextcloud/files' +import { FileAction, DefaultType } from '@nextcloud/files' import { STORAGE_STATUS } from '../utils/credentialsUtils' export const action = new FileAction({ @@ -71,5 +71,3 @@ export const action = new FileAction({ order: -1000, default: DefaultType.HIDDEN, }) - -registerFileAction(action) diff --git a/apps/files_external/src/main.ts b/apps/files_external/src/init.ts similarity index 82% rename from apps/files_external/src/main.ts rename to apps/files_external/src/init.ts index c85dd371f51..ccce2448dfe 100644 --- a/apps/files_external/src/main.ts +++ b/apps/files_external/src/init.ts @@ -19,18 +19,19 @@ * along with this program. If not, see . * */ -import { translate as t } from '@nextcloud/l10n' import { loadState } from '@nextcloud/initial-state' +import { translate as t } from '@nextcloud/l10n' +import { View, getNavigation, Column, registerFileAction } from '@nextcloud/files' import FolderNetworkSvg from '@mdi/svg/svg/folder-network.svg?raw' -import './actions/enterCredentialsAction' -import './actions/inlineStorageCheckAction' -import './actions/openInFilesAction' +import { action as enterCredentialsAction } from './actions/enterCredentialsAction' +import { action as inlineStorageCheckAction } from './actions/inlineStorageCheckAction' +import { action as openInFilesAction } from './actions/openInFilesAction' import { getContents } from './services/externalStorage' -import { View, getNavigation, Column } from '@nextcloud/files' const allowUserMounting = loadState('files_external', 'allowUserMounting', false) +// Register view const Navigation = getNavigation() Navigation.register(new View({ id: 'extstoragemounts', @@ -73,3 +74,8 @@ Navigation.register(new View({ getContents, })) + +// Register actions +registerFileAction(enterCredentialsAction) +registerFileAction(inlineStorageCheckAction) +registerFileAction(openInFilesAction) diff --git a/apps/files_trashbin/src/services/trashbin.ts b/apps/files_trashbin/src/services/trashbin.ts index 5e7a31b2448..9aef75ef6d5 100644 --- a/apps/files_trashbin/src/services/trashbin.ts +++ b/apps/files_trashbin/src/services/trashbin.ts @@ -19,12 +19,12 @@ * along with this program. If not, see . * */ -import { File, Folder, davParsePermissions, type ContentsWithRoot } from '@nextcloud/files' -import { generateRemoteUrl, generateUrl } from '@nextcloud/router' -import { getCurrentUser } from '@nextcloud/auth' import type { FileStat, ResponseDataDetailed } from 'webdav' +import type { ContentsWithRoot } from '@nextcloud/files' -import { getDavNameSpaces, getDavProperties } from '../../../files/src/services/DavProperties' +import { File, Folder, davParsePermissions, getDavNameSpaces, getDavProperties } from '@nextcloud/files' +import { generateRemoteUrl, generateUrl } from '@nextcloud/router' +import { getCurrentUser } from '@nextcloud/auth' import client, { rootPath } from './client' diff --git a/apps/systemtags/src/init.ts b/apps/systemtags/src/init.ts index 3dbb606dc87..aa8312c9875 100644 --- a/apps/systemtags/src/init.ts +++ b/apps/systemtags/src/init.ts @@ -23,7 +23,7 @@ import './actions/inlineSystemTagsAction.js' import { translate as t } from '@nextcloud/l10n' -import { Column, Node, View, getNavigation } from '@nextcloud/files' +import { View, getNavigation } from '@nextcloud/files' import TagMultipleSvg from '@mdi/svg/svg/tag-multiple.svg?raw' import { getContents } from './services/systemtags.js' diff --git a/webpack.modules.js b/webpack.modules.js index 8c13c2f3b9d..67be70c5fed 100644 --- a/webpack.modules.js +++ b/webpack.modules.js @@ -26,6 +26,7 @@ module.exports = { comments: path.join(__dirname, 'apps/comments/src', 'comments.js'), 'comments-app': path.join(__dirname, 'apps/comments/src', 'comments-app.js'), 'comments-tab': path.join(__dirname, 'apps/comments/src', 'comments-tab.js'), + init: path.join(__dirname, 'apps/comments/src', 'init.ts'), }, core: { files_client: path.join(__dirname, 'core/src', 'files/client.js'), @@ -51,11 +52,12 @@ module.exports = { files: { sidebar: path.join(__dirname, 'apps/files/src', 'sidebar.js'), main: path.join(__dirname, 'apps/files/src', 'main.ts'), + init: path.join(__dirname, 'apps/files/src', 'init.ts'), 'personal-settings': path.join(__dirname, 'apps/files/src', 'main-personal-settings.js'), 'reference-files': path.join(__dirname, 'apps/files/src', 'reference-files.js'), }, files_external: { - main: path.join(__dirname, 'apps/files_external/src', 'main.ts'), + init: path.join(__dirname, 'apps/files_external/src', 'init.ts'), }, files_reminders: { main: path.join(__dirname, 'apps/files_reminders/src', 'main.ts'),