Skip to content
Merged
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
147 changes: 147 additions & 0 deletions .github/workflows/tron-headless.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# Build, smoke-test and publish ghcr.io/profullstack/tron-headless: the
# TronBrowser engine headless with CDP on :9222, for c0mpute browser nodes.
# Contract: docker/tron-headless/README.md.
#
# Pull requests that touch the image: build + smoke test, push nothing.
# v* tags (every TronBrowser release) and workflow_dispatch: smoke test, then
# push :vX.Y.Z and :latest (linux/amd64). Nothing is uploaded as a workflow
# artifact; the registry is the only output.
#
# Visibility: GHCR creates org packages PRIVATE and has no API to change it, so
# it is one click by an org admin: github.com/orgs/profullstack/packages ->
# tron-headless -> Package settings -> Change visibility -> Public. The last
# step warns until an anonymous pull works.
name: tron-headless image

on:
push:
tags: ['v*']
pull_request:
paths:
- 'docker/tron-headless/**'
- '.github/workflows/tron-headless.yml'
workflow_dispatch:
inputs:
version:
description: 'Tag to publish, e.g. 3.21.0 (pushed as v3.21.0 and latest)'
required: true

permissions:
contents: read

env:
IMAGE: ghcr.io/profullstack/tron-headless

concurrency:
group: tron-headless-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: false

jobs:
smoke:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: 22
# The smoke script has no dependencies; without this, setup-node v5
# sees package.json's packageManager and looks for pnpm.
package-manager-cache: false

- name: Build
run: docker build -t tron-headless:ci docker/tron-headless

- name: Run with the c0mpute node's flags
run: |
docker run -d --name th \
--cap-drop ALL --security-opt no-new-privileges \
--shm-size 1g --memory 2g \
-p 127.0.0.1:9222:9222 tron-headless:ci
test "$(docker exec th id -u):$(docker exec th id -g)" = "1000:1000"

- name: CDP smoke test (version, attach, navigate, screencast, screenshot)
run: node docker/tron-headless/smoke.mjs http://127.0.0.1:9222

- name: The container exits when its command exits
run: |
set -eu
docker run -d --name th-exit --cap-drop ALL --security-opt no-new-privileges \
--shm-size 1g tron-headless:ci bash -c 'sleep 3; exit 7'
code=$(timeout 60 docker wait th-exit)
test "$code" = "7"

- name: Container logs
if: always()
run: docker logs th 2>&1 | grep -v -E 'dbus|GLib-GIO' | tail -40 || true

publish:
needs: smoke
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
packages: write
steps:
- id: v
env:
EVENT: ${{ github.event_name }}
INPUT_VERSION: ${{ inputs.version }}
REF_NAME: ${{ github.ref_name }}
run: |
set -eu
if [ "$EVENT" = "workflow_dispatch" ]; then v="${INPUT_VERSION#v}"; else v="${REF_NAME#v}"; fi
echo "$v" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$' || { echo "not a release version: $v" >&2; exit 1; }
echo "tag=v$v" >> "$GITHUB_OUTPUT"
echo "version=$v" >> "$GITHUB_OUTPUT"

- uses: actions/checkout@v5
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
id: build
uses: docker/build-push-action@v6
with:
context: docker/tron-headless
platforms: linux/amd64
push: true
tags: |
${{ env.IMAGE }}:${{ steps.v.outputs.tag }}
${{ env.IMAGE }}:latest
labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.url=https://tronbrowser.dev
org.opencontainers.image.title=tron-headless
org.opencontainers.image.description=TronBrowser engine (ungoogled-chromium) headless, CDP on :9222, for c0mpute browser nodes
org.opencontainers.image.licenses=MIT
org.opencontainers.image.version=${{ steps.v.outputs.version }}
org.opencontainers.image.revision=${{ github.sha }}

- name: Inspect
env:
TAG: ${{ steps.v.outputs.tag }}
DIGEST: ${{ steps.build.outputs.digest }}
run: |
docker buildx imagetools inspect "${IMAGE}:${TAG}"
echo "${IMAGE}:${TAG} @ ${DIGEST}" >> "$GITHUB_STEP_SUMMARY"

- name: Check anonymous pull (package visibility)
env:
TAG: ${{ steps.v.outputs.tag }}
run: |
token=$(curl -fsS "https://ghcr.io/token?scope=repository:profullstack/tron-headless:pull" | jq -r .token)
code=$(curl -s -o /dev/null -w '%{http_code}' -H "Authorization: Bearer $token" \
-H 'Accept: application/vnd.oci.image.index.v1+json, application/vnd.docker.distribution.manifest.list.v2+json' \
"https://ghcr.io/v2/profullstack/tron-headless/manifests/${TAG}")
if [ "$code" = "200" ]; then
echo "anonymous pull works" >> "$GITHUB_STEP_SUMMARY"
else
echo "::warning::ghcr.io/profullstack/tron-headless is not public (HTTP $code): an org admin must set Package settings -> Change visibility -> Public"
echo "ghcr.io/profullstack/tron-headless is PRIVATE (HTTP $code): make it public in package settings" >> "$GITHUB_STEP_SUMMARY"
fi
6 changes: 3 additions & 3 deletions .github/workflows/windows-pit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches: [main]
paths:
- 'apps/desktop/launcher/**'
- 'apps/desktop/test/test_windows_pit.py'
- 'apps/desktop/test/test_*.py'
- 'apps/desktop/test/windows_pit_acceptance.py'
- 'apps/desktop/test/windows-pit-browser.mjs'
- 'apps/desktop/test/browser-driver/**'
Expand All @@ -17,7 +17,7 @@ on:
pull_request:
paths:
- 'apps/desktop/launcher/**'
- 'apps/desktop/test/test_windows_pit.py'
- 'apps/desktop/test/test_*.py'
- 'apps/desktop/test/windows_pit_acceptance.py'
- 'apps/desktop/test/windows-pit-browser.mjs'
- 'apps/desktop/test/browser-driver/**'
Expand Down Expand Up @@ -45,7 +45,7 @@ jobs:
with:
python-version: '3.12'
- name: Test helper and Windows launcher (no certificate imports)
run: python -B -m unittest discover -s apps/desktop/test -p test_windows_pit.py -v
run: python -B -m unittest discover -s apps/desktop/test -p 'test_*.py' -v

windows-browser:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ tron version
> clearnet names untouched. For every app on the box run `moshcode dns enable`
> instead. Details: [`docs/moshpit-pit-toggle.md`](docs/moshpit-pit-toggle.md).

> **🌱 Scallion** (Settings, and a sidebar button) is c0mpute's onion-style relay
> network. It is **off by default, experimental and unreviewed**, and today it
> cannot carry TronBrowser's traffic: the setting shows the c0mpute CLI's own
> readiness check and its blockers, and only routes once that check passes and a
> local Scallion SOCKS client is running. Details: [`docs/scallion.md`](docs/scallion.md).
>
> **`ghcr.io/profullstack/tron-headless`** is a headless Tron engine image with
> CDP on port 9222, used by c0mpute browser nodes. Details:
> [`docker/tron-headless/README.md`](docker/tron-headless/README.md).

Also packaged for **macOS · Windows · Debian/Ubuntu (.deb) · Fedora/RHEL (.rpm) ·
Arch (AUR) · Gentoo · NixOS · Snap · Flatpak · AppImage · FreeBSD** — and arm64
Linux phones (Librem 5 / PinePhone / Ubuntu Touch). See
Expand Down
49 changes: 49 additions & 0 deletions apps/desktop/extensions/ai-sidebar/background-helper.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,55 @@ describe('extension network helper requests', () => {
expectSimpleRequests();
});

it('refuses Scallion while the doctor is not ready and never touches the proxy', async () => {
fetchMock.mockImplementation(async (url) => ({
ok: true,
json: async () => url.endsWith('/scallion/start')
? { started: false, routing: false, ready: false, error: 'not-ready', blockers: ['independent security review is outstanding'] }
: {},
}));
const res = await send({ type: 'scallion-set', on: true });
expect(res).toMatchObject({ enabled: false, error: 'not-ready' });
expect(res.status.blockers).toEqual(['independent security review is outstanding']);
expect(chrome.proxy.settings.set).not.toHaveBeenCalled();
expect(helperCalls().map(([url, options]) => [new URL(url).pathname, options.method]))
.toEqual([['/scallion/start', 'POST']]);
expectSimpleRequests();
});

it('routes through a ready Scallion SOCKS client and reverts when traffic does not flow', async () => {
let verify = false;
fetchMock.mockImplementation(async (url) => {
if (url.startsWith('https://my.ip.pit.world/')) {
if (!verify) throw new Error('socks dead');
return { ok: true, json: async () => ({ ip: '203.0.113.7' }) };
}
return {
ok: true,
json: async () => url.endsWith('/scallion/start')
? { started: true, routing: true, ready: true, socks: '127.0.0.1:9095', host: '127.0.0.1', port: 9095 }
: { stopped: true },
};
});
const failed = await send({ type: 'scallion-set', on: true });
expect(failed).toMatchObject({ enabled: false, error: 'verify-failed' });
const sets = chrome.proxy.settings.set.mock.calls.map(([arg]) => arg.value);
expect(sets[0].rules.singleProxy).toEqual({ scheme: 'socks5', host: '127.0.0.1', port: 9095 });
expect(sets.at(-1)).toEqual({ mode: 'system' });
expect(helperCalls().map(([url]) => new URL(url).pathname)).toEqual(['/scallion/start', '/scallion/stop']);

verify = true;
expect(await send({ type: 'scallion-set', on: true })).toMatchObject({ enabled: true, check: { ok: true, ip: '203.0.113.7' } });
expect(chrome.privacy.network.webRTCIPHandlingPolicy.set).toHaveBeenCalledWith({ value: 'disable_non_proxied_udp' });
});

it('keeps Scallion and Tor exclusive', async () => {
chrome.storage.local.get.mockResolvedValue({ torEnabled: true });
expect(await send({ type: 'scallion-set', on: true })).toMatchObject({ enabled: false, error: 'tor-on' });
chrome.storage.local.get.mockResolvedValue({ scallionEnabled: true });
expect(await send({ type: 'pit-set', on: true })).toMatchObject({ enabled: false, error: 'scallion-on' });
});

it('uses POST for Tor mutations and GET only for status', async () => {
expect(await send({ type: 'tor-set', on: true })).toMatchObject({ enabled: true });
expect(await send({ type: 'tor-set', on: false })).toEqual({ enabled: false });
Expand Down
Loading
Loading