mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
fix: builtin editor (#503)
This commit is contained in:
@@ -1,11 +1,4 @@
|
|||||||
import 'dart:async';
|
part of 'worker.dart';
|
||||||
|
|
||||||
import 'package:fl_lib/fl_lib.dart';
|
|
||||||
import 'package:server_box/data/res/store.dart';
|
|
||||||
|
|
||||||
import '../../../core/utils/server.dart';
|
|
||||||
import '../server/server_private_info.dart';
|
|
||||||
import 'worker.dart';
|
|
||||||
|
|
||||||
class SftpReq {
|
class SftpReq {
|
||||||
final ServerPrivateInfo spi;
|
final ServerPrivateInfo spi;
|
||||||
@@ -69,9 +62,8 @@ class SftpReqStatus {
|
|||||||
int get hashCode => id ^ super.hashCode;
|
int get hashCode => id ^ super.hashCode;
|
||||||
|
|
||||||
void dispose() {
|
void dispose() {
|
||||||
// ignore: deprecated_member_use_from_same_package
|
worker._dispose();
|
||||||
worker.dispose();
|
completer?.complete(true);
|
||||||
completer?.complete();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void onNotify(dynamic event) {
|
void onNotify(dynamic event) {
|
||||||
|
|||||||
@@ -5,9 +5,12 @@ import 'dart:typed_data';
|
|||||||
|
|
||||||
import 'package:dartssh2/dartssh2.dart';
|
import 'package:dartssh2/dartssh2.dart';
|
||||||
import 'package:easy_isolate/easy_isolate.dart';
|
import 'package:easy_isolate/easy_isolate.dart';
|
||||||
|
import 'package:fl_lib/fl_lib.dart';
|
||||||
|
import 'package:server_box/core/utils/server.dart';
|
||||||
|
import 'package:server_box/data/model/server/server_private_info.dart';
|
||||||
|
import 'package:server_box/data/res/store.dart';
|
||||||
|
|
||||||
import '../../../core/utils/server.dart';
|
part 'req.dart';
|
||||||
import 'req.dart';
|
|
||||||
|
|
||||||
class SftpWorker {
|
class SftpWorker {
|
||||||
final Function(Object event) onNotify;
|
final Function(Object event) onNotify;
|
||||||
@@ -20,14 +23,7 @@ class SftpWorker {
|
|||||||
required this.req,
|
required this.req,
|
||||||
});
|
});
|
||||||
|
|
||||||
/// Use [@Deprecated] to prevent calling [SftpWorker.dispose] directly
|
void _dispose() {
|
||||||
///
|
|
||||||
/// Don't delete this method
|
|
||||||
@Deprecated(
|
|
||||||
"Use [SftpWorkerStatus.dispose] to dispose the worker, "
|
|
||||||
"instead of [SftpWorker.dispose]",
|
|
||||||
)
|
|
||||||
void dispose() {
|
|
||||||
worker.dispose();
|
worker.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:server_box/data/model/sftp/worker.dart';
|
||||||
import '../model/sftp/req.dart';
|
|
||||||
|
|
||||||
class SftpProvider extends ChangeNotifier {
|
class SftpProvider extends ChangeNotifier {
|
||||||
final List<SftpReqStatus> _status = [];
|
final List<SftpReqStatus> _status = [];
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ abstract final class GithubIds {
|
|||||||
'FrancXPT',
|
'FrancXPT',
|
||||||
'Liloupar',
|
'Liloupar',
|
||||||
'dccif',
|
'dccif',
|
||||||
|
'mikropsoft',
|
||||||
};
|
};
|
||||||
|
|
||||||
static const participants = <GhId>{
|
static const participants = <GhId>{
|
||||||
@@ -95,6 +96,7 @@ abstract final class GithubIds {
|
|||||||
'logce',
|
'logce',
|
||||||
'h-lyf',
|
'h-lyf',
|
||||||
'88484396',
|
'88484396',
|
||||||
|
'honggeigei',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -117,7 +117,7 @@
|
|||||||
"fullScreen": "Tam ekran modu",
|
"fullScreen": "Tam ekran modu",
|
||||||
"fullScreenJitter": "Tam ekran titremesi",
|
"fullScreenJitter": "Tam ekran titremesi",
|
||||||
"fullScreenJitterHelp": "Ekran yanıklarını önlemek için",
|
"fullScreenJitterHelp": "Ekran yanıklarını önlemek için",
|
||||||
"fullScreenTip": "Cihaz yatay moda döndürüldüğünde tam ekran modu etkinleştirilsin mi? Bu seçenek yalnızca sunucu sekmesi için geçerlidir."
|
"fullScreenTip": "Cihaz yatay moda döndürüldüğünde tam ekran modu etkinleştirilsin mi? Bu seçenek yalnızca sunucu sekmesi için geçerlidir.",
|
||||||
"getPushTokenFailed": "Push token alınamıyor",
|
"getPushTokenFailed": "Push token alınamıyor",
|
||||||
"gettingToken": "Token alınıyor...",
|
"gettingToken": "Token alınıyor...",
|
||||||
"goBackQ": "Geri dön?",
|
"goBackQ": "Geri dön?",
|
||||||
@@ -225,7 +225,7 @@
|
|||||||
"primaryColorSeed": "Birincil renk tohumu",
|
"primaryColorSeed": "Birincil renk tohumu",
|
||||||
"privateKey": "Özel Anahtar",
|
"privateKey": "Özel Anahtar",
|
||||||
"process": "Süreç",
|
"process": "Süreç",
|
||||||
"pushToken": "Push token"
|
"pushToken": "Push token",
|
||||||
"pveIgnoreCertTip": "Etkinleştirilmesi önerilmez, güvenlik risklerine dikkat edin! PVE'nin varsayılan sertifikasını kullanıyorsanız, bu seçeneği etkinleştirmeniz gerekir.",
|
"pveIgnoreCertTip": "Etkinleştirilmesi önerilmez, güvenlik risklerine dikkat edin! PVE'nin varsayılan sertifikasını kullanıyorsanız, bu seçeneği etkinleştirmeniz gerekir.",
|
||||||
"pveLoginFailed": "Giriş başarısız. Linux PAM girişi için sunucu yapılandırmasındaki kullanıcı adı/şifre ile kimlik doğrulaması yapılamadı.",
|
"pveLoginFailed": "Giriş başarısız. Linux PAM girişi için sunucu yapılandırmasındaki kullanıcı adı/şifre ile kimlik doğrulaması yapılamadı.",
|
||||||
"pveVersionLow": "Bu özellik şu anda test aşamasında ve sadece PVE 8+ üzerinde test edilmiştir. Lütfen dikkatli kullanın.",
|
"pveVersionLow": "Bu özellik şu anda test aşamasında ve sadece PVE 8+ üzerinde test edilmiştir. Lütfen dikkatli kullanın.",
|
||||||
|
|||||||
@@ -296,10 +296,7 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
|||||||
final subtitle =
|
final subtitle =
|
||||||
val.isEmpty ? null : Text(val.keys.join(','), style: UIs.textGrey);
|
val.isEmpty ? null : Text(val.keys.join(','), style: UIs.textGrey);
|
||||||
return ListTile(
|
return ListTile(
|
||||||
leading: const Padding(
|
leading: const Icon(HeroIcons.variable),
|
||||||
padding: EdgeInsets.only(left: 10),
|
|
||||||
child: Icon(HeroIcons.variable),
|
|
||||||
),
|
|
||||||
subtitle: subtitle,
|
subtitle: subtitle,
|
||||||
title: Text(l10n.envVars),
|
title: Text(l10n.envVars),
|
||||||
trailing: const Icon(Icons.keyboard_arrow_right),
|
trailing: const Icon(Icons.keyboard_arrow_right),
|
||||||
@@ -388,10 +385,7 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Padding(
|
leading: const Icon(MingCute.certificate_line),
|
||||||
padding: EdgeInsets.only(left: 10),
|
|
||||||
child: Icon(MingCute.certificate_line),
|
|
||||||
),
|
|
||||||
title: Text('PVE ${l10n.ignoreCert}'),
|
title: Text('PVE ${l10n.ignoreCert}'),
|
||||||
subtitle: Text(l10n.pveIgnoreCertTip, style: UIs.text12Grey),
|
subtitle: Text(l10n.pveIgnoreCertTip, style: UIs.text12Grey),
|
||||||
trailing: ListenableBuilder(
|
trailing: ListenableBuilder(
|
||||||
@@ -414,7 +408,7 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
|||||||
_customCmds.listenVal(
|
_customCmds.listenVal(
|
||||||
(vals) {
|
(vals) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
leading: const Icon(BoxIcons.bxs_file_json).paddingOnly(left: 10),
|
leading: const Icon(BoxIcons.bxs_file_json),
|
||||||
title: const Text('JSON'),
|
title: const Text('JSON'),
|
||||||
subtitle: vals.isEmpty
|
subtitle: vals.isEmpty
|
||||||
? null
|
? null
|
||||||
@@ -432,10 +426,7 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
|||||||
},
|
},
|
||||||
).cardx,
|
).cardx,
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Padding(
|
leading: const Icon(MingCute.doc_line),
|
||||||
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: () => l10n.customCmdDocUrl.launch(),
|
onTap: () => l10n.customCmdDocUrl.launch(),
|
||||||
@@ -448,10 +439,7 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
|||||||
const Text('Wake On LAN', style: UIs.text13Grey),
|
const Text('Wake On LAN', style: UIs.text13Grey),
|
||||||
UIs.height7,
|
UIs.height7,
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Padding(
|
leading: const Icon(BoxIcons.bxs_help_circle),
|
||||||
padding: EdgeInsets.only(left: 10),
|
|
||||||
child: Icon(BoxIcons.bxs_help_circle),
|
|
||||||
),
|
|
||||||
title: Text(l10n.about),
|
title: Text(l10n.about),
|
||||||
subtitle: Text(l10n.wolTip, style: UIs.text12Grey),
|
subtitle: Text(l10n.wolTip, style: UIs.text12Grey),
|
||||||
).cardx,
|
).cardx,
|
||||||
@@ -513,19 +501,13 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
|||||||
.toList();
|
.toList();
|
||||||
children.add(ListTile(
|
children.add(ListTile(
|
||||||
title: Text(l10n.clear),
|
title: Text(l10n.clear),
|
||||||
trailing: const Padding(
|
trailing: const Icon(Icons.clear),
|
||||||
padding: EdgeInsets.only(right: 13),
|
|
||||||
child: Icon(Icons.clear),
|
|
||||||
),
|
|
||||||
onTap: () => _jumpServer.value = null,
|
onTap: () => _jumpServer.value = null,
|
||||||
contentPadding: const EdgeInsets.symmetric(horizontal: 17),
|
contentPadding: const EdgeInsets.symmetric(horizontal: 17),
|
||||||
));
|
));
|
||||||
return CardX(
|
return CardX(
|
||||||
child: ExpandTile(
|
child: ExpandTile(
|
||||||
leading: const Padding(
|
leading: const Icon(Icons.map),
|
||||||
padding: EdgeInsets.only(left: 10),
|
|
||||||
child: Icon(Icons.map),
|
|
||||||
),
|
|
||||||
initiallyExpanded: _jumpServer.value != null,
|
initiallyExpanded: _jumpServer.value != null,
|
||||||
title: Text(l10n.jumpServer),
|
title: Text(l10n.jumpServer),
|
||||||
children: children,
|
children: children,
|
||||||
|
|||||||
@@ -114,8 +114,12 @@ class _IOSSettingsPageState extends State<IOSSettingsPage> {
|
|||||||
final result = await AppRoutes.kvEditor(data: urls).go(context);
|
final result = await AppRoutes.kvEditor(data: urls).go(context);
|
||||||
if (result == null || result is! Map<String, String>) return;
|
if (result == null || result is! Map<String, String>) return;
|
||||||
|
|
||||||
await context.showLoadingDialog(fn: () async {
|
final suc = await context.showLoadingDialog(fn: () async {
|
||||||
await wc.updateApplicationContext({'urls': result});
|
await wc.updateApplicationContext({'urls': result});
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
|
if (suc == true) {
|
||||||
|
context.showSnackBar(l10n.success);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import 'package:fl_lib/fl_lib.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:server_box/core/extension/context/locale.dart';
|
import 'package:server_box/core/extension/context/locale.dart';
|
||||||
import 'package:server_box/data/model/server/server_private_info.dart';
|
import 'package:server_box/data/model/server/server_private_info.dart';
|
||||||
import 'package:server_box/data/model/sftp/req.dart';
|
import 'package:server_box/data/model/sftp/worker.dart';
|
||||||
import 'package:server_box/data/res/misc.dart';
|
import 'package:server_box/data/res/misc.dart';
|
||||||
import 'package:server_box/data/res/provider.dart';
|
import 'package:server_box/data/res/provider.dart';
|
||||||
import 'package:server_box/view/widget/omit_start_text.dart';
|
import 'package:server_box/view/widget/omit_start_text.dart';
|
||||||
|
|||||||
@@ -11,16 +11,16 @@ import 'package:server_box/core/utils/comparator.dart';
|
|||||||
import 'package:server_box/data/model/server/server_private_info.dart';
|
import 'package:server_box/data/model/server/server_private_info.dart';
|
||||||
import 'package:server_box/data/model/sftp/absolute_path.dart';
|
import 'package:server_box/data/model/sftp/absolute_path.dart';
|
||||||
import 'package:server_box/data/model/sftp/browser_status.dart';
|
import 'package:server_box/data/model/sftp/browser_status.dart';
|
||||||
import 'package:server_box/data/model/sftp/req.dart';
|
import 'package:server_box/data/model/sftp/worker.dart';
|
||||||
import 'package:server_box/data/res/misc.dart';
|
import 'package:server_box/data/res/misc.dart';
|
||||||
import 'package:server_box/data/res/provider.dart';
|
import 'package:server_box/data/res/provider.dart';
|
||||||
import 'package:server_box/data/res/store.dart';
|
import 'package:server_box/data/res/store.dart';
|
||||||
import 'package:server_box/view/widget/omit_start_text.dart';
|
import 'package:server_box/view/widget/omit_start_text.dart';
|
||||||
|
|
||||||
import 'package:icons_plus/icons_plus.dart';
|
|
||||||
import 'package:server_box/view/widget/two_line_text.dart';
|
import 'package:server_box/view/widget/two_line_text.dart';
|
||||||
import 'package:server_box/view/widget/unix_perm.dart';
|
import 'package:server_box/view/widget/unix_perm.dart';
|
||||||
|
|
||||||
|
import 'package:icons_plus/icons_plus.dart';
|
||||||
|
|
||||||
class SftpPage extends StatefulWidget {
|
class SftpPage extends StatefulWidget {
|
||||||
final ServerPrivateInfo spi;
|
final ServerPrivateInfo spi;
|
||||||
final String? initPath;
|
final String? initPath;
|
||||||
@@ -401,16 +401,10 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
|
|||||||
|
|
||||||
final permStr = newPerm.perm;
|
final permStr = newPerm.perm;
|
||||||
if (ok == true && permStr != perm.perm) {
|
if (ok == true && permStr != perm.perm) {
|
||||||
await context.showLoadingDialog(
|
await context.showLoadingDialog(fn: () async {
|
||||||
fn: () async {
|
|
||||||
await _client!.run('chmod $permStr "${_getRemotePath(file)}"');
|
await _client!.run('chmod $permStr "${_getRemotePath(file)}"');
|
||||||
await _listDir();
|
await _listDir();
|
||||||
},
|
});
|
||||||
onErr: (e, s) {
|
|
||||||
context.showErrDialog(e: e, s: s, operation: l10n.permission);
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -758,15 +752,22 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
|
|||||||
context.showRoundDialog(
|
context.showRoundDialog(
|
||||||
title: l10n.error,
|
title: l10n.error,
|
||||||
child: Text('Unsupport file: ${name.filename}'),
|
child: Text('Unsupport file: ${name.filename}'),
|
||||||
actions: [
|
actions: Btns.oks(onTap: () => context.pop()),
|
||||||
TextButton(
|
|
||||||
onPressed: () => context.pop(),
|
|
||||||
child: Text(l10n.ok),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final confirm = await context.showRoundDialog(
|
||||||
|
title: l10n.attention,
|
||||||
|
child: SimpleMarkdown(data: '```sh\n$cmd\n```'),
|
||||||
|
actions: Btns.okCancels(
|
||||||
|
onTapOk: () => context.pop(true),
|
||||||
|
onTapCancel: () => context.pop(false),
|
||||||
|
red: true,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
if (confirm != true) return;
|
||||||
|
|
||||||
final suc = await context.showLoadingDialog(
|
final suc = await context.showLoadingDialog(
|
||||||
fn: () => _client?.run(cmd) ?? Future.value(false),
|
fn: () => _client?.run(cmd) ?? Future.value(false),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,11 +3,10 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:server_box/core/extension/context/locale.dart';
|
import 'package:server_box/core/extension/context/locale.dart';
|
||||||
import 'package:server_box/core/route.dart';
|
import 'package:server_box/core/route.dart';
|
||||||
|
import 'package:server_box/data/model/sftp/worker.dart';
|
||||||
|
import 'package:server_box/data/provider/sftp.dart';
|
||||||
import 'package:server_box/data/res/provider.dart';
|
import 'package:server_box/data/res/provider.dart';
|
||||||
|
|
||||||
import '../../../data/model/sftp/req.dart';
|
|
||||||
import '../../../data/provider/sftp.dart';
|
|
||||||
|
|
||||||
class SftpMissionPage extends StatefulWidget {
|
class SftpMissionPage extends StatefulWidget {
|
||||||
const SftpMissionPage({super.key});
|
const SftpMissionPage({super.key});
|
||||||
|
|
||||||
|
|||||||
@@ -385,8 +385,8 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
path: "."
|
path: "."
|
||||||
ref: "v1.0.89"
|
ref: "v1.0.90"
|
||||||
resolved-ref: "2ea7a87e7f4c1bd68902557799a4e9406e559dcf"
|
resolved-ref: "9f17bfce9f6cc9e071c40648bcac8d94e2dee919"
|
||||||
url: "https://github.com/lppcg/fl_lib"
|
url: "https://github.com/lppcg/fl_lib"
|
||||||
source: git
|
source: git
|
||||||
version: "0.0.1"
|
version: "0.0.1"
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ dependencies:
|
|||||||
fl_lib:
|
fl_lib:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/lppcg/fl_lib
|
url: https://github.com/lppcg/fl_lib
|
||||||
ref: v1.0.89
|
ref: v1.0.90
|
||||||
|
|
||||||
dependency_overrides:
|
dependency_overrides:
|
||||||
# dartssh2:
|
# dartssh2:
|
||||||
|
|||||||
Reference in New Issue
Block a user