diff --git a/.eslintrc.js b/.eslintrc.js index 1f4e61e0..2a2aa5ac 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -52,8 +52,10 @@ module.exports = { // It works fine on server because by default in @nextcloud/eslint-config .vue files are not inspected via eslint-plugin-import thus import/extensions doesn't include .vue // See: https://github.com/import-js/eslint-plugin-import/blob/main/README.md#importextensions 'import/default': 'off', - // import/namespace is not compatible with TS/JS mix + // Not compatible with TS/JS mix 'import/namespace': 'off', + // Not compatible with TS/JS mix or reexports + 'import/named': 'off', /** * ESLint */ @@ -135,7 +137,7 @@ module.exports = { overrides: [ { - files: '*.ts', + files: ['*.ts', '*.vue'], rules: { 'jsdoc/require-returns-type': 'off', // TODO upstream }, diff --git a/src/global.d.ts b/src/global.d.ts index 8517492c..8251ebd8 100644 --- a/src/global.d.ts +++ b/src/global.d.ts @@ -16,6 +16,11 @@ declare module '*.svg' { export default url } +declare module '*.svg?raw' { + const url: string + export default url +} + declare module 'vue-material-design-icons/*.vue' { import type { Component } from 'vue' const component: Component, Record, Record, { size: number }, Record> diff --git a/src/main.js b/src/main.js index ccf9e667..52725ca7 100644 --- a/src/main.js +++ b/src/main.js @@ -13,7 +13,7 @@ const { createAuthenticationWindow } = require('./authentication/authentication. const { openLoginWebView } = require('./authentication/login.window.js') const { createHelpWindow } = require('./help/help.window.js') const { createUpgradeWindow } = require('./upgrade/upgrade.window.js') -const { systemInfo, isLinux, isMac, isWayland, isWindows } = require('./app/system.utils.ts') +const { systemInfo, isLinux, isMac, isWindows } = require('./app/system.utils.ts') const { createTalkWindow } = require('./talk/talk.window.js') const { createWelcomeWindow } = require('./welcome/welcome.window.js') const { installVueDevtools } = require('./install-vue-devtools.js') @@ -94,8 +94,7 @@ ipcMain.handle('app:getDesktopCapturerSources', async () => { return null } - // We cannot show live previews on Wayland, so we show thumbnails - const thumbnailWidth = isWayland ? 320 : 0 + const thumbnailWidth = 800 const sources = await desktopCapturer.getSources({ types: ['screen', 'window'], diff --git a/src/shared/globals/globals.js b/src/shared/globals/globals.js index cd62d9b1..48d4f12a 100644 --- a/src/shared/globals/globals.js +++ b/src/shared/globals/globals.js @@ -9,7 +9,7 @@ import { translate, translatePlural } from '@nextcloud/l10n' import { appData } from '../../app/AppData.js' import { dialogs } from './OC/dialogs.js' import { MimeTypeList } from './OC/mimetype.js' -import { getDesktopMediaSource } from '../../talk/renderer/getDesktopMediaSource.js' +import { getDesktopMediaSource } from '../../talk/renderer/screensharing/screensharing.module.ts' let enabledAbsoluteWebroot = false diff --git a/src/talk/renderer/components/DesktopMediaSourceDialog.vue b/src/talk/renderer/components/DesktopMediaSourceDialog.vue deleted file mode 100644 index 64a46653..00000000 --- a/src/talk/renderer/components/DesktopMediaSourceDialog.vue +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - diff --git a/src/talk/renderer/components/DesktopMediaSourcePreview.vue b/src/talk/renderer/components/DesktopMediaSourcePreview.vue deleted file mode 100644 index 24583760..00000000 --- a/src/talk/renderer/components/DesktopMediaSourcePreview.vue +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - - diff --git a/src/talk/renderer/AppGetDesktopMediaSource.vue b/src/talk/renderer/screensharing/AppGetDesktopMediaSource.vue similarity index 60% rename from src/talk/renderer/AppGetDesktopMediaSource.vue rename to src/talk/renderer/screensharing/AppGetDesktopMediaSource.vue index ce408048..51f8057f 100644 --- a/src/talk/renderer/AppGetDesktopMediaSource.vue +++ b/src/talk/renderer/screensharing/AppGetDesktopMediaSource.vue @@ -3,25 +3,24 @@ - SPDX-License-Identifier: AGPL-3.0-or-later --> - + + + + diff --git a/src/talk/renderer/screensharing/DesktopMediaSourcePreview.vue b/src/talk/renderer/screensharing/DesktopMediaSourcePreview.vue new file mode 100644 index 00000000..3c9a55e0 --- /dev/null +++ b/src/talk/renderer/screensharing/DesktopMediaSourcePreview.vue @@ -0,0 +1,126 @@ + + + + + + + diff --git a/src/talk/renderer/screensharing/DesktopMediaSourcePreviewLive.vue b/src/talk/renderer/screensharing/DesktopMediaSourcePreviewLive.vue new file mode 100644 index 00000000..77375a06 --- /dev/null +++ b/src/talk/renderer/screensharing/DesktopMediaSourcePreviewLive.vue @@ -0,0 +1,150 @@ + + + + + + + diff --git a/src/talk/renderer/getDesktopMediaSource.js b/src/talk/renderer/screensharing/getDesktopMediaSource.ts similarity index 72% rename from src/talk/renderer/getDesktopMediaSource.js rename to src/talk/renderer/screensharing/getDesktopMediaSource.ts index 04e8d6e9..8a31d9c9 100644 --- a/src/talk/renderer/getDesktopMediaSource.js +++ b/src/talk/renderer/screensharing/getDesktopMediaSource.ts @@ -7,18 +7,16 @@ import Vue from 'vue' import AppGetDesktopMediaSource from './AppGetDesktopMediaSource.vue' -/** @type {import('vue').ComponentPublicInstance} */ -let appGetDesktopMediaSourceInstance +let appGetDesktopMediaSourceInstance: InstanceType | null = null /** * Prompt user to select a desktop media source to share and return the selected sourceId or an empty string if canceled - * - * @return {Promise<{ sourceId: string }>} sourceId of the selected mediaSource or an empty string if canceled + * @return sourceId of the selected mediaSource or an empty string if canceled */ export async function getDesktopMediaSource() { if (!appGetDesktopMediaSourceInstance) { const container = document.body.appendChild(document.createElement('div')) - appGetDesktopMediaSourceInstance = new Vue(AppGetDesktopMediaSource).$mount(container) + appGetDesktopMediaSourceInstance = new Vue(AppGetDesktopMediaSource).$mount(container) as InstanceType } return appGetDesktopMediaSourceInstance.promptDesktopMediaSource() diff --git a/src/talk/renderer/screensharing/screensharing.module.ts b/src/talk/renderer/screensharing/screensharing.module.ts new file mode 100644 index 00000000..0f59fbdd --- /dev/null +++ b/src/talk/renderer/screensharing/screensharing.module.ts @@ -0,0 +1,6 @@ +/** + * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +export { getDesktopMediaSource } from './getDesktopMediaSource.ts' diff --git a/src/talk/renderer/screensharing/screensharing.types.ts b/src/talk/renderer/screensharing/screensharing.types.ts new file mode 100644 index 00000000..2a6ba49b --- /dev/null +++ b/src/talk/renderer/screensharing/screensharing.types.ts @@ -0,0 +1,19 @@ +/** + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +export type ScreensharingSourceId = `entire-desktop:${number}:${number}` | `screen:${number}:${number}` | `window:${number}:${number}` + +export type ScreensharingSource = { + id: ScreensharingSourceId + name: string + /** + * data:image/png;base64 encoded icon of the source + */ + icon: string | null + /** + * data:image/png;base64 encoded thumbnail of the source + */ + thumbnail: string | null +}