feat: add cross-browser builds and refresh project documentation
- add Chrome/Chromium Manifest V3 build with PAC proxy routing - keep Firefox Manifest V2 and Android compatibility - add Chromium API adapter and service worker - add Chrome build script and Makefile target - update README and add AGENT.md - document installation, signing, permissions, themes, and platform limitations
This commit is contained in:
1 parent
11508e6740
commit
d0c5fc5679
12 files changed
+256
-14
No files matched your search
@@ -0,0 +1,31 @@
|
||||
// Small Promise-based WebExtension API adapter for Chromium browsers.
|
||||
// Firefox already provides the browser namespace, so this is a no-op there.
|
||||
(function () {
|
||||
if (globalThis.browser || !globalThis.chrome) return;
|
||||
|
||||
const wrap = (object, method) => (...args) => new Promise((resolve, reject) => {
|
||||
object[method](...args, result => {
|
||||
const error = globalThis.chrome.runtime.lastError;
|
||||
if (error) reject(new Error(error.message));
|
||||
else resolve(result);
|
||||
});
|
||||
});
|
||||
|
||||
globalThis.browser = {
|
||||
runtime: {
|
||||
sendMessage: wrap(chrome.runtime, 'sendMessage'),
|
||||
openOptionsPage: wrap(chrome.runtime, 'openOptionsPage'),
|
||||
onMessage: chrome.runtime.onMessage
|
||||
},
|
||||
tabs: {
|
||||
query: wrap(chrome.tabs, 'query'),
|
||||
reload: wrap(chrome.tabs, 'reload')
|
||||
},
|
||||
storage: {
|
||||
local: {
|
||||
get: wrap(chrome.storage.local, 'get'),
|
||||
set: wrap(chrome.storage.local, 'set')
|
||||
}
|
||||
}
|
||||
};
|
||||
})();
|
||||
Reference in new issue
Block a user