diff options
-rw-r--r-- | .github/FUNDING.yml | 1 | ||||
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | extension/background.js | 1 | ||||
-rw-r--r-- | fs/Makefile | 1 | ||||
-rw-r--r-- | fs/tabfs.c | 14 | ||||
-rwxr-xr-x | install.sh | 8 | ||||
-rw-r--r-- | tabfs.md | 18 |
7 files changed, 36 insertions, 11 deletions
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..5f6219e --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: [osnr] @@ -1,3 +1,7 @@ # TabFS See <https://omar.website/tabfs/>. + +(**update**: You can now **[sponsor further development of +TabFS](https://github.com/sponsors/osnr)** and help to turn it from an +experiment into something really reliable and useful!) diff --git a/extension/background.js b/extension/background.js index 127f4f9..c660aee 100644 --- a/extension/background.js +++ b/extension/background.js @@ -237,6 +237,7 @@ router["/tabs/by-id"] = { router["/tabs/by-id/*/url.txt"] = withTab(tab => tab.url + "\n", buf => ({ url: buf })); router["/tabs/by-id/*/title.txt"] = withTab(tab => tab.title + "\n"); router["/tabs/by-id/*/text.txt"] = fromScript(`document.body.innerText`); + router["/tabs/by-id/*/source.html"] = fromScript(`document.body.innerHTML`); })(); (function() { let nextConsoleFh = 0; let consoleForFh = {}; diff --git a/fs/Makefile b/fs/Makefile index 658adb7..622c2df 100644 --- a/fs/Makefile +++ b/fs/Makefile @@ -36,3 +36,4 @@ unmount: killall -9 tabfs || true diskutil unmount force mnt || true fusermount -u mnt || true + umount -f mnt || true @@ -261,7 +261,7 @@ static int tabfs_open(const char *path, struct fuse_file_info *fi) { "open", path, fi->flags); parse_and_free_response(data, size, - "fh: %d", + "fh: %llu", &fi->fh); return 0; @@ -275,7 +275,7 @@ static int tabfs_read(const char *path, char *rdata; size_t rsize; exchange_json(&rdata, &rsize, - "op: %Q, path: %Q, size: %d, offset: %d, fh: %d, flags: %d", + "op: %Q, path: %Q, size: %d, offset: %d, fh: %llu, flags: %d", "read", path, size, offset, fi->fh, fi->flags); char *scan_buf; int scan_len; @@ -298,7 +298,7 @@ static int tabfs_write(const char *path, char *rdata; size_t rsize; exchange_json(&rdata, &rsize, - "op: %Q, path: %Q, buf: %V, offset: %d, fh: %d, flags: %d", + "op: %Q, path: %Q, buf: %V, offset: %d, fh: %llu, flags: %d", "write", path, data, size, offset, fi->fh, fi->flags); int ret; @@ -313,7 +313,7 @@ static int tabfs_release(const char *path, struct fuse_file_info *fi) { char *data; size_t size; exchange_json(&data, &size, - "op: %Q, path: %Q, fh: %d", + "op: %Q, path: %Q, fh: %llu", "release", path, fi->fh); parse_and_free_response(data, size, ""); @@ -329,7 +329,7 @@ static int tabfs_opendir(const char *path, struct fuse_file_info *fi) { "opendir", path, fi->flags); parse_and_free_response(rdata, rsize, - "fh: %d", + "fh: %llu", &fi->fh); return 0; @@ -365,7 +365,7 @@ static int tabfs_releasedir(const char *path, struct fuse_file_info *fi) { char *rdata; size_t rsize; exchange_json(&rdata, &rsize, - "op: %Q, path: %Q, fh: %d", + "op: %Q, path: %Q, fh: %llu", "releasedir", path, fi->fh); parse_and_free_response(rdata, rsize, ""); @@ -495,8 +495,10 @@ int main(int argc, char **argv) { argv[0], "-f", #if !defined(__APPLE__) +#if !defined(__FreeBSD__) "-oauto_unmount", #endif +#endif "-odirect_io", getenv("TABFS_MOUNT_DIR"), NULL, @@ -2,12 +2,14 @@ set -eux +# (Brave uses same path as Chrome, so for Brave, say `chrome`) if [[ "$#" -lt 1 || ( ! ( ( "$1" == "firefox" && "$#" -eq 1 ) || ( "$1" == "chrome" && "$#" -eq 2 && ${#2} -eq 32 ) || ( "$1" == "vivaldi" && "$#" -eq 2 && ${#2} -eq 32 ) || + ( "$1" == "chromebeta" && "$#" -eq 2 && ${#2} -eq 32 ) || ( "$1" == "chromium" && "$#" -eq 2 && ${#2} -eq 32 ) ) ) ]]; then - echo "Usage: $0 <chrome EXTENSION_ID | chromium EXTENSION_ID | vivaldi EXTENSION_ID | firefox>" + echo "Usage: $0 <chrome EXTENSION_ID | chromebeta EXTENSION_ID | chromium EXTENSION_ID | vivaldi EXTENSION_ID | firefox>" exit 2 fi @@ -33,6 +35,8 @@ case "$OS $BROWSER" in MANIFEST_LOCATION="$HOME/.config/vivaldi/NativeMessagingHosts";; "Darwin chrome") MANIFEST_LOCATION="$HOME/Library/Application Support/Google/Chrome/NativeMessagingHosts";; + "Darwin chromebeta") + MANIFEST_LOCATION="$HOME/Library/Application Support/Google/Chrome Beta/NativeMessagingHosts";; "Darwin chromium") MANIFEST_LOCATION="$HOME/Library/Application Support/Chromium/NativeMessagingHosts";; esac @@ -43,7 +47,7 @@ APP_NAME="com.rsnous.tabfs" EXE_PATH=$(pwd)/fs/tabfs case "$BROWSER" in - chrome | chromium | vivaldi) + chrome | chromium | chromebeta | vivaldi) EXTENSION_ID=$2 MANIFEST=$(cat <<EOF { @@ -24,6 +24,10 @@ mounts your browser tabs as a filesystem on your computer. Out of the box, it supports Chrome and (to a lesser extent[^firefox]) Firefox, on macOS and Linux.[^otherbrowsers] +(**update**: You can now **[sponsor further development of +TabFS](https://github.com/sponsors/osnr)** and help to turn it from an +experiment into something really reliable and useful!) + [^firefox]: because of the absence of the [chrome.debugger API for extensions](https://developer.chrome.com/docs/extensions/reference/debugger/). With a bit more plumbing, you could maybe find a way to connect it @@ -169,7 +173,7 @@ $ echo 'document.body.style.background = "green"' > mnt/tabs/last-focused/execut $ echo 'alert("hi!")' > mnt/tabs/last-focused/execute-script ``` -### Get images / scripts / etc on page +### Get images / scripts / other resource files from page (TODO: [document better](https://github.com/osnr/TabFS/issues/5), put in screenshots) @@ -177,9 +181,10 @@ The [`debugger/` subdirectory](https://github.com/osnr/TabFS/blob/fef9289e3a7f82cda6319d5f19d5a5f13f3cc44b/extension/background.js#L355) in each tab folder has synthetic files that let you access loaded resources (in `debugger/resources/`) and scripts (in -`debugger/scripts/`). +`debugger/scripts/`). -(this is experimental.) +Images will show up as actual PNG or JPEG files, scripts as actual JS +files, and so on. (this is experimental.) (TODO: edit the images in place? you can already kinda edit the scripts in place) @@ -482,6 +487,13 @@ TODO: make diagrams? GPLv3 +## Sponsors + +Thanks to [all the project sponsors](https://github.com/sponsors/osnr). Special +thanks to: + +<a href="https://oss.capital/"><img style="max-width: 50%" src="oss-capital.png"></a> + ## things that could/should be done (maybe you can do these? lots of people are [already pitching in on |