parent
26e9a5404a
commit
9ffc96de4d
@ -19,6 +19,9 @@ import {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
MenuClickInfo,
|
||||
CHROME,
|
||||
runtime,
|
||||
history,
|
||||
sessions,
|
||||
} from "./browser";
|
||||
import { Bus } from "./bus";
|
||||
import { filterInSitu } from "./util";
|
||||
@ -566,6 +569,43 @@ locale.then(() => {
|
||||
}
|
||||
|
||||
(async function init() {
|
||||
const urlBase = runtime.getURL("");
|
||||
history.onVisited.addListener(({url}: {url: string}) => {
|
||||
if (!url || !url.startsWith(urlBase)) {
|
||||
return;
|
||||
}
|
||||
history.deleteUrl({url});
|
||||
});
|
||||
const results: {url?: string}[] = await history.search({text: urlBase});
|
||||
for (const {url} of results) {
|
||||
if (!url) {
|
||||
continue;
|
||||
}
|
||||
history.deleteUrl({url});
|
||||
}
|
||||
|
||||
if (!CHROME) {
|
||||
const sessionRemover = async () => {
|
||||
for (const s of await sessions.getRecentlyClosed()) {
|
||||
if (s.tab) {
|
||||
if (s.tab.url.startsWith(urlBase)) {
|
||||
await sessions.forgetClosedTab(s.tab.windowId, s.tab.sessionId);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (!s.window || !s.window.tabs || s.window.tabs.length > 1) {
|
||||
continue;
|
||||
}
|
||||
const [tab] = s.window.tabs;
|
||||
if (tab.url.startsWith(urlBase)) {
|
||||
await sessions.forgetClosedWindow(s.window.sessionId);
|
||||
}
|
||||
}
|
||||
};
|
||||
sessions.onChanged.addListener(sessionRemover);
|
||||
await sessionRemover();
|
||||
}
|
||||
|
||||
await Prefs.set("last-run", new Date());
|
||||
Prefs.get("global-turbo", false).then(v => adjustAction(v));
|
||||
Prefs.on("global-turbo", (prefs, key, value) => {
|
||||
|
@ -39,13 +39,15 @@ export interface RawPort {
|
||||
postMessage: (message: any) => void;
|
||||
}
|
||||
|
||||
export const {extension} = polyfill;
|
||||
export const {notifications} = polyfill;
|
||||
export const {browserAction} = polyfill;
|
||||
export const {contextMenus} = polyfill;
|
||||
export const {downloads} = polyfill;
|
||||
export const {extension} = polyfill;
|
||||
export const {history} = polyfill;
|
||||
export const {menus} = polyfill;
|
||||
export const {notifications} = polyfill;
|
||||
export const {runtime} = polyfill;
|
||||
export const {sessions} = polyfill;
|
||||
export const {storage} = polyfill;
|
||||
export const {tabs} = polyfill;
|
||||
export const {webNavigation} = polyfill;
|
||||
|
@ -98,6 +98,7 @@ export async function select(links: BaseItem[], media: BaseItem[]) {
|
||||
type: "popup",
|
||||
});
|
||||
const window = await windows.create(windowOptions);
|
||||
tracker.track(window.id, null);
|
||||
try {
|
||||
const port = await Promise.race<Port>([
|
||||
new Promise<Port>(resolve => Bus.oncePort("select", resolve)),
|
||||
|
@ -21,6 +21,7 @@ export async function single(item: BaseItem | null) {
|
||||
type: "popup",
|
||||
});
|
||||
const window = await windows.create(windowOptions);
|
||||
tracker.track(window.id, null);
|
||||
try {
|
||||
const port: Port = await Promise.race<Port>([
|
||||
new Promise<Port>(resolve => Bus.oncePort("single", resolve)),
|
||||
|
@ -24,11 +24,13 @@
|
||||
"permissions": [
|
||||
"<all_urls>",
|
||||
"contextMenus",
|
||||
"menus",
|
||||
"downloads",
|
||||
"downloads.open",
|
||||
"downloads.shelf",
|
||||
"history",
|
||||
"menus",
|
||||
"notifications",
|
||||
"sessions",
|
||||
"storage",
|
||||
"tabs",
|
||||
"webNavigation",
|
||||
|
@ -27,7 +27,7 @@ LICENSED = set((".css", ".html", ".js", "*.ts"))
|
||||
IGNORED = set((".DS_Store", "Thumbs.db"))
|
||||
|
||||
PERM_IGNORED_FX = set(("downloads.shelf", "webRequest"))
|
||||
PERM_IGNORED_CHROME = set(("menus",))
|
||||
PERM_IGNORED_CHROME = set(("menus", "sessions"))
|
||||
|
||||
SCRIPTS = [
|
||||
"yarn build:regexps",
|
||||
|
Loading…
x
Reference in New Issue
Block a user