readd: jump server

This commit is contained in:
lollipopkit
2024-04-21 00:42:00 +08:00
parent 9d1df94f89
commit 23764f8c93
5 changed files with 110 additions and 113 deletions

View File

@@ -1,7 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:toolbox/view/widget/cardx.dart';
extension WidgetX on Widget { extension WidgetX on Widget {
Widget get card { Widget get card {
return Card(child: this); return CardX(child: this);
} }
} }

View File

@@ -60,28 +60,25 @@ Future<SSHClient> genClient(
onStatus?.call(GenSSHClientStatus.socket); onStatus?.call(GenSSHClientStatus.socket);
final socket = await () async { final socket = await () async {
/// Issues #210
/// Temporarily comment out the proxy function
// Proxy // Proxy
// final jumpSpi_ = () { final jumpSpi_ = () {
// // Multi-thread or key login // Multi-thread or key login
// if (jumpSpi != null) return jumpSpi; if (jumpSpi != null) return jumpSpi;
// // Main thread // Main thread
// if (spi.jumpId != null) return Stores.server.box.get(spi.jumpId); if (spi.jumpId != null) return Stores.server.box.get(spi.jumpId);
// }(); }();
// if (jumpSpi_ != null) { if (jumpSpi_ != null) {
// final jumpClient = await genClient( final jumpClient = await genClient(
// jumpSpi_, jumpSpi_,
// privateKey: jumpPrivateKey, privateKey: jumpPrivateKey,
// timeout: timeout, timeout: timeout,
// ); );
// return await jumpClient.forwardLocal( return await jumpClient.forwardLocal(
// spi.ip, spi.ip,
// spi.port, spi.port,
// ); );
// } }
// Direct // Direct
try { try {

View File

@@ -259,9 +259,8 @@ class _ServerEditPageState extends State<ServerEditPage> {
), ),
), ),
_buildAuth(), _buildAuth(),
//_buildJumpServer(), _buildJumpServer(),
_buildPVE(), _buildMore(),
_buildCustomCmd(),
]; ];
return SingleChildScrollView( return SingleChildScrollView(
padding: const EdgeInsets.fromLTRB(17, 17, 17, 47), padding: const EdgeInsets.fromLTRB(17, 17, 17, 47),
@@ -356,10 +355,13 @@ class _ServerEditPageState extends State<ServerEditPage> {
); );
} }
Widget _buildPVE() { Widget _buildMore() {
return ExpandTile( return ExpandTile(
title: const Text('PVE'), title: Text(l10n.more),
children: [ children: [
UIs.height7,
const Text('PVE', style: UIs.text13Grey),
UIs.height7,
Input( Input(
controller: _pveAddrCtrl, controller: _pveAddrCtrl,
type: TextInputType.url, type: TextInputType.url,
@@ -368,8 +370,11 @@ class _ServerEditPageState extends State<ServerEditPage> {
hint: 'https://example.com:8006', hint: 'https://example.com:8006',
), ),
ListTile( ListTile(
leading: const Icon(MingCute.certificate_line), leading: const Padding(
title: Text(l10n.ignoreCert), padding: EdgeInsets.only(left: 10),
child: Icon(MingCute.certificate_line),
),
title: Text('PVE ${l10n.ignoreCert}'),
subtitle: Text(l10n.pveIgnoreCertTip, style: UIs.text12Grey), subtitle: Text(l10n.pveIgnoreCertTip, style: UIs.text12Grey),
trailing: ListenableBuilder( trailing: ListenableBuilder(
listenable: _pveIgnoreCert, listenable: _pveIgnoreCert,
@@ -381,24 +386,22 @@ class _ServerEditPageState extends State<ServerEditPage> {
), ),
), ),
).card, ).card,
], UIs.height7,
); Text(l10n.customCmd, style: UIs.text13Grey),
} UIs.height7,
Widget _buildCustomCmd() {
return ExpandTile(
title: Text(l10n.customCmd),
children: [
Input( Input(
controller: _customCmdCtrl, controller: _customCmdCtrl,
type: TextInputType.text, type: TextInputType.text,
maxLines: 3, maxLines: 3,
label: 'Json', label: 'JSON',
icon: Icons.code, icon: Icons.code,
hint: '{${l10n.customCmdHint}}', hint: '{${l10n.customCmdHint}}',
), ),
ListTile( ListTile(
leading: const Icon(MingCute.doc_line), leading: const Padding(
padding: EdgeInsets.only(left: 10),
child: Icon(MingCute.doc_line),
),
title: Text(l10n.doc), title: Text(l10n.doc),
trailing: const Icon(Icons.open_in_new, size: 17), trailing: const Icon(Icons.open_in_new, size: 17),
onTap: () => openUrl(l10n.customCmdDocUrl), onTap: () => openUrl(l10n.customCmdDocUrl),
@@ -427,48 +430,44 @@ class _ServerEditPageState extends State<ServerEditPage> {
); );
} }
// Widget _buildJumpServer() { Widget _buildJumpServer() {
// return ListenableBuilder( return ListenableBuilder(
// listenable: _jumpServer, listenable: _jumpServer,
// builder: (_, __) { builder: (_, __) {
// final children = Pros.server.servers final children = Pros.server.servers
// .where((element) => element.spi.jumpId == null) .where((element) => element.spi.jumpId == null)
// .where((element) => element.spi.id != widget.spi?.id) .where((element) => element.spi.id != widget.spi?.id)
// .map( .map(
// (e) => ListTile( (e) => ListTile(
// title: Text(e.spi.name), title: Text(e.spi.name),
// subtitle: Text(e.spi.id, style: UIs.textGrey), subtitle: Text(e.spi.id, style: UIs.textGrey),
// trailing: Radio<String>( trailing: Radio<String>(
// groupValue: _jumpServer.value, groupValue: _jumpServer.value,
// value: e.spi.id, value: e.spi.id,
// onChanged: (val) => _jumpServer.value = val, onChanged: (val) => _jumpServer.value = val,
// ), ),
// onTap: () { onTap: () {
// _jumpServer.value = e.spi.id; _jumpServer.value = e.spi.id;
// }, },
// ), ),
// ) )
// .toList(); .toList();
// children.add(ListTile( children.add(ListTile(
// title: Text(l10n.clear), title: Text(l10n.clear),
// trailing: const Icon(Icons.clear), trailing: const Icon(Icons.clear),
// onTap: () => _jumpServer.value = null, onTap: () => _jumpServer.value = null,
// )); ));
// return CardX( return CardX(
// child: ExpandTile( child: ExpandTile(
// leading: const Icon(Icons.map), leading: const Icon(Icons.map),
// initiallyExpanded: _jumpServer.value != null, initiallyExpanded: _jumpServer.value != null,
// title: Text(l10n.jumpServer), title: Text(l10n.jumpServer),
// subtitle: const Text( children: children,
// "It was temporarily disabled because it has some bugs (Issues #210)", ),
// style: UIs.textGrey, );
// ), },
// children: children, );
// ), }
// );
// },
// );
// }
void _onSave() async { void _onSave() async {
if (_ipController.text.isEmpty) { if (_ipController.text.isEmpty) {

View File

@@ -223,18 +223,18 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: countly_flutter name: countly_flutter
sha256: c5fd3e841af363d284d41d54bc33e8dd9312b0be148ce3600cc531e99203e8e1 sha256: "829853407896350bdb4881ddc92326cf87b8d70ad92a78c4775cd05666d5a965"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "23.12.1" version: "24.4.0"
cross_file: cross_file:
dependency: transitive dependency: transitive
description: description:
name: cross_file name: cross_file
sha256: fedaadfa3a6996f75211d835aaeb8fede285dae94262485698afd832371b9a5e sha256: "55d7b444feb71301ef6b8838dbc1ae02e63dd48c8773f3810ff53bb1e2945b32"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.3.3+8" version: "0.3.4+1"
crypto: crypto:
dependency: transitive dependency: transitive
description: description:
@@ -263,10 +263,10 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: dartssh2 name: dartssh2
sha256: "53a230c7dd6f487b704ceef1b29323ad64d19be89e786ccbc81e157a70417a56" sha256: "48d35ad9b697627b59f9ebeab4e4936266dc153cff96f02c997d3fe30df4d80a"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.8.2" version: "2.9.1-pre"
dio: dio:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -327,10 +327,10 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: file_picker name: file_picker
sha256: "4e42aacde3b993c5947467ab640882c56947d9d27342a5b6f2895b23956954a6" sha256: b6283d7387310ad83bc4f3bc245b75d223a032ae6eba275afcd585de2b9a1476
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "6.1.1" version: "8.0.1"
fixnum: fixnum:
dependency: transitive dependency: transitive
description: description:
@@ -417,10 +417,10 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: flutter_markdown name: flutter_markdown
sha256: "21b085a1c185e46701373866144ced56cfb7a0c33f63c916bb8fe2d0c1491278" sha256: "15f39b20486760f9b85531ed2ef7f63e3a376210d2ff83614119ee93fda5670c"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.6.19" version: "0.7.0"
flutter_native_splash: flutter_native_splash:
dependency: "direct dev" dependency: "direct dev"
description: description:
@@ -531,10 +531,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: http name: http
sha256: a2bbf9d017fcced29139daa8ed2bba4ece450ab222871df93ca9eec6f80c34ba sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.2.0" version: "1.2.1"
http_multi_server: http_multi_server:
dependency: transitive dependency: transitive
description: description:
@@ -979,18 +979,18 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: share_plus name: share_plus
sha256: "3ef39599b00059db0990ca2e30fca0a29d8b37aae924d60063f8e0184cf20900" sha256: fb5319f3aab4c5dda5ebb92dca978179ba21f8c783ee4380910ef4c1c6824f51
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "7.2.2" version: "8.0.3"
share_plus_platform_interface: share_plus_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: share_plus_platform_interface name: share_plus_platform_interface
sha256: df08bc3a07d01f5ea47b45d03ffcba1fa9cd5370fb44b3f38c70e42cced0f956 sha256: "251eb156a8b5fa9ce033747d73535bf53911071f8d3b6f4f0b578505ce0d4496"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.3.1" version: "3.4.0"
shared_preferences: shared_preferences:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -1035,10 +1035,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: shared_preferences_web name: shared_preferences_web
sha256: "7b15ffb9387ea3e237bb7a66b8a23d2147663d391cafc5c8f37b2e7b4bde5d21" sha256: "9aee1089b36bd2aafe06582b7d7817fd317ef05fc30e6ba14bff247d0933042a"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.2.2" version: "2.3.0"
shared_preferences_windows: shared_preferences_windows:
dependency: transitive dependency: transitive
description: description:
@@ -1224,10 +1224,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_web name: url_launcher_web
sha256: fff0932192afeedf63cdd50ecbb1bc825d31aed259f02bb8dba0f3b729a5e88b sha256: "8d9e750d8c9338601e709cd0885f95825086bd8b642547f26bda435aade95d8a"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.2.3" version: "2.3.1"
url_launcher_windows: url_launcher_windows:
dependency: transitive dependency: transitive
description: description:
@@ -1313,18 +1313,18 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: web name: web
sha256: "4188706108906f002b3a293509234588823c8c979dc83304e229ff400c996b05" sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.4.2" version: "0.5.1"
web_socket_channel: web_socket_channel:
dependency: transitive dependency: transitive
description: description:
name: web_socket_channel name: web_socket_channel
sha256: "939ab60734a4f8fa95feacb55804fa278de28bdeef38e616dc08e44a84adea23" sha256: "58c6666b342a38816b2e7e50ed0f1e261959630becd4c879c4f26bfa14aa5a42"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.4.3" version: "2.4.5"
webdav_client: webdav_client:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -1370,8 +1370,8 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
path: "." path: "."
ref: master ref: "03c74c4"
resolved-ref: "8f17dcbcafa9dc1b56cb3d7075dedfe0487d6a9b" resolved-ref: "03c74c45ceb3481ed98d11f69422e60d59eb1654"
url: "https://github.com/lollipopkit/xterm.dart" url: "https://github.com/lollipopkit/xterm.dart"
source: git source: git
version: "4.0.0" version: "4.0.0"
@@ -1392,5 +1392,5 @@ packages:
source: hosted source: hosted
version: "0.0.6" version: "0.0.6"
sdks: sdks:
dart: ">=3.3.0-279.1.beta <4.0.0" dart: ">=3.3.0 <4.0.0"
flutter: ">=3.19.0" flutter: ">=3.19.0"

View File

@@ -18,8 +18,8 @@ dependencies:
dio: ^5.2.1 dio: ^5.2.1
after_layout: ^1.1.0 after_layout: ^1.1.0
url_launcher: ^6.1.8 url_launcher: ^6.1.8
countly_flutter: ^23.6.0 countly_flutter: ^24.4.0
dartssh2: ^2.8.2 dartssh2: ^2.9.1-pre
# newer version has some issues # newer version has some issues
# git: # git:
# ref: master # ref: master
@@ -35,15 +35,15 @@ dependencies:
r_upgrade: 0.3.8+2 r_upgrade: 0.3.8+2
path_provider: ^2.0.9 path_provider: ^2.0.9
easy_isolate: ^1.3.0 easy_isolate: ^1.3.0
share_plus: ^7.0.2 share_plus: ^8.0.3
intl: ^0.18.0 intl: ^0.18.0
# xterm: ^3.5.0 # xterm: ^3.5.0
xterm: xterm:
# path: ../xterm.dart # path: ../xterm.dart
git: git:
ref: master ref: 03c74c4
url: https://github.com/lollipopkit/xterm.dart url: https://github.com/lollipopkit/xterm.dart
file_picker: ^6.1.1 file_picker: ^8.0.1
plain_notification_token: ^0.0.4 plain_notification_token: ^0.0.4
highlight: ^0.7.0 highlight: ^0.7.0
flutter_highlight: ^0.7.0 flutter_highlight: ^0.7.0
@@ -66,7 +66,7 @@ dependencies:
url: https://github.com/lollipopkit/webdav_client url: https://github.com/lollipopkit/webdav_client
window_manager: ^0.3.7 window_manager: ^0.3.7
flutter_displaymode: ^0.6.0 flutter_displaymode: ^0.6.0
flutter_markdown: ^0.6.18+2 flutter_markdown: ^0.7.0
computer: computer:
git: git:
ref: master ref: master