From 8c4ceb3e4b8ba182594d1fabe052e45fdf261e3a Mon Sep 17 00:00:00 2001 From: Nils Maier Date: Tue, 10 Sep 2019 12:44:46 +0200 Subject: [PATCH] Privetize downloads --- lib/background.ts | 3 +++ scripts/gather.ts | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/lib/background.ts b/lib/background.ts index fcce28a..e9d983c 100644 --- a/lib/background.ts +++ b/lib/background.ts @@ -48,6 +48,9 @@ const CHROME_CONTEXTS = Object.freeze(new Set([ async function runContentJob(tab: Tab, file: string, msg: any) { try { + if (tab && tab.incognito && msg) { + msg.private = tab.incognito; + } const res = await tabs.executeScript(tab.id, { file, allFrames: true, diff --git a/scripts/gather.ts b/scripts/gather.ts index fa074dc..c452358 100644 --- a/scripts/gather.ts +++ b/scripts/gather.ts @@ -77,6 +77,8 @@ function urlToUsable(e: any, u: string) { } class Gatherer { + private: boolean; + textLinks: boolean; selectionOnly: boolean; @@ -88,6 +90,7 @@ class Gatherer { transferable: string[]; constructor(options: any) { + this.private = !!options.private; this.textLinks = options.textLinks; this.selectionOnly = options.selectionOnly; this.selection = options.selectionOnly ? getSelection() : null; @@ -255,6 +258,7 @@ class Gatherer { return { url: url.href, title, + private: this.private }; } catch (ex) {