From 7812c4983f3be600c073559a75ea8dfa94c19b64 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Wed, 23 Oct 2024 04:11:31 +0800 Subject: [PATCH] update --- web/core/mw.py | 16 +++++++++++----- web/utils/mwplugin.py | 13 ++++++++++++- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/web/core/mw.py b/web/core/mw.py index 9a41d96f0..1c9298a2f 100644 --- a/web/core/mw.py +++ b/web/core/mw.py @@ -69,17 +69,23 @@ def getRunDir(): def getRootDir(): return os.path.dirname(getRunDir()) +def getPanelDir(): + return getRootDir() + +def getFatherDir(): + return os.path.dirname(os.path.dirname(getPanelDir())) + def getPluginDir(): - return getRootDir() + '/plugins' + return getPanelDir() + '/plugins' def getPanelDataDir(): - return getRootDir() + '/data' + return getPanelDir() + '/data' def getMWLogs(): - return getRootDir() + '/logs' + return getPanelDir() + '/logs' def getPanelTmp(): - return getRootDir() + '/tmp' + return getPanelDir() + '/tmp' def getServerDir(): @@ -145,7 +151,7 @@ def isNumber(s): pass return False - + def getPathSuffix(path): return os.path.splitext(path)[-1] diff --git a/web/utils/mwplugin.py b/web/utils/mwplugin.py index 53791ad40..28df1c161 100644 --- a/web/utils/mwplugin.py +++ b/web/utils/mwplugin.py @@ -103,6 +103,7 @@ class MwPlugin(object): def getVersion(self, path): version_t = path + '/version.pl' + print(version_t) if os.path.exists(version_t): return mw.readFile(version_t).strip() return '' @@ -152,11 +153,16 @@ class MwPlugin(object): path = '' coexist = False + if info["checks"].startswith('/'): + checks = info["checks"] + else: + checks = mw.getFatherDir() + '/' + info['checks'] + if 'path' in info: path = info['path'] if not path.startswith('/'): - path = mw.getRootDir() + '/' + path + path = mw.getFatherDir() + '/' + path if 'coexist' in info and info['coexist']: coexist = True @@ -192,9 +198,14 @@ class MwPlugin(object): if checks.find('VERSION') > -1: pInfo['install_checks'] = checks.replace('VERSION', info['versions']) + if path.find('VERSION') > -1: + pInfo['path'] = path.replace('VERSION', info['versions']) + pInfo['display'] = self.checkDisplayIndex(info['name'], pInfo['versions'], coexist) pInfo['setup'] = os.path.exists(pInfo['install_checks']) + + if coexist and pInfo['setup']: pInfo['setup_version'] = info['versions'] else: