asking for the correct permission when using the Anthropic API. Fixes #389
This commit is contained in:
parent
e279412203
commit
5efdf91570
11 changed files with 65 additions and 25 deletions
|
|
@ -1032,16 +1032,16 @@
|
|||
"GetTask_info_default": {
|
||||
"message": "Auf dieser Seite kannst du den Standard-Prompt anpassen, der verwendet wird, um eine Aufgabe aus dem ausgewählten Text zu erstellen."
|
||||
},
|
||||
"ask_chatgptweb_permission_2": {
|
||||
"ask_integration_permission_2": {
|
||||
"message": "Klicke hier, um fortzufahren."
|
||||
},
|
||||
"ask_chatgptweb_permission_1": {
|
||||
"message": "Um die ChatGPT-Web-Integration zu nutzen, musst du die erforderliche Berechtigung erteilen."
|
||||
},
|
||||
"ask_chatgptweb_permission_2_popup": {
|
||||
"ask_integration_permission_2_popup": {
|
||||
"message": "Klicke hier, um einen neuen Tab zu öffnen und den Anweisungen zu folgen."
|
||||
},
|
||||
"ask_chatgptweb_permission_ok": {
|
||||
"ask_integration_permission_ok": {
|
||||
"message": "Berechtigung erteilt. Du kannst hier klicken, um diesen Tab zu schließen und zum Hauptfenster zurückzukehren."
|
||||
},
|
||||
"AccountSelector_AutoTags": {
|
||||
|
|
|
|||
|
|
@ -1348,18 +1348,22 @@
|
|||
"description": ""
|
||||
},
|
||||
"ask_chatgptweb_permission_1": {
|
||||
"message": "To use the ChatGPT Web Integration, you need to grant the required permission.",
|
||||
"message": "To use the ChatGPT Web integration, you need to grant the required permission.",
|
||||
"description": ""
|
||||
},
|
||||
"ask_chatgptweb_permission_2_popup": {
|
||||
"ask_anthropic_api_permission_1": {
|
||||
"message": "To use the Anthropic API integration, you need to grant the required permission.",
|
||||
"description": ""
|
||||
},
|
||||
"ask_integration_permission_2_popup": {
|
||||
"message": "Click here to open a new tab and follow the instructions.",
|
||||
"description": ""
|
||||
},
|
||||
"ask_chatgptweb_permission_2": {
|
||||
"ask_integration_permission_2": {
|
||||
"message": "Click here to proceed.",
|
||||
"description": ""
|
||||
},
|
||||
"ask_chatgptweb_permission_ok": {
|
||||
"ask_integration_permission_ok": {
|
||||
"message": "Permission granted. You can click here to close this tab and return to the main window.",
|
||||
"description": ""
|
||||
},
|
||||
|
|
|
|||
|
|
@ -987,10 +987,10 @@
|
|||
"prefs_OptionText_chatgpt_web_custom_data_info": {
|
||||
"message": "Cela doit être dans le format suivant :"
|
||||
},
|
||||
"ask_chatgptweb_permission_2_popup": {
|
||||
"ask_integration_permission_2_popup": {
|
||||
"message": "Cliquez ici pour ouvrir un nouvel onglet et suivre les instructions."
|
||||
},
|
||||
"ask_chatgptweb_permission_2": {
|
||||
"ask_integration_permission_2": {
|
||||
"message": "Cliquez ici pour continuer."
|
||||
},
|
||||
"prefs_OptionText_Project_No_temporary_chat_warn": {
|
||||
|
|
@ -1035,7 +1035,7 @@
|
|||
"AccountSelector_Spamfilter": {
|
||||
"message": "Choisissez les comptes pour lesquels le filtre anti-spam est activé"
|
||||
},
|
||||
"ask_chatgptweb_permission_ok": {
|
||||
"ask_integration_permission_ok": {
|
||||
"message": "Autorisation accordée. Vous pouvez cliquer ici pour fermer cet onglet et revenir à la fenêtre principale."
|
||||
},
|
||||
"prefs_OptionText_add_tags_auto_Info2": {
|
||||
|
|
|
|||
|
|
@ -996,7 +996,7 @@
|
|||
"ask_chatgptweb_permission_1": {
|
||||
"message": "Per utilizzare l'integrazione con ChatGPT Web, devi concedere l'autorizzazione richiesta."
|
||||
},
|
||||
"ask_chatgptweb_permission_2_popup": {
|
||||
"ask_integration_permission_2_popup": {
|
||||
"message": "Clicca qui per aprire una nuova scheda e seguire le istruzioni."
|
||||
},
|
||||
"GetTask_info_default": {
|
||||
|
|
@ -1035,10 +1035,10 @@
|
|||
"no_valid_data_received": {
|
||||
"message": "Nessun dato valido ricevuto dall'IA."
|
||||
},
|
||||
"ask_chatgptweb_permission_2": {
|
||||
"ask_integration_permission_2": {
|
||||
"message": "Clicca qui per procedere."
|
||||
},
|
||||
"ask_chatgptweb_permission_ok": {
|
||||
"ask_integration_permission_ok": {
|
||||
"message": "Autorizzazione concessa. Puoi cliccare qui per chiudere questa scheda e tornare alla finestra principale."
|
||||
},
|
||||
"prompt_proofread_this": {
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
"messagesUpdate",
|
||||
"messagesMove",
|
||||
"https://*.chatgpt.com/*",
|
||||
"https://*.anthropic.com/*",
|
||||
"<all_urls>"
|
||||
],
|
||||
"background": {
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ h2 {
|
|||
box-shadow: inset 5px 2px 5px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
#chatgpt_web_permission {
|
||||
#chatgpt_web_permission, #anthropic_api_permission {
|
||||
display: none;
|
||||
background-color: red;
|
||||
color: white;
|
||||
|
|
@ -196,12 +196,12 @@ h2 {
|
|||
transition: background-color 0.3s ease, transform 0.3s ease;
|
||||
}
|
||||
|
||||
#chatgpt_web_permission:hover {
|
||||
#chatgpt_web_permission:hover, #anthropic_api_permission:hover {
|
||||
background-color: darkred;
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
#chatgpt_web_permission_ok {
|
||||
#integration_permission_ok {
|
||||
display: none;
|
||||
background-color: green;
|
||||
color: white;
|
||||
|
|
@ -213,7 +213,7 @@ h2 {
|
|||
text-align: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
#chatgpt_web_permission_ok:hover {
|
||||
#integration_permission_ok:hover {
|
||||
background-color: darkgreen;
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
|
@ -15,9 +15,12 @@
|
|||
<body>
|
||||
<div class="content">
|
||||
<div id="chatgpt_web_permission">__MSG_ask_chatgptweb_permission_1__
|
||||
<br>__MSG_ask_chatgptweb_permission_2__
|
||||
<br>__MSG_ask_integration_permission_2__
|
||||
</div>
|
||||
<div id="chatgpt_web_permission_ok">__MSG_ask_chatgptweb_permission_ok__</div>
|
||||
<div id="anthropic_api_permission">__MSG_ask_anthropic_api_permission_1__
|
||||
<br>__MSG_ask_integration_permission_2__
|
||||
</div>
|
||||
<div id="integration_permission_ok">__MSG_ask_integration_permission_ok__</div>
|
||||
<div class="section header">
|
||||
<h1><img src="../../images/icon.png" class="title-icon"/>ThunderAI</h1>
|
||||
<p>
|
||||
|
|
|
|||
|
|
@ -32,13 +32,32 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||
let granted = await messenger.permissions.request({ origins: ["https://*.chatgpt.com/*"] });
|
||||
if(granted){
|
||||
document.getElementById("chatgpt_web_permission").style.display = "none";
|
||||
document.getElementById("chatgpt_web_permission_ok").style.display = "block";
|
||||
taLog.log("ChatGPT web permission granted");
|
||||
document.getElementById("integration_permission_ok").style.display = "block";
|
||||
taLog.log("ChatGPT Web permission granted");
|
||||
}else{
|
||||
taLog.log("ChatGPT web permission denied");
|
||||
taLog.log("ChatGPT Web permission denied");
|
||||
}
|
||||
});
|
||||
document.getElementById("chatgpt_web_permission_ok").addEventListener("click", async () => {
|
||||
document.getElementById("integration_permission_ok").addEventListener("click", async () => {
|
||||
await messenger.tabs.remove((await messenger.tabs.getCurrent()).id);
|
||||
});
|
||||
}
|
||||
}
|
||||
if(prefs.connection_type === 'anthropic_api'){
|
||||
let permission_chatgpt = await messenger.permissions.contains({ origins: ["https://*.anthropic.com/*"] });
|
||||
if(permission_chatgpt === false){
|
||||
document.getElementById("anthropic_api_permission").style.display = "block";
|
||||
document.getElementById("anthropic_api_permission").addEventListener("click", async () => {
|
||||
let granted = await messenger.permissions.request({ origins: ["https://*.anthropic.com/*"] });
|
||||
if(granted){
|
||||
document.getElementById("anthropic_api_permission").style.display = "none";
|
||||
document.getElementById("integration_permission_ok").style.display = "block";
|
||||
taLog.log("Anthropic API permission granted");
|
||||
}else{
|
||||
taLog.log("Anthropic API web permission denied");
|
||||
}
|
||||
});
|
||||
document.getElementById("integration_permission_ok").addEventListener("click", async () => {
|
||||
await messenger.tabs.remove((await messenger.tabs.getCurrent()).id);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ body {
|
|||
background-color: #cfe9ff;
|
||||
}
|
||||
|
||||
#ask_chatgpt_web_perm{
|
||||
#ask_chatgpt_web_perm, #ask_anthropic_api_perm{
|
||||
display: none;
|
||||
max-width: 20em;
|
||||
background-color: red;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,10 @@
|
|||
|
||||
<body>
|
||||
<div id="ask_chatgpt_web_perm">__MSG_ask_chatgptweb_permission_1__
|
||||
<br>__MSG_ask_chatgptweb_permission_2_popup__
|
||||
<br>__MSG_ask_integration_permission_2_popup__
|
||||
</div>
|
||||
<div id="ask_anthropic_api_perm">__MSG_ask_anthropic_api_permission_1__
|
||||
<br>__MSG_ask_integration_permission_2_popup__
|
||||
</div>
|
||||
<div id="mzta_search_banner">
|
||||
<div id="_spacer_div"> </div>
|
||||
|
|
|
|||
|
|
@ -66,6 +66,16 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||
});
|
||||
}
|
||||
}
|
||||
if(prefs.connection_type === 'anthropic_api'){
|
||||
let permission_anthropic = await browser.permissions.contains({ origins: ["https://*.anthropic.com/*"] });
|
||||
if(permission_anthropic === false){
|
||||
document.getElementById("mzta_search_banner").style.display = "none";
|
||||
document.getElementById("ask_anthropic_api_perm").style.display = "block";
|
||||
document.getElementById('ask_anthropic_api_perm').addEventListener('click', async () => {
|
||||
await browser.tabs.create({ url: "../pages/onboarding/onboarding.html" });
|
||||
});
|
||||
}
|
||||
}
|
||||
}, { once: true });
|
||||
|
||||
async function searchPrompt(allPrompts, tabId, tabType){
|
||||
|
|
|
|||
Loading…
Reference in a new issue