mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-18 07:44:26 +01:00
SFTP init.
This commit is contained in:
@@ -15,7 +15,7 @@ class MenuItems {
|
||||
static const List<MenuItem> secondItems = [edit];
|
||||
|
||||
static const ssh = MenuItem(text: 'SSH', icon: Icons.link);
|
||||
static const sftp = MenuItem(text: 'SFTP', icon: Icons.file_present);
|
||||
static const sftp = MenuItem(text: 'SFTP', icon: Icons.insert_drive_file);
|
||||
static const snippet = MenuItem(text: 'Snippet', icon: Icons.label);
|
||||
static const apt = MenuItem(text: 'Apt', icon: Icons.system_security_update);
|
||||
static const edit = MenuItem(text: 'Edit', icon: Icons.edit);
|
||||
|
||||
29
lib/data/model/sftp/absolute_path.dart
Normal file
29
lib/data/model/sftp/absolute_path.dart
Normal file
@@ -0,0 +1,29 @@
|
||||
class AbsolutePath {
|
||||
String path;
|
||||
String? _prePath;
|
||||
AbsolutePath(this.path);
|
||||
|
||||
void update(String newPath) {
|
||||
_prePath = path;
|
||||
if (newPath == '..') {
|
||||
path = path.substring(0, path.lastIndexOf('/'));
|
||||
if (path == '') {
|
||||
path = '/';
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (newPath == '/') {
|
||||
path = '/';
|
||||
return;
|
||||
}
|
||||
path = path + (path.endsWith('/') ? '' : '/') + newPath;
|
||||
}
|
||||
|
||||
bool undo() {
|
||||
if (_prePath == null) {
|
||||
return false;
|
||||
}
|
||||
path = _prePath!;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
39
lib/data/model/sftp/sftp_side_status.dart
Normal file
39
lib/data/model/sftp/sftp_side_status.dart
Normal file
@@ -0,0 +1,39 @@
|
||||
import 'package:dartssh2/dartssh2.dart';
|
||||
import 'package:toolbox/data/model/server/server_private_info.dart';
|
||||
import 'package:toolbox/data/model/sftp/absolute_path.dart';
|
||||
|
||||
class SFTPSideViewStatus {
|
||||
bool leftSelected = false;
|
||||
bool rightSelected = false;
|
||||
ServerPrivateInfo? leftSpi;
|
||||
ServerPrivateInfo? rightSpi;
|
||||
List<SftpName>? leftFiles;
|
||||
List<SftpName>? rightFiles;
|
||||
AbsolutePath? leftPath;
|
||||
AbsolutePath? rightPath;
|
||||
SftpClient? leftClient;
|
||||
SftpClient? rightClient;
|
||||
|
||||
SFTPSideViewStatus();
|
||||
|
||||
ServerPrivateInfo? spi(bool left) => left ? leftSpi : rightSpi;
|
||||
void setSpi(bool left, ServerPrivateInfo nSpi) =>
|
||||
left ? leftSpi = nSpi : rightSpi = nSpi;
|
||||
|
||||
/// Whether the Left/Right Destination is selected.
|
||||
bool selected(bool left) => left ? leftSelected : rightSelected;
|
||||
void setSelect(bool left, bool nSelect) =>
|
||||
left ? leftSelected = nSelect : rightSelected = nSelect;
|
||||
|
||||
List<SftpName>? files(bool left) => left ? leftFiles : rightFiles;
|
||||
void setFiles(bool left, List<SftpName>? nFiles) =>
|
||||
left ? leftFiles = nFiles : rightFiles = nFiles;
|
||||
|
||||
AbsolutePath? path(bool left) => left ? leftPath : rightPath;
|
||||
void setPath(bool left, AbsolutePath? nPath) =>
|
||||
left ? leftPath = nPath : rightPath = nPath;
|
||||
|
||||
SftpClient? client(bool left) => left ? leftClient : rightClient;
|
||||
void setClient(bool left, SftpClient? nClient) =>
|
||||
left ? leftClient = nClient : rightClient = nClient;
|
||||
}
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
class BuildData {
|
||||
static const String name = "ServerBox";
|
||||
static const int build = 97;
|
||||
static const int build = 98;
|
||||
static const String engine =
|
||||
"Flutter 2.8.1 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 77d935af4d (8 weeks ago) • 2021-12-16 08:37:33 -0800\nEngine • revision 890a5fca2e\nTools • Dart 2.15.1\n";
|
||||
static const String buildAt = "2022-02-10 19:30:23.388434";
|
||||
static const int modifications = 9;
|
||||
"╔════════════════════════════════════════════════════════════════════════════╗\n║ A new version of Flutter is available! ║\n║ ║\n║ To update to the latest version, run \"flutter upgrade\". ║\n╚════════════════════════════════════════════════════════════════════════════╝\n\nFlutter 2.8.1 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 77d935af4d (9 weeks ago) • 2021-12-16 08:37:33 -0800\nEngine • revision 890a5fca2e\nTools • Dart 2.15.1\n";
|
||||
static const String buildAt = "2022-02-18 13:28:18.254386";
|
||||
static const int modifications = 5;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user