插件发布元数据协议

当你开发了一个小树壁纸 Next 插件后,可以通过编写一个插件元数据文件来发布你的插件。插件元数据采用 TOML 格式,包含插件的基本信息和下载链接,供小树壁纸 Next 客户端读取和展示。

1. 文件结构

每个插件元数据为一个 .toml 文件。

identifier = "example_plugin"
name = "示例插件"
description = "这是一个示例插件"
long_description = """
这是详细描述,支持多行文本。
可包含功能介绍、使用说明等。
"""
logo = "https://example.com/logo.png"
repository = "https://github.com/user/example-plugin"
python_url = "https://raw.githubusercontent.com/user/example-plugin/main/plugin.py"

2. 字段说明

字段必填类型说明
identifierstring插件唯一 ID(小写字母、数字、下划线,3–32 字符)
namestring插件显示名称
descriptionstring简短描述(建议 ≤100 字符)
long_descriptionstring详细描述(支持多行)
logostringLogo 地址,支持 HTTPS URL 或 image/...;base64,...
repositorystringGitHub 仓库地址(必须为完整 HTTPS URL)
python_urlstring插件主 Python 文件的原始链接(如 GitHub raw 链接)

字段回退逻辑(客户端实现)

  • 若未提供 long_description
    • 且提供了 repository → 尝试从仓库的 README.md 提取首段作为详细描述(可选实现)
    • 否则,使用 description(若存在),否则使用 name
  • 若未提供 description
    • 使用 long_description 的首句(可选),否则使用 name
  • 若未提供 logo → 显示默认插件图标

3. 示例

完整示例

identifier = "wallpaper_scheduler"
name = "壁纸定时轮换"
description = "按时间自动切换壁纸"
long_description = """
支持每天/每周/自定义时间表切换壁纸,
可配合多个壁纸源使用。
"""
logo = "https://raw.githubusercontent.com/user/wallpaper-scheduler/main/icon.png"
repository = "https://github.com/user/wallpaper-scheduler"
python_url = "https://raw.githubusercontent.com/user/wallpaper-scheduler/main/plugin.py"

最简示例

identifier = "hello_world"
name = "Hello World"
python_url = "https://raw.githubusercontent.com/user/hello-world/main/plugin.py"

此情况下:

  • description 未提供 → 显示 name
  • long_description 未提供且无 repository → 显示 name
  • logo 未提供 → 使用默认图标