parent
52643e0bec
commit
bd72c417d2
@ -117,3 +117,4 @@ export const {windows} = polyfill;
|
|||||||
export const {theme} = polyfill;
|
export const {theme} = polyfill;
|
||||||
|
|
||||||
export const CHROME = navigator.appVersion.includes("Chrome/");
|
export const CHROME = navigator.appVersion.includes("Chrome/");
|
||||||
|
export const OPERA = navigator.appVersion.includes("OPR/");
|
||||||
|
@ -16,7 +16,7 @@ import { Download } from "./download";
|
|||||||
import { ManagerPort } from "./port";
|
import { ManagerPort } from "./port";
|
||||||
import { Scheduler } from "./scheduler";
|
import { Scheduler } from "./scheduler";
|
||||||
import { Limits } from "./limits";
|
import { Limits } from "./limits";
|
||||||
import { downloads, runtime, webRequest, CHROME } from "../browser";
|
import { downloads, runtime, webRequest, CHROME, OPERA } from "../browser";
|
||||||
|
|
||||||
const US = runtime.getURL("");
|
const US = runtime.getURL("");
|
||||||
|
|
||||||
@ -240,7 +240,7 @@ export class Manager extends EventEmitter {
|
|||||||
if (this.notifiedFinished || this.running.size || this.retrying.size) {
|
if (this.notifiedFinished || this.running.size || this.retrying.size) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (SOUNDS.value) {
|
if (SOUNDS.value && !OPERA) {
|
||||||
const audio = new Audio(runtime.getURL("/style/done.opus"));
|
const audio = new Audio(runtime.getURL("/style/done.opus"));
|
||||||
audio.addEventListener("canplaythrough", () => audio.play());
|
audio.addEventListener("canplaythrough", () => audio.play());
|
||||||
audio.addEventListener("ended", () => document.body.removeChild(audio));
|
audio.addEventListener("ended", () => document.body.removeChild(audio));
|
||||||
|
@ -25,6 +25,8 @@ RELEASE_ID = "{DDC359D1-844A-42a7-9AA1-88A850A938A8}"
|
|||||||
UNCOMPRESSABLE = set((".png", ".jpg", ".zip", ".woff2"))
|
UNCOMPRESSABLE = set((".png", ".jpg", ".zip", ".woff2"))
|
||||||
LICENSED = set((".css", ".html", ".js", "*.ts"))
|
LICENSED = set((".css", ".html", ".js", "*.ts"))
|
||||||
IGNORED = set((".DS_Store", "Thumbs.db"))
|
IGNORED = set((".DS_Store", "Thumbs.db"))
|
||||||
|
# XXX: #125
|
||||||
|
IGNORED_OPERA = set(("done.opus", "error.opus"))
|
||||||
|
|
||||||
PERM_IGNORED_FX = set(("downloads.shelf", "webRequest", "webRequestBlocking"))
|
PERM_IGNORED_FX = set(("downloads.shelf", "webRequest", "webRequestBlocking"))
|
||||||
PERM_IGNORED_CHROME = set(("menus", "sessions", "theme"))
|
PERM_IGNORED_CHROME = set(("menus", "sessions", "theme"))
|
||||||
@ -45,17 +47,17 @@ def check_licenses():
|
|||||||
raise Exception(f"No license in {file}")
|
raise Exception(f"No license in {file}")
|
||||||
|
|
||||||
|
|
||||||
def files():
|
def files(additional_ignored):
|
||||||
p = Path("")
|
p = Path("")
|
||||||
for pattern in FILES:
|
for pattern in FILES:
|
||||||
for file in sorted(p.glob(pattern)):
|
for file in sorted(p.glob(pattern)):
|
||||||
if file.name in IGNORED or not file.is_file():
|
if file.name in IGNORED or file.name in additional_ignored or not file.is_file():
|
||||||
continue
|
continue
|
||||||
yield file
|
yield file
|
||||||
|
|
||||||
def build(out, manifest):
|
def build(out, manifest, additional_ignored=set()):
|
||||||
with ZipFile(out, "w", compression=ZIP_DEFLATED, allowZip64=False, compresslevel=2) as zp:
|
with ZipFile(out, "w", compression=ZIP_DEFLATED, allowZip64=False, compresslevel=2) as zp:
|
||||||
for file in files():
|
for file in files(additional_ignored):
|
||||||
if str(file) == "manifest.json":
|
if str(file) == "manifest.json":
|
||||||
buf = manifest
|
buf = manifest
|
||||||
else:
|
else:
|
||||||
@ -101,7 +103,7 @@ def build_firefox(args):
|
|||||||
build(out, json.dumps(infos, indent=2).encode("utf-8"))
|
build(out, json.dumps(infos, indent=2).encode("utf-8"))
|
||||||
|
|
||||||
|
|
||||||
def build_chrome(args):
|
def build_chromium(args, pkg, additional_ignored=set()):
|
||||||
now = datetime.now().strftime("%Y%m%d%H%M%S")
|
now = datetime.now().strftime("%Y%m%d%H%M%S")
|
||||||
with open("manifest.json") as manip:
|
with open("manifest.json") as manip:
|
||||||
infos = json.load(manip, object_pairs_hook=OrderedDict)
|
infos = json.load(manip, object_pairs_hook=OrderedDict)
|
||||||
@ -119,13 +121,13 @@ def build_chrome(args):
|
|||||||
infos["name"] = f"{infos.get('name')} {args.mode}"
|
infos["name"] = f"{infos.get('name')} {args.mode}"
|
||||||
|
|
||||||
infos["permissions"] = [p for p in infos.get("permissions") if not p in PERM_IGNORED_CHROME]
|
infos["permissions"] = [p for p in infos.get("permissions") if not p in PERM_IGNORED_CHROME]
|
||||||
out = Path("web-ext-artifacts") / f"dta-{version}-{args.mode}-crx.zip"
|
out = Path("web-ext-artifacts") / f"dta-{version}-{args.mode}-{pkg}.zip"
|
||||||
if not out.parent.exists():
|
if not out.parent.exists():
|
||||||
out.parent.mkdir()
|
out.parent.mkdir()
|
||||||
if out.exists():
|
if out.exists():
|
||||||
out.unlink()
|
out.unlink()
|
||||||
print("Output", out)
|
print("Output", out)
|
||||||
build(out, json.dumps(infos, indent=2).encode("utf-8"))
|
build(out, json.dumps(infos, indent=2).encode("utf-8"), additional_ignored=additional_ignored)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
@ -140,7 +142,8 @@ def main():
|
|||||||
else:
|
else:
|
||||||
run([script], shell=True)
|
run([script], shell=True)
|
||||||
build_firefox(args)
|
build_firefox(args)
|
||||||
build_chrome(args)
|
build_chromium(args, "crx")
|
||||||
|
build_chromium(args, "opr", IGNORED_OPERA)
|
||||||
print("DONE.")
|
print("DONE.")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -19,7 +19,7 @@ import { iconForPath, visible } from "../lib/windowutils";
|
|||||||
import { VirtualTable } from "../uikit/lib/table";
|
import { VirtualTable } from "../uikit/lib/table";
|
||||||
import { Icons } from "./icons";
|
import { Icons } from "./icons";
|
||||||
import { $ } from "./winutil";
|
import { $ } from "./winutil";
|
||||||
import { runtime, storage } from "../lib/browser";
|
import { runtime, storage, OPERA } from "../lib/browser";
|
||||||
import "./theme";
|
import "./theme";
|
||||||
|
|
||||||
const ICON_BASE_SIZE = 16;
|
const ICON_BASE_SIZE = 16;
|
||||||
@ -558,7 +558,14 @@ addEventListener("DOMContentLoaded", async () => {
|
|||||||
new BoolPref("pref-manager-in-popup", "manager-in-popup");
|
new BoolPref("pref-manager-in-popup", "manager-in-popup");
|
||||||
new BoolPref("pref-queue-notification", "queue-notification");
|
new BoolPref("pref-queue-notification", "queue-notification");
|
||||||
new BoolPref("pref-finish-notification", "finish-notification");
|
new BoolPref("pref-finish-notification", "finish-notification");
|
||||||
new BoolPref("pref-sounds", "sounds");
|
// XXX: #125
|
||||||
|
const sounds = new BoolPref("pref-sounds", "sounds");
|
||||||
|
if (OPERA) {
|
||||||
|
const sp = sounds.elem.parentElement;
|
||||||
|
if (sp) {
|
||||||
|
sp.style.display = "none";
|
||||||
|
}
|
||||||
|
}
|
||||||
new BoolPref("pref-hide-context", "hide-context");
|
new BoolPref("pref-hide-context", "hide-context");
|
||||||
new BoolPref("pref-tooltip", "tooltip");
|
new BoolPref("pref-tooltip", "tooltip");
|
||||||
new BoolPref("pref-open-manager-on-queue", "open-manager-on-queue");
|
new BoolPref("pref-open-manager-on-queue", "open-manager-on-queue");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user