mirror of
https://github.com/osnr/TabFS.git
synced 2024-05-21 15:06:47 +02:00
Specify extension id in install.sh & check usage. Improve README.
This commit is contained in:
parent
f576b4c324
commit
140bd127df
68
README.md
68
README.md
|
@ -2,10 +2,28 @@
|
|||
|
||||
## Setup
|
||||
|
||||
You need to compile the FUSE filesystem (written in C), then install
|
||||
the browser extension which runs it and talks to it.
|
||||
First, install the browser extension.
|
||||
|
||||
### Run the C filesystem
|
||||
Then, install the C filesystem.
|
||||
|
||||
### Install the browser extension
|
||||
|
||||
(I think it will work on Edge or Opera or whatever, too. You'll need to
|
||||
change the native messaging path in install.sh in those cases.)
|
||||
|
||||
#### Chrome
|
||||
|
||||
Go to the [Chrome extensions page](chrome://extensions). Enable
|
||||
Developer mode (top-right corner).
|
||||
|
||||
Load-unpacked the `extension/` folder in this repo.
|
||||
|
||||
Get the extension ID.
|
||||
|
||||
#### Firefox
|
||||
|
||||
|
||||
### Install the C filesystem
|
||||
|
||||
First, make sure you `git submodule update --init` to get the
|
||||
`fs/cJSON` and `fs/base64` dependencies.
|
||||
|
@ -26,21 +44,43 @@ extension can launch and talk to the filesystem:
|
|||
$ ./install.sh [chrome | chromium | firefox]
|
||||
```
|
||||
|
||||
### Install the browser extension
|
||||
### Ready
|
||||
|
||||
I think it will work on Edge or Opera or whatever, too. You'll need to
|
||||
change the native messaging path in install.sh
|
||||
|
||||
#### Firefox
|
||||
|
||||
#### Chrome
|
||||
|
||||
Go to the [Chrome extensions page](chrome://extensions).
|
||||
|
||||
Enable Developer mode. Load-unpacked the `extension/` folder in this repo.
|
||||
Reload the extension in `chrome://extensions`.
|
||||
|
||||
Now your browser tabs should be mounted in `fs/mnt`!
|
||||
|
||||
## Examples of stuff you can do
|
||||
|
||||
(assuming your shell is in the `fs` subdirectory)
|
||||
|
||||
### List the titles of all the tabs you have open
|
||||
|
||||
```
|
||||
$ cat mnt/tabs/by-id/*/title
|
||||
GitHub
|
||||
Extensions
|
||||
TabFS/install.sh at master · osnr/TabFS
|
||||
Alternative Extension Distribution Options - Google Chrome
|
||||
Web Store Hosting and Updating - Google Chrome
|
||||
Home / Twitter
|
||||
...
|
||||
```
|
||||
|
||||
### Close all Stack Overflow tabs
|
||||
|
||||
```
|
||||
$ echo close | tee -a mnt/tabs/by-title/*Stack_Overflow*/control
|
||||
```
|
||||
|
||||
### Save text of all tabs to a file
|
||||
|
||||
(wip, FIXME)
|
||||
|
||||
```
|
||||
$ cat mnt/tabs/by-id/*/text > text.txt
|
||||
```
|
||||
|
||||
## Design
|
||||
|
||||
- `extension/`: Browser extension, written in JS
|
||||
|
|
12
install.sh
12
install.sh
|
@ -1,7 +1,14 @@
|
|||
#!/bin/bash -eux
|
||||
|
||||
if [[ ! ( ( "$1" == "firefox" && "$#" -eq 1 ) ||
|
||||
( "$1" == "chrome" && "$#" -eq 2 && ${#2} -eq 32) ||
|
||||
( "$1" == "chromium" && "$#" -eq 2 && ${#2} -eq 32) ) ]]; then
|
||||
echo "Usage: $0 <chrome EXTENSION_ID | chromium EXTENSION_ID | firefox>"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
OS="$(uname -s)"
|
||||
BROWSER="$(echo ${1:-chrome} | tr '[:upper:]' '[:lower:]')"
|
||||
BROWSER="$(echo $1 | tr '[:upper:]' '[:lower:]')"
|
||||
|
||||
# https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_manifests#Manifest_location
|
||||
# https://developer.chrome.com/extensions/nativeMessaging#native-messaging-host-location
|
||||
|
@ -27,6 +34,7 @@ EXE_PATH=$(pwd)/fs/tabfs
|
|||
|
||||
case "$BROWSER" in
|
||||
chrome | chromium)
|
||||
EXTENSION_ID=$2
|
||||
MANIFEST=$(cat <<EOF
|
||||
{
|
||||
"name": "$APP_NAME",
|
||||
|
@ -34,7 +42,7 @@ case "$BROWSER" in
|
|||
"path": "$EXE_PATH",
|
||||
"type": "stdio",
|
||||
"allowed_extensions": ["tabfs@rsnous.com"],
|
||||
"allowed_origins": ["chrome-extension://jimpolemfaeckpjijgapgkmolankohgj/"]
|
||||
"allowed_origins": ["chrome-extension://$EXTENSION_ID/"]
|
||||
}
|
||||
EOF
|
||||
);;
|
||||
|
|
Loading…
Reference in a new issue