pull/109/head
Mr Chen 7 years ago
parent 4dd22cd3dc
commit 0978a94379
  1. 17
      app.py
  2. 33
      class/core/config.py
  3. 9
      class/core/public.py
  4. 3
      route/system.py
  5. 4
      static/js/index.js

@ -3,20 +3,16 @@
import sys
import io
import os
import time
from datetime import timedelta
sys.path.append("/class/core/")
sys.path.append("/class/core")
reload(sys)
sys.setdefaultencoding('utf8')
import route
from flask import Flask
import config
app = Flask(__name__)
app.debug = True
app = config.config().makeApp(__name__)
DEFAULT_MODULES = (
@ -35,13 +31,6 @@ DEFAULT_MODULES = (
)
# print "time.time(): %f " % time.time()
app.config.version = "0.0.1" + str(time.time())
app.config['SECRET_KEY'] = os.urandom(24)
app.config['PERMANENT_SESSION_LIFETIME'] = timedelta(days=7)
def setting_modules(app, modules):
for module, url_prefix in modules:
app.register_blueprint(module, url_prefix=url_prefix)

@ -0,0 +1,33 @@
# coding:utf-8
import sys
import io
import os
import time
from flask import Flask
from datetime import timedelta
class config:
__version = '0.0.1'
__app = None
def __init__(self):
pass
def makeApp(self, name):
app = Flask(name)
app.debug = True
app.config.version = self.__version + str(time.time())
app.config['SECRET_KEY'] = os.urandom(24)
app.config['PERMANENT_SESSION_LIFETIME'] = timedelta(days=7)
__app = app
return app
def getVersion(self):
return self.__version
def getApp(self):
return self.__app

@ -682,7 +682,7 @@ def checkCert(certPath='ssl/certificate.pem'):
# return result
def to_size(size):
def toSize(size):
# 字节单位转换
d = ('b', 'KB', 'MB', 'GB', 'TB')
s = d[0]
@ -694,6 +694,13 @@ def to_size(size):
return str(size) + ' ' + b
def getMacAddress():
# 获取mac
import uuid
mac = uuid.UUID(int=uuid.getnode()).hex[-12:]
return ":".join([mac[e:e + 2] for e in range(0, 11, 2)])
def get_string(t):
if t != -1:
max = 126

@ -25,7 +25,8 @@ def network():
@system.route("/update_server")
def updateServer():
data = system_api.system_api().updateServer('update')
data = system_api.system_api().updateServer('check')
print data
return data

@ -500,7 +500,7 @@ function checkUpdate() {
function updateMsg(){
window.open("http://www.bt.cn/bbs/thread-1186-1-1.html");
$.get('/ajax?action=UpdatePanel',function(rdata){
$.get('/system/update_server',function(rdata){
layer.open({
type:1,
title:lan.index.update_to+'['+rdata.version+']',
@ -515,7 +515,7 @@ function updateMsg(){
+'</div>'
+'</div>'
});
});
},'json');
}

Loading…
Cancel
Save