def create_serverid(self,get): try: userPath = 'data/userInfo.json' if not os.path.exists(userPath): return public.returnMsg(False,'LOGIN_FIRST') tmp = public.readFile(userPath) if len(tmp) < 2: tmp = '{}' data = json.loads(tmp) data['uid'] = data['id'] if not data: return public.returnMsg(False,'LOGIN_FIRST') if not 'server_id' in data: s1 = public.get_mac_address() + public.get_hostname() s2 = self.get_cpuname() serverid = public.md5(s1) + public.md5(s2) data['server_id'] = serverid public.writeFile(userPath,json.dumps(data)) return data except: return public.returnMsg(False,'LOGIN_FIRST')
app.config['SESSION_KEY_PREFIX'] = 'BT_:' app.config['SESSION_COOKIE_NAME'] = "BT_PANEL_6" app.config['PERMANENT_SESSION_LIFETIME'] = 86400 * 7 Session(app) if s_sqlite: sdb.create_all() from datetime import datetime import socket comm = common.panelAdmin() method_all = ['GET', 'POST'] method_get = ['GET'] method_post = ['POST'] json_header = {'Content-Type': 'application/json; charset=utf-8'} cache.set('p_token', 'bmac_' + public.Md5(public.get_mac_address())) admin_path_file = 'data/admin_path.pl' admin_path = '/' if os.path.exists(admin_path_file): admin_path = public.readFile(admin_path_file).strip() admin_path_checks = [ '/', '/close', '/task', '/login', '/config', '/site', '/sites', 'ftp', '/public', '/database', '/data', '/download_file', '/control', '/crontab', '/firewall', '/files', 'config', '/soft', '/ajax', '/system', '/panel_data', '/code', '/ssl', '/plugin', '/wxapp', '/hook', '/safe', '/yield', '/downloadApi', '/pluginApi', '/auth', '/download', '/cloud', '/webssh', '/connect_event', '/panel' ] if admin_path in admin_path_checks: admin_path = '/bt'