mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
fix (#195) & opt.
- fix: debug provider color - fix: can't write script through SFTP (#195) - opt.: go next refresh only after current refresh task is done
This commit is contained in:
@@ -5,13 +5,7 @@ const seperator = 'SrvBoxSep';
|
||||
|
||||
/// The suffix `\t` is for formatting
|
||||
const _cmdDivider = '\necho $seperator\n\t';
|
||||
|
||||
const _serverBoxDir = r'$HOME/.config/server_box';
|
||||
|
||||
/// Issue #159
|
||||
/// Use script commit count as version of shell script.
|
||||
/// So different version of app can run at the same time.
|
||||
const installShellPath = '$_serverBoxDir/mobile_v${BuildData.script}.sh';
|
||||
const _homeVar = '\$HOME';
|
||||
|
||||
enum ShellFunc {
|
||||
status,
|
||||
@@ -22,6 +16,31 @@ enum ShellFunc {
|
||||
suspend,
|
||||
;
|
||||
|
||||
static const _serverBoxDir = '.config/server_box';
|
||||
static const _scriptFileName = 'mobile_v${BuildData.script}.sh';
|
||||
|
||||
/// Issue #159
|
||||
///
|
||||
/// Use script commit count as version of shell script.
|
||||
///
|
||||
/// So different version of app can run at the same time.
|
||||
///
|
||||
/// **Can't** use it in SFTP, because SFTP can't recognize `$HOME`
|
||||
static String getShellPath(String home) =>
|
||||
'$home/$_serverBoxDir/$_scriptFileName';
|
||||
|
||||
static final _installShellPath = getShellPath(_homeVar);
|
||||
|
||||
/// Issue #168
|
||||
/// Use `sh` for compatibility
|
||||
static final installShellCmd = """
|
||||
mkdir -p $_homeVar/$_serverBoxDir
|
||||
cat << 'EOF' > $_installShellPath
|
||||
${ShellFunc.allScript}
|
||||
EOF
|
||||
chmod +x $_installShellPath
|
||||
""";
|
||||
|
||||
String get flag {
|
||||
switch (this) {
|
||||
case ShellFunc.status:
|
||||
@@ -39,7 +58,7 @@ enum ShellFunc {
|
||||
}
|
||||
}
|
||||
|
||||
String get exec => 'sh $installShellPath -$flag';
|
||||
String get exec => 'sh $_installShellPath -$flag';
|
||||
|
||||
String get name {
|
||||
switch (this) {
|
||||
@@ -241,13 +260,3 @@ const _bsdStatusCmd = [
|
||||
//'sysctl -a | grep temperature',
|
||||
'hostname',
|
||||
];
|
||||
|
||||
/// Issue #168
|
||||
/// Use `sh` for compatibility
|
||||
final installShellCmd = """
|
||||
mkdir -p $_serverBoxDir
|
||||
cat << 'EOF' > $installShellPath
|
||||
${ShellFunc.allScript}
|
||||
EOF
|
||||
chmod +x $installShellPath
|
||||
""";
|
||||
|
||||
@@ -10,9 +10,8 @@ class Server implements TagPickable {
|
||||
SSHClient? client;
|
||||
ServerState state;
|
||||
|
||||
/// Whether is generating client.
|
||||
/// Use this to avoid reconnecting if last connect try not finished.
|
||||
bool isGenerating = false;
|
||||
/// Whether is connectting, parsing and etc.
|
||||
bool isBusy = false;
|
||||
|
||||
Server(this.spi, this.status, this.client, this.state);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user