diff --git a/permission.html b/permission.html
new file mode 100644
index 0000000..5238e5d
--- /dev/null
+++ b/permission.html
@@ -0,0 +1,70 @@
+
+
+
+
+
+ السماح باستخدام الميكروفون
+
+
+
+
+
🎤
+
مطلوب إذن الميكروفون
+
ميزة الإملاء الصوتي تحتاج إلى إذن للوصول إلى الميكروفون لتعمل بشكل صحيح في الخلفية.
+
يرجى الضغط على الزر أدناه والموافقة على طلب الصلاحية من المتصفح.
+
+
+
+
+
+
diff --git a/permission.js b/permission.js
new file mode 100644
index 0000000..8d841a1
--- /dev/null
+++ b/permission.js
@@ -0,0 +1,19 @@
+document.getElementById('grantBtn').addEventListener('click', async () => {
+ const status = document.getElementById('status');
+ try {
+ const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
+ // Stop the tracks immediately since we only needed to ask for permission
+ stream.getTracks().forEach(track => track.stop());
+
+ status.style.color = '#00d67e';
+ status.textContent = '✅ تم منح الصلاحية بنجاح! يمكنك إغلاق هذه النافذة والعودة إلى الإضافة.';
+
+ // Auto close after 3 seconds
+ setTimeout(() => {
+ window.close();
+ }, 3000);
+ } catch (err) {
+ status.style.color = '#ff4d6d';
+ status.textContent = '❌ حدث خطأ أو تم رفض الصلاحية: ' + err.message;
+ }
+});
diff --git a/popup.js b/popup.js
index 7556024..ff4b8f4 100644
--- a/popup.js
+++ b/popup.js
@@ -356,6 +356,7 @@ function initDictation() {
recognition.start();
} catch (err) {
statusEl.textContent = '❌ يجب السماح باستخدام الميكروفون';
+ chrome.tabs.create({ url: chrome.runtime.getURL('permission.html') });
}
}
});