Skip Navigation
Firefox@Lemmy.ml: Is it possible to install Firefox addons in Thunderbird?
  • MV2 extensions should work in Thunderbird without modification. I've made a couple of simple extensions that work like a charm in both Firefox and Thunderbird, but I'm not sure if more complex extensions would have issues. The documentation says thus:

    Some information listed on MDN may not apply to Thunderbird and some API methods may not be supported. Each API page should include a compatibility chart and if that includes support for Firefox, it should work in Thunderbird as well.

    Some MV3 extensions will not work in Thunderbird. See this page for list of missing functionality.

  • Firefox 127.0 Release Notes
  • navigator.clipboard.read()/write() has been enabled (see documentation). A paste context menu will appear for the user to confirm when attempting to read clipboard content that is not originated from a same-origin page.

    Very nice. The old execCommand API was annoying.

  • My first Thunderbird extension

    I just finished my first (private) Thunderbird extension and felt like blogging a bit, since there certainly aren't too many resources on this topic.

    The problem I set out to solve was that soft hyphens in message subjects are displayed as whitespace in the message list pane. I use Thunderbird as an RSS reader and have subscribed to a newspaper that uses a lot of soft hyphens, which made it jarring to read the headlines.

    There's already an extension called FiltaQuilla that almost does what I needed. It adds filter actions that can prepend and append text to message subject, but it doesn't have features for removing or replacing singular characters like I wanted.

    Two possible solutions came to mind:

    1. Create a HTTP server that forwards requests to the RSS feed and removes soft hyphens from the response.
    2. Create a Thunderbird extension that removes soft hyphens when the feed items are added.

    I didn't feel like running a separate service/process for something this simple, so I decided to go with solution 2.

    My first stop was Thunderbird's documentation on supported WebExtension APIs, specifically the messages API. Alas, the API doesn't support modifying the subject of a message, though it allows marking them as read, changing tags, fetching the subject, etc.

    Since FiltaQuilla supported modifying the subject, I knew that it was possible somehow. Thankfully, FiltaQuilla is open source, so I skimmed the source and found that it's done roughly as follows: js const Cc = Components.classes, Ci = Components.interfaces; var filterService = Cc["@mozilla.org/messenger/services/filters;1"] .getService(Ci.nsIMsgFilterService); filterService.addCustomAction({ "applyAction": (msgHdrs) => { for (let msgHdr of msgHdrs) { msgHdr.subject = msgHdr.subject.replace(...); } }, ... });

    Keyword googling revealed that Components is some legacy API thing that has very little documentation. Luckily, this helpful forum post outlined how to properly call addCustomAction with less reliance on legacy cruft, though the documentation is still not great.

    With the hello world tutorial, Experiments documentation and some trial and error, I finally got something working: ```js // background.js browser.FilterActionAPI.addHyphenRemover();

    // api/FilterActionAPI/implementation.js const softHyphen = String.fromCharCode(173); const { MailServices } = ChromeUtils.import("resource:///modules/MailServices.jsm");

    this.FilterActionAPI = class extends ExtensionAPI { getAPI(context) { return { FilterActionAPI: { addHyphenRemover() { MailServices.filters.addCustomAction({ id: "filter-remove-softhyphen", name: "Remove soft hyphens", applyAction: (msgHdrs) => { for (const msgHdr of msgHdrs) { if (msgHdr.subject.includes(softHyphen)) { console.log("filter-remove-softhyphen", "Removing soft hyphen from subject", msgHdr.subject); msgHdr.subject = msgHdr.subject.replace(softHyphen, ""); } } }, isValidForType: () => true, validateActionValue: () => null, allowDuplicates: false, needsBody: false, isAsync: false }) } } }; } } ```

    Then I just added a message filter that matches my RSS feed and applies the Remove soft hyphens action. Not the prettiest but works!

    0
    HTTP warning now has 5s delay before "Continue to HTTP Site" is clickable
  • Isn't it already game over if malware can write into your hostfile? At least on Windows you need some elevated access for it, which means such malware could just read/write the target program's memory directly instead of resorting to clunky MitM.

  • A Linear Algebra Trick for Computing Fibonacci Numbers Fast
  • At the same time, it is also worth noting that the closed form formula is working with irrational numbers which can only be represented approximately in computers, and thus in some rare cases the method may produce incorrect result due to approximation errors.

    I'm nitpicking, but golden ratio can actually be represented exactly in computers. This is because the golden ratio is not merely an irrational number, but also an algebraic number. By definition, any real algebraic number can be represented as an integer vector, which contains a polynomial and two rationals that identify a root of the polynomial. Alas, the multiplication of algebraic numbers is quite involved and certainly far slower than the linear algebra approach for Fibonacci numbers.

  • InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)XH
    xhduqetz @lemmy.ml
    Posts 1
    Comments 5