From c99fd56c7cb7e06749491384292d0a48e8ec953d Mon Sep 17 00:00:00 2001 From: Konstantin Schukraft Date: Sat, 2 Jan 2021 19:26:58 +0100 Subject: Add default log file and mountpoint to gitignore --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 4467a5b..12f12fd 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,6 @@ scratch fs/tabfs fs/tabfs.dSYM -test/test \ No newline at end of file +fs/log.txt +fs/mnt +test/test -- cgit v1.2.3 From 2c7e30217188f49097ce86b081b1a694822ab363 Mon Sep 17 00:00:00 2001 From: Konstantin Schukraft Date: Sat, 2 Jan 2021 19:30:36 +0100 Subject: Add FreeBSD compatibility --- fs/Makefile | 7 +++++++ fs/tabfs.c | 2 ++ install.sh | 8 +++++++- tabfs.md | 2 ++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/fs/Makefile b/fs/Makefile index e5a4b18..97ca01a 100644 --- a/fs/Makefile +++ b/fs/Makefile @@ -4,6 +4,9 @@ TARGETS = tabfs OSXFUSE_ROOT = /usr/local #OSXFUSE_ROOT = /opt/local +# Root for libraries from FreeBSD's ports +FREEBSD_ROOT = /usr/local + CFLAGS_EXTRA = -DFUSE_USE_VERSION=26 -D_FILE_OFFSET_BITS=64 -Wall -Wno-unused-function -g ifeq ($(shell uname -s),Linux) @@ -14,6 +17,10 @@ ifeq ($(shell uname -s),Darwin) CFLAGS = -I$(OSXFUSE_ROOT)/include/osxfuse/fuse -L$(OSXFUSE_ROOT)/lib -D_DARWIN_USE_64_BIT_INODE $(CFLAGS_EXTRA) LIBS = -losxfuse endif +ifeq ($(shell uname -s),FreeBSD) + CFLAGS += -L$(FREEBSD_ROOT)/lib -I$(FREEBSD_ROOT)/include $(CFLAGS_EXTRA) + LIBS = -lfuse +endif all: $(TARGETS) diff --git a/fs/tabfs.c b/fs/tabfs.c index c5ed91e..fecec22 100644 --- a/fs/tabfs.c +++ b/fs/tabfs.c @@ -216,6 +216,8 @@ int main(int argc, char **argv) { system(killcmd); #ifdef __APPLE__ system("diskutil umount force mnt > /dev/null"); +#elif __FreeBSD__ + system("umount -f mnt"); #else system("fusermount -u mnt"); #endif diff --git a/install.sh b/install.sh index fc0c3c3..bbc5379 100755 --- a/install.sh +++ b/install.sh @@ -1,4 +1,6 @@ -#!/bin/bash -eux +#!/usr/bin/env bash + +set -eux if [[ "$#" -lt 1 || ( ! ( ( "$1" == "firefox" && "$#" -eq 1 ) || @@ -16,10 +18,14 @@ BROWSER="$(echo $1 | tr '[:upper:]' '[:lower:]')" case "$OS $BROWSER" in "Linux firefox") MANIFEST_LOCATION="$HOME/.mozilla/native-messaging-hosts";; + "FreeBSD firefox") + MANIFEST_LOCATION="$HOME/.mozilla/native-messaging-hosts";; "Darwin firefox") MANIFEST_LOCATION="$HOME/Library/Application Support/Mozilla/NativeMessagingHosts";; "Linux chrome") MANIFEST_LOCATION="$HOME/.config/google-chrome/NativeMessagingHosts";; + "FreeBSD chromium") + MANIFEST_LOCATION="$HOME/.config/chromium/NativeMessagingHosts";; "Linux chromium") MANIFEST_LOCATION="$HOME/.config/chromium/NativeMessagingHosts";; "Darwin chrome") diff --git a/tabfs.md b/tabfs.md index d3eac54..32d521d 100644 --- a/tabfs.md +++ b/tabfs.md @@ -324,6 +324,8 @@ $ mkdir mnt $ make ``` +(GNU Make is required, so use gmake on FreeBSD) + Now install the native messaging host into your browser, so the extension can launch and talk to the filesystem: -- cgit v1.2.3 From dcce4221a2122c2d62c2f6c45761374dc8e08ecb Mon Sep 17 00:00:00 2001 From: Omar Rizwan Date: Sat, 2 Jan 2021 15:46:44 -0800 Subject: md updates --- tabfs.md | 48 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/tabfs.md b/tabfs.md index 32d521d..785124d 100644 --- a/tabfs.md +++ b/tabfs.md @@ -39,8 +39,8 @@ Firefox, on macOS and Linux.[^otherbrowsers] Each of your open tabs is mapped to a folder.
- - + +

I have 3 tabs open, and they map to 3 folders in TabFS

@@ -166,6 +166,20 @@ $ 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 + +(TODO: [document better](https://github.com/osnr/TabFS/issues/5), put in screenshots) + +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/`). (this is experimental) + +### Retrieve what's playing on YouTube Music: [youtube-music-tabfs](https://github.com/junhoyeo/youtube-music-tabfs) + +[thanks](https://www.reddit.com/r/programming/comments/kok4dw/tabfs_mount_your_browser_tabs_as_a_filesystem/ghtbgw1/) to [Junho Yeo](https://github.com/junhoyeo)! + ### Reload an extension when you edit its source code Suppose you're working on a Chrome extension (apart from this @@ -314,7 +328,9 @@ Choose manifest.json in the extension subfolder of this repo. First, make sure you have FUSE and FUSE headers. On Linux, for example, `sudo apt install libfuse-dev` or equivalent. On macOS, get [FUSE for -macOS](https://osxfuse.github.io/). +macOS](https://osxfuse.github.io/). (on macOS, also check [this +bug](https://github.com/osnr/TabFS/issues/11) -- TODO work out the +best path to explain here.) Then compile the C filesystem: @@ -363,7 +379,7 @@ in the extension's entry in the Chrome extensions page; in Firefox, click "Inspect")
- +
This console is also incredibly helpful for debugging anything that @@ -443,9 +459,12 @@ GPLv3 ## things that could/should be done -- add more synthetic files!! view DOM nodes, snapshot current HTML of - page, spelunk into living objects. see what your code is doing. make - more files writable also +(maybe you can do these?) + +- [add more synthetic files!! (it's just + JavaScript)](https://twitter.com/rsnous/status/1345113873792126976) + view DOM nodes, snapshot current HTML of page, spelunk into living + objects. see what your code is doing. make more files writable also - build more (GUI and CLI) tools on top, on both sides @@ -514,8 +533,8 @@ inside of the browser. 'browser tabs as files' Unix, and Unix is by far the more accessible and programmable and cohesive as a computing environment (it has concepts that compose! shell, processes, files), even though it's arguably the less important -to my daily life. how can the browser take on more of the properties -of Unix? +to my daily life. [how can the browser take on more of the properties +of Unix?](https://twitter.com/jcreed/status/1344982366243213312) - it's [way too hard](https://twitter.com/rsnous/status/1342236988938719232) to make a @@ -524,6 +543,11 @@ suggests making an extension is a whole Thing, a whole Project. like, why can't I just take a minute to ask my browser a question or tell it to automate something? lightness +- ["files are a sort of approachable 'bridge' that everyone knows how + to interact with" / files are like one of the first things you learn + if you know any programming language / "because of this fs thing any + beginner coding thing can make use of it now"](https://twitter.com/rsnous/status/1345490658836926464) + - a lot of existing uses of these browser control APIs are in an automation context: testing your code on a robotic browser as part of some pipeline. I'm much more interested in an interactive, @@ -596,9 +620,9 @@ files - my [fake filesystems talk](https://www.youtube.com/watch?v=pfHpDDXJQVg) - - it has the right idea for - how to set up userscripts. just make files -- don't make [your - own weird UI to add and remove + - [Witchcraft](https://luciopaiva.com/witchcraft/) has the right + idea for how to set up userscripts. just make files -- don't + make [your own weird UI to add and remove them](https://twitter.com/rsnous/status/1196536798312140800). (I guess there is a political or audience [tradeoff](https://twitter.com/rsnous/status/1290031845363466242) -- cgit v1.2.3