Skip to content

extension.json

extension.json文件是OPanel扩展的元数据,用于记录扩展插件的一些基本信息,存放在项目源码的resources目录下。

示例

json
{
  "extId": "example-extension",
  "version": "1.0.0",
  "name": "Example Extension",
  "description": "An example OPanel extension.",
  "author": "Norcleeh",
  "pages": [
    {
      "name": "Example Page",
      "url": "/"
    }
  ]
}

字段

字段类型介绍必填
extIdstring扩展的ID,不可与其他扩展重复
versionstring扩展版本
namestring扩展名称
descriptionstring扩展简介
authorstring作者名称
pagesobject[]需要在面板侧边栏中展示的扩展页面

pages

pages中的每一项都会在面板侧边栏的“扩展”分组中显示为一个入口。一个扩展可以注册多个页面;如果扩展不需要在侧边栏中展示页面,可以省略此字段。

字段类型介绍必填
namestring页面在面板侧边栏中显示的名称,不可为空
urlstring页面在扩展的resources/web目录中的路径,必须以/开头

url是扩展内部路径,不是完整的外部网址。它不能包含协议或域名,也不能使用..跳出resources/web目录。例如:

  • /对应resources/web/index.html
  • /hello/对应resources/web/hello/index.html

有关页面资源和完整示例,请参见前端页面

Released under the GPL-3.0 License