#!/usr/bin/env python3 """ SysDeck - Mining Bridge Helper Author: Jeremy Anderson (https://dcos.net) 1999 POWER-TOOL STYLE: maximum UI control over every mining surface. The Mining Dashboard panel surfaces every XMRig REST API knob: summary — GET /1/summary (live hashrate, pool, threads) threads — GET /1/summary → hashrate.threads[] detail pool-config-get — GET /1/config → the pool section pool-config-set — PUT /1/config with a new pool URL/username/pass threads-config-get — GET /1/config → cpu.threads section threads-config-set — PUT /1/config with new thread count algorithm-get — GET /1/config → cpu.asm / randomx section algorithm-set — PUT /1/config with a new algorithm preset pause — POST /json_rpc method=paused (id 1) resume — POST /json_rpc method=resumed (id 1) pause-worker — POST /json_rpc method=pause_worker resume-worker — POST /json_rpc method=resume_worker start — systemctl start xmrig.service (superuser) stop — systemctl stop xmrig.service (superuser) restart — systemctl restart xmrig.service (superuser) service-status — systemctl is-active xmrig.service (read-only) Cockpit way (v0.0.31+ pattern): the bridge runs systemctl / curl via subprocess directly; the JS panel passes { superuser: 'try' } for mutating ops so the cockpit bridge prompts the operator via polkit for the org.sysdeck.system.modify action (shipped since v0.0.17 — authorizes /usr/bin/systemctl, /usr/bin/hostnamectl, etc.). XMRig is GPL-3.0 licensed by the XMRig project. This bridge helper invokes its REST API over HTTP — the suite (MIT) and XMRig (GPL-3.0) remain independent programs. No XMRig code is bundled. Usage: python3 /usr/lib/sysdeck/bridge/mining.py summary python3 /usr/lib/sysdeck/bridge/mining.py pool-config-set monero.hero '$wallet' x python3 /usr/lib/sysdeck/bridge/mining.py threads-config-set 8 python3 /usr/lib/sysdeck/bridge/mining.py pause-worker 1 """ import json import os import shutil import subprocess import sys import urllib.request import urllib.error from typing import Any XMRIG_URL = "http://127.0.0.1:18088" XMRIG_SERVICE = "xmrig.service" # Algorithm presets the panel surfaces as a `