From 35214c9698e54e107ad1f28f9fce6da6b00ed39a Mon Sep 17 00:00:00 2001 From: Omar Rizwan Date: Tue, 22 Dec 2020 20:34:01 -0800 Subject: extensions/*/enabled is readable (+ test that works) --- extension/background.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'extension') 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 -- cgit v1.2.3