Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recover settings from disabled add-on. #178

Open
MrQwerky opened this issue Jul 22, 2024 · 13 comments
Open

Recover settings from disabled add-on. #178

MrQwerky opened this issue Jul 22, 2024 · 13 comments

Comments

@MrQwerky
Copy link

Using Thunderbird 102.15.1. Today tbkeys (not lite) updated, and became disabled because the new version is not compatible with this version of Thunderbird. I've download the tbkeys 2.2.4 .xpi, which I believe is the latest version compatible with this version of Thunderbird. But since the current add-on is disabled, it won't allow me to access its settings. So where are tbkeys setting saved, or how can I recover the current settings before removing the new version of the add-on and installing the 2.2.4 version, and then how to restore those settings?

@morat523035
Copy link

morat523035 commented Jul 23, 2024

How addon settings are stored
http://github.com/wshanks/tbkeys/issues/164

If the tbkeys addon is disabled using the Addons Manager tab, then I can't run the following code snippet to show the extension storage contents using the Debugging tab.

Menu Bar > Tools > Developer Tools > Debug Addons > tbkeys > Inspect

browser.storage.local.get(null).then(function (aResult) {
  console.log(aResult.mainkeys);
  console.log(aResult.composekeys);
});

If the tbkeys addon is removed using the Addons Manager tab, then the data should be removed.

When an extension is removed is anything left behind (see cor-el's comment)
http://support.mozilla.com/questions/1412114

As a test, I removed the tbkeys addon, then restarted the app. The <Profile Folder>\storage\default\moz-extension+++<Internal UUID> folder was removed for me.

The following preferences are set to false by default.

  • extensions.webextensions.keepStorageOnUninstall
  • extensions.webextensions.keepUuidOnUninstall

Are you saying that you have two tbkeys addons installed? (1 disabled and 1 enabled)

Maybe you could edit the [email protected] internal UUID in the extensions.webextensions.uuids pref in the prefs.js file to access the extension storage contents. (just guessing here)

@wshanks
Copy link
Owner

wshanks commented Jul 23, 2024

Sorry about that @MrQwerky. Your experience is the exact opposite of what was supposed to happen which was the addon marking itself as not compatible with older Thunderbird so that the older Thunderbird would not try to install it. I would like to experiment with this and see why tbkeys is updating to an incompatible version. Maybe I will need to roll back that change.

I don't know much beyond what @morat523035 wrote -- basically tbkeys stores its settings in Thunderbird's local storage (a hunk of json stored in a sqlite database, I think). I am surprised that you can't downgrade the tbkeys version and recover the settings. I wonder if you could hack the version number of tbkeys to be a higher version marked as compatible with TB 102 and then access the settings.

@morat523035
Copy link

I hacked manifest.json file in the <Profile Folder>\extensions\[email protected] archive as a test.

- "strict_min_version": "68.0",
+ "strict_min_version": "128.0",
  "strict_max_version": "*",

On startup, tbkeys addon was disabled. There was a yellow notification "tbkeys is incompatible with Thunderbird 115.13.0" in the Addons Manager tab.

Then I replaced the hacked archive with the original archive. On startup, tbkeys addon was enabled, but the Addon Options button was grayed out, so I quickly disabled the tbkeys addon, then enabled it. Now the tbkeys addon works like normal.

tbkeys 2.2.4 (not lite)
Thunderbird 115.13.0
Windows 10 Pro 22H2 32-bit

I guess a similar hack should be able to access the extension storage contents for @MrQwerky.

- "strict_min_version": "115.0",
+ "strict_min_version": "68.0",
  "strict_max_version": "*",

@MrQwerky
Copy link
Author

Thanks for the replies. I just noticed that the tbkeys add-on which is disabled is shown as version 2.3.0, but there is no way to enable it. This is the only version of the add-on installed at this time. So it seems that TB didn't install the new version (sorry to mislead), but it did disable the old version, and can't be re-enabled.

@morat523035, using Menu Bar > Tools > Developer Tools > Debug Addons, like you, the add-on is not listed, so can't be debugged. I set to TRUE the two preferences which you listed. Does this mean that if I uninstall the add-on, the storage will remain? But how do I find that storage? I can't seem even to find what the UUID for this add-on is, since it is disabled. Is there a way to find the UUID? Okay, I see that in prefs.js the UUID is listed. Now how can I make use of that to find the storage?

Are you saying that I should edit the .xpi file? And that every time TB restarts, it attempts to access that file?

@morat523035
Copy link

In my opinion, the easy method to recover the key bindings would be to hack the manifest.json file in the <Profile Folder>\extensions\[email protected] archive.

tbkeys 2.3.0 manifest.json file
http://github.com/wshanks/tbkeys/blob/b7bff64ff0c1df5157fe2ffd307c1fc4f4d6cabc/addon/manifest.json

For example:

  • exit app
  • open <Profile Folder>\extensions directory
  • unzip manifest.json file within [email protected] archive
  • open manifest.json file
  • find "115.0" and replace with "68.0"
  • save manifest.json file
  • zip manifest.json file within [email protected] archive
  • start app
  • open Addons Manager tab, then open Addon Options for tbkeys
  • copy and paste key bindings into text file for backup

@wshanks
Copy link
Owner

wshanks commented Jul 24, 2024

I haven't had a chance to test different scenarios so far. I hope @morat523035's suggestion works. For now, I pulled 2.3.0 from the updates file so clients should stop updating to it. I think the updates file needs to be specifying the minimum Thunderbird version for every add-on release, but I haven't had a chance to test that that solves the problem yet.

@MrQwerky
Copy link
Author

@morat523035 Thanks. I followed your procedure, then opened TB and went to the Addons tab. Unfortunately, tbkeys is still disabled. I unzipped the file again and checked the manifest.json file, and it does correctly contain the change in "strict_min_version" that I made as per your instructions.

Apart from that change, the manifest.json file does appear exactly as the one you linked. The manifest from version 2.2.4 which I downloaded, is:

{
  "manifest_version": 2,
  "browser_specific_settings": {
    "gecko": {
      "id": "[email protected]",
      "strict_min_version": "68.0",
      "strict_max_version": "*",
      "update_url": "https://raw.githubusercontent.com/wshanks/tbkeys/main/updates.json"
    }
  },
  "name": "tbkeys",
  "description": "Custom Thunderbird keybindings",
  "author": "Will Shanks",
  "version": "2.2.4",
  "background": {
    "scripts": ["background.js"]
  },
  "options_ui": {
    "browser_style": true,
    "page": "options.html"
  },
  "permissions": ["storage"],
  "experiment_apis": {
    "tbkeys": {
      "schema": "schema.json",
      "parent": {
        "scopes": ["addon_parent"],
        "paths": [["tbkeys"]],
        "script": "implementation.js"
      }
    }
  }
}

And the manifest.json from the .xpi that I originally installed the add-on from, is:

{
  "manifest_version": 2,
  "applications": {
    "gecko": {
      "id": "[email protected]",
      "strict_min_version": "68.0",
      "update_url": "https://raw.githubusercontent.com/wshanks/tbkeys/main/updates.json"
    }
  },
  "name": "tbkeys",
  "description": "Custom Thunderbird keybindings",
  "author": "Will Shanks",
  "version": "2.2.0",
  "background": {
    "scripts": ["background.js"]
  },
  "options_ui": {
    "browser_style": true,
    "page": "options.html"
  },
  "permissions": ["storage"],
  "experiment_apis": {
    "tbkeys": {
      "schema": "schema.json",
      "parent": {
        "scopes": ["addon_parent"],
        "paths": [["tbkeys"]],
        "script": "implementation.js"
      }
    }
  }
}

Not sure what those differences mean. Also, I see that the tbkeys UUID in prefs.js is different than the UUID in extensions.json; not sure what that means, either.

What is needed is either a way to enable the disabled add-on (sad that the above didn't work), or else to recover the date from where it is restored in the profile. At this point, I have no idea how to do either.

@wshanks
Copy link
Owner

wshanks commented Jul 24, 2024

Hmm, it sounds like what you tried should work. Have you tried downloading the 2.2.4 xpi from the releases page here and using Gear button -> "Install Add-on from File..." to install it? In my testing, when I updated to 2.3.0 and then downgraded in this way, the add-on was enabled again and I was able to access the settings again.

I think I fixed the problem of the add-on updating to an incompatible version with #180.

@MrQwerky
Copy link
Author

@wshanks Thank you, thank you, thank you! I just did that, and now tbkeys is once again active, and it seems on first glance that the keybindings are also intact. For good measure, I've set the add-on's "Check for Updates" to off, though I doubt that there will be a new update of the add-on for TB 102.15.1.

@MrQwerky
Copy link
Author

So, today tbkeys once again offered to update?

@morat523035
Copy link

It's a good idea not to update your addons if you are using an obsolete version.

Addons Manager tab > Gear icon > [click] Reset All Addons to Update Manually

If any addons have been set to update automatically, clicking this option will reset all addons to update manually.

@MrQwerky
Copy link
Author

Understood. That's the setting I use. But each day I click Check for Updates in the gear icon to see if there is anything new. And when I do, it offers to update tbkeys, which I had hoped would no longer be the case when the updated version was incompatible with the TB version?

@morat523035
Copy link

morat523035 commented Jul 28, 2024

I would use 115.0 not 115 for the strict_min_version value in the updates.json file.

Valid application versions
http://addons.thunderbird.net/thunderbird/pages/appversions/

tbkeys updates.json
http://github.com/wshanks/tbkeys/blob/main/updates.json

PostGuard updates.json
http://github.com/encryption4all/postguard-tb-addon/blob/main/resources/updates.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants