feat: 支持局域网 HTTPS 直连并持久化插件连接配置
This commit is contained in:
1 parent
9eba4556db
commit
2203afde3c
15 files changed
+486
-17
No files matched your search
@@ -6,6 +6,7 @@ import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import ssl
|
||||
import time
|
||||
import urllib.request
|
||||
import urllib.parse
|
||||
@@ -19,6 +20,7 @@ def main():
|
||||
parser.add_argument('--url', default='http://127.0.0.1:8765')
|
||||
parser.add_argument('--task', default=':app:assembleDebug')
|
||||
parser.add_argument('--adb', default='adb')
|
||||
parser.add_argument('--server-cert', help='Trusted server public PEM certificate for LAN HTTPS')
|
||||
parser.add_argument('--device', help='Explicit adb device serial; omit to download only')
|
||||
args = parser.parse_args()
|
||||
token = os.environ.get('REMOTE_BUILD_TOKEN', '')
|
||||
@@ -38,7 +40,8 @@ def main():
|
||||
data = json.dumps(body).encode() if body is not None else None
|
||||
req = urllib.request.Request(endpoint + '/api/v1' + path, data=data, method=method,
|
||||
headers={'Authorization': 'Bearer ' + token, 'Content-Type': 'application/json'})
|
||||
with urllib.request.urlopen(req, timeout=300) as response:
|
||||
context = ssl.create_default_context(cafile=args.server_cert) if args.server_cert else None
|
||||
with urllib.request.urlopen(req, timeout=300, context=context) as response:
|
||||
result = response.read()
|
||||
return result if '/artifacts/' in path else json.loads(result)
|
||||
|
||||
|
||||
Reference in new issue
Block a user