Skip to content

Commit c6bb792

Browse files
authored
fix: use Alloy CEF media permissions (#1638)
### Description - use the CEF Alloy runtime so tauri://localhost can enumerate named media devices - restore policy-gated microphone, camera, and desktop-capture requests through the runtime - retain the native tauri origin and select the CEF distribution matching the resolved dependency Fixes #1480 #### Type of change - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update ### Checklist: - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings ### AI disclosure: - [ ] Partially AI assisted (clarify which code was AI assisted and briefly explain what it does). - [ ] Fully AI generated (explain what all the generated code does in moderate detail). <!-- Write any explanation required here, but do not generate the explanation using AI!! You must prove you understand what the code in this PR does. -->
2 parents db3b488 + e155fdb commit c6bb792

3 files changed

Lines changed: 14 additions & 11 deletions

File tree

scripts/cef/copy-libs.sh

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,6 @@ PROFILE="${1:-debug}"
1212
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
1313
DEST="${2:-$ROOT/src-tauri/target/$PROFILE}"
1414

15-
CEF_DIR="$(
16-
find "$ROOT/src-tauri/target/$PROFILE/build" \
17-
-type d -name cef_linux_x86_64 -print -quit 2>/dev/null || true
18-
)"
19-
if [ -z "$CEF_DIR" ]; then
20-
echo "❌ CEF dist not found under target/$PROFILE/build — build with --features cef first." >&2
21-
exit 1
22-
fi
23-
2415
CEF_VERSION="$(awk '
2516
/^\[\[package\]\]$/ { in_cef=0 }
2617
/^name = "cef"$/ { in_cef=1 }
@@ -36,6 +27,18 @@ if [ -z "$CEF_VERSION" ]; then
3627
fi
3728
CEF_MAJOR="${CEF_VERSION%%.*}"
3829

30+
CEF_DIR=""
31+
while IFS= read -r candidate; do
32+
if grep -q "^#define CEF_VERSION_MAJOR $CEF_MAJOR$" "$candidate/include/cef_version.h" 2>/dev/null; then
33+
CEF_DIR="$candidate"
34+
break
35+
fi
36+
done < <(find "$ROOT/src-tauri/target/$PROFILE/build" -type d -name cef_linux_x86_64 2>/dev/null)
37+
if [ -z "$CEF_DIR" ]; then
38+
echo "❌ CEF $CEF_MAJOR dist not found under target/$PROFILE/build — build with --features cef first." >&2
39+
exit 1
40+
fi
41+
3942
CEF_LIB="$CEF_DIR/libcef.so"
4043
if [ ! -f "$CEF_LIB" ]; then
4144
echo "❌ libcef.so not found in $CEF_DIR." >&2

src-tauri/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ fn main() {
131131
.cloned()
132132
.collect();
133133

134-
if permission_kinds.is_empty() {
134+
if permission_kinds.is_empty() || permission_kinds.len() != request.kinds.len() {
135135
return responder.deny(DenyReason::NoPolicy);
136136
}
137137

0 commit comments

Comments
 (0)