插件發布元數據協議

當你開發了一個小樹壁紙 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 未提供 → 使用默認圖標