更新插件功能

This commit is contained in:
wojiaoyishang
2023-02-10 21:29:39 +08:00
parent 51db1944ed
commit 7bef64f632
24 changed files with 1442 additions and 137 deletions
+9
View File
@@ -0,0 +1,9 @@
{
"plugin_name": "Hello World",
"plugin_version": "1.0.0.1",
"plugin_description": "一个测试的插件。",
"developer_name": "Yishang",
"developer_website": "https://lovepikachu.top",
"developer_email": "422880152@qq.com",
"developer_phone": "-"
}
+18
View File
@@ -0,0 +1,18 @@
"""
初始化插件
"""
from flask import Flask
from .main import helloworld_blueprint
def event_enable():
"""当此插件被启用时会调用此处"""
print("启用插件")
def event_disable():
"""当此插件被禁用时会调用此处"""
print("禁用插件")
def event_init(app: Flask):
"""初始化完成时会调用这里"""
app.register_blueprint(helloworld_blueprint)
+19
View File
@@ -0,0 +1,19 @@
from applications.dev import *
from flask import render_template, Blueprint
import os
import psutil
# 获取插件所在的目录(结尾没有分割符号)
dir_path = os.path.dirname(__file__).replace("\\", "/")
folder_name = dir_path[dir_path.rfind("/") + 1:] # 插件文件夹名称
# 创建蓝图
helloworld_blueprint = Blueprint('hello_world', __name__, template_folder='templates', static_folder="static",
url_prefix="/hello_world")
@helloworld_blueprint.route("/")
def index():
return render_template("helloworld_index.html")
@@ -0,0 +1 @@
<h1>Test!</h1>