diff --git a/README.md b/README.md
index a32abc4c8..74eb866c3 100644
--- a/README.md
+++ b/README.md
@@ -10,4 +10,5 @@ curl -fsSL https://raw.githubusercontent.com/midoks/mdweb/master/install/instal
- pip install pip==9.0.3
- pip install flask
- pip install gunicorn
+- pip install psutil
- pip install -r requirements.txt
diff --git a/main.py b/main.py
index 062704129..9518f82c7 100644
--- a/main.py
+++ b/main.py
@@ -2,7 +2,7 @@
from flask import Flask
from flask import Blueprint,render_template
-from views import dashboard,site
+from views import dashboard,site,files
app = Flask(__name__)
app.debug = True
@@ -10,6 +10,7 @@ app.debug = True
DEFAULT_MODULES = (
(dashboard, "/"),
(site, "/site"),
+ (files, "/files"),
)
def setting_modules(app, modules):
diff --git a/models/index.html b/models/index.html
new file mode 100644
index 000000000..b2d525b29
--- /dev/null
+++ b/models/index.html
@@ -0,0 +1 @@
+index
\ No newline at end of file
diff --git a/plugins/index.html b/plugins/index.html
new file mode 100644
index 000000000..b2d525b29
--- /dev/null
+++ b/plugins/index.html
@@ -0,0 +1 @@
+index
\ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
index f163f4d22..a2478b34f 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,2 +1,3 @@
flask
-gunicorn
\ No newline at end of file
+gunicorn
+psutil
\ No newline at end of file
diff --git a/static/js/files.js b/static/js/files.js
index 0fac35880..faf3a432d 100755
--- a/static/js/files.js
+++ b/static/js/files.js
@@ -781,7 +781,7 @@ function GetFileName(fileNameFull) {
//取磁盘
function GetDisk() {
var LBody = '';
- $.get('/system?action=GetDiskInfo', function(rdata) {
+ $.get('/files/GetDiskInfo', function(rdata) {
for (var i = 0; i < rdata.length; i++) {
LBody += " " + (rdata[i].path=='/'?lan.files.path_root:rdata[i].path) + "(" + rdata[i].size[2] + ")";
}
diff --git a/templates/default/files.html b/templates/default/files.html
index c6be288be..19de9f628 100755
--- a/templates/default/files.html
+++ b/templates/default/files.html
@@ -1,88 +1,89 @@
-$def with (tData)
+{% extends "default/layout.html" %} {% block content %}
\ No newline at end of file
+setTimeout(function() {
+ GetFiles((xPath != undefined ? xPath : '/www/wwwroot'));
+}, 800);
+
+PathPlaceBtn((xPath != undefined ? xPath : '/www/wwwroot'));
+setCookie('uploadSize', 1024 * 1024 * 1024);
+if (getCookie('rank') == undefined || getCookie('rank') == null) {
+ setCookie('rank', 'a');
+}
+$$("#set_icon").click(function() {
+ setCookie('rank', 'b');
+ $$(this).addClass("active");
+ $$("#set_list").removeClass("active");
+ GetFiles(getCookie('Path'));
+});
+$$("#set_list").click(function() {
+ setCookie('rank', 'a');
+ $$(this).addClass("active");
+ $$("#set_icon").removeClass("active");
+ GetFiles(getCookie('Path'));
+})
+$$(".refreshBtn").click(function() {
+ GetFiles(getCookie('Path'));
+})
+
+{% endblock %}
\ No newline at end of file
diff --git a/templates/default/index.html b/templates/default/index.html
index 4e16f3e9b..d8bcc32e7 100755
--- a/templates/default/index.html
+++ b/templates/default/index.html
@@ -1,7 +1,4 @@
-{% extends "default/layout.html" %}
-
-
-{% block content %}
+{% extends "default/layout.html" %} {% block content %}
- 免费版 0.0.1
+ 免费版 0.0.1
检查更新
@@ -27,33 +24,33 @@
-
-
$data['lan']['N1']
+
网站
-
$data['siteCount'] $data['lan']['L3']
+
1个
-
-
$data['lan']['N3']
+
FTP
-
$data['ftpCount'] $data['lan']['L3']
+
1个
-
-
$data['lan']['N2']
+
数据库
-
$data['databaseCount'] $data['lan']['L3']
+
1个
@@ -63,9 +60,9 @@
@@ -83,7 +80,7 @@
获取中:
-
-
$data['lan']['P1']
+ CPU使用率
@@ -96,7 +93,7 @@
$data['lan']['S2']
-
-
$data['lan']['P2']
+ 内存使用率
@@ -116,7 +113,7 @@
-
$data['lan']['P4']
+
软件
@@ -129,7 +126,7 @@
-
$data['lan']['NET1']
+
网络流量
- $data['lan']['NET2']$data['lan']['S2']
diff --git a/test/index.html b/test/index.html
new file mode 100644
index 000000000..b2d525b29
--- /dev/null
+++ b/test/index.html
@@ -0,0 +1 @@
+index
\ No newline at end of file
diff --git a/views/__init__.py b/views/__init__.py
index fc82c6661..8cd2bb2bc 100644
--- a/views/__init__.py
+++ b/views/__init__.py
@@ -1,3 +1,4 @@
from dashboard import *
from site import *
+from files import *
diff --git a/views/dashboard.py b/views/dashboard.py
index 8ddd18035..8cf0e0b4b 100644
--- a/views/dashboard.py
+++ b/views/dashboard.py
@@ -2,10 +2,39 @@
from flask import Flask
from flask import Blueprint,render_template
+from flask import jsonify
+import psutil,time
+
dashboard = Blueprint('dashboard', __name__, template_folder='templates')
@dashboard.route("/")
def index():
- return render_template('default/index.html')
\ No newline at end of file
+ return render_template('default/index.html')
+
+@dashboard.route("getnetwork")
+def getnetwork():
+ #取网络流量信息
+ networkIo = psutil.net_io_counters()[:4]
+ # if not hasattr(web.ctx.session,'otime'):
+ # web.ctx.session.up = networkIo[0]
+ # web.ctx.session.down = networkIo[1]
+ # web.ctx.session.otime = time.time();
+
+ ntime = time.time();
+ networkInfo = {}
+ networkInfo['upTotal'] = networkIo[0]
+ networkInfo['downTotal'] = networkIo[1]
+ # networkInfo['up'] = round(float(networkIo[0] - web.ctx.session.up) / 1024 / (ntime - web.ctx.session.otime),2)
+ # networkInfo['down'] = round(float(networkIo[1] - web.ctx.session.down) / 1024 / (ntime - web.ctx.session.otime),2)
+ networkInfo['downPackets'] =networkIo[3]
+ networkInfo['upPackets'] =networkIo[2]
+
+ # web.ctx.session.up = networkIo[0]
+ # web.ctx.session.down = networkIo[1]
+ # web.ctx.session.otime = ntime;
+
+ # networkInfo['cpu'] = self.GetCpuInfo()
+ # networkInfo['load'] = self.GetLoadAverage(get);
+ return jsonify(networkInfo)
\ No newline at end of file
diff --git a/views/files.py b/views/files.py
new file mode 100644
index 000000000..06f8177fd
--- /dev/null
+++ b/views/files.py
@@ -0,0 +1,16 @@
+# coding:utf-8
+
+from flask import Flask
+from flask import Blueprint,render_template
+from flask import jsonify
+
+
+files = Blueprint('files', __name__, template_folder='templates')
+
+@files.route("/")
+def index():
+ return render_template('default/files.html')
+
+@files.route("/GetDiskInfo")
+def GetDiskInfo():
+ return jsonify({'result':'ok'})
\ No newline at end of file