API v1
Documentation/清单参考

权限

声明后台需要飞块代理执行的操作。

Plugin API v1

Documentation content is currently available in Simplified Chinese.

插件调用系统操作、原生工具或网络代理时,先在 permissions 中写入对应权限。用户启用插件时,飞块展示这些请求,让用户授权。

例如,一个打开网页的动作可以声明:

json
{
  "permissions": ["system.openExternal"]
}

#权限名称

权限 对应接口
system.openExternal system.openExternal()
system.openApplication system.openApplication()
system.openPath system.openPath()
system.adjustVolume system.adjustVolume()
system.sendHotkey system.sendHotkey()
system.sendText system.sendText()
system.captureScreen system.captureScreen()
system.lockScreen system.lockScreen()
system.sleepComputer system.sleepComputer()
system.sleepDisplay system.sleepDisplay()
system.runShortcut system.runShortcut()
native.execute native.execute()
network.getJson network.getJson()
network.unrestricted 声明后台直接使用 Node.js 联网

发布状态、查询实例和调用已声明的插件服务不需要额外权限;它们根据清单中的功能声明确定调用范围。

#两种网络来源

后台通过 context.network.getJson() 请求接口时,在 networkOrigins 中填写 HTTPS 来源。比如,请求 https://api.example.com/weather,填写 https://api.example.com。

页面直接通过 fetch() 或 WebSocket 连接时,在 widgetConnectOrigins 中填写来源。页面请求还受浏览器的 CORS 策略约束。

两个字段分别控制不同的调用入口,每个最多 8 项。填写 ["*"] 表示允许任意来源,后台 JSON 代理仍使用公网 HTTPS 目标。字段定义见 manifest.json。

#系统授权

清单权限和操作系统授权是两件事。比如,用户同意插件发送热键后,还要在 macOS 中允许飞块使用辅助功能。遇到系统授权问题时,先检查对应系统设置,见调试插件。

Updated 2026-11-04
View implementation sources