mirror of
https://github.com/osnr/TabFS.git
synced 2024-05-19 14:06:34 +02:00
Merge branch 'master' of github.com:osnr/TabFS
This commit is contained in:
commit
9f38203ebf
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -2,4 +2,6 @@
|
||||||
scratch
|
scratch
|
||||||
fs/tabfs
|
fs/tabfs
|
||||||
fs/tabfs.dSYM
|
fs/tabfs.dSYM
|
||||||
test/test
|
fs/log.txt
|
||||||
|
fs/mnt
|
||||||
|
test/test
|
||||||
|
|
|
@ -4,6 +4,9 @@ TARGETS = tabfs
|
||||||
OSXFUSE_ROOT = /usr/local
|
OSXFUSE_ROOT = /usr/local
|
||||||
#OSXFUSE_ROOT = /opt/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
|
CFLAGS_EXTRA = -DFUSE_USE_VERSION=26 -D_FILE_OFFSET_BITS=64 -Wall -Wno-unused-function -g
|
||||||
|
|
||||||
ifeq ($(shell uname -s),Linux)
|
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)
|
CFLAGS = -I$(OSXFUSE_ROOT)/include/osxfuse/fuse -L$(OSXFUSE_ROOT)/lib -D_DARWIN_USE_64_BIT_INODE $(CFLAGS_EXTRA)
|
||||||
LIBS = -losxfuse
|
LIBS = -losxfuse
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(shell uname -s),FreeBSD)
|
||||||
|
CFLAGS += -L$(FREEBSD_ROOT)/lib -I$(FREEBSD_ROOT)/include $(CFLAGS_EXTRA)
|
||||||
|
LIBS = -lfuse
|
||||||
|
endif
|
||||||
|
|
||||||
all: $(TARGETS)
|
all: $(TARGETS)
|
||||||
|
|
||||||
|
|
|
@ -225,6 +225,8 @@ int main(int argc, char **argv) {
|
||||||
char unmountcmd[1000];
|
char unmountcmd[1000];
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
sprintf(unmountcmd, "diskutil umount force %s > /dev/null", mountdir);
|
sprintf(unmountcmd, "diskutil umount force %s > /dev/null", mountdir);
|
||||||
|
#elif __FreeBSD__
|
||||||
|
sprintf(unmountcmd, "umount -f %s", mountdir);
|
||||||
#else
|
#else
|
||||||
sprintf(unmountcmd, "fusermount -u %s", mountdir);
|
sprintf(unmountcmd, "fusermount -u %s", mountdir);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
#!/bin/bash -eux
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -eux
|
||||||
|
|
||||||
if [[ "$#" -lt 1 || (
|
if [[ "$#" -lt 1 || (
|
||||||
! ( ( "$1" == "firefox" && "$#" -eq 1 ) ||
|
! ( ( "$1" == "firefox" && "$#" -eq 1 ) ||
|
||||||
|
@ -16,10 +18,14 @@ BROWSER="$(echo $1 | tr '[:upper:]' '[:lower:]')"
|
||||||
case "$OS $BROWSER" in
|
case "$OS $BROWSER" in
|
||||||
"Linux firefox")
|
"Linux firefox")
|
||||||
MANIFEST_LOCATION="$HOME/.mozilla/native-messaging-hosts";;
|
MANIFEST_LOCATION="$HOME/.mozilla/native-messaging-hosts";;
|
||||||
|
"FreeBSD firefox")
|
||||||
|
MANIFEST_LOCATION="$HOME/.mozilla/native-messaging-hosts";;
|
||||||
"Darwin firefox")
|
"Darwin firefox")
|
||||||
MANIFEST_LOCATION="$HOME/Library/Application Support/Mozilla/NativeMessagingHosts";;
|
MANIFEST_LOCATION="$HOME/Library/Application Support/Mozilla/NativeMessagingHosts";;
|
||||||
"Linux chrome")
|
"Linux chrome")
|
||||||
MANIFEST_LOCATION="$HOME/.config/google-chrome/NativeMessagingHosts";;
|
MANIFEST_LOCATION="$HOME/.config/google-chrome/NativeMessagingHosts";;
|
||||||
|
"FreeBSD chromium")
|
||||||
|
MANIFEST_LOCATION="$HOME/.config/chromium/NativeMessagingHosts";;
|
||||||
"Linux chromium")
|
"Linux chromium")
|
||||||
MANIFEST_LOCATION="$HOME/.config/chromium/NativeMessagingHosts";;
|
MANIFEST_LOCATION="$HOME/.config/chromium/NativeMessagingHosts";;
|
||||||
"Darwin chrome")
|
"Darwin chrome")
|
||||||
|
|
50
tabfs.md
50
tabfs.md
|
@ -39,8 +39,8 @@ Firefox, on macOS and Linux.[^otherbrowsers]
|
||||||
Each of your open tabs is mapped to a folder.
|
Each of your open tabs is mapped to a folder.
|
||||||
|
|
||||||
<div class="figure">
|
<div class="figure">
|
||||||
<img src="doc/00-browser.png" style="width: 70%">
|
<a href="doc/00-browser.png"><img src="doc/00-browser.png" style="width: 70%"></a>
|
||||||
<img src="doc/00-finder.png" style="width: 80%; max-height: 1000px">
|
<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
|
<p class="caption" style="margin-top: -20px">I have 3 tabs open, and
|
||||||
they map to 3 folders in TabFS</p>
|
they map to 3 folders in TabFS</p>
|
||||||
</div>
|
</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
|
$ 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
|
### Reload an extension when you edit its source code
|
||||||
|
|
||||||
Suppose you're working on a Chrome extension (apart from this
|
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,
|
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
|
`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:
|
Then compile the C filesystem:
|
||||||
|
|
||||||
|
@ -324,6 +340,8 @@ $ mkdir mnt
|
||||||
$ make
|
$ make
|
||||||
```
|
```
|
||||||
|
|
||||||
|
(GNU Make is required, so use gmake on FreeBSD)
|
||||||
|
|
||||||
Now install the native messaging host into your browser, so the
|
Now install the native messaging host into your browser, so the
|
||||||
extension can launch and talk to the filesystem:
|
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")
|
click "Inspect")
|
||||||
|
|
||||||
<div class="figure">
|
<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>
|
</div>
|
||||||
|
|
||||||
This console is also incredibly helpful for debugging anything that
|
This console is also incredibly helpful for debugging anything that
|
||||||
|
@ -441,9 +459,12 @@ GPLv3
|
||||||
|
|
||||||
## things that could/should be done
|
## things that could/should be done
|
||||||
|
|
||||||
- add more synthetic files!! view DOM nodes, snapshot current HTML of
|
(maybe you can do these?)
|
||||||
page, spelunk into living objects. see what your code is doing. make
|
|
||||||
more files writable also
|
- [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
|
- 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
|
Unix, and Unix is by far the more accessible and programmable and
|
||||||
cohesive as a computing environment (it has concepts that compose!
|
cohesive as a computing environment (it has concepts that compose!
|
||||||
shell, processes, files), even though it's arguably the less important
|
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
|
to my daily life. [how can the browser take on more of the properties
|
||||||
of Unix?
|
of Unix?](https://twitter.com/jcreed/status/1344982366243213312)
|
||||||
|
|
||||||
- it's [way too
|
- it's [way too
|
||||||
hard](https://twitter.com/rsnous/status/1342236988938719232) to make a
|
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
|
why can't I just take a minute to ask my browser a question or tell it
|
||||||
to automate something? lightness
|
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
|
- a lot of existing uses of these browser control APIs are in an
|
||||||
automation context: testing your code on a robotic browser as part
|
automation context: testing your code on a robotic browser as part
|
||||||
of some pipeline. I'm much more interested in an interactive,
|
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)
|
- my [fake filesystems talk](https://www.youtube.com/watch?v=pfHpDDXJQVg)
|
||||||
|
|
||||||
- <https://luciopaiva.com/witchcraft/> it has the right idea for
|
- [Witchcraft](https://luciopaiva.com/witchcraft/) has the right
|
||||||
how to set up userscripts. just make files -- don't make [your
|
idea for how to set up userscripts. just make files -- don't
|
||||||
own weird UI to add and remove
|
make [your own weird UI to add and remove
|
||||||
them](https://twitter.com/rsnous/status/1196536798312140800). (I
|
them](https://twitter.com/rsnous/status/1196536798312140800). (I
|
||||||
guess there is a political or audience
|
guess there is a political or audience
|
||||||
[tradeoff](https://twitter.com/rsnous/status/1290031845363466242)
|
[tradeoff](https://twitter.com/rsnous/status/1290031845363466242)
|
||||||
|
|
Loading…
Reference in a new issue