Files
coco-app/src-tauri/tauri.conf.json
Copilot 65c0531492 feat: add Open Camera window for webcam preview, photo capture, and mirror toggle (#1064)
* feat: add Open Camera feature with live preview, photo capture, mirror toggle, and camera switching

Agent-Logs-Url: https://github.com/infinilabs/coco-app/sessions/e874b626-f179-4d54-bc6c-c239394459e3

Co-authored-by: medcl <64487+medcl@users.noreply.github.com>

* fix: address code review feedback - add error logging, remove invisible button, document eslint-disable

Agent-Logs-Url: https://github.com/infinilabs/coco-app/sessions/e874b626-f179-4d54-bc6c-c239394459e3

Co-authored-by: medcl <64487+medcl@users.noreply.github.com>

* refactor: convert camera from dedicated window to built-in extension with permission handling

- Create Open Camera built-in extension (search source in Rust)
- Add camera permission check/request via macOS permissions plugin
- Render camera inline in main Coco window (not a separate window)
- Add com.apple.security.device.camera entitlement
- Remove dedicated camera window, tray menu entry, and window commands
- Add cameraOpened state to search store for navigation support
- Handle Escape/Back navigation for camera view

Agent-Logs-Url: https://github.com/infinilabs/coco-app/sessions/bb996add-d287-464c-bc53-c69167630351

Co-authored-by: medcl <64487+medcl@users.noreply.github.com>

* fix: address code review feedback - fix permission check flow, remove duplicate cleanup, fix type

Agent-Logs-Url: https://github.com/infinilabs/coco-app/sessions/bb996add-d287-464c-bc53-c69167630351

Co-authored-by: medcl <64487+medcl@users.noreply.github.com>

* fix: camera not displaying video due to missing CSP media-src, secure context, and stream lifecycle issues

Three root causes fixed:
1. CSP missing media-src directive - Added media-src with blob: and mediastream:
   schemes to allow camera streams in the webview
2. Missing useHttpsScheme - Added to main window config to ensure secure context
   required by getUserMedia API on macOS WKWebView
3. Camera.tsx stream lifecycle - Rewrote initialization to use a single sequential
   flow (permission → getUserMedia → enumerate → assign) instead of three
   separate useEffects with circular dependency issues. Uses refs for stream
   tracking to prevent stale closure bugs in cleanup.

Agent-Logs-Url: https://github.com/infinilabs/coco-app/sessions/f3b86e6b-3ce2-423d-a5a1-c3a5f4e115f2

Co-authored-by: medcl <64487+medcl@users.noreply.github.com>

* fix: tighten CSP media-src directive and add permission polling timeout

- Remove overly permissive https:/http: from media-src (only need self/blob/mediastream)
- Remove unnecessary img-src override (falls back to default-src)
- Add 60-second timeout to camera permission polling to prevent infinite loops
- Check cancelled flag during polling to support component unmount

Agent-Logs-Url: https://github.com/infinilabs/coco-app/sessions/f3b86e6b-3ce2-423d-a5a1-c3a5f4e115f2

Co-authored-by: medcl <64487+medcl@users.noreply.github.com>

* feat: add Open Camera functionality with icon and translations

* fix: remove unused setCameraOpened from SearchResultsPanel

* feat: update platform adapters to include saveFileDialog method for Tauri and Web

* fix: streamline camera search source registration in built-in extension

* refactor: update extension icon

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: medcl <64487+medcl@users.noreply.github.com>
Co-authored-by: ayangweb <473033518@qq.com>
2026-05-13 09:16:32 +08:00

175 lines
4.5 KiB
JSON

{
"$schema": "https://schema.tauri.app/config/2.0.0",
"productName": "Coco-AI",
"version": "../package.json",
"identifier": "rs.coco.app",
"build": {
"beforeDevCommand": "pnpm dev",
"devUrl": "http://localhost:6060",
"beforeBuildCommand": "pnpm build",
"frontendDist": "../dist"
},
"app": {
"macOSPrivateApi": true,
"windows": [
{
"label": "main",
"title": "Coco AI",
"url": "/ui",
"useHttpsScheme": true,
"height": 590,
"width": 680,
"decorations": false,
"minimizable": false,
"maximizable": true,
"skipTaskbar": true,
"resizable": false,
"acceptFirstMouse": true,
"shadow": true,
"transparent": true,
"fullscreen": false,
"center": false,
"visible": false,
"windowEffects": {
"effects": [],
"radius": 6
},
"visibleOnAllWorkspaces": true,
"alwaysOnTop": true
},
{
"label": "settings",
"title": "Coco AI Settings",
"url": "/ui/settings",
"width": 1000,
"minWidth": 1000,
"height": 700,
"minHeight": 700,
"center": true,
"transparent": true,
"maximizable": false,
"skipTaskbar": false,
"dragDropEnabled": false,
"hiddenTitle": true,
"visible": false,
"windowEffects": {
"effects": ["sidebar"],
"state": "active"
}
},
{
"label": "check",
"title": "Coco AI Update",
"url": "/ui/check",
"width": 340,
"minWidth": 340,
"height": 260,
"minHeight": 260,
"center": true,
"decorations": false,
"transparent": true,
"maximizable": false,
"skipTaskbar": false,
"dragDropEnabled": false,
"hiddenTitle": true,
"visible": false,
"shadow": false,
"windowEffects": {
"effects": ["sidebar"],
"state": "active",
"radius": 7
}
},
{
"label": "selection",
"title": "Selection",
"alwaysOnTop": true,
"shadow": false,
"decorations": false,
"transparent": true,
"closable": true,
"minimizable": false,
"maximizable": false,
"dragDropEnabled": false,
"resizable": false,
"center": false,
"url": "/ui/selection",
"hiddenTitle": true,
"visible": false,
"acceptFirstMouse": true,
"windowEffects": {
"effects": [],
"state": "active",
"radius": 7
}
}
],
"security": {
"csp": {
"default-src": "'self' asset: http: https: ipc: blob: data:",
"media-src": "'self' blob: mediastream:"
},
"dangerousDisableAssetCspModification": true,
"assetProtocol": {
"enable": true,
"scope": {
"allow": ["**/*"],
"requireLiteralLeadingDot": false
}
}
}
},
"bundle": {
"active": true,
"createUpdaterArtifacts": true,
"targets": ["nsis", "dmg", "app", "appimage", "deb", "rpm"],
"category": "Utility",
"shortDescription": "Coco AI",
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico",
"icons/icon.png",
"icons/Square30x30Logo.png",
"icons/Square44x44Logo.png",
"icons/Square71x71Logo.png",
"icons/Square89x89Logo.png",
"icons/Square107x107Logo.png",
"icons/Square142x142Logo.png",
"icons/Square150x150Logo.png",
"icons/Square284x284Logo.png",
"icons/Square310x310Logo.png",
"icons/StoreLogo.png"
],
"resources": ["assets/**/*", "icons"]
},
"plugins": {
"features": {
"protocol": ["all"]
},
"window": {},
"updater": {
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDlDRjNDRUU0NTdBMzdCRTMKUldUamU2Tlg1TTd6bkUwZWM0d2Zjdk0wdXJmendWVlpMMmhKN25EcmprYmIydnJ3dmFUME9QYXkK",
"endpoints": [
"https://release.infinilabs.com/coco/app/.latest.json?target={{target}}&arch={{arch}}&current_version={{current_version}}"
]
},
"shell": {},
"globalShortcut": {},
"deep-link": {
"mobile": [
{
"host": "app.infini.cloud",
"pathPrefix": ["/open"]
}
],
"desktop": {
"schemes": ["coco"]
}
},
"os": {}
}
}