diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 77fb453c..904229c1 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1696,5 +1696,9 @@ "Anthropic_System_Prompt_Info": { "message": "You can improve Claude performance by using a System Prompt to give it a role. This technique, known as role prompting, is the most powerful way to use system prompts with Claude. The right role can turn Claude from a general assistant into your virtual domain expert.", "description": "" + }, + "Optional_Permission_Denied_Model_Fetching": { + "message": "You have denied the optional permission needed to fetch models for this integration.", + "description": "" } } diff --git a/pages/_lib/connection-ui.js b/pages/_lib/connection-ui.js index 22f24500..9fb24523 100644 --- a/pages/_lib/connection-ui.js +++ b/pages/_lib/connection-ui.js @@ -787,6 +787,13 @@ export async function injectConnectionUI({ apiKey: document.getElementById("anthropic_api_key").value, version: document.getElementById("anthropic_version").value, }); + let granted = await messenger.permissions.request({ origins: ["https://*.anthropic.com/*"] }); + if(!granted){ + document.getElementById('anthropic_model_fetch_loading').style.display = 'none'; + taLog.warn("Claude API web permission denied"); + alert(browser.i18n.getMessage("Optional_Permission_Denied_Model_Fetching")); + return; + } anthropic.fetchModels().then((data) => { if(!data.ok){ let errorDetail;