mirror of
https://github.com/osnr/TabFS.git
synced 2024-06-16 12:45:01 +02:00
add tabs directory to window
This commit is contained in:
parent
6cf4c2630d
commit
bf7edaec22
|
@ -628,6 +628,24 @@ Routes["/windows"] = {
|
||||||
return { entries: [".", "..", ...windows.map(window => String(window.id))] };
|
return { entries: [".", "..", ...windows.map(window => String(window.id))] };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Routes["/windows/#WINDOW_ID/tabs"] = {
|
||||||
|
async readdir({windowId}) {
|
||||||
|
const tabs = await browser.tabs.query({windowId});
|
||||||
|
return { entries: [".", "..", ...tabs.map(tab => sanitize(String(tab.title) + "." + String(tab.id))) ] }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Routes["/windows/#WINDOW_ID/tabs/:TAB_TITLE.#TAB_ID"] = {
|
||||||
|
async readlink({tabId}) {
|
||||||
|
return { buf: "../../../tabs/by-id/" + tabId };
|
||||||
|
},
|
||||||
|
async unlink({tabId}) {
|
||||||
|
await browser.tabs.remove(tabId);
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Routes["/windows/last-focused"] = {
|
Routes["/windows/last-focused"] = {
|
||||||
description: `A symbolic link to /windows/[id for the last focused window].`,
|
description: `A symbolic link to /windows/[id for the last focused window].`,
|
||||||
async readlink() {
|
async readlink() {
|
||||||
|
@ -635,6 +653,7 @@ Routes["/windows/last-focused"] = {
|
||||||
return { buf: windowId };
|
return { buf: windowId };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
const withWindow = (readHandler, writeHandler) => makeRouteWithContents(async ({windowId}) => {
|
const withWindow = (readHandler, writeHandler) => makeRouteWithContents(async ({windowId}) => {
|
||||||
const window = await browser.windows.get(windowId);
|
const window = await browser.windows.get(windowId);
|
||||||
|
|
Loading…
Reference in a new issue