Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ jobs:
- run: nimble build -d:debug --verbose --passL:-static
if: runner.os == 'Linux'

- run: nimble test -Y

- run: |
mv native_main.exe native_main
shell: bash
Expand All @@ -67,8 +69,6 @@ jobs:
lipo -create -output native_main native_main-x86 native_main-arm64
if: runner.os == 'macOS'

# - run: nimble test -Y

- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
Expand Down
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ This small application allows [Tridactyl](https://github.com/tridactyl/tridactyl
- write files to your computer
- launch applications, including opening `about:*` tabs in Firefox
- and generally do arbitrary stuff in userspace.
- from version 0.6.0 onwards, if `:set nativecontrol true` is set in the extension it can also send commands to Firefox.

It therefore greatly increases the amount of damage bugs in Tridactyl can do to your machine, although, arguably, not to your life, since almost all of that is on the internet anyway.

Expand All @@ -32,10 +33,35 @@ Three options:

# Testing

DIY testing:
```
nimble build
nimble test
```

For manual compatibility testing:

```
./gen_native_message.py cmd..getconfigpath | ./native_main | cut -b4- | jq 'walk( if type == "object" then with_entries(select(.value != null)) else . end)'
```

Swap `native_main` for the old `native_main.py` messenger to check compat.

# Controlling Firefox via the messenger

0.6.0+ supports sending an ex command to Firefox. First enable it in Tridactyl 1.26.0+ with `:set nativecontrol true`, then run:

```
~/.local/share/tridactyl/native_main --request 'tabopen https://example.com'
```

The default Windows path is `%USERPROFILE%\.tridactyl\native_main.exe`. If `XDG_DATA_HOME` is set, the Unix path is `$XDG_DATA_HOME/tridactyl/native_main`.

If more than one Firefox instance has opted in, the command reports their instance IDs. Select one by full ID or a unique prefix:

```
native_main --request 'reload' --instance 0123abcd
```

The bridge binds an ephemeral port on `127.0.0.1`, i.e. not accessible on the local network. Each native instance publishes a random ID, port and high-entropy authentication token in its per-user cache directory.

If you wish to reverse-engineer the protocol for doing stupid stuff like controlling Firefox across the network, you'l need to grab that token and forward the port.
1 change: 1 addition & 0 deletions nim.cfg
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
d:debug
--threads:on
Loading
Loading