Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
midoks committed Oct 21, 2024
1 parent 86014af commit d97e265
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 1 deletion.
1 change: 1 addition & 0 deletions web/admin/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
}
)


class Version(db.Model):
"""用于参考/升级的版本号"""
__tablename__ = 'version'
Expand Down
18 changes: 17 additions & 1 deletion web/admin/plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,29 @@

from flask import Blueprint, render_template

from utils.mwplugin import MwPlugin

blueprint = Blueprint('plugins', __name__, url_prefix='/plugins', template_folder='../../templates/default')
@blueprint.route('/index', endpoint='index')
def index():
return render_template('plugins.html', data={})


# 插件列表
@blueprint.route('/list', endpoint='list', methods=['GET'])
def list():

pg = MwPlugin.instance()
print(pg.getList())
return pg.getList()

# 初始化检查,首页提示选择安装
@blueprint.route('/init', endpoint='init', methods=['POST'])
def init():
plugin_names = {
'openresty': '1.25.3',
'php': '56',
'swap': '1.1',
'mysql': '5.7',
'phpmyadmin': '4.4.15',
}
return []
88 changes: 88 additions & 0 deletions web/utils/mwplugin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# coding:utf-8

# ---------------------------------------------------------------------------------
# MW-Linux面板
# ---------------------------------------------------------------------------------
# copyright (c) 2018-∞(https://github.com/midoks/mdserver-web) All rights reserved.
# ---------------------------------------------------------------------------------
# Author: midoks <[email protected]>
# ---------------------------------------------------------------------------------

import threading

class MwPlugin(object):

def_plugin_type = [
{
"title":"全部",
"type":0,
"ps":""
},
{
"title":"已安装",
"type":-1,
"ps":""
},
{
"title":"运行环境",
"type":1,
"ps":""
},
{
"title":"数据软件",
"type":2,
"ps":""
},
{
"title":"代码管理",
"type":3,
"ps":""
},
{
"title":"系统工具",
"type":4,
"ps":""
},
{
"title":"其他插件",
"type":5,
"ps":""
},
{
"title":"辅助插件",
"type":6,
"ps":""
}
]

# lock
_instance_lock = threading.Lock()

"""docstring for MwPlugin"""
def __init__(self):
pass

@classmethod
def instance(cls, *args, **kwargs):
if not hasattr(MwPlugin, "_instance"):
with MwPlugin._instance_lock:
if not hasattr(MwPlugin, "_instance"):
MwPlugin._instance = MwPlugin(*args, **kwargs)
return MwPlugin._instance


def getList(
self,
type: str | None = None,
keyword: str | None = None,
page: str | None = 1,
size: str | None = 10,
) -> object:
rdata = {}
rdata['type'] = self.def_plugin_type
# print(type,keyword,page,size)
return rdata




0 comments on commit d97e265

Please sign in to comment.