added camera permissions and patch file
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
diff --git a/src/app/src/features/Plugins/components/PluginPanel.tsx b/src/app/src/features/Plugins/components/PluginPanel.tsx
|
||||
index 36ba576fe..109479304 100644
|
||||
--- a/src/app/src/features/Plugins/components/PluginPanel.tsx
|
||||
+++ b/src/app/src/features/Plugins/components/PluginPanel.tsx
|
||||
@@ -21,6 +21,9 @@ type PluginPanelProps = {
|
||||
// bridge instead and have no iframe-level equivalent.
|
||||
const IFRAME_ALLOW_MAP: Partial<Record<string, string>> = {
|
||||
"local-fonts": "local-fonts",
|
||||
+ // Camera / mic for getUserMedia in plugin iframes
|
||||
+ camera: "camera",
|
||||
+ microphone: "microphone",
|
||||
};
|
||||
|
||||
const buildIframeAllow = (permissions: PluginRecord["permissions"]): string =>
|
||||
diff --git a/src/app/src/features/Plugins/types.ts b/src/app/src/features/Plugins/types.ts
|
||||
index eecb2e44c..cd77d2681 100644
|
||||
--- a/src/app/src/features/Plugins/types.ts
|
||||
+++ b/src/app/src/features/Plugins/types.ts
|
||||
@@ -52,7 +52,9 @@ export type PluginPermissionsType =
|
||||
| "visualizer:load"
|
||||
| "workspace:read"
|
||||
| "redux:read"
|
||||
- | "local-fonts";
|
||||
+ | "local-fonts"
|
||||
+ | "camera"
|
||||
+ | "microphone";
|
||||
|
||||
export type PluginTopicsType = "workspace" | "redux"
|
||||
|
||||
diff --git a/src/main.js b/src/main.js
|
||||
index 19953f74a..1cf699f5b 100644
|
||||
--- a/src/main.js
|
||||
+++ b/src/main.js
|
||||
@@ -209,15 +209,17 @@ const main = () => {
|
||||
// grant is enough — per-plugin scoping happens at the iframe's
|
||||
// `allow="local-fonts"` attribute (see PluginPanel.tsx), which is only
|
||||
// set for plugins that declare "local-fonts" in their manifest.
|
||||
+ // Plugin iframes are same-origin with the app.
|
||||
+ // Allow local-fonts (existing) and media (camera/mic for plugins).
|
||||
+ const allowedPermissions = new Set(["local-fonts", "media"]);
|
||||
session.defaultSession.setPermissionCheckHandler(
|
||||
- (_webContents, permission) => permission === "local-fonts",
|
||||
+ (_webContents, permission) => allowedPermissions.has(permission),
|
||||
);
|
||||
session.defaultSession.setPermissionRequestHandler(
|
||||
(_webContents, permission, callback) => {
|
||||
- callback(permission === "local-fonts");
|
||||
+ callback(allowedPermissions.has(permission));
|
||||
},
|
||||
);
|
||||
-
|
||||
windowManager = new WindowManager();
|
||||
// Create and show splash before server starts
|
||||
const splashScreen = windowManager.createSplashScreen({
|
||||
@@ -14,6 +14,7 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"permissions": ["camera", "microphone"],
|
||||
"capabilities": {
|
||||
"requestTypes": [
|
||||
"gcode:load:to:visualizer",
|
||||
|
||||
Reference in New Issue
Block a user