MCPcopy
hub / github.com/lejianwen/rustdesk-api

github.com/lejianwen/rustdesk-api @v2.7 sqlite

repository ↗ · DeepWiki ↗ · release v2.7 ↗
8,468 symbols 12,911 edges 192 files 366 documented · 4%
README

RustDesk API

This project implements the RustDesk API using Go, and includes both a web UI and web client. RustDesk is a remote desktop software that provides self-hosted solutions.

Better used with [lejianwen/rustdesk-server].

[lejianwen/rustdesk-server] is a fork of the official RustDesk Server repository. 1. Solves the API connection timeout issue. 2. Can enforce login before initiating a connection. 3. Supports client websocket.

Features

  • PC API
    • Personal API
    • Login
    • Address Book
    • Groups
    • Authorized login,
    • supports GitHub, Google and OIDC login,
    • supports web admin authorized login,
    • supports LDAP(test AD and openladp) if API Server config
    • i18n
  • Web Admin
    • User Management
    • Device Management
    • Address Book Management
    • Tag Management
    • Group Management
    • OAuth Management
    • LDAP Config by config file or ENV
    • Login Logs
    • Connection Logs
    • File Transfer Logs
    • Quick access to web client
    • i18n
    • Share to guest by web client
    • Server control (some simple official commands WIKI)
  • Web Client
    • Automatically obtain API server
    • Automatically obtain ID server and KEY
    • Automatically obtain address book
    • Visitors are remotely to the device via a temporary sharing link
  • CLI
    • Reset admin password

Overview

API Service

Basic implementation of the PC client's primary interfaces.Supports the Personal version api, which can be enabled by configuring the rustdesk.personal file or the RUSTDESK_API_RUSTDESK_PERSONAL environment variable.

Login
Address Book Groups

Web Admin

  • The frontend and backend are separated to provide a user-friendly management interface, primarily for managing and displaying data.Frontend code is available at rustdesk-api-web

  • Admin panel URL: http://<your server[:port]>/_admin/

  • For the initial installation, the admin username is admin, and the password will be printed in the console. You can change the password via the command line.

img.png

  1. Admin interface: web_admin
  2. Regular user interface: web_user

  3. Each user can have multiple address books, which can also be shared with other users.

  4. Groups can be customized for easy management. Currently, two types are supported: shared group and regular group.
  5. You can directly launch the client or open the web client for convenience; you can also share it with guests, who can remotely access the device via the web client.
  6. OAuth support: Currently, GitHub, Google and OIDC are supported. You need to create an OAuth App and configure it in the admin panel.

    • For Google and Github, you don't need to fill the Issuer and Scpoes
    • For OIDC, you must set the Issuer. And Scopes is optional which default is openid,email,profile, please make sure this Oauth App can access sub, email and preferred_username
    • Create a GitHub OAuth App at Settings -> Developer settings -> OAuth Apps -> New OAuth App here.
    • Set the Authorization callback URL to http://<your server[:port]>/api/oidc/callback, e.g., http://127.0.0.1:21114/api/oidc/callback.
  7. Login logs

  8. Connection logs
  9. File transfer logs
  10. Server control
  11. Simple mode, some simple commands have been GUI-ized and can be executed directly in the backend rustdesk_command_simple

  12. Advanced mode, commands can be executed directly in the backend

    • Official commands can be used
    • Custom commands can be added
    • Custom commands can be executed
  13. LDAP Support, When you setup the LDAP(test for OpenLDAP and AD), you can login with the LDAP's user. https://github.com/lejianwen/rustdesk-api/issues/114 , if LDAP fail fallback local user

Web Client:

  1. If you're already logged into the admin panel, the web client will log in automatically.
  2. If you're not logged in, simply click the login button in the top right corner, and the API server will be pre-configured.
  3. After logging in, the ID server and key will be automatically synced.
  4. The address book will also be automatically saved to the web client for convenient use.

Automated Documentation : API documentation is generated using Swag, making it easier for developers to understand and use the API.

  1. Admin panel docs: <your server[:port]>/admin/swagger/index.html
  2. PC client docs: <your server[:port]>/swagger/index.html api_swag

CLI

# help
./apimain -h

Reset admin password

./apimain reset-admin-pwd <pwd>

Installation and Setup

Configuration

  • Config File
  • Modify the configuration in conf/config.yaml.
  • If gorm.type is set to sqlite, MySQL-related configurations are not required.
  • Language support: en and zh-CN are supported. The default is zh-CN.

Environment Variables

The environment variables correspond one-to-one with the configurations in the conf/config.yaml file. The prefix for variable names is RUSTDESK_API. The table below does not list all configurations. Please refer to the configurations in conf/config.yaml.

Variable Name Description Example
TZ timezone Asia/Shanghai
RUSTDESK_API_LANG Language en,zh-CN
RUSTDESK_API_APP_WEB_CLIENT web client on/off; 1: on, 0 off, default: 1 1
RUSTDESK_API_APP_REGISTER register enable; true, false; default:false false
RUSTDESK_API_APP_SHOW_SWAGGER swagger visible; 1: yes, 0: no; default: 0 0
RUSTDESK_API_APP_TOKEN_EXPIRE token expire duration 168h
RUSTDESK_API_APP_DISABLE_PWD_LOGIN disable password login false
RUSTDESK_API_APP_REGISTER_STATUS register user default status ; 1 enabled , 2 disabled ; default 1 1
RUSTDESK_API_APP_CAPTCHA_THRESHOLD captcha threshold; -1 disabled, 0 always enable, >0 threshold ;default 3 3
RUSTDESK_API_APP_BAN_THRESHOLD ban ip threshold; 0 disabled, >0 threshold ; default 0 0
----- ADMIN Configuration----- ---------- ----------
RUSTDESK_API_ADMIN_TITLE Admin Title RustDesk Api Admin
RUSTDESK_API_ADMIN_HELLO Admin welcome message, you can use html
RUSTDESK_API_ADMIN_HELLO_FILE Admin welcome message file,

will override RUSTDESK_API_ADMIN_HELLO | ./conf/admin/hello.html | | ----- GIN Configuration ----- | --------------------------------------- | ----------------------------- | | RUSTDESK_API_GIN_TRUST_PROXY | Trusted proxy IPs, separated by commas. | 192.168.1.2,192.168.1.3 | | ----- GORM Configuration ----- | --------------------------------------- | ----------------------------- | | RUSTDESK_API_GORM_TYPE | Database type (sqlite or mysql). Default is sqlite. | sqlite | | RUSTDESK_API_GORM_MAX_IDLE_CONNS | Maximum idle connections | 10 | | RUSTDESK_API_GORM_MAX_OPEN_CONNS | Maximum open connections | 100 | | RUSTDESK_API_RUSTDESK_PERSONAL | Open Personal Api 1:Enable,0:Disable | 1 | | ----- MYSQL Configuration ----- | --------------------------------------- | ----------------------------- | | RUSTDESK_API_MYSQL_USERNAME | MySQL username | root | | RUSTDESK_API_MYSQL_PASSWORD | MySQL password | 111111 | | RUSTDESK_API_MYSQL_ADDR | MySQL address | 192.168.1.66:3306 | | RUSTDESK_API_MYSQL_DBNAME | MySQL database name | rustdesk | | RUSTDESK_API_MYSQL_TLS | Whether to enable TLS, optional values: true, false, skip-verify, custom | false | | ----- RUSTDESK Configuration ----- | --------------------------------------- | ----------------------------- | | RUSTDESK_API_RUSTDESK_ID_SERVER | Rustdesk ID server address | 192.168.1.66:21116 | | RUSTDESK_API_RUSTDESK_RELAY_SERVER | Rustdesk relay server address

Extension points exported contracts — how you extend this code

CaptchaProvider (Interface)
验证码提供者接口 [3 implementers]
utils/login_limiter.go
Handler (Interface)
(no doc) [4 implementers]
lib/cache/cache.go
Locker (Interface)
(no doc) [1 implementers]
lib/lock/lock.go
RegisterPeer (Interface)
(no doc)
resources/web/js/src/rendezvous.ts
RegisterPeerResponse (Interface)
(no doc)
resources/web/js/src/rendezvous.ts
PunchHoleRequest (Interface)
(no doc)
resources/web/js/src/rendezvous.ts
PunchHole (Interface)
(no doc)
resources/web/js/src/rendezvous.ts
TestNatRequest (Interface)
(no doc)
resources/web/js/src/rendezvous.ts

Core symbols most depended-on inside this repo

s
called by 2138
resources/web/main.dart.js
q
called by 764
resources/web/ogvjs-1.8.6/ogv.js
p
called by 619
resources/web/ogvjs-1.8.6/ogv.js
Fail
called by 358
http/response/response.go
TranslateMsg
called by 344
http/response/response.go
n
called by 289
resources/web/ogvjs-1.8.6/ogv-es2017.js
abort
called by 262
resources/web/libopus.js
Error
called by 260
lib/upload/oss.go

Shape

Function 7,460
Method 671
Struct 213
Interface 78
Class 28
Enum 11
TypeAlias 7

Languages

TypeScript90%
Go10%
Python1%

Modules by API surface

resources/web/main.dart.js6,082 symbols
resources/web/ogvjs-1.8.6/ogv-es2017.js193 symbols
resources/web/js/src/message.ts145 symbols
resources/web/libopus.js125 symbols
resources/web/ogvjs-1.8.6/ogv-decoder-video-vp9-simd-mt-wasm.js109 symbols
resources/web/ogvjs-1.8.6/ogv-decoder-video-vp9-mt-wasm.js109 symbols
resources/web/ogvjs-1.8.6/ogv-decoder-video-vp8-mt-wasm.js107 symbols
resources/web/ogvjs-1.8.6/ogv-decoder-video-av1-simd-mt-wasm.js95 symbols
resources/web/ogvjs-1.8.6/ogv-decoder-video-av1-mt-wasm.js95 symbols
resources/web/libs/firebase-analytics.js73 symbols
resources/web/ogvjs-1.8.6/ogv.js65 symbols
resources/web/js/src/rendezvous.ts57 symbols

Dependencies from manifests, versioned

github.com/Azure/go-ntlmsspv0.0.0-2022112819355 · 1×
github.com/KyleBanks/depthv1.2.1 · 1×
github.com/PuerkitoBio/purellv1.1.1 · 1×
github.com/PuerkitoBio/urlescv0.0.0-2017081014372 · 1×
github.com/antonfisher/nested-logrus-formatterv1.3.1 · 1×
github.com/bytedance/sonicv1.8.0 · 1×
github.com/cespare/xxhash/v2v2.1.2 · 1×
github.com/chenzhuoyu/base64xv0.0.0-2022111506244 · 1×
github.com/dgryski/go-rendezvousv0.0.0-2020082301473 · 1×
github.com/fsnotify/fsnotifyv1.5.1 · 1×

For agents

$ claude mcp add rustdesk-api \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact