APIs
The subsection converter is actually an API. And to support proxy-provider, I implemented another API.
Here I'm gonna introduce the APIs.
GET /sub
This is the API for subsection converter. It's contained in the link generated by the web ui.
It accepts GET requests. Here're the parameters:
| Parameter | Description | Optional | Default | Remarks |
|---|---|---|---|---|
| url | The URL of the original subscription or node sharing link. It needs to be URIComponent encoded. | No | - | Multiple subscription links are supported. You can use line breaks or "|" to separate them. https://t.me/... links are treated as standalone share links (parsed as V2Ray nodes), not as remote subscription URLs. |
| template | Template ID used to render the final config. | Yes | zju | Built-in values are zju and general. When omitted, zju is used. |
| interval | The interval of proxy update. | Yes | 1800 | Unit: seconds. |
| urlstandby | The URL of the standby subscription or node sharing link. The proxies in it will only be added to the manual switch group (the group whose "manual" is True in the configuration file), and will not be classified into region groups. It's recommended to be URIComponent encoded. | Yes | - | Multiple subscription links are supported. You can use line breaks or " |
| short | If this parameter is set (regardless of its value), the header section and dns section containing allow-lan will not be generated. | Yes | - | - |
| npr | If this parameter is set (regardless of its value), the URL of the ruleset will not be proxied. | Yes | - | By default, this service is used to proxy the URL of the ruleset to ensure that the ruleset can be obtained normally. If this parameter is set, the URL of the ruleset will not be proxied. |
GET /provider
This API converts the subscription to the configuration required by proxy-provider. This API will be called whenever the proxy is updated via proxy-provider.
It accepts GET requests. Here're the parameters:
| Parameter | Description | Optional | Default | Remarks |
|---|---|---|---|---|
| url | The URL of the original subscription. It needs to be URIComponent encoded. | No | - | Should be a single subscription link. |
GET /config
This API returns the runtime configuration used by the Web UI. It accepts GET requests and takes no parameters.
Response JSON fields:
| Field | Description |
|---|---|
| defaultTemplate | The template name used when /sub or /proxy omits the template query parameter (from DEFAULT_TEMPLATE in config.yaml). |
| availableTemplates | A list of all template names found in the template/ directory. |
GET /robots.txt
Returns a robots.txt response based on the DISALLOW_ROBOTS setting in config.yaml. When DISALLOW_ROBOTS=true, it returns User-agent: * / Disallow: /; otherwise it returns 404.
GET /proxy
This API is used to access the specified URL through this service. It accepts GET requests. Here're the parameters:
| Parameter | Description | Optional | Default | Remarks |
|---|---|---|---|---|
| url | The URL to be proxied. It needs to be URIComponent encoded. | No | - | Use this service to access this URL and return the result. |
| template | Template ID used for rule whitelist validation. | Yes | zju | This should match the template used in /sub; the generated config already includes it when needed. |