asking claude optional permission. see #558

This commit is contained in:
mic 2025-12-08 16:03:25 +01:00
parent b7315bf810
commit e94aeac45b
2 changed files with 11 additions and 0 deletions

View file

@ -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": ""
}
}

View file

@ -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;