Merge branch 'main' into window_position_issue685

This commit is contained in:
Mic 2026-03-04 21:50:33 +01:00 committed by GitHub
commit 557f6741c3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 42 additions and 34 deletions

View file

@ -3,6 +3,10 @@
<h2>Version 4.0.2 - ??/??/2026</h2>
<ul>
<li>...</li>
</ul>
<h2>Version 4.0.1 - 27/02/2026</h2> <h2>Version 4.0.1 - 27/02/2026</h2>
<ul> <ul>
<li>Fix: Correctly handling additional text without a placeholder [<a href="https://github.com/micz/ThunderAI/issues/681">#681</a>].</li> <li>Fix: Correctly handling additional text without a placeholder [<a href="https://github.com/micz/ThunderAI/issues/681">#681</a>].</li>

View file

@ -20,7 +20,7 @@
"description": "" "description": ""
}, },
"prompt_reply_custom_command": { "prompt_reply_custom_command": {
"message": "Reply with command", "message": "Reply with command...",
"description": "" "description": ""
}, },
"prompt_rewrite_polite": { "prompt_rewrite_polite": {

View file

@ -2,7 +2,7 @@
"manifest_version": 2, "manifest_version": 2,
"name": "ThunderAI", "name": "ThunderAI",
"description": "__MSG_extensionDescription__", "description": "__MSG_extensionDescription__",
"version": "4.0.1_issue685_rev2", "version": "4.0.2",
"author": "Mic (m@micz.it)", "author": "Mic (m@micz.it)",
"homepage_url": "https://micz.it/thunderbird-addon-thunderai/", "homepage_url": "https://micz.it/thunderbird-addon-thunderai/",
"browser_specific_settings": { "browser_specific_settings": {

View file

@ -113,25 +113,6 @@ messenger.messageDisplayScripts.register({
js: [{ file: "js/mzta-compose-script.js" }], js: [{ file: "js/mzta-compose-script.js" }],
}); });
// Inject script and CSS in all already open message tabs.
let openTabs = await messenger.tabs.query();
let messageTabs = openTabs.filter(
tab => ["mail", "messageDisplay"].includes(tab.type)
);
for (let messageTab of messageTabs) {
if((messageTab.url == undefined) || (["start.thunderbird.net","about:blank"].some(blockedUrl => messageTab.url.includes(blockedUrl)))) {
continue;
}
try {
await browser.tabs.executeScript(messageTab.id, {
file: "js/mzta-compose-script.js"
})
} catch (error) {
console.error("[ThunderAI] Error injecting message display script:", error);
console.error("[ThunderAI] Message tab:", messageTab.url);
}
}
browser.contentScripts.register({ browser.contentScripts.register({
matches: ["https://*.chatgpt.com/*"], matches: ["https://*.chatgpt.com/*"],
js: [{file: "js/mzta-chatgpt-loader.js"}], js: [{file: "js/mzta-chatgpt-loader.js"}],
@ -736,13 +717,13 @@ async function openChatGPT(promptText, action, curr_tabId, prompt_name = '', do_
{ {
// We are using the Anthropic API // We are using the Anthropic API
let rand_call_id5 = '_anthropic_' + generateCallID(); let rand_call_id6 = '_anthropic_' + generateCallID();
const listener5 = (message, sender, sendResponse) => { const listener6 = (message, sender, sendResponse) => {
function handleAnthropicApi(createdTab) { function handleAnthropicApi(createdTab) {
let mailMessageId5 = -1; let mailMessageId6 = -1;
if(mailMessage) mailMessageId5 = mailMessage.id; if(mailMessage) mailMessageId6 = mailMessage.id;
// check if the config is present, or give a message error // check if the config is present, or give a message error
if (prefs.anthropic_api_key == '') { if (prefs.anthropic_api_key == '') {
@ -758,27 +739,27 @@ async function openChatGPT(promptText, action, curr_tabId, prompt_name = '', do_
return; return;
} }
//console.log(">>>>>>>>>> sender: " + JSON.stringify(sender)); //console.log(">>>>>>>>>> sender: " + JSON.stringify(sender));
browser.tabs.sendMessage(createdTab.id, { command: "api_send", prompt: promptText, action: action, tabId: curr_tabId, mailMessageId: mailMessageId5, do_custom_text: do_custom_text, prompt_info: prompt_info}); browser.tabs.sendMessage(createdTab.id, { command: "api_send", prompt: promptText, action: action, tabId: curr_tabId, mailMessageId: mailMessageId6, do_custom_text: do_custom_text, prompt_info: prompt_info});
taLog.log('[OpenAI ChatGPT] Connection succeded!'); taLog.log('[OpenAI ChatGPT] Connection succeded!');
browser.runtime.onMessage.removeListener(listener5); browser.runtime.onMessage.removeListener(listener6);
} }
if (message.command === "anthropic_api_ready_"+rand_call_id5) { if (message.command === "anthropic_api_ready_"+rand_call_id6) {
return handleAnthropicApi(sender.tab); return handleAnthropicApi(sender.tab);
} }
return false; return false;
} }
browser.runtime.onMessage.addListener(listener5); browser.runtime.onMessage.addListener(listener6);
let win_options5 = { let win_options6 = {
url: browser.runtime.getURL('api_webchat/index.html?llm='+prefs.connection_type+'&call_id='+rand_call_id5+'&ph_def_val='+(prefs.placeholders_use_default_value?'1':'0')+'&prompt_id='+encodeURIComponent(prompt_info.id) + '&prompt_name=' + encodeURIComponent(i18nConditionalGet(prompt_info.name))), url: browser.runtime.getURL('api_webchat/index.html?llm='+prefs.connection_type+'&call_id='+rand_call_id6+'&ph_def_val='+(prefs.placeholders_use_default_value?'1':'0')+'&prompt_id='+encodeURIComponent(prompt_info.id) + '&prompt_name=' + encodeURIComponent(i18nConditionalGet(prompt_info.name))),
type: "popup", type: "popup",
} }
applyWindowPositionAndSize(win_options5, prefs); applyWindowPositionAndSize(win_options6, prefs);
await browser.windows.create(win_options5); await browser.windows.create(win_options6);
} }
break; // anthropic_api - END break; // anthropic_api - END
@ -1348,4 +1329,23 @@ async function processEmails(args) {
taWorkingStatus.stopWorking(); taWorkingStatus.stopWorking();
} }
browser.messages.onNewMailReceived.addListener(newEmailListener, !prefs_init.add_tags_auto_only_inbox); browser.messages.onNewMailReceived.addListener(newEmailListener, !prefs_init.add_tags_auto_only_inbox);
// Inject script and CSS in all already open message tabs.
let openTabs = await messenger.tabs.query();
let messageTabs = openTabs.filter(
tab => ["mail", "messageDisplay"].includes(tab.type)
);
for (let messageTab of messageTabs) {
if((messageTab.url == undefined) || (["start.thunderbird.net","about:blank"].some(blockedUrl => messageTab.url.includes(blockedUrl)))) {
continue;
}
try {
await browser.tabs.executeScript(messageTab.id, {
file: "js/mzta-compose-script.js"
})
} catch (error) {
console.error("[ThunderAI] Error injecting message display script:", error);
console.error("[ThunderAI] Message tab:", messageTab.url);
}
}

View file

@ -7,6 +7,10 @@
<body> <body>
<div id="miczBackPrefs"><a href="mzta-options.html">__MSG_backToOptionsText__</a></div> <div id="miczBackPrefs"><a href="mzta-options.html">__MSG_backToOptionsText__</a></div>
<div id="miczRelNotes"><h1>ThunderAI Release Notes</h1> <div id="miczRelNotes"><h1>ThunderAI Release Notes</h1>
<h2>Version 4.0.2 - ??/??/2026</h2>
<ul>
<li>...</li>
</ul>
<h2>Version 4.0.1 - 27/02/2026</h2> <h2>Version 4.0.1 - 27/02/2026</h2>
<ul> <ul>
<li>Fix: Correctly handling additional text without a placeholder [<a href="https://github.com/micz/ThunderAI/issues/681">#681</a>].</li> <li>Fix: Correctly handling additional text without a placeholder [<a href="https://github.com/micz/ThunderAI/issues/681">#681</a>].</li>