mirror of
https://github.com/nextcloud/server.git
synced 2026-10-22 10:16:56 +02:00
Dropping the bundled app takes the OCA.Viewer global and the LoadViewer event with it, and apps in the wild still use both: text and recommendations ask the global what it can open, photos opens and closes it, files_pdfviewer re-opens the current file with another handler, and photos, maps and collectives construct the event without checking that it exists, so their pages would fail on the missing class. The global goes back on the page, backed by the package rather than by the app. open() takes the paths and the loose file info apps passed before and turns them into nodes, the getters answer from what the last open() was given, and mimetypes answers by asking the handlers about a file of that type. registerHandler is deliberately not here: it was deprecated in the viewer app in August 2025 and this is where it stops. The event stays as an empty class nobody dispatches. Both live in apps/viewer, which is not an app: it has no appinfo, the server autoloads the event from it and the core viewer init script imports the bridge. The checkers that take every folder in apps/ for an app are told so: .noopenapi, the untranslated list, and a skip in the autoloader checker and in tests/enable_all.php for folders without an appinfo/info.xml. psalm lints it like the others. Every use of the global logs a warning naming the replacement and Nextcloud 39, where the folder and those exceptions go. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
48 lines
1.2 KiB
TypeScript
48 lines
1.2 KiB
TypeScript
/**
|
|
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
import type Tab from './apps/files/src/models/Tab.js'
|
|
import type RouterService from './apps/files/src/services/RouterService.ts'
|
|
import type Settings from './apps/files/src/services/Settings.js'
|
|
import type Sidebar from './apps/files/src/services/Sidebar.js'
|
|
import type { LegacyViewerApi } from './apps/viewer/src/legacy.ts'
|
|
|
|
type SidebarAPI = Sidebar & {
|
|
open: (path: string) => Promise<void>
|
|
close: () => void
|
|
setFullScreenMode: (fullScreen: boolean) => void
|
|
setShowTagsDefault: (showTagsDefault: boolean) => void
|
|
Tab: typeof Tab
|
|
}
|
|
|
|
declare global {
|
|
interface Window {
|
|
OC: Nextcloud.v29.OC
|
|
|
|
// Private Files namespace
|
|
OCA: {
|
|
Files: {
|
|
Settings: Settings
|
|
Sidebar: SidebarAPI
|
|
}
|
|
/**
|
|
* @deprecated since 36, removed in 39.
|
|
* Use the `@nextcloud/viewer` package instead.
|
|
*/
|
|
Viewer?: LegacyViewerApi
|
|
} & Record<string, any> // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
|
|
// Public Files namespace
|
|
OCP: {
|
|
Files: {
|
|
Router: RouterService
|
|
}
|
|
} & Nextcloud.v29.OCP
|
|
|
|
// Private global files pinia store
|
|
_nc_files_pinia: Pinia
|
|
}
|
|
}
|