Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat(whiteboard): enable image sharing on the inline web whiteboard (#17536)

Avram Tudor1166a15b7800
diff --git a/package-lock.json b/package-lock.json
index 909a123b2c..3e1b9062eb 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -18,7 +18,7 @@
"@giphy/js-fetch-api": "4.9.3",
"@giphy/react-components": "6.9.4",
"@giphy/react-native-sdk": "5.0.1",
- "@jitsi/excalidraw": "https://github.com/jitsi/excalidraw/releases/download/0.18.6/jitsi-excalidraw-0.18.6.tgz",
+ "@jitsi/excalidraw": "https://github.com/jitsi/excalidraw/releases/download/0.18.7/jitsi-excalidraw-v0.18.7.tgz",
"@jitsi/js-utils": "6.3.2",
"@jitsi/logger": "2.1.1",
"@jitsi/rnnoise-wasm": "0.2.1",
@@ -4203,9 +4203,9 @@
}
},
"node_modules/@jitsi/excalidraw": {
- "version": "0.18.6",
- "resolved": "https://github.com/jitsi/excalidraw/releases/download/0.18.6/jitsi-excalidraw-0.18.6.tgz",
- "integrity": "sha512-nM7N5iEsh+eu/LKccO8FKPo/TvWZuoSoXiD+rVgAoA3aPhYIIoDLgBC1fNzkdfEJs6oFjhIMe85H5PRffXUvSw==",
+ "version": "0.18.7",
+ "resolved": "https://github.com/jitsi/excalidraw/releases/download/0.18.7/jitsi-excalidraw-v0.18.7.tgz",
+ "integrity": "sha512-dUnLDroHWzzR0C5x49njgR6YRx+drTPzzzGutg9wqrKRnnmKX5BXO+vWhRgna8Jr/O/CgPItOVIpm5f9oDOj3w==",
"license": "MIT",
"dependencies": {
"@braintree/sanitize-url": "6.0.2",
@@ -30070,8 +30070,8 @@
}
},
"@jitsi/excalidraw": {
- "version": "https://github.com/jitsi/excalidraw/releases/download/0.18.6/jitsi-excalidraw-0.18.6.tgz",
- "integrity": "sha512-nM7N5iEsh+eu/LKccO8FKPo/TvWZuoSoXiD+rVgAoA3aPhYIIoDLgBC1fNzkdfEJs6oFjhIMe85H5PRffXUvSw==",
+ "version": "https://github.com/jitsi/excalidraw/releases/download/0.18.7/jitsi-excalidraw-v0.18.7.tgz",
+ "integrity": "sha512-dUnLDroHWzzR0C5x49njgR6YRx+drTPzzzGutg9wqrKRnnmKX5BXO+vWhRgna8Jr/O/CgPItOVIpm5f9oDOj3w==",
"requires": {
"@braintree/sanitize-url": "6.0.2",
"@excalidraw/laser-pointer": "1.3.1",
diff --git a/package.json b/package.json
index 17e2499871..4f1c361b5b 100644
--- a/package.json
+++ b/package.json
@@ -24,7 +24,7 @@
"@giphy/js-fetch-api": "4.9.3",
"@giphy/react-components": "6.9.4",
"@giphy/react-native-sdk": "5.0.1",
- "@jitsi/excalidraw": "https://github.com/jitsi/excalidraw/releases/download/0.18.6/jitsi-excalidraw-0.18.6.tgz",
+ "@jitsi/excalidraw": "https://github.com/jitsi/excalidraw/releases/download/0.18.7/jitsi-excalidraw-v0.18.7.tgz",
"@jitsi/js-utils": "6.3.2",
"@jitsi/logger": "2.1.1",
"@jitsi/rnnoise-wasm": "0.2.1",
diff --git a/react/features/whiteboard/components/web/Whiteboard.tsx b/react/features/whiteboard/components/web/Whiteboard.tsx
index b1423fa1b7..940038078d 100644
--- a/react/features/whiteboard/components/web/Whiteboard.tsx
+++ b/react/features/whiteboard/components/web/Whiteboard.tsx
@@ -13,7 +13,7 @@ import { getLocalParticipant } from '../../../base/participants/functions';
import { getVerticalViewMaxWidth } from '../../../filmstrip/functions.web';
import { getToolboxHeight } from '../../../toolbox/functions.web';
import { shouldDisplayTileView } from '../../../video-layout/functions.any';
-import { WHITEBOARD_UI_OPTIONS } from '../../constants';
+import { WHITEBOARD_UI_OPTIONS, WHITEBOARD_UI_OPTIONS_WITH_IMAGES } from '../../constants';
import {
getCollabDetails,
getCollabServerUrl,
@@ -46,6 +46,7 @@ interface IDimensions {
}
interface IMeetingDetails {
+ getStorageToken: () => Promise<string | undefined>;
jwt: string;
roomJid: string;
sessionId: string;
@@ -82,10 +83,24 @@ const Whiteboard = (props: WithTranslation): JSX.Element => {
const sessionId = conference?.getMeetingUniqueId();
const roomJid = conference?.room?.roomjid;
+ // Provides a fresh short-term credential for each whiteboard storage
+ // request, so that image binaries are uploaded/fetched with a token that is
+ // refreshed transparently as the previous one expires.
+ const getStorageToken = useCallback(async () => {
+ const conf = getCurrentConference(store.getState());
+
+ if (!conf) {
+ return undefined;
+ }
+
+ return conf.getShortTermCredentials(conf.getFileSharing()?.getIdentityType());
+ }, [ store ]);
+
const meetingDetails: IMeetingDetails = {
sessionId: sessionId ?? '',
roomJid: roomJid ?? '',
- jwt: jwt
+ jwt: jwt,
+ getStorageToken
};
useEffect(() => {
@@ -178,7 +193,7 @@ const Whiteboard = (props: WithTranslation): JSX.Element => {
isCollaborating: true,
langCode: i18next.language,
theme: 'light',
- UIOptions: WHITEBOARD_UI_OPTIONS
+ UIOptions: storageBackendUrl ? WHITEBOARD_UI_OPTIONS_WITH_IMAGES : WHITEBOARD_UI_OPTIONS
}}
getCollabAPI = { getCollabAPI }
getExcalidrawAPI = { getExcalidrawAPI }
diff --git a/react/features/whiteboard/constants.ts b/react/features/whiteboard/constants.ts
index a806ea1654..a8fd7c4290 100644
--- a/react/features/whiteboard/constants.ts
+++ b/react/features/whiteboard/constants.ts
@@ -56,6 +56,23 @@ export const WHITEBOARD_UI_OPTIONS = {
}
};
+/**
+ * Whiteboard UI Options with image support enabled.
+ *
+ * Used only for the inline web whiteboard, where a storage backend and a token
+ * provider are available to persist and sync image binaries. The standalone
+ * whiteboard page (mobile/native) keeps {@link WHITEBOARD_UI_OPTIONS}, since it
+ * has no conference context to supply storage credentials.
+ */
+export const WHITEBOARD_UI_OPTIONS_WITH_IMAGES = {
+ ...WHITEBOARD_UI_OPTIONS,
+ canvasActions: {
+ ...WHITEBOARD_UI_OPTIONS.canvasActions,
+ allowedShapes: [ ...WHITEBOARD_UI_OPTIONS.canvasActions.allowedShapes, 'image' ],
+ disableFileDrop: false
+ }
+};
+
/**
* Whiteboard default lower limit.
*/