rebuild rtorrent config

This commit is contained in:
Mateusz Gruszczyński
2026-05-27 22:31:22 +02:00
parent a8adee0f2f
commit 80c71c8d79
4 changed files with 485 additions and 81 deletions

View File

@@ -3,45 +3,347 @@ from __future__ import annotations
from .client import *
RTORRENT_CONFIG_FIELDS = [
{"group": "Directories", "key": "directory.default", "label": "Default download directory", "type": "text"},
{"group": "Directories", "key": "session.path", "label": "Session path", "type": "text"},
{"group": "Directories", "key": "system.cwd", "label": "Working directory", "type": "text", "readonly": True},
{"group": "Network", "key": "network.port_range", "label": "Incoming port range", "type": "text", "placeholder": "49164-49164"},
{"group": "Network", "key": "network.port_random", "label": "Random incoming port", "type": "bool"},
{"group": "Network", "key": "network.bind_address", "label": "Bind address", "type": "text", "placeholder": "0.0.0.0"},
{"group": "Network", "key": "network.local_address", "label": "Local address", "type": "text"},
{"group": "Network", "key": "network.max_open_files", "label": "Max open files", "type": "number"},
{"group": "Network", "key": "network.max_open_sockets", "label": "Max open sockets", "type": "number"},
{"group": "Network", "key": "network.http.max_open", "label": "Max HTTP connections", "type": "number"},
{"group": "Network", "key": "network.http.ssl_verify_peer", "label": "Verify SSL peers", "type": "bool"},
{"group": "Network", "key": "network.xmlrpc.size_limit", "label": "XML-RPC upload size limit", "type": "text", "placeholder": "16M"},
{"group": "Peers", "key": "throttle.min_peers.normal", "label": "Min peers downloading", "type": "number"},
{"group": "Peers", "key": "throttle.max_peers.normal", "label": "Max peers downloading", "type": "number"},
{"group": "Peers", "key": "throttle.min_peers.seed", "label": "Min peers seeding", "type": "number"},
{"group": "Peers", "key": "throttle.max_peers.seed", "label": "Max peers seeding", "type": "number"},
{"group": "Peers", "key": "trackers.numwant", "label": "Tracker numwant", "type": "number"},
{"group": "Throttle", "key": "throttle.global_down.max_rate", "label": "Global download limit B/s", "type": "number"},
{"group": "Throttle", "key": "throttle.global_up.max_rate", "label": "Global upload limit B/s", "type": "number"},
{"group": "Throttle", "key": "throttle.max_downloads.global", "label": "Max active downloads", "type": "number"},
{"group": "Throttle", "key": "throttle.max_uploads.global", "label": "Max active uploads", "type": "number"},
{"group": "Throttle", "key": "throttle.max_downloads.div", "label": "Max downloads per throttle", "type": "number"},
{"group": "Throttle", "key": "throttle.max_uploads.div", "label": "Max uploads per throttle", "type": "number"},
{"group": "DHT / PEX", "key": "dht.mode", "label": "DHT mode", "type": "text", "placeholder": "disable/off/auto/on"},
{"group": "DHT / PEX", "key": "dht.port", "label": "DHT port", "type": "number"},
{"group": "DHT / PEX", "key": "protocol.pex", "label": "Peer exchange", "type": "bool"},
{"group": "Protocol", "key": "protocol.encryption.set", "label": "Encryption flags", "type": "text", "placeholder": "allow_incoming,try_outgoing,enable_retry"},
{"group": "Protocol", "key": "protocol.connection.leech", "label": "Leech connection type", "type": "text", "placeholder": "leech"},
{"group": "Protocol", "key": "protocol.connection.seed", "label": "Seed connection type", "type": "text", "placeholder": "seed"},
{"group": "Files", "key": "pieces.hash.on_completion", "label": "Hash check on completion", "type": "bool"},
{"group": "Files", "key": "pieces.preload.type", "label": "Pieces preload type", "type": "number"},
{"group": "Files", "key": "pieces.preload.min_size", "label": "Pieces preload min size", "type": "number"},
{"group": "Files", "key": "pieces.preload.min_rate", "label": "Pieces preload min rate", "type": "number"},
{"group": "Files", "key": "system.file.allocate", "label": "File allocation", "type": "number"},
{"group": "Files", "key": "system.file.max_size", "label": "Max file size", "type": "number"},
{"group": "System", "key": "system.umask", "label": "File umask", "type": "text", "placeholder": "0002"},
{"group": "System", "key": "system.hostname", "label": "Hostname", "type": "text", "readonly": True},
{"group": "System", "key": "system.client_version", "label": "Client version", "type": "text", "readonly": True},
{"group": "System", "key": "system.library_version", "label": "Library version", "type": "text", "readonly": True},
{
"group": "Directories",
"key": "directory.default",
"label": "Default download directory",
"type": "text",
"description": "Main destination for new downloads added without an explicit directory.",
"recommendation": "Use a stable absolute path on storage with enough free space; avoid changing it while active torrents use relative paths.",
},
{
"group": "Directories",
"key": "session.path",
"label": "Session path",
"type": "text",
"description": "Directory where rTorrent stores session state, resume data and internal torrent metadata.",
"recommendation": "Keep it on reliable local storage and include it in backups before maintenance.",
},
{
"group": "Directories",
"key": "system.cwd",
"label": "Working directory",
"type": "text",
"readonly": True,
"description": "Current rTorrent process working directory reported by rTorrent.",
"recommendation": "Read-only diagnostic value; change it in the service or startup configuration if needed.",
},
{
"group": "Network",
"key": "network.port_range",
"label": "Incoming port range",
"type": "text",
"placeholder": "49164-49164",
"description": "TCP port or range used for incoming peer connections.",
"recommendation": "Use a fixed forwarded port, for example 49164-49164, for stable connectivity.",
},
{
"group": "Network",
"key": "network.port_random",
"label": "Random incoming port",
"type": "bool",
"description": "Lets rTorrent select a random incoming port on startup.",
"recommendation": "Disable it when using router/NAT forwarding; fixed ports are easier to monitor.",
},
{
"group": "Network",
"key": "network.bind_address",
"label": "Bind address",
"type": "text",
"placeholder": "0.0.0.0",
"description": "Local interface address used for peer traffic binding.",
"recommendation": "Leave empty unless the host has multiple interfaces or policy routing.",
},
{
"group": "Network",
"key": "network.local_address",
"label": "Announced local address",
"type": "text",
"description": "Address rTorrent may announce as its local network address.",
"recommendation": "Usually leave empty; set only when a specific advertised address is required.",
},
{
"group": "Network",
"key": "network.max_open_files",
"label": "Max open files",
"type": "number",
"description": "Maximum number of files rTorrent can keep open at once.",
"recommendation": "Raise together with the OS file descriptor limit on large seeds.",
},
{
"group": "Network",
"key": "network.max_open_sockets",
"label": "Max open sockets",
"type": "number",
"description": "Upper bound for peer and tracker sockets opened by rTorrent.",
"recommendation": "Keep below OS limits; increase gradually when many torrents are active.",
},
{
"group": "Network",
"key": "network.http.max_open",
"label": "Max HTTP connections",
"type": "number",
"description": "Maximum simultaneous HTTP connections for tracker and metadata requests.",
"recommendation": "Moderate values reduce tracker pressure; increase only if tracker requests queue up.",
},
{
"group": "Network",
"key": "network.http.ssl_verify_peer",
"label": "Verify SSL peers",
"type": "bool",
"description": "Controls certificate verification for HTTPS tracker connections.",
"recommendation": "Keep enabled unless a private tracker has a known certificate problem.",
},
{
"group": "Network",
"key": "network.xmlrpc.size_limit",
"label": "XML-RPC upload size limit",
"type": "text",
"placeholder": "16M",
"description": "Maximum XML-RPC payload size accepted by rTorrent.",
"recommendation": "Keep enough headroom for large UI responses; avoid very high values on public endpoints.",
},
{
"group": "Peers",
"key": "throttle.min_peers.normal",
"label": "Min peers while downloading",
"type": "number",
"description": "Minimum peer target for incomplete torrents.",
"recommendation": "Use a conservative floor; too high values can waste sockets on weak swarms.",
},
{
"group": "Peers",
"key": "throttle.max_peers.normal",
"label": "Max peers while downloading",
"type": "number",
"description": "Maximum peer target for incomplete torrents.",
"recommendation": "Increase for fast lines, but keep total sockets and CPU usage under control.",
},
{
"group": "Peers",
"key": "throttle.min_peers.seed",
"label": "Min peers while seeding",
"type": "number",
"description": "Minimum peer target for complete torrents.",
"recommendation": "Lower than download min peers is usually enough for long-term seeding.",
},
{
"group": "Peers",
"key": "throttle.max_peers.seed",
"label": "Max peers while seeding",
"type": "number",
"description": "Maximum peer target for complete torrents.",
"recommendation": "Avoid excessive values on many seeding torrents because sockets multiply quickly.",
},
{
"group": "Peers",
"key": "trackers.numwant",
"label": "Tracker numwant",
"type": "number",
"description": "Number of peers requested from trackers per announce where supported.",
"recommendation": "Use moderate values; many trackers cap this server-side anyway.",
},
{
"group": "Throttle",
"key": "throttle.global_down.max_rate",
"label": "Global download limit B/s",
"type": "number",
"description": "Global download speed cap in bytes per second. Zero usually means unlimited.",
"recommendation": "Leave unlimited or cap below line speed if other services share the connection.",
},
{
"group": "Throttle",
"key": "throttle.global_up.max_rate",
"label": "Global upload limit B/s",
"type": "number",
"description": "Global upload speed cap in bytes per second. Zero usually means unlimited.",
"recommendation": "Keep below real upstream capacity to avoid bufferbloat and slow downloads.",
},
{
"group": "Throttle",
"key": "throttle.max_downloads.global",
"label": "Max active downloads",
"type": "number",
"description": "Maximum number of downloading torrents active at once.",
"recommendation": "Match disk and network capacity; fewer active downloads often finish faster.",
},
{
"group": "Throttle",
"key": "throttle.max_uploads.global",
"label": "Max active uploads",
"type": "number",
"description": "Maximum number of uploading torrents active at once.",
"recommendation": "Keep enough slots for ratio goals without overloading disks and sockets.",
},
{
"group": "Throttle",
"key": "throttle.max_downloads.div",
"label": "Max downloads per throttle",
"type": "number",
"description": "Per-throttle download slot divisor used by rTorrent throttling logic.",
"recommendation": "Change only when using named throttle groups or advanced queues.",
},
{
"group": "Throttle",
"key": "throttle.max_uploads.div",
"label": "Max uploads per throttle",
"type": "number",
"description": "Per-throttle upload slot divisor used by rTorrent throttling logic.",
"recommendation": "Change only when using named throttle groups or advanced queues.",
},
{
"group": "DHT / PEX",
"key": "dht.mode",
"label": "DHT mode",
"type": "text",
"placeholder": "disable/off/auto/on",
"description": "Controls Distributed Hash Table usage for peer discovery.",
"recommendation": "Private-tracker setups often disable DHT; public torrents usually benefit from auto/on.",
},
{
"group": "DHT / PEX",
"key": "dht.port",
"label": "DHT port",
"type": "number",
"description": "UDP port used by DHT traffic.",
"recommendation": "Use the same forwarded port strategy as incoming TCP when DHT is enabled.",
},
{
"group": "DHT / PEX",
"key": "protocol.pex",
"label": "Peer exchange",
"type": "bool",
"description": "Enables Peer Exchange peer discovery between connected peers.",
"recommendation": "Disable for strict private-tracker policies; enable for public swarms if allowed.",
},
{
"group": "DHT / PEX",
"key": "trackers.use_udp",
"label": "UDP trackers",
"type": "bool",
"description": "Allows rTorrent to use UDP trackers where supported.",
"recommendation": "Keep enabled for public torrents unless the network blocks UDP tracker traffic.",
},
{
"group": "Protocol",
"key": "protocol.encryption.set",
"label": "Encryption flags",
"type": "text",
"placeholder": "allow_incoming,try_outgoing,enable_retry",
"description": "Encryption policy flags for peer connections.",
"recommendation": "Prefer permissive settings unless a tracker or network requires strict encryption.",
},
{
"group": "Protocol",
"key": "protocol.connection.leech",
"label": "Leech connection type",
"type": "text",
"placeholder": "leech",
"description": "Connection behavior profile used by incomplete torrents.",
"recommendation": "Leave default unless tuning advanced libTorrent behavior.",
},
{
"group": "Protocol",
"key": "protocol.connection.seed",
"label": "Seed connection type",
"type": "text",
"placeholder": "seed",
"description": "Connection behavior profile used by complete torrents.",
"recommendation": "Leave default unless tuning advanced libTorrent behavior.",
},
{
"group": "Files",
"key": "pieces.hash.on_completion",
"label": "Hash check on completion",
"type": "bool",
"description": "Runs a hash verification after a torrent completes.",
"recommendation": "Enable for data integrity when storage is unreliable; disable if completion checks are too expensive.",
},
{
"group": "Files",
"key": "pieces.preload.type",
"label": "Pieces preload type",
"type": "number",
"description": "Controls how rTorrent preloads torrent pieces from disk.",
"recommendation": "Keep default unless you are tuning disk cache behavior for a known workload.",
},
{
"group": "Files",
"key": "pieces.preload.min_size",
"label": "Pieces preload min size",
"type": "number",
"description": "Minimum piece size threshold for preload behavior.",
"recommendation": "Keep default unless large-piece torrents show disk latency issues.",
},
{
"group": "Files",
"key": "pieces.preload.min_rate",
"label": "Pieces preload min rate",
"type": "number",
"description": "Minimum transfer rate threshold for preloading pieces.",
"recommendation": "Tune only after measuring disk read pressure.",
},
{
"group": "Files",
"key": "pieces.memory.max",
"label": "Pieces memory max",
"type": "text",
"placeholder": "512M",
"description": "Maximum memory rTorrent may use for piece handling where supported.",
"recommendation": "Avoid values that compete with OS page cache; increase only on hosts with spare RAM.",
},
{
"group": "Files",
"key": "system.file.allocate",
"label": "File allocation",
"type": "number",
"description": "Controls preallocation behavior for downloaded files.",
"recommendation": "Preallocation can reduce fragmentation but may slow adding very large torrents.",
},
{
"group": "Files",
"key": "system.file.max_size",
"label": "Max file size",
"type": "number",
"description": "Maximum single file size rTorrent accepts where supported.",
"recommendation": "Leave default unless you intentionally need to block oversized files.",
},
{
"group": "System",
"key": "system.umask",
"label": "File umask",
"type": "text",
"placeholder": "0002",
"description": "Permission mask applied to files created by rTorrent.",
"recommendation": "Use 0002 for shared media groups, 0022 for private single-user setups.",
},
{
"group": "System",
"key": "system.hostname",
"label": "Hostname",
"type": "text",
"readonly": True,
"description": "Hostname reported by the rTorrent runtime.",
"recommendation": "Read-only diagnostic value.",
},
{
"group": "System",
"key": "system.client_version",
"label": "Client version",
"type": "text",
"readonly": True,
"description": "rTorrent client version reported through XML-RPC.",
"recommendation": "Read-only diagnostic value useful when checking compatibility.",
},
{
"group": "System",
"key": "system.library_version",
"label": "Library version",
"type": "text",
"readonly": True,
"description": "libTorrent library version used by rTorrent.",
"recommendation": "Read-only diagnostic value useful when checking compatibility.",
},
]

File diff suppressed because one or more lines are too long

View File

@@ -1950,45 +1950,123 @@ body.mobile-mode .mobile-filter-bar {
}
}
.rt-config-grid {
.rt-config-shell {
display: grid;
gap: 0.6rem;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: 0.85rem;
}
.rt-config-group {
grid-column: 1 / -1;
padding: 0.45rem 0.2rem 0.1rem;
border-bottom: 1px solid var(--bs-border-color);
.rt-config-section {
border: 1px solid var(--bs-border-color);
border-radius: 0.85rem;
background: rgba(var(--bs-secondary-bg-rgb), 0.22);
overflow: hidden;
}
.rt-config-section > summary {
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
padding: 0.75rem 0.9rem;
cursor: pointer;
list-style: none;
}
.rt-config-section > summary::-webkit-details-marker {
display: none;
}
.rt-config-section > summary span {
display: inline-flex;
align-items: center;
gap: 0.45rem;
color: var(--bs-primary-text-emphasis);
font-weight: 800;
}
.rt-config-section > summary small {
max-width: 58ch;
color: var(--bs-secondary-color);
font-size: 0.76rem;
text-align: right;
}
.rt-config-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 0.75rem;
padding: 0 0.9rem 0.9rem;
}
.rt-config-note {
margin-bottom: 0.75rem;
}
.rt-config-toolbar {
.rt-config-toolbar,
.rt-config-actions {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 0.75rem;
gap: 0.55rem;
}
.rt-config-toolbar {
margin-bottom: 0.75rem;
}
.rt-config-row {
.rt-config-card {
display: grid;
grid-template-columns: 1fr minmax(120px, 190px);
align-items: center;
gap: 0.6rem;
padding: 0.6rem;
gap: 0.55rem;
min-width: 0;
padding: 0.75rem;
border: 1px solid var(--bs-border-color);
border-radius: 0.7rem;
background: rgba(var(--bs-secondary-bg-rgb), 0.35);
border-radius: 0.75rem;
background: var(--bs-body-bg);
}
.rt-config-card-head,
.rt-config-control {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 0.6rem;
min-width: 0;
}
.rt-config-card-head b {
display: block;
font-size: 0.9rem;
line-height: 1.25;
}
.rt-config-card-head small,
.rt-config-help-text,
.rt-config-value-note {
display: block;
overflow-wrap: anywhere;
color: var(--bs-secondary-color);
font-size: 0.73rem;
}
.rt-config-help {
flex: 0 0 auto;
padding: 0;
color: var(--bs-secondary-color);
line-height: 1;
text-decoration: none;
}
.rt-config-control {
align-items: center;
}
.rt-config-control .form-control,
.rt-config-switch {
max-width: 210px;
}
.rt-config-switch {
justify-self: end;
justify-content: flex-end;
margin: 0;
}
@@ -2003,29 +2081,41 @@ body.mobile-mode .mobile-filter-bar {
font-weight: 700;
}
.rt-config-row b {
font-size: 0.88rem;
}
.rt-config-row small {
display: block;
overflow-wrap: anywhere;
.rt-config-state {
flex: 0 0 auto;
padding: 0.16rem 0.42rem;
border: 1px solid var(--bs-border-color);
border-radius: 999px;
color: var(--bs-secondary-color);
font-size: 0.72rem;
font-size: 0.68rem;
font-weight: 700;
white-space: nowrap;
}
.rt-config-row.disabled {
opacity: 0.58;
.rt-config-state-live {
color: var(--bs-success-text-emphasis);
}
.rt-config-row.changed,
.rt-config-row.changed-live {
.rt-config-state-saved {
color: var(--bs-primary-text-emphasis);
}
.rt-config-state-unavailable {
color: var(--bs-danger-text-emphasis);
}
.rt-config-card.disabled {
opacity: 0.62;
}
.rt-config-card.changed,
.rt-config-card.changed-live {
border-color: var(--bs-danger);
box-shadow: 0 0 0 0.12rem rgba(220, 53, 69, 0.2);
box-shadow: 0 0 0 0.12rem rgba(var(--bs-danger-rgb), 0.18);
}
.rt-config-value-note {
margin-top: 0.15rem;
margin-top: -0.2rem;
}
.rt-config-output {
@@ -2033,6 +2123,26 @@ body.mobile-mode .mobile-filter-bar {
font-size: 0.82rem;
}
@media (max-width: 575.98px) {
.rt-config-section > summary,
.rt-config-card-head,
.rt-config-control {
align-items: stretch;
flex-direction: column;
}
.rt-config-section > summary small {
max-width: none;
text-align: left;
}
.rt-config-control .form-control,
.rt-config-switch {
max-width: none;
}
}
.tracker-toolbar,
.tracker-actions {
display: flex;
@@ -4629,14 +4739,6 @@ body,
}
}
/* Current rTorrent settings uses the same card rhythm as Diagnostics for faster scanning. */
.rt-config-current-summary {
margin-bottom: 1rem;
}
.rt-config-value-note {
word-break: break-word;
}
.file-row-actions {
align-items: center;

File diff suppressed because one or more lines are too long