Files
proxyswitcher/scripts/build-chrome.py
T
wt d0c5fc5679 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
2026-10-09 16:17:33 +07:00

41 lines
1.2 KiB
Python

#!/usr/bin/env python3
"""Build a Chrome/Chromium Manifest V3 zip without changing the Firefox tree."""
from pathlib import Path
import json
import shutil
import tempfile
import zipfile
ROOT = Path(__file__).resolve().parent.parent
OUTPUT = ROOT / "web-ext-artifacts" / "proxyswitcherforkbywt-chrome.zip"
FILES = [
"background-chrome.js",
"background-service-worker.js",
"browser-api.js",
"config-manager.js",
"options.css",
"options.html",
"options.js",
"popup.css",
"popup.html",
"popup.js",
]
def main():
OUTPUT.parent.mkdir(exist_ok=True)
with tempfile.TemporaryDirectory() as temp:
staging = Path(temp)
manifest = json.loads((ROOT / "manifest.chrome.json").read_text())
(staging / "manifest.json").write_text(json.dumps(manifest, indent=2) + "\n")
for name in FILES:
shutil.copy2(ROOT / name, staging / name)
shutil.copytree(ROOT / "icons", staging / "icons")
if OUTPUT.exists(): OUTPUT.unlink()
with zipfile.ZipFile(OUTPUT, "w", zipfile.ZIP_DEFLATED) as archive:
for path in sorted(staging.rglob("*")):
if path.is_file(): archive.write(path, path.relative_to(staging))
print(OUTPUT)
if __name__ == "__main__":
main()