Release 9.2.0

This commit is contained in:
Alessandro Autiero
2024-07-06 18:43:52 +02:00
parent 45b8629207
commit e3b8d7d182
91 changed files with 3871 additions and 3132 deletions

View File

@@ -14,7 +14,6 @@ class BackendController extends GetxController {
late final Rx<ServerType> type;
late final TextEditingController gameServerAddress;
late final FocusNode gameServerAddressFocusNode;
late final RxnString gameServerOwner;
late final RxBool started;
late final RxBool detached;
StreamSubscription? worker;
@@ -22,7 +21,7 @@ class BackendController extends GetxController {
HttpServer? remoteServer;
BackendController() {
storage = appWithNoStorage ? null : GetStorage("backend");
storage = appWithNoStorage ? null : GetStorage("backend_storage");
started = RxBool(false);
type = Rx(ServerType.values.elementAt(storage?.read("type") ?? 0));
type.listen((value) {
@@ -64,8 +63,10 @@ class BackendController extends GetxController {
}
});
gameServerAddressFocusNode = FocusNode();
gameServerOwner = RxnString(storage?.read("game_server_owner"));
gameServerOwner.listen((value) => storage?.write("game_server_owner", value));
}
void joinLocalhost() {
gameServerAddress.text = kDefaultGameServerHost;
}
void reset() async {
@@ -147,12 +148,11 @@ class BackendController extends GetxController {
switch(type()){
case ServerType.embedded:
final process = await startEmbeddedBackend(detached.value);
final processPid = process.pid;
watchProcess(processPid).then((value) {
if(started()) {
started.value = false;
}
});
watchProcess(process.pid)
.asStream()
.asBroadcastStream()
.where((_) => !started())
.map((_) => ServerResult(ServerResultType.processError));
break;
case ServerType.remote:
yield ServerResult(ServerResultType.pingingRemote);

View File

@@ -1,22 +0,0 @@
import 'package:get/get.dart';
import 'package:reboot_common/common.dart';
class BuildController extends GetxController {
List<FortniteBuild>? _builds;
Rxn<FortniteBuild> _selectedBuild;
BuildController() : _selectedBuild = Rxn();
List<FortniteBuild>? get builds => _builds;
FortniteBuild? get selectedBuild => _selectedBuild.value;
set selectedBuild(FortniteBuild? value) {
_selectedBuild.value = value;
}
set builds(List<FortniteBuild>? builds) {
_builds = builds;
_selectedBuild.value = builds?.firstOrNull;
}
}

View File

@@ -25,7 +25,7 @@ class GameController extends GetxController {
late final Rx<PhysicalKeyboardKey> consoleKey;
GameController() {
_storage = appWithNoStorage ? null : GetStorage("game");
_storage = appWithNoStorage ? null : GetStorage("game_storage");
Iterable decodedVersionsJson = jsonDecode(_storage?.read("versions") ?? "[]");
final decodedVersions = decodedVersionsJson
.map((entry) => FortniteVersion.fromJson(entry))
@@ -33,8 +33,7 @@ class GameController extends GetxController {
versions = Rx(decodedVersions);
versions.listen((data) => _saveVersions());
final decodedSelectedVersionName = _storage?.read("version");
final decodedSelectedVersion = decodedVersions.firstWhereOrNull((
element) => element.name == decodedSelectedVersionName);
final decodedSelectedVersion = decodedVersions.firstWhereOrNull((element) => element.content.toString() == decodedSelectedVersionName);
_selectedVersion = Rxn(decodedSelectedVersion);
username = TextEditingController(
text: _storage?.read("username") ?? kDefaultPlayerName);
@@ -88,7 +87,7 @@ class GameController extends GetxController {
}
FortniteVersion? getVersionByName(String name) {
return versions.value.firstWhereOrNull((element) => element.name == name);
return versions.value.firstWhereOrNull((element) => element.content.toString() == name);
}
void addVersion(FortniteVersion version) {
@@ -99,15 +98,9 @@ class GameController extends GetxController {
}
}
FortniteVersion removeVersionByName(String versionName) {
var version = versions.value.firstWhere((element) => element.name == versionName);
removeVersion(version);
return version;
}
void removeVersion(FortniteVersion version) {
versions.update((val) => val?.remove(version));
if (selectedVersion?.name == version.name || hasNoVersions) {
if (selectedVersion == version || hasNoVersions) {
selectedVersion = null;
}
}
@@ -125,7 +118,7 @@ class GameController extends GetxController {
set selectedVersion(FortniteVersion? version) {
_selectedVersion.value = version;
_storage?.write("version", version?.name);
_storage?.write("version", version?.content.toString());
}
void updateVersion(FortniteVersion version, Function(FortniteVersion) function) {

View File

@@ -1,17 +1,25 @@
import 'dart:convert';
import 'package:dart_ipify/dart_ipify.dart';
import 'package:fluent_ui/fluent_ui.dart';
import 'package:get/get.dart';
import 'package:get_storage/get_storage.dart';
import 'package:reboot_common/common.dart';
import 'package:reboot_launcher/main.dart';
import 'package:reboot_launcher/src/util/cryptography.dart';
import 'package:supabase_flutter/supabase_flutter.dart';
import 'package:sync/semaphore.dart';
import 'package:uuid/uuid.dart';
class HostingController extends GetxController {
late final GetStorage? _storage;
late final String uuid;
late final TextEditingController name;
late final FocusNode nameFocusNode;
late final TextEditingController description;
late final FocusNode descriptionFocusNode;
late final TextEditingController password;
late final FocusNode passwordFocusNode;
late final RxBool showPassword;
late final RxBool discoverable;
late final Rx<GameServerType> type;
@@ -19,10 +27,11 @@ class HostingController extends GetxController {
late final RxBool started;
late final RxBool published;
late final Rxn<GameInstance> instance;
late final Rxn<Set<Map<String, dynamic>>> servers;
late final Rxn<Set<FortniteServer>> servers;
late final Semaphore _semaphore;
HostingController() {
_storage = appWithNoStorage ? null : GetStorage("hosting");
_storage = appWithNoStorage ? null : GetStorage("hosting_storage");
uuid = _storage?.read("uuid") ?? const Uuid().v4();
_storage?.write("uuid", uuid);
name = TextEditingController(text: _storage?.read("name"));
@@ -31,6 +40,9 @@ class HostingController extends GetxController {
description.addListener(() => _storage?.write("description", description.text));
password = TextEditingController(text: _storage?.read("password") ?? "");
password.addListener(() => _storage?.write("password", password.text));
nameFocusNode = FocusNode();
descriptionFocusNode = FocusNode();
passwordFocusNode = FocusNode();
discoverable = RxBool(_storage?.read("discoverable") ?? false);
discoverable.listen((value) => _storage?.write("discoverable", value));
type = Rx(GameServerType.values.elementAt(_storage?.read("type") ?? GameServerType.headless.index));
@@ -43,16 +55,80 @@ class HostingController extends GetxController {
instance = Rxn();
final supabase = Supabase.instance.client;
servers = Rxn();
supabase.from("hosting")
supabase.from("hosting_v2")
.stream(primaryKey: ['id'])
.map((event) => _parseValidServers(event))
.map((event) => event.map((element) => FortniteServer.fromJson(element)).where((element) => element.ip.isNotEmpty).toSet())
.listen((event) {
servers.value = event;
published.value = event.any((element) => element["id"] == uuid);
published.value = event.any((element) => element.id == uuid);
});
_semaphore = Semaphore();
}
Set<Map<String, dynamic>> _parseValidServers(event) => event.where((element) => element["ip"] != null).toSet();
Future<void> publishServer(String author, String version) async {
try {
_semaphore.acquire();
log("[SERVER] Publishing server...");
if(published.value) {
log("[SERVER] Already published");
return;
}
final passwordText = password.text;
final hasPassword = passwordText.isNotEmpty;
var ip = await Ipify.ipv4();
if(hasPassword) {
ip = aes256Encrypt(ip, passwordText);
}
final supabase = Supabase.instance.client;
final hosts = supabase.from("hosting_v2");
final payload = FortniteServer(
id: uuid,
name: name.text,
description: description.text,
author: author,
ip: ip,
version: version,
password: hasPassword ? hashPassword(passwordText) : null,
timestamp: DateTime.now(),
discoverable: discoverable.value
).toJson();
log("[SERVER] Payload: ${jsonEncode(payload)}");
if(published()) {
await hosts.update(payload)
.eq("id", uuid);
}else {
await hosts.insert(payload);
}
published.value = true;
log("[SERVER] Published");
}catch(error) {
log("[SERVER] Cannot publish server: $error");
published.value = false;
}finally {
_semaphore.release();
}
}
Future<void> discardServer() async {
try {
_semaphore.acquire();
log("[SERVER] Discarding server...");
final supabase = Supabase.instance.client;
await supabase.from("hosting_v2")
.delete()
.match({'id': uuid});
servers.value?.removeWhere((element) => element.id == uuid);
log("[SERVER] Discarded server");
}catch(error) {
log("[SERVER] Cannot discard server: $error");
}finally {
published.value = false;
_semaphore.release();
}
}
void reset() {
name.text = "";
@@ -65,9 +141,9 @@ class HostingController extends GetxController {
autoRestart.value = true;
}
Map<String, dynamic>? findServerById(String uuid) {
FortniteServer? findServerById(String uuid) {
try {
return servers.value?.firstWhere((element) => element["id"] == uuid);
return servers.value?.firstWhere((element) => element.id == uuid);
} on StateError catch(_) {
return null;
}

View File

@@ -1,71 +1,333 @@
import 'dart:async';
import 'dart:io';
import 'package:fluent_ui/fluent_ui.dart';
import 'package:get/get.dart';
import 'package:get_storage/get_storage.dart';
import 'package:http/http.dart' as http;
import 'package:path/path.dart';
import 'package:reboot_common/common.dart';
import 'package:reboot_launcher/main.dart';
import 'package:reboot_launcher/src/messenger/abstract/info_bar.dart';
import 'package:reboot_launcher/src/util/translations.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:version/version.dart';
import 'package:yaml/yaml.dart';
class SettingsController extends GetxController {
late final GetStorage _storage;
late final GetStorage? _storage;
late final String originalDll;
late final TextEditingController gameServerDll;
late final TextEditingController unrealEngineConsoleDll;
late final TextEditingController backendDll;
late final TextEditingController memoryLeakDll;
late final TextEditingController gameServerPort;
late final RxBool firstRun;
late final RxString language;
late final Rx<ThemeMode> themeMode;
late final RxnInt timestamp;
late final Rx<UpdateStatus> status;
late final Rx<UpdateTimer> timer;
late final TextEditingController url;
late final RxBool customGameServer;
late final RxBool firstRun;
late final Map<String, Future<bool>> _operations;
late double width;
late double height;
late double? offsetX;
late double? offsetY;
InfoBarEntry? infoBarEntry;
Future<bool>? _updater;
SettingsController() {
_storage = GetStorage("settings");
gameServerDll = _createController("game_server", "reboot.dll");
unrealEngineConsoleDll = _createController("unreal_engine_console", "console.dll");
backendDll = _createController("backend", "cobalt.dll");
memoryLeakDll = _createController("memory_leak", "memory.dll");
gameServerPort = TextEditingController(text: _storage.read("game_server_port") ?? kDefaultGameServerPort);
gameServerPort.addListener(() => _storage.write("game_server_port", gameServerPort.text));
width = _storage.read("width") ?? kDefaultWindowWidth;
height = _storage.read("height") ?? kDefaultWindowHeight;
offsetX = _storage.read("offset_x");
offsetY = _storage.read("offset_y");
firstRun = RxBool(_storage.read("first_run_new1") ?? true);
firstRun.listen((value) => _storage.write("first_run_new1", value));
themeMode = Rx(ThemeMode.values.elementAt(_storage.read("theme") ?? 0));
themeMode.listen((value) => _storage.write("theme", value.index));
language = RxString(_storage.read("language") ?? currentLocale);
language.listen((value) => _storage.write("language", value));
_storage = appWithNoStorage ? null : GetStorage("settings_storage");
gameServerDll = _createController("game_server", InjectableDll.reboot);
unrealEngineConsoleDll = _createController("unreal_engine_console", InjectableDll.console);
backendDll = _createController("backend", InjectableDll.cobalt);
memoryLeakDll = _createController("memory_leak", InjectableDll.memory);
gameServerPort = TextEditingController(text: _storage?.read("game_server_port") ?? kDefaultGameServerPort);
gameServerPort.addListener(() => _storage?.write("game_server_port", gameServerPort.text));
width = _storage?.read("width") ?? kDefaultWindowWidth;
height = _storage?.read("height") ?? kDefaultWindowHeight;
offsetX = _storage?.read("offset_x");
offsetY = _storage?.read("offset_y");
themeMode = Rx(ThemeMode.values.elementAt(_storage?.read("theme") ?? 0));
themeMode.listen((value) => _storage?.write("theme", value.index));
language = RxString(_storage?.read("language") ?? currentLocale);
language.listen((value) => _storage?.write("language", value));
timestamp = RxnInt(_storage?.read("ts"));
timestamp.listen((value) => _storage?.write("ts", value));
final timerIndex = _storage?.read("timer");
timer = Rx(timerIndex == null ? UpdateTimer.hour : UpdateTimer.values.elementAt(timerIndex));
timer.listen((value) => _storage?.write("timer", value.index));
url = TextEditingController(text: _storage?.read("update_url") ?? kRebootDownloadUrl);
url.addListener(() => _storage?.write("update_url", url.text));
status = Rx(UpdateStatus.waiting);
customGameServer = RxBool(_storage?.read("custom_game_server") ?? false);
customGameServer.listen((value) => _storage?.write("custom_game_server", value));
firstRun = RxBool(_storage?.read("first_run_tutorial") ?? true);
firstRun.listen((value) => _storage?.write("first_run_tutorial", value));
_operations = {};
}
TextEditingController _createController(String key, String name) {
var controller = TextEditingController(text: _storage.read(key) ?? _controllerDefaultPath(name));
controller.addListener(() => _storage.write(key, controller.text));
TextEditingController _createController(String key, InjectableDll dll) {
final controller = TextEditingController(text: _storage?.read(key) ?? _getDefaultPath(dll));
controller.addListener(() => _storage?.write(key, controller.text));
return controller;
}
void saveWindowSize(Size size) {
_storage.write("width", size.width);
_storage.write("height", size.height);
_storage?.write("width", size.width);
_storage?.write("height", size.height);
}
void saveWindowOffset(Offset position) {
offsetX = position.dx;
offsetY = position.dy;
_storage.write("offset_x", offsetX);
_storage.write("offset_y", offsetY);
_storage?.write("offset_x", offsetX);
_storage?.write("offset_y", offsetY);
}
void reset(){
gameServerDll.text = _controllerDefaultPath("reboot.dll");
unrealEngineConsoleDll.text = _controllerDefaultPath("console.dll");
backendDll.text = _controllerDefaultPath("cobalt.dll");
gameServerDll.text = _getDefaultPath(InjectableDll.reboot);
unrealEngineConsoleDll.text = _getDefaultPath(InjectableDll.console);
backendDll.text = _getDefaultPath(InjectableDll.cobalt);
memoryLeakDll.text = _getDefaultPath(InjectableDll.memory);
gameServerPort.text = kDefaultGameServerPort;
firstRun.value = true;
timestamp.value = null;
timer.value = UpdateTimer.never;
url.text = kRebootDownloadUrl;
status.value = UpdateStatus.waiting;
customGameServer.value = false;
updateReboot();
}
String _controllerDefaultPath(String name) => "${dllsDirectory.path}\\$name";
Future<void> notifyLauncherUpdate() async {
if(appVersion == null) {
return;
}
final pubspec = await _getPubspecYaml();
if(pubspec == null) {
return;
}
final latestVersion = Version.parse(pubspec["version"]);
if(latestVersion <= appVersion) {
return;
}
late InfoBarEntry infoBar;
infoBar = showRebootInfoBar(
translations.updateAvailable(latestVersion.toString()),
duration: null,
severity: InfoBarSeverity.warning,
action: Button(
child: Text(translations.updateAvailableAction),
onPressed: () {
infoBar.close();
launchUrl(Uri.parse("https://github.com/Auties00/reboot_launcher/releases"));
},
)
);
}
Future<dynamic> _getPubspecYaml() async {
try {
final pubspecResponse = await http.get(Uri.parse("https://raw.githubusercontent.com/Auties00/reboot_launcher/master/gui/pubspec.yaml"));
if(pubspecResponse.statusCode != 200) {
return null;
}
return loadYaml(pubspecResponse.body);
}catch(error) {
log("[UPDATER] Cannot check for updates: $error");
return null;
}
}
Future<bool> updateReboot({bool force = false, bool silent = false}) async {
if(_updater != null) {
return await _updater!;
}
final result = _updateReboot(force, silent);
_updater = result;
return await result;
}
Future<bool> _updateReboot(bool force, bool silent) async {
try {
if(customGameServer.value) {
status.value = UpdateStatus.success;
return true;
}
final needsUpdate = await hasRebootDllUpdate(
timestamp.value,
hours: timer.value.hours,
force: force
);
if(!needsUpdate) {
status.value = UpdateStatus.success;
return true;
}
if(!silent) {
infoBarEntry = showRebootInfoBar(
translations.downloadingDll("reboot"),
loading: true,
duration: null
);
}
timestamp.value = await downloadRebootDll(url.text);
status.value = UpdateStatus.success;
infoBarEntry?.close();
if(!silent) {
infoBarEntry = showRebootInfoBar(
translations.downloadDllSuccess("reboot"),
severity: InfoBarSeverity.success,
duration: infoBarShortDuration
);
}
return true;
}catch(message) {
infoBarEntry?.close();
var error = message.toString();
error = error.contains(": ") ? error.substring(error.indexOf(": ") + 2) : error;
error = error.toLowerCase();
status.value = UpdateStatus.error;
showRebootInfoBar(
translations.downloadDllError("reboot.dll", error.toString()),
duration: infoBarLongDuration,
severity: InfoBarSeverity.error,
action: Button(
onPressed: () => updateReboot(
force: true,
silent: silent
),
child: Text(translations.downloadDllRetry),
)
);
return false;
}finally {
_updater = null;
}
}
(File, bool) getInjectableData(InjectableDll dll) {
final defaultPath = canonicalize(_getDefaultPath(dll));
switch(dll){
case InjectableDll.reboot:
if(customGameServer.value) {
final file = File(gameServerDll.text);
if(file.existsSync()) {
return (file, true);
}
}
return (rebootDllFile, false);
case InjectableDll.console:
final ue4ConsoleFile = File(unrealEngineConsoleDll.text);
return (ue4ConsoleFile, canonicalize(ue4ConsoleFile.path) != defaultPath);
case InjectableDll.cobalt:
final backendFile = File(backendDll.text);
return (backendFile, canonicalize(backendFile.path) != defaultPath);
case InjectableDll.memory:
final memoryLeakFile = File(memoryLeakDll.text);
return (memoryLeakFile, canonicalize(memoryLeakFile.path) != defaultPath);
}
}
String _getDefaultPath(InjectableDll dll) => "${dllsDirectory.path}\\${dll.name}.dll";
Future<bool> downloadCriticalDllInteractive(String filePath, {bool silent = false}) {
log("[DLL] Asking for $filePath(silent: $silent)");
final old = _operations[filePath];
if(old != null) {
log("[DLL] Download task already exists");
return old;
}
log("[DLL] Creating new download task...");
final newRun = _downloadCriticalDllInteractive(filePath, silent);
_operations[filePath] = newRun;
return newRun;
}
Future<bool> _downloadCriticalDllInteractive(String filePath, bool silent) async {
final fileName = basename(filePath).toLowerCase();
log("[DLL] File name: $fileName");
InfoBarEntry? entry;
try {
if (fileName == "reboot.dll") {
log("[DLL] Downloading reboot.dll...");
return await updateReboot(
silent: silent
);
}
if(File(filePath).existsSync()) {
log("[DLL] File already exists");
return true;
}
final fileNameWithoutExtension = basenameWithoutExtension(filePath);
if(!silent) {
entry = showRebootInfoBar(
translations.downloadingDll(fileNameWithoutExtension),
loading: true,
duration: null
);
}
await downloadCriticalDll(fileName, filePath);
entry?.close();
if(!silent) {
entry = await showRebootInfoBar(
translations.downloadDllSuccess(fileNameWithoutExtension),
severity: InfoBarSeverity.success,
duration: infoBarShortDuration
);
}
return true;
}catch(message) {
log("[DLL] Error: $message");
entry?.close();
var error = message.toString();
error = error.contains(": ") ? error.substring(error.indexOf(": ") + 2) : error;
error = error.toLowerCase();
final completer = Completer();
await showRebootInfoBar(
translations.downloadDllError(fileName, error.toString()),
duration: infoBarLongDuration,
severity: InfoBarSeverity.error,
onDismissed: () => completer.complete(null),
action: Button(
onPressed: () async {
await downloadCriticalDllInteractive(filePath);
completer.complete(null);
},
child: Text(translations.downloadDllRetry),
)
);
await completer.future;
return false;
}finally {
_operations.remove(fileName);
}
}
}
extension _UpdateTimerExtension on UpdateTimer {
int get hours {
switch(this) {
case UpdateTimer.never:
return -1;
case UpdateTimer.hour:
return 1;
case UpdateTimer.day:
return 24;
case UpdateTimer.week:
return 24 * 7;
}
}
}

View File

@@ -1,161 +0,0 @@
import 'package:fluent_ui/fluent_ui.dart';
import 'package:get/get.dart';
import 'package:get_storage/get_storage.dart';
import 'package:http/http.dart' as http;
import 'package:reboot_common/common.dart';
import 'package:reboot_launcher/main.dart';
import 'package:reboot_launcher/src/dialog/abstract/info_bar.dart';
import 'package:reboot_launcher/src/util/translations.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:version/version.dart';
import 'package:yaml/yaml.dart';
class UpdateController {
late final GetStorage? _storage;
late final RxnInt timestamp;
late final Rx<UpdateStatus> status;
late final Rx<UpdateTimer> timer;
late final TextEditingController url;
late final RxBool customGameServer;
InfoBarEntry? infoBarEntry;
Future? _updater;
UpdateController() {
_storage = appWithNoStorage ? null : GetStorage("update");
timestamp = RxnInt(_storage?.read("ts"));
timestamp.listen((value) => _storage?.write("ts", value));
var timerIndex = _storage?.read("timer");
timer = Rx(timerIndex == null ? UpdateTimer.hour : UpdateTimer.values.elementAt(timerIndex));
timer.listen((value) => _storage?.write("timer", value.index));
url = TextEditingController(text: _storage?.read("update_url") ?? kRebootDownloadUrl);
url.addListener(() => _storage?.write("update_url", url.text));
status = Rx(UpdateStatus.waiting);
customGameServer = RxBool(_storage?.read("custom_game_server") ?? false);
customGameServer.listen((value) => _storage?.write("custom_game_server", value));
}
Future<void> notifyLauncherUpdate() async {
if(appVersion == null) {
return;
}
final pubspecResponse = await http.get(Uri.parse("https://raw.githubusercontent.com/Auties00/reboot_launcher/master/gui/pubspec.yaml"));
if(pubspecResponse.statusCode != 200) {
return;
}
final pubspec = loadYaml(pubspecResponse.body);
final latestVersion = Version.parse(pubspec["version"]);
if(latestVersion <= appVersion) {
return;
}
late InfoBarEntry infoBar;
infoBar = showInfoBar(
translations.updateAvailable(latestVersion.toString()),
duration: null,
severity: InfoBarSeverity.warning,
action: Button(
child: Text(translations.updateAvailableAction),
onPressed: () {
infoBar.close();
launchUrl(Uri.parse("https://github.com/Auties00/reboot_launcher/releases"));
},
)
);
}
Future<void> updateReboot({bool force = false, bool silent = false}) async {
if(_updater != null) {
return await _updater;
}
final result = _updateReboot(force, silent);
_updater = result;
return await result;
}
Future<void> _updateReboot(bool force, bool silent) async {
try {
if(customGameServer.value) {
status.value = UpdateStatus.success;
return;
}
final needsUpdate = await hasRebootDllUpdate(
timestamp.value,
hours: timer.value.hours,
force: force
);
if(!needsUpdate) {
status.value = UpdateStatus.success;
return;
}
if(!silent) {
infoBarEntry = showInfoBar(
translations.downloadingDll("reboot"),
loading: true,
duration: null
);
}
timestamp.value = await downloadRebootDll(url.text);
status.value = UpdateStatus.success;
infoBarEntry?.close();
if(!silent) {
infoBarEntry = showInfoBar(
translations.downloadDllSuccess("reboot"),
severity: InfoBarSeverity.success,
duration: infoBarShortDuration
);
}
}catch(message) {
if(!silent) {
infoBarEntry?.close();
var error = message.toString();
error =
error.contains(": ") ? error.substring(error.indexOf(": ") + 2) : error;
error = error.toLowerCase();
status.value = UpdateStatus.error;
showInfoBar(
translations.downloadDllError("reboot.dll", error.toString()),
duration: infoBarLongDuration,
severity: InfoBarSeverity.error,
action: Button(
onPressed: () => updateReboot(
force: true,
silent: silent
),
child: Text(translations.downloadDllRetry),
)
);
}
}finally {
_updater = null;
}
}
void reset() {
timestamp.value = null;
timer.value = UpdateTimer.never;
url.text = kRebootDownloadUrl;
status.value = UpdateStatus.waiting;
customGameServer.value = false;
updateReboot();
}
}
extension _UpdateTimerExtension on UpdateTimer {
int get hours {
switch(this) {
case UpdateTimer.never:
return -1;
case UpdateTimer.hour:
return 1;
case UpdateTimer.day:
return 24;
case UpdateTimer.week:
return 24 * 7;
}
}
}