aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore4
-rw-r--r--fs/Makefile7
-rw-r--r--fs/tabfs.c2
-rwxr-xr-xinstall.sh8
-rw-r--r--tabfs.md50
5 files changed, 57 insertions, 14 deletions
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
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 f674216..90895f2 100644
--- a/fs/tabfs.c
+++ b/fs/tabfs.c
@@ -225,6 +225,8 @@ int main(int argc, char **argv) {
char unmountcmd[1000];
#ifdef __APPLE__
sprintf(unmountcmd, "diskutil umount force %s > /dev/null", mountdir);
+#elif __FreeBSD__
+ sprintf(unmountcmd, "umount -f %s", mountdir);
#else
sprintf(unmountcmd, "fusermount -u %s", mountdir);
#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..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.
<div class="figure">
-<img src="doc/00-browser.png" style="width: 70%">
-<img src="doc/00-finder.png" style="width: 80%; max-height: 1000px">
+<a href="doc/00-browser.png"><img src="doc/00-browser.png" style="width: 70%"></a>
+<a href="doc/00-finder.png"><img src="doc/00-finder.png" style="width: 80%; max-height: 1000px"></a>
<p class="caption" style="margin-top: -20px">I have 3 tabs open, and
they map to 3 folders in TabFS</p>
</div>
@@ -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:
@@ -324,6 +340,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:
@@ -361,7 +379,7 @@ in the extension's entry in the Chrome extensions page; in Firefox,
click "Inspect")
<div class="figure">
-<img style="max-width: 90%; max-height: 1000px" src="doc/inspector.png">
+<a href="doc/inspector.png"><img style="max-width: 90%; max-height: 1000px" src="doc/inspector.png"></a>
</div>
This console is also incredibly helpful for debugging anything that
@@ -441,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
@@ -512,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
@@ -522,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,
@@ -594,9 +620,9 @@ files
- my [fake filesystems talk](https://www.youtube.com/watch?v=pfHpDDXJQVg)
- - <https://luciopaiva.com/witchcraft/> 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)