mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 23:34:24 +01:00
new: auto run snippet (#67)
This commit is contained in:
@@ -16,18 +16,24 @@ class Snippet implements TagPickable {
|
||||
@HiveField(3)
|
||||
final String? note;
|
||||
|
||||
/// List of server id that this snippet should be auto run on
|
||||
@HiveField(4)
|
||||
final List<String>? autoRunOn;
|
||||
|
||||
const Snippet({
|
||||
required this.name,
|
||||
required this.script,
|
||||
this.tags,
|
||||
this.note,
|
||||
this.autoRunOn,
|
||||
});
|
||||
|
||||
Snippet.fromJson(Map<String, dynamic> json)
|
||||
: name = json['name'].toString(),
|
||||
script = json['script'].toString(),
|
||||
tags = json['tags']?.cast<String>(),
|
||||
note = json['note']?.toString();
|
||||
note = json['note']?.toString(),
|
||||
autoRunOn = json['autoRunOn']?.cast<String>();
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = <String, dynamic>{};
|
||||
@@ -35,6 +41,7 @@ class Snippet implements TagPickable {
|
||||
data['script'] = script;
|
||||
data['tags'] = tags;
|
||||
data['note'] = note;
|
||||
data['autoRunOn'] = autoRunOn;
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,13 +21,14 @@ class SnippetAdapter extends TypeAdapter<Snippet> {
|
||||
script: fields[1] as String,
|
||||
tags: (fields[2] as List?)?.cast<String>(),
|
||||
note: fields[3] as String?,
|
||||
autoRunOn: (fields[4] as List?)?.cast<String>(),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void write(BinaryWriter writer, Snippet obj) {
|
||||
writer
|
||||
..writeByte(4)
|
||||
..writeByte(5)
|
||||
..writeByte(0)
|
||||
..write(obj.name)
|
||||
..writeByte(1)
|
||||
@@ -35,7 +36,9 @@ class SnippetAdapter extends TypeAdapter<Snippet> {
|
||||
..writeByte(2)
|
||||
..write(obj.tags)
|
||||
..writeByte(3)
|
||||
..write(obj.note);
|
||||
..write(obj.note)
|
||||
..writeByte(4)
|
||||
..write(obj.autoRunOn);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -273,10 +273,9 @@ class ServerProvider extends ChangeNotifier {
|
||||
ensure(await client.run(ShellFunc.installerMkdirs).string);
|
||||
|
||||
ensure(await client.runForOutput(ShellFunc.installerShellWriter,
|
||||
action: (session) async {
|
||||
session.stdin.add(ShellFunc.allScript.uint8List);
|
||||
})
|
||||
.string);
|
||||
action: (session) async {
|
||||
session.stdin.add(ShellFunc.allScript.uint8List);
|
||||
}).string);
|
||||
|
||||
ensure(await client.run(ShellFunc.installerPermissionModifier).string);
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
class BuildData {
|
||||
static const String name = "ServerBox";
|
||||
static const int build = 746;
|
||||
static const String engine = "3.16.9";
|
||||
static const String buildAt = "2024-02-15 16:45:05";
|
||||
static const int modifications = 2;
|
||||
static const int script = 37;
|
||||
static const int build = 761;
|
||||
static const String engine = "3.19.0";
|
||||
static const String buildAt = "2024-02-18 12:48:41";
|
||||
static const int modifications = 10;
|
||||
static const int script = 38;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user