aboutsummaryrefslogtreecommitdiffstats
path: root/extension
diff options
context:
space:
mode:
authorOmar Rizwan <omar@omar.website>2020-12-22 20:34:01 -0800
committerOmar Rizwan <omar@omar.website>2020-12-22 20:34:01 -0800
commit35214c9698e54e107ad1f28f9fce6da6b00ed39a (patch)
treefafd4bd7ef06be352448fe49a6380256b5ee8550 /extension
parente6f9ce7437d8f83076680391be0d260f80a018c3 (diff)
extensions/*/enabled is readable (+ test that works)
Diffstat (limited to 'extension')
-rw-r--r--extension/background.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/extension/background.js b/extension/background.js
index 4fb5923..af8fb10 100644
--- a/extension/background.js
+++ b/extension/background.js
@@ -326,6 +326,14 @@ router["/extensions"] = {
return { entries: [".", "..", ...infos.map(info => `${sanitize(info.name)}_${info.id}`)] };
}
};
+router["/extensions/*/enabled"] = defineFile(async path => {
+ const parts = pathComponent(path, -2).split('_'); const extensionId = parts[parts.length - 1];
+ const info = await browser.management.get(extensionId);
+ return String(info.enabled);
+
+}, async (path, buf) => {
+ await browser.management.setEnabled();
+});
// Ensure that there are routes for all ancestors. This algorithm is
// probably not correct, but whatever. I also think it would be