From 186e728fd1549db4fe4bc3f7487e1e82afb6241d Mon Sep 17 00:00:00 2001 From: richardli1598 Date: Fri, 8 Mar 2024 22:15:09 +0800 Subject: [PATCH] doc: add plugin yaml definition yaml Signed-off-by: richardli1598 --- docs/zh/contribute/plugin_definition.md | 107 ++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 docs/zh/contribute/plugin_definition.md diff --git a/docs/zh/contribute/plugin_definition.md b/docs/zh/contribute/plugin_definition.md new file mode 100644 index 00000000..085f70bd --- /dev/null +++ b/docs/zh/contribute/plugin_definition.md @@ -0,0 +1,107 @@ +# Plugin插件定义 + +kubespider使用不同的Plugin解析不同资源网站,调用不同下载软件触发资源下载,开发者可以根据自己的场景开发出合适的Plugin,如解析YoutuBe channel的Plugin,实现自动下载最新的channel内容,如下将对如何定义Plugin做详细描述。 + + +## Plugin模板定义 + +kubespider使用yaml定义Plugin模板,前端将使用此模板在前端渲染对应的插件内容,首先我们看一个整体Demo: +``` +name: majic-source +version: 1.0.0 +author: opennaslab +type: parser +description: This is a magic source parser to parse different resource websites +language: python +logo: https://via.placeholder.com/200 +binary: https://raw.githubusercontent.com/qingchoulove/ks_provider_example/main/example_provider +arguments: + - name: handle_host + type: text + description: Configuration options + required: true + default: "" + - name: link_selector + type: text + description: Configuration options + required: true + default: "" +``` + +其中,除开arguments,都为非常简单的 `key: value` 的Plugin描述信息,描述此插件的作者和版本等信息,其中毕比较关键的是 `binary` 参数,kubespider会动态去此地址下载二进制并拉起,用于解析资源。 + +### arguments定义 + +kubespider会使用arguments定义渲染前端配置表格,这里对`arguments`的各种类型做详细格式描述。 + +#### text类型 + +```yaml +- name: handle_host + type: text + description: Configuration options + required: true + default: "" +``` + +#### integer类型 + +```yaml +- name: host_port + type: integer + description: Configuration options + required: true + default: "" +``` + +#### boolean类型 + +```yaml +- name: enable_autodownload + type: boolean + description: Configuration options + required: true + default: true +``` + +#### array类型 + +```yaml +- name: checking_websites + type: array + description: Configuration options + required: false + default: nil + itemProperties: + - name: website + type: text + description: Configuration options + required: true + - name: use_proxy + type: boolean + description: Configuration options + required: true +``` + +#### object类型 + +```yaml +- name: checking_websites + type: array + description: Configuration options + required: true + default: nil + properties: + - name: website + type: text + description: Configuration options + required: true + - name: use_proxy + type: boolean + description: Configuration options + required: true +``` + +## Plugin二进制开发 + +TBD \ No newline at end of file