File tree Expand file tree Collapse file tree 5 files changed +39
-26
lines changed
components/system_options Expand file tree Collapse file tree 5 files changed +39
-26
lines changed Original file line number Diff line number Diff line change 11import asyncio
22import json
33import socket
4+ import ssl
45
56import aiohttp
67
@@ -132,9 +133,17 @@ async def get_ota_config(self):
132133 payload = self .build_payload ()
133134
134135 try :
136+ # 禁用SSL证书验证以支持自签名证书
137+ ssl_context = ssl .create_default_context ()
138+ ssl_context .check_hostname = False
139+ ssl_context .verify_mode = ssl .CERT_NONE
140+
135141 # 使用aiohttp异步发送请求
136142 timeout = aiohttp .ClientTimeout (total = 10 )
137- async with aiohttp .ClientSession (timeout = timeout ) as session :
143+ connector = aiohttp .TCPConnector (ssl = ssl_context )
144+ async with aiohttp .ClientSession (
145+ timeout = timeout , connector = connector
146+ ) as session :
138147 async with session .post (
139148 self .ota_version_url , headers = headers , json = payload
140149 ) as response :
Original file line number Diff line number Diff line change @@ -324,9 +324,3 @@ def handle_verification_code(text: str) -> None:
324324 return
325325
326326 copy_to_clipboard (code )
327-
328- from src .utils .config_manager import ConfigManager
329-
330- config = ConfigManager .get_instance ()
331- ota_url = config .get_config ("SYSTEM_OPTIONS.NETWORK.AUTHORIZATION_URL" , "" )
332- open_url (ota_url )
Original file line number Diff line number Diff line change @@ -428,19 +428,26 @@ def _on_data_ready(self, data):
428428
429429 def _on_retry_clicked (self ):
430430 """
431- 重新激活按钮点击 .
431+ 跳转激活按钮点击 - 打开激活网页 .
432432 """
433- self .logger .info ("用户请求重新激活 " )
433+ self .logger .info ("用户点击跳转激活 " )
434434
435- # 检查是否已经关闭
436- if self .is_shutdown_requested ():
437- return
438-
439- # 重置状态
440- self .activation_model .reset_activation_code ()
441-
442- # 重新开始初始化
443- self .create_task (self ._start_initialization (), "retry_initialization" )
435+ # 从配置中获取激活URL并打开
436+ try :
437+ from src .utils .common_utils import open_url
438+ from src .utils .config_manager import ConfigManager
439+
440+ config = ConfigManager .get_instance ()
441+ ota_url = config .get_config ("SYSTEM_OPTIONS.NETWORK.AUTHORIZATION_URL" , "" )
442+ if ota_url :
443+ open_url (ota_url )
444+ self .update_status ("已打开激活页面,请在浏览器中输入验证码" )
445+ else :
446+ self .logger .error ("未配置激活URL" )
447+ self .update_status ("错误: 未配置激活URL" )
448+ except Exception as e :
449+ self .logger .error (f"打开激活页面失败: { e } " )
450+ self .update_status (f"打开激活页面失败: { e } " )
444451
445452 def _on_copy_code_clicked (self ):
446453 """
Original file line number Diff line number Diff line change @@ -231,6 +231,15 @@ def get_config_data(self) -> dict:
231231 config_data = {}
232232
233233 try :
234+ # 客户端ID和设备ID
235+ client_id = self ._get_text_value ("client_id_edit" )
236+ if client_id :
237+ config_data ["SYSTEM_OPTIONS.CLIENT_ID" ] = client_id
238+
239+ device_id = self ._get_text_value ("device_id_edit" )
240+ if device_id :
241+ config_data ["SYSTEM_OPTIONS.DEVICE_ID" ] = device_id
242+
234243 # 系统选项 - 网络配置
235244 ota_url = self ._get_text_value ("ota_url_edit" )
236245 if ota_url :
Original file line number Diff line number Diff line change 6161 <item row =" 0" column =" 1" >
6262 <widget class =" QLineEdit" name =" client_id_edit" >
6363 <property name =" readOnly" >
64- <bool >true</bool >
65- </property >
66- <property name =" styleSheet" >
67- <string >background-color: #f5f5f5;</string >
64+ <bool >false</bool >
6865 </property >
6966 </widget >
7067 </item >
8178 <item row =" 1" column =" 1" >
8279 <widget class =" QLineEdit" name =" device_id_edit" >
8380 <property name =" readOnly" >
84- <bool >true</bool >
85- </property >
86- <property name =" styleSheet" >
87- <string >background-color: #f5f5f5;</string >
81+ <bool >false</bool >
8882 </property >
8983 </widget >
9084 </item >
You can’t perform that action at this time.
0 commit comments