Skip to content

Royal TS

Royal TS 是一款远程桌面和服务器管理应用。Protocol Launcher 允许你生成 Royal TS 官方 URL Scheme 链接。

使用

提供两种使用方式:

  • 按需加载(通过子路径导入),支持 Tree Shaking,体积更小。
  • 全量导入(从根包导入),使用简单,但会包含所有应用模块。

生产环境建议使用按需加载以减小体积;快速脚本或演示可选择全量导入。

选择安装方式

按需加载
推荐使用。生产环境优化。
全量导入
使用便捷。适合快速脚本。

说明

Royal Apps 官方文档公开了 rtscli://local/<scope>/<command>?...,用于执行 Royal TS CLI 命令。connect helper 仅覆盖已公开的 rtscli.exe action connect 带值参数。cliCommand 也只覆盖文档中出现的 action connectdocument opendocument close 命令形态。由于 URI 页面没有公开纯 flag 选项在 URI 中的序列化方式,这里不会暴露这类参数。

Royal TS V6 也公开了 legacy rtsx:// scheme,用于连接动作。这些示例不会渲染可点击的启动按钮,因为生成的链接可能会发起或断开远程会话。

CLI 命令

On-Demand
ts
import { cliCommand } from 'protocol-launcher/royal-ts'

const url = cliCommand({
  scope: 'action',
  command: 'connect',
  options: {
    '-n': 'QNAP (SSH)',
  },
})

连接

On-Demand
ts
import { connect } from 'protocol-launcher/royal-ts'

const url = connect({
  name: 'QNAP (SSH)',
})

Legacy 按 URI 连接

On-Demand
ts
import { legacyConnect } from 'protocol-launcher/royal-ts'

const url = legacyConnect({
  protocolIdentifier: 'rdp',
  uri: '192.168.5.16',
  using: 'uri',
})

Legacy 按名称连接

On-Demand
ts
import { legacyConnect } from 'protocol-launcher/royal-ts'

const url = legacyConnect({
  protocolIdentifier: 'rdp',
  auth: {
    username: 'admin',
  },
  uri: 'Web Server 1',
  using: 'name',
})

Legacy 断开连接

On-Demand
ts
import { legacyDisconnect } from 'protocol-launcher/royal-ts'

const url = legacyDisconnect({
  protocolIdentifier: 'rdp',
  uri: 'Web Server 1',
  using: 'name',
})

Legacy Ad Hoc 属性

On-Demand
ts
import { legacyConnect } from 'protocol-launcher/royal-ts'

const url = legacyConnect({
  protocolIdentifier: 'rdp',
  uri: '192.168.5.16',
  using: 'adhoc',
  action: 'connect',
  properties: {
    Description: 'Connected using URI',
    ColorDepth: 8,
  },
})

生成的 URL

ts
cliCommand({
  scope: 'action',
  command: 'connect',
  options: { '-n': 'QNAP (SSH)' },
})
// => 'rtscli://local/action/connect?-n=QNAP+(SSH)'

connect({ name: 'QNAP (SSH)' })
// => 'rtscli://local/action/connect?-n=QNAP+(SSH)'

legacyConnect({ protocolIdentifier: 'rdp', uri: '192.168.5.16', using: 'uri' })
// => 'rtsx://rdp%3a%2f%2f192.168.5.16?using=uri'

legacyConnect({
  protocolIdentifier: 'rdp',
  auth: { username: 'admin' },
  uri: 'Web Server 1',
  using: 'name',
})
// => 'rtsx://rdp%3a%2f%2fadmin@Web%20Server%201?using=name'

legacyDisconnect({ protocolIdentifier: 'rdp', uri: 'Web Server 1', using: 'name' })
// => 'rtsx://rdp%3a%2f%2fWeb%20Server%201?using=name&action=disconnect'

legacyConnect({
  protocolIdentifier: 'rdp',
  uri: '192.168.5.16',
  using: 'adhoc',
  action: 'connect',
  properties: {
    Description: 'Connected using URI',
    ColorDepth: 8,
  },
})
// => 'rtsx://rdp%3a%2f%2f192.168.5.16?using=adhoc&action=connect&property_Description=Connected%20using%20URI&property_ColorDepth=8'

官方文档