perf: applet host platform

pull/13572/head
ibuler 2024-07-02 15:13:51 +08:00 committed by 老广
parent 912cefbc85
commit d42acc3848
6 changed files with 15 additions and 5 deletions

View File

@ -646,7 +646,7 @@ platforms_data_json = '''[
"sftp_enabled": true,
"sftp_home": "/tmp"
},
"required": true,
"required": false,
"default": false
},
{

View File

@ -459,8 +459,9 @@
"EnableDomain": "Gateway enabled",
"EnableKoKoSSHHelpText": "When switched on, connecting to the asset will display ssh client pull-up method",
"Endpoint": "Endpoint",
"Endpoints": "Endpoints",
"EndpointListHelpMessage": "The service endpoint is the address (port) for users to access the service. when users connect to assets, they choose service endpoints based on endpoint rules and asset tags, using them as access points to establish connections and achieve distributed connections to assets",
"EndpointRule": "Endpoint rules",
"EndpointRules": "Endpoint rules",
"EndpointRuleListHelpMessage": "For the server endpoint selection strategy, there are currently two options:<br>1. specify the endpoint according to the endpoint rule (current page);<br>2. choose the endpoint through asset tags, with the fixed tag name being 'endpoint' and the value being the name of the endpoint.<br>the tag matching method is preferred for both methods, as the ip range may conflict, and the tag method exists as a supplement to the rules.",
"Endswith": "Ending with...",
"EnsureThisValueIsGreaterThanOrEqualTo1": "Please make sure this number is greater than or equal to 1",
@ -1210,6 +1211,7 @@
"TemplateManagement": "Templates",
"TencentCloud": "Tencent cloud",
"Terminal": "Components",
"Components": "Components",
"TerminalDetail": "Terminal details",
"TerminalUpdate": "Update the terminal",
"TerminalUpdateStorage": "Update the terminal storage",

View File

@ -474,8 +474,9 @@
"EnableDomain": "ドメインの有効化",
"EnableKoKoSSHHelpText": "起動時にアセットに接続すると、 SSH Client の起動方法が表示されます",
"Endpoint": "サーバーエンドポイント",
"Endpoints": "サーバーエンドポイント",
"EndpointListHelpMessage": "サービスエンドポイントはユーザーがサービスにアクセスするアドレス(ポート)で、ユーザーが資産に接続する際、エンドポイントルールと資産ラベルに基づいてサービスエンドポイントを選択し、アクセスポイントを設定して分散接続資産を実現します",
"EndpointRule": "エンドポイントのルール",
"EndpointRules": "エンドポイントのルール",
"EndpointRuleListHelpMessage": "サーバーエンドポイント選択策略については、現在2つの方式をサポートしています<br>1、エンドポイントルールに基づいて指定されたエンドポイント現在のページ<br>2、資産タグを通じてエンドポイントを選択し、タグ名は固定で、endpointである、その値はエンドポイントの名称である。<br>2つの方式では、タグマッチングが優先されます。なぜならIP範囲が衝突する可能性があるからです。タグ方式はルールの補足として存在しています。",
"Endswith": "...で終わる",
"EnsureThisValueIsGreaterThanOrEqualTo1": "この値が1以上であることを確認してください",
@ -1248,6 +1249,7 @@
"TemplateManagement": "テンプレート管理",
"TencentCloud": "テンセントクラウド",
"Terminal": "コンポーネント設定",
"Components": "コンポーネント設定",
"TerminalDetail": "端末の詳細",
"TerminalUpdate": "端末の更新",
"TerminalUpdateStorage": "ターミナルストレージの更新",

View File

@ -459,8 +459,9 @@
"EnableDomain": "启用网域",
"EnableKoKoSSHHelpText": "开启时连接资产会显示 SSH Client 拉起方式",
"Endpoint": "服务端点",
"Endpoints": "服务端点",
"EndpointListHelpMessage": "服务端点是用户访问服务的地址(端口),当用户在连接资产时,会根据端点规则和资产标签选择服务端点,作为访问入口建立连接,实现分布式连接资产",
"EndpointRule": "端点规则",
"EndpointRules": "端点规则",
"EndpointRuleListHelpMessage": "对于服务端点选择策略,目前支持两种:<br>1、根据端点规则指定端点(当前页面)<br>2、通过资产标签选择端点标签名固定是 endpoint值是端点的名称。<br>两种方式优先使用标签匹配,因为 IP 段可能冲突,标签方式是作为规则的补充存在的。",
"Endswith": "以...结尾",
"EnsureThisValueIsGreaterThanOrEqualTo1": "请确保该值大于或者等于 1",
@ -1211,6 +1212,7 @@
"TemplateManagement": "模版管理",
"TencentCloud": "腾讯云",
"Terminal": "组件设置",
"Components": "组件设置",
"TerminalDetail": "终端详情",
"TerminalUpdate": "更新终端",
"TerminalUpdateStorage": "更新终端存储",

View File

@ -513,8 +513,9 @@
"EnableKoKoSSHHelpText": "開啟時連接資產會顯示 SSH Client 拉起方式",
"EnableVaultStorage": "開啟 Vault 儲存",
"Endpoint": "服務端點",
"Endpoints": "服務端點",
"EndpointListHelpMessage": "服務端點是用戶訪問服務的地址(埠),當用戶在連接資產時,會根據端點規則和資產標籤選擇服務端點,作為訪問入口建立連接,實現分布式連接資產",
"EndpointRule": "端點規則",
"EndpointRules": "端點規則",
"EndpointRuleListHelpMessage": "對於服務端點選擇策略,目前支持兩種:<br>1、根據端點規則指定端點(當前頁面)<br>2、通過資產標籤選擇端點標籤名固定是 endpoint值是端點的名稱。<br>兩種方式優先使用標籤匹配,因為 IP 段可能衝突,標籤方式是作為規則的補充存在的。",
"Endswith": "以...結尾",
"EnsureThisValueIsGreaterThanOrEqualTo1": "請確保該值大於或者等於 1",
@ -1345,6 +1346,7 @@
"Templates": "模板管理",
"TencentCloud": "騰訊雲",
"Terminal": "組件設置",
"Components": "組件設置",
"TerminalStat": "CPU/記憶體/磁碟",
"TerminateTaskSendSuccessMsg": "終斷任務已下發,請稍後刷新查看",
"TermsAndConditions": "條款和條件",

View File

@ -87,6 +87,8 @@ class DownloadUploadMixin:
path = os.path.join(settings.APPS_DIR, 'terminal', 'applets', instance.name)
else:
path = default_storage.path('applets/{}'.format(instance.name))
if not os.path.exists(path):
raise ValidationError({'error': _('Applet not found in path: {}').format(path)})
zip_path = shutil.make_archive(path, 'zip', path)
with open(zip_path, 'rb') as f:
response = HttpResponse(f.read(), status=200, content_type='application/octet-stream')