From 485f42e3d77c678f3ab41c2d901f4a370b4485a5 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 6 May 2022 13:05:01 -0600 Subject: [PATCH 1/3] Move widget screenshots to devtools dialog instead of labs --- src/components/views/dialogs/DevtoolsDialog.tsx | 1 + .../views/settings/tabs/user/LabsUserSettingsTab.tsx | 8 -------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/components/views/dialogs/DevtoolsDialog.tsx b/src/components/views/dialogs/DevtoolsDialog.tsx index 14fb69b156..fb2f7113dd 100644 --- a/src/components/views/dialogs/DevtoolsDialog.tsx +++ b/src/components/views/dialogs/DevtoolsDialog.tsx @@ -101,6 +101,7 @@ const DevtoolsDialog: React.FC = ({ roomId, onFinished }) => {

{ _t("Options") }

+ ; } diff --git a/src/components/views/settings/tabs/user/LabsUserSettingsTab.tsx b/src/components/views/settings/tabs/user/LabsUserSettingsTab.tsx index 9e0b31b2ad..14b27b0515 100644 --- a/src/components/views/settings/tabs/user/LabsUserSettingsTab.tsx +++ b/src/components/views/settings/tabs/user/LabsUserSettingsTab.tsx @@ -92,14 +92,6 @@ export default class LabsUserSettingsTab extends React.Component<{}, IState> { ); }); - groups.getOrCreate(LabGroup.Widgets, []).push( - , - ); - groups.getOrCreate(LabGroup.Experimental, []).push( Date: Fri, 6 May 2022 13:09:53 -0600 Subject: [PATCH 2/3] Remove dead function in WidgetUtils relating to screenshots/capabilities We always approve the capability these days --- src/utils/WidgetUtils.ts | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/utils/WidgetUtils.ts b/src/utils/WidgetUtils.ts index 8537e03583..cd22562b81 100644 --- a/src/utils/WidgetUtils.ts +++ b/src/utils/WidgetUtils.ts @@ -17,7 +17,7 @@ limitations under the License. import * as url from "url"; import { base32 } from "rfc4648"; -import { Capability, IWidget, IWidgetData, MatrixCapabilities } from "matrix-widget-api"; +import { IWidget, IWidgetData } from "matrix-widget-api"; import { Room } from "matrix-js-sdk/src/models/room"; import { MatrixEvent } from "matrix-js-sdk/src/models/event"; import { logger } from "matrix-js-sdk/src/logger"; @@ -496,21 +496,6 @@ export default class WidgetUtils { return app as IApp; } - static getCapWhitelistForAppTypeInRoomId(appType: string, roomId: string): Capability[] { - const enableScreenshots = SettingsStore.getValue("enableWidgetScreenshots", roomId); - - const capWhitelist = enableScreenshots ? [MatrixCapabilities.Screenshots] : []; - - // Obviously anyone that can add a widget can claim it's a jitsi widget, - // so this doesn't really offer much over the set of domains we load - // widgets from at all, but it probably makes sense for sanity. - if (WidgetType.JITSI.matches(appType)) { - capWhitelist.push(MatrixCapabilities.AlwaysOnScreen); - } - - return capWhitelist; - } - static getLocalJitsiWrapperUrl(opts: {forLocalRender?: boolean, auth?: string} = {}) { // NB. we can't just encodeURIComponent all of these because the $ signs need to be there const queryStringParts = [ From b2bf5aacc0c37136ffe19a1a8906377fddddded5 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 6 May 2022 13:13:00 -0600 Subject: [PATCH 3/3] Add a settings store check to make the menu code easy to find again ... and because we probably should check this... --- src/components/views/context_menus/WidgetContextMenu.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/views/context_menus/WidgetContextMenu.tsx b/src/components/views/context_menus/WidgetContextMenu.tsx index 1aeeccc724..b6a46bd2ac 100644 --- a/src/components/views/context_menus/WidgetContextMenu.tsx +++ b/src/components/views/context_menus/WidgetContextMenu.tsx @@ -110,7 +110,8 @@ const WidgetContextMenu: React.FC = ({ } let snapshotButton; - if (widgetMessaging?.hasCapability(MatrixCapabilities.Screenshots)) { + const screenshotsEnabled = SettingsStore.getValue("enableWidgetScreenshots"); + if (screenshotsEnabled && widgetMessaging?.hasCapability(MatrixCapabilities.Screenshots)) { const onSnapshotClick = () => { widgetMessaging?.takeScreenshot().then(data => { dis.dispatch({