diff --git a/class/core/public.py b/class/core/public.py index 67ea4fddc..0d666497f 100755 --- a/class/core/public.py +++ b/class/core/public.py @@ -793,16 +793,19 @@ def checkCert(certPath='ssl/certificate.pem'): return False return True -# 获取面板地址 -# def getPanelAddr(): -# import web -# protocol = 'https://' if os.path.exists("data/ssl.pl") else 'http://' -# h = web.ctx.host.split(':') -# try: -# result = protocol + h[0] + ':' + h[1] -# except: -# result = protocol + h[0] + ':' + readFile('data/port.pl').strip() -# return result + +def getPathSize(path): + # 取文件或目录大小 + if not os.path.exists(path): + return 0 + if not os.path.isdir(path): + return os.path.getsize(path) + size_total = 0 + for nf in os.walk(path): + for f in nf[2]: + filename = nf[0] + '/' + f + size_total += os.path.getsize(filename) + return size_total def toSize(size): diff --git a/plugins/readme/ico.png b/plugins/readme/ico.png deleted file mode 100644 index ba110c1a1..000000000 Binary files a/plugins/readme/ico.png and /dev/null differ diff --git a/plugins/readme/index.html b/plugins/readme/index.html deleted file mode 100755 index f91addaaf..000000000 --- a/plugins/readme/index.html +++ /dev/null @@ -1,57 +0,0 @@ -
-
-
-

插件说明

-

INFO说明

-

index.py说明

-
- -
-
-

在每一个插件中,都必须包含一个info.json文件,格式如下:


-
123
-
- -
-

在每一个插件中,都必须包含一个info.json文件,格式如下:


-
{
-"title": "插件开发说明",
-"tip": "soft",
-"name": "readme",
-"type": "扩展",
-"ps": "(mdserver-web)插件产开发说明,每个版本可能有所变化!",
-"versions": "0.1",
-"shell": "install.sh",
-"checks": "server/readme",
-"path": "server/readme",
-"author": "mdserver-web",
-"home": "github.com/midoks/mdserver-web",
-"date": "2018-11-30",
-"pid": "5"
-}
-
- -
-

在每一个插件中,都必须包含一个index.py文件


-
-
-
- -
- \ No newline at end of file diff --git a/plugins/readme/index.py b/plugins/readme/index.py deleted file mode 100755 index 9780ba8c3..000000000 --- a/plugins/readme/index.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding: utf-8 - -import time -import random -import os -import json -import re -import sys - -sys.path.append(os.getcwd() + "/class/core") -import public - - -def status(): - return 'start' - -if __name__ == "__main__": - func = sys.argv[1] - if func == 'status': - print status() diff --git a/plugins/readme/info.json b/plugins/readme/info.json deleted file mode 100755 index 2afdffc56..000000000 --- a/plugins/readme/info.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "title":"开发说明", - "tip":"soft", - "name":"readme", - "type":"扩展", - "ps":"[mdserver-web]插件产开发说明,每个版本可能有所变化!", - "versions": "0.1", - "shell":"install.sh", - "checks":"server/readme", - "path":"server/readme", - "author":"mdserver-web", - "home":"https://github.com/midoks/mdserver-web", - "date":"2018-11-30", - "pid":"5" -} \ No newline at end of file diff --git a/plugins/readme/install.sh b/plugins/readme/install.sh deleted file mode 100755 index e37dea1f4..000000000 --- a/plugins/readme/install.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin -export PATH - -curPath=`pwd` -rootPath=$(dirname "$curPath") -rootPath=$(dirname "$rootPath") -serverPath=$(dirname "$rootPath") - -install_tmp=${rootPath}/tmp/bt_install.pl - -Install_readme() -{ - mkdir -p ${serverPath}/readme - echo "${1}" > ${serverPath}/readme/version.pl - echo '安装完成' > $install_tmp -} - -Uninstall_readme() -{ - rm -rf ${serverPath}/readme - echo '卸载完成' > $install_tmp -} - -action=$1 -if [ "${1}" == 'install' ];then - Install_readme $2 -else - Uninstall_readme $2 -fi diff --git a/route/static/app/soft.js b/route/static/app/soft.js index 2f940876f..3006cb4da 100755 --- a/route/static/app/soft.js +++ b/route/static/app/soft.js @@ -381,6 +381,7 @@ function importPlugin(file){ type: "POST", data: formData, processData: false, + dataType:'json', contentType: false, success: function (data) { if (data.status === false) { @@ -405,21 +406,21 @@ function importPlugin(file){

名称:'+ data.title + '

\

版本:' + data.versions +'

\

描述:' + data.ps + '

\ -

大小:' + bt.format_size(data.size, true) + '

\ +

大小:' + toSize(data.size) + '

\

作者:' + data.author + '

\

来源:' + data.home + '

\ \ \
\ ' }); - }, - error: function (responseStr) { - layer.msg('上传失败2!', { icon: 2 }); + + },error: function (responseStr) { + layer.msg('上传失败2!:' + responseStr, { icon: 2 }); } }); } @@ -427,13 +428,13 @@ function importPlugin(file){ function importPluginInstall(plugin_name, tmp_path) { layer.msg('正在安装,这可能需要几分钟时间...', { icon: 16, time: 0, shade: [0.3, '#000'] }); - $.post('/plugin?action=input_zip', { plugin_name: plugin_name, tmp_path: tmp_path }, function (rdata) { + $.post('/plugins/input_zip', { plugin_name: plugin_name, tmp_path: tmp_path }, function (rdata) { layer.closeAll() if (rdata.status) { - soft.get_list(); + getSList(true); } setTimeout(function () { layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }) }, 1000); - }); + },'json'); } $(function() {