fix: SystemType(#184) & opt.: ios home widget

This commit is contained in:
lollipopkit
2023-10-14 13:26:15 +08:00
parent 930697d033
commit 9a4a7cef4c
8 changed files with 150 additions and 68 deletions

View File

@@ -9,15 +9,16 @@ enum SystemType {
const SystemType._(this.value);
static SystemType? parse(String? value) {
if (value == null) return null;
switch (value) {
static SystemType parse(String value) {
switch (value.trim()) {
case linuxSign:
return SystemType.linux;
case bsdSign:
return SystemType.bsd;
default:
// Fallback to linux
return SystemType.linux;
}
return null;
}
bool isSegmentsLenMatch(int len) => len == segmentsLen;

View File

@@ -329,10 +329,10 @@ class ServerProvider extends ChangeNotifier {
}
final systemType = SystemType.parse(segments[0]);
if (systemType == null || !systemType.isSegmentsLenMatch(segments.length)) {
if (!systemType.isSegmentsLenMatch(segments.length)) {
_limiter.inc(sid);
s.status.failedInfo =
'Segments not match: expect ${systemType?.segmentsLen}, got ${segments.length}';
'Segments not match: expect ${systemType.segmentsLen}, got ${segments.length}';
_setServerState(s, ServerState.failed);
return;
}

View File

@@ -2,9 +2,9 @@
class BuildData {
static const String name = "ServerBox";
static const int build = 588;
static const int build = 589;
static const String engine = "3.13.6";
static const String buildAt = "2023-10-13 14:38:17";
static const int modifications = 5;
static const String buildAt = "2023-10-14 12:09:35";
static const int modifications = 6;
static const int script = 21;
}