运行了这个命令,进入软件商店依然弹出登陆对话框 sed -i -r "s/not not get_user_info()/True/" /www/server/panel/class/public.py && bt 1
- def get_user_info():
- user_file = ‘{}/data/userInfo.json’.format(get_panel_path())
- if not os.path.exists(user_file): return {}
- userInfo = {}
- try:
- userTmp = json.loads(readFile(user_file))
- if not ‘serverid’ in userTmp or len(userTmp[‘serverid’]) != 64:
- import panelAuth
- userTmp = panelAuth.panelAuth().create_serverid(None)
- userInfo[‘uid’] = userTmp[‘uid’]
- userInfo[‘access_key’] = userTmp[‘access_key’]
- userInfo[‘username’] = userTmp[‘username’]
- userInfo[‘serverid’] = userTmp[‘serverid’]
- userInfo[‘oem’] = get_oem_name()
- userInfo[‘o’] = userInfo[‘oem’]
- userInfo[‘mac’] = get_mac_address()
- except: pass
- return userInfo
复制代码
- def download_main(upgrade_plugin_name,upgrade_version):
- ”’
- [url=home.php?mod=space&uid=5839]@name[/url] 下载插件主程序文件
- @author hwliang<2021-06-25>
- @param upgrade_plugin_name<string> 插件名称
- @param upgrade_version<string> 插件版本
- @return void
- ”’
- import requests,shutil
- plugin_path = get_plugin_path()
- tmp_path = ‘{}/temp’.format(get_panel_path())
- download_d_main_url = ‘https://api.bt.cn/down/download_plugin_main’
- pdata = get_user_info()
- pdata[‘name’] = upgrade_plugin_name
- pdata[‘version’] = upgrade_version
- pdata[‘os’] = ‘Linux’
- download_res = requests.post(download_d_main_url,pdata,timeout=30,headers=get_requests_headers())
- filename = ‘{}/{}.py’.format(tmp_path,upgrade_plugin_name)
- with open(filename,’wb+’) as save_script_f:
- save_script_f.write(download_res.content)
- save_script_f.close()
- if md5(download_res.content) != download_res.headers[‘Content-md5’]:
- raise PanelError(‘插件安装包HASH校验失败’)
- dst_file = ‘{plugin_path}/{plugin_name}/{plugin_name}_main.py’.format(plugin_path=plugin_path,plugin_name = upgrade_plugin_name)
- shutil.copyfile(filename,dst_file)
- if os.path.exists(filename): os.remove(filename)
- WriteLog(‘软件管理’,"检测到插件[{}]程序文件异常,已尝试自动修复!".format(get_plugin_info(upgrade_plugin_name)[‘title’]))
复制代码
⠀ |