Skip to content

Add Rucio as a client. Closes #59#60

Open
ogarcia wants to merge 3 commits into
got3nks:mainfrom
ogarcia:feat/rucio-client
Open

Add Rucio as a client. Closes #59#60
ogarcia wants to merge 3 commits into
got3nks:mainfrom
ogarcia:feat/rucio-client

Conversation

@ogarcia

@ogarcia ogarcia commented Jun 22, 2026

Copy link
Copy Markdown

This adds Rucio as a new client type. Rucio is a P2P file-sharing daemon — a native libp2p network (BLAKE3 / verified streaming) plus eMule/Kad2 compatibility — exposing a clean JSON REST API.

The PR is split into two commits so each concern is reviewable on its own:

1. Rucio: add client integration

A self-contained, working client integration following the existing five touch points:

  • server/lib/rucio/RucioClient.js — a fetch wrapper over the daemon API. Rucio has no built-in auth (it delegates to a reverse proxy), so connecting needs just a base URL; optional HTTP Basic credentials and a base path are supported for proxied / sub-path setups.
  • server/modules/rucioManager.jsBaseClientManager subclass. Downloads are addressed by a signed integer id (negative = eMule), so the manager keeps a hash → id map (rebuilt each fetchData) and translates the hash-based control methods into id-based REST calls. Stamps instanceId on every item so batch operations resolve the manager.
  • server/lib/clientMeta.js + downloadNormalizer.js — capability block and normalizers.
  • ClientRegistry/server.js + config.js wiring (RUCIO_* env vars).
  • Frontend — Rucio icon, a dedicated Rucio search source (unified rucio + eMule/Kad in one query), the Add-Client modal entry, and the first-run setup wizard step. The download-state map accepts both snake_case and PascalCase so it works against any daemon version.
  • Categories sync name, colour and download dir; create/edit/rename are wired to the daemon (with a graceful fallback if the daemon rejects a path it can't see).
  • Connection test support (configTester + the test endpoint), so the Test button works in both the wizard and the settings modal.

Capabilities: search, sharedFiles, categories, renameFile, cancelDeletesFiles, removeSharedMustDeleteFiles: false (Rucio can un-share via the API without deleting the file). No trackers, single-file.

2. Rucio: give it its own network type

Promotes Rucio from reusing the ed2k networkType to its own rucio networkType, so it's a first-class entity everywhere instead of being lumped in with aMule. No DB migration is needed (the metrics table is type-agnostic and the metrics API buckets per networkType dynamically). The hardcoded two-network (ed2k/bittorrent) dashboard is generalised to N networks:

  • useClientChartConfig returns a networks list; HomeView / StatisticsView / MobileSpeedWidget render one chart per connected network.
  • ClientFilterContext exposes a generic isNetworkTypeEnabled(); the Header filter toggles + per-instance chips and the Footer status/speed totals are built per connected network.
  • StatsWidget shows a per-network breakdown.
  • unifiedItemBuilder applies the source-based shape to any non-BitTorrent network, so ed2k and rucio share it.

Configuring an instance

Settings → Download Clients → Add → Rucio, or the first-run wizard, or env:
RUCIO_ENABLED=true
RUCIO_HOST=localhost
RUCIO_PORT=3003
optional: RUCIO_USE_SSL, RUCIO_BASE_PATH, RUCIO_USERNAME, RUCIO_PASSWORD

Testing

Verified end-to-end against a live Rucio daemon (0.32.0): connect; unified search returns real results; add (rucio: and ed2k:); pause / resume / cancel / delete; category assign + create/edit with colour + dir; the connection test; the per-network charts / filter toggles / stats / footer; the Add-Client modal and the first-run wizard with a Rucio-only setup.

ogarcia added 2 commits June 22, 2026 13:16
…ories)

Add Rucio (github.com/ogarcia/rucio) as a new client type — a P2P daemon
with a native libp2p network plus eMule/Kad2 compatibility, exposing a
JSON REST API.

Five touch points, following the existing client contract:
- server/lib/rucio/RucioClient.js: fetch wrapper over the daemon API (no
  auth needed; optional HTTP Basic + base path for reverse proxies).
- server/modules/rucioManager.js: BaseClientManager subclass. Downloads
  are addressed by a signed integer id (negative = eMule), so the manager
  keeps a hash->id map rebuilt each fetchData and translates the
  hash-based control methods into id-based REST calls.
- server/lib/clientMeta.js: capability block. Modelled under the 'ed2k'
  networkType because Rucio's profile matches aMule (search + shared
  files + categories, no trackers, single-file), so the unified pipeline
  and the search instance selector light up with no frontend branching.
- server/lib/downloadNormalizer.js: normalizers feeding the ed2k branch.
- ClientRegistry/server.js + config.js wiring (RUCIO_* env vars).

Frontend:
- A Rucio icon (ClientIcon + logo-rucio.svg) and a CLIENT_NAMES label.
- A dedicated "Rucio" search source button alongside ED2K Server / Kad /
  Prowlarr. The search widget now gates each source on the actual client
  TYPE connected (not just networkType), so the aMule ED2K/Kad buttons are
  not falsely enabled by a Rucio-only setup, and targets the matching
  instance type for the chosen source.
- The footer renders Rucio as its own status badge from a flat
  getNetworkStatus, and the ED2K/KAD headers are gated on an actual aMule
  instance being present, so a Rucio-only setup shows no phantom ED2K/KAD.
- The download state map accepts both snake_case and PascalCase, so the
  integration works against any daemon version.

Unified search spans Rucio's own network and eMule/Kad in one query. v1
is poll-based; the daemon's WebSocket push is left for a later iteration.
Until now Rucio reused the 'ed2k' networkType so the integration could land
without touching the dashboard. That conflated it with aMule: shared chart
series, shared filter toggle, shared stats and footer grouping, all labelled
"aMule". This makes Rucio a first-class network everywhere.

Backend (no DB migration — instance_metrics is type-agnostic and the metrics
API buckets per networkType dynamically):
- clientMeta: Rucio networkType 'ed2k' -> 'rucio'.
- unifiedItemBuilder: apply the source-based shape (sources, category id +
  name, ed2k-style link, no trackers, single-file) to any non-BitTorrent
  network, so ed2k and rucio share it.

Frontend — generalize the hardcoded two-network (ed2k/bittorrent) UI to N
networks so Rucio gets its own series/toggle/column:
- constants: NETWORK_NAMES + NETWORK_ORDER (ed2k=aMule, rucio=Rucio,
  bittorrent=BitTorrent).
- ClientFilterContext: generic isNetworkTypeEnabled() + rucioConnected /
  isRucioEnabled; the "don't disable everything" safety no longer assumes two
  types.
- useClientChartConfig: returns a `networks` list (connected+enabled, ordered)
  that the views map over; old booleans kept for back-compat.
- HomeView / StatisticsView: one speed/transfer chart per network.
- StatsWidget: per-network breakdown over N networks.
- MobileSpeedWidget: network selector built per connected network.
- Header: network filter toggles + per-instance chips built dynamically per
  connected network (Rucio instances were previously dropped from the groups).
- Footer: speed totals gated by isNetworkTypeEnabled (generic).
@got3nks

got3nks commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Hi @ogarcia, thanks for the contribution!

I will review it as soon as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants