Clash API
Lets a dashboard (MetaCubeXD, yacd, zashboard) or an app read and control a running Apranik through the API that Mihomo defined. The endpoints are on Clash API endpoints.
Structure
{
"type": "clash",
"settings": {
"listen": "127.0.0.1",
"port": 9090,
"secret": "a long random string",
"allow_origins": ["https://metacubex.github.io"],
"external_ui": "/opt/apranik/ui",
"log_buffer_records": 256,
"delay_test": {
"url": "https://www.gstatic.com/generate_204",
"timeout": "10s",
"expected_status": "200-299"
}
}
}Fields
listen
IP addressRequired
The address to listen on. Off loopback, check warns. On a phone, loopback is reachable by every app, so keep the secret long.
port
integerRequired
The port to listen on.
secret
stringRequired
Every request sends it as Authorization: Bearer <secret>. A WebSocket handshake, which a browser cannot give headers, may send ?token=<secret> instead.
allow_origins
list of originsDefault: none
The web pages allowed to call the API, as scheme://host[:port]. "*" allows every page, with a warning. Programs that are not browsers are not affected.
external_ui
stringDefault: none
An absolute path to an unpacked dashboard, served at /ui/ without the secret.
log_buffer_records
integerDefault: 256
How far one log stream may fall behind before it loses records, up to 100,000.
delay_test
object
Defaults for the delay endpoints: url, timeout and expected_status, as in a probe.