mirror of
https://github.com/Auties00/Reboot-Launcher.git
synced 2026-01-14 03:32:23 +01:00
9.0.2
This commit is contained in:
@@ -10,7 +10,13 @@ const int _keyLength = 32;
|
||||
|
||||
String hashPassword(String plaintext) => BCrypt.hashpw(plaintext, BCrypt.gensalt());
|
||||
|
||||
bool checkPassword(String password, String hashedText) => BCrypt.checkpw(password, hashedText);
|
||||
bool checkPassword(String password, String hashedText) {
|
||||
try {
|
||||
return BCrypt.checkpw(password, hashedText);
|
||||
}catch(error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
String aes256Encrypt(String plainText, String password) {
|
||||
final random = Random.secure();
|
||||
|
||||
@@ -6,9 +6,6 @@ import 'package:reboot_launcher/src/controller/game_controller.dart';
|
||||
import 'package:reboot_launcher/src/controller/hosting_controller.dart';
|
||||
import 'package:supabase_flutter/supabase_flutter.dart';
|
||||
|
||||
final SupabaseClient _supabase = Supabase.instance.client;
|
||||
final GameController _gameController = Get.find<GameController>();
|
||||
final HostingController _hostingController = Get.find<HostingController>();
|
||||
final File _executable = File("${assetsDirectory.path}\\misc\\watch.exe");
|
||||
|
||||
extension GameInstanceWatcher on GameInstance {
|
||||
@@ -17,18 +14,24 @@ extension GameInstanceWatcher on GameInstance {
|
||||
Process.killPid(observerPid!, ProcessSignal.sigabrt);
|
||||
}
|
||||
|
||||
final hostingController = Get.find<HostingController>();
|
||||
final gameController = Get.find<GameController>();
|
||||
watchProcess(gamePid).then((value) async {
|
||||
if(hosting) {
|
||||
_onHostingStopped();
|
||||
gameController.started.value = false;
|
||||
gameController.instance.value?.kill();
|
||||
if(_nestedHosting) {
|
||||
hostingController.started.value = false;
|
||||
hostingController.instance.value?.kill();
|
||||
await Supabase.instance.client.from("hosting")
|
||||
.delete()
|
||||
.match({'id': hostingController.uuid});
|
||||
}
|
||||
|
||||
_onGameStopped();
|
||||
});
|
||||
|
||||
observerPid = await startBackgroundProcess(
|
||||
executable: _executable,
|
||||
args: [
|
||||
_hostingController.uuid,
|
||||
hostingController.uuid,
|
||||
gamePid.toString(),
|
||||
launcherPid?.toString() ?? "-1",
|
||||
eacPid?.toString() ?? "-1",
|
||||
@@ -37,19 +40,16 @@ extension GameInstanceWatcher on GameInstance {
|
||||
);
|
||||
}
|
||||
|
||||
void _onGameStopped() {
|
||||
_gameController.started.value = false;
|
||||
_gameController.instance.value?.kill();
|
||||
if(linkedHosting) {
|
||||
_onHostingStopped();
|
||||
}
|
||||
}
|
||||
bool get _nestedHosting {
|
||||
GameInstance? child = this;
|
||||
while(child != null) {
|
||||
if(child.hosting) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Future<void> _onHostingStopped() async {
|
||||
_hostingController.started.value = false;
|
||||
_hostingController.instance.value?.kill();
|
||||
await _supabase.from('hosts')
|
||||
.delete()
|
||||
.match({'id': _hostingController.uuid});
|
||||
child = child.child;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
52
gui/lib/src/util/dll.dart
Normal file
52
gui/lib/src/util/dll.dart
Normal file
@@ -0,0 +1,52 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:fluent_ui/fluent_ui.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
import 'package:reboot_common/common.dart';
|
||||
import 'package:reboot_launcher/src/controller/update_controller.dart';
|
||||
import 'package:reboot_launcher/src/dialog/abstract/info_bar.dart';
|
||||
import 'package:reboot_launcher/src/util/translations.dart';
|
||||
|
||||
final UpdateController _updateController = Get.find<UpdateController>();
|
||||
Future<void> downloadCriticalDllInteractive(String filePath) async {
|
||||
try {
|
||||
final fileName = path.basename(filePath);
|
||||
if (fileName == "reboot.dll") {
|
||||
_updateController.update(true);
|
||||
return;
|
||||
}
|
||||
|
||||
final fileNameWithoutExtension = path.basenameWithoutExtension(filePath);
|
||||
await showInfoBar(
|
||||
translations.downloadingDll(fileNameWithoutExtension),
|
||||
loading: true,
|
||||
duration: null
|
||||
);
|
||||
await downloadCriticalDll(fileName, filePath);
|
||||
await showInfoBar(
|
||||
translations.downloadDllSuccess(fileNameWithoutExtension),
|
||||
severity: InfoBarSeverity.success,
|
||||
duration: infoBarShortDuration
|
||||
);
|
||||
}catch(message) {
|
||||
var error = message.toString();
|
||||
error = error.contains(": ") ? error.substring(error.indexOf(": ") + 2) : error;
|
||||
error = error.toLowerCase();
|
||||
final completer = Completer();
|
||||
await showInfoBar(
|
||||
translations.downloadDllError(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;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:fluent_ui/fluent_ui.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
|
||||
final RegExp _winBuildRegex = RegExp(r'(?<=\(Build )(.*)(?=\))');
|
||||
|
||||
bool get isWin11 {
|
||||
@@ -10,4 +13,7 @@ bool get isWin11 {
|
||||
|
||||
var intBuild = int.tryParse(result);
|
||||
return intBuild != null && intBuild > 22000;
|
||||
}
|
||||
}
|
||||
|
||||
bool get isDarkMode
|
||||
=> SchedulerBinding.instance.platformDispatcher.platformBrightness.isDark;
|
||||
@@ -1,3 +1,12 @@
|
||||
import 'package:reboot_launcher/src/util/translations.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
Future<void> openPortTutorial() => launchUrl(Uri.parse("https://github.com/Auties00/reboot_launcher/blob/master/documentation/en/PortForwarding.md"));
|
||||
Future<void> openYoutubeTutorial() => launchUrl(Uri.parse("https://www.youtube.com/watch?v=nrVE2RB0qa4"));
|
||||
|
||||
Future<void> openDiscordServer() => launchUrl(Uri.parse("https://discord.gg/reboot"));
|
||||
|
||||
Future<void> openTutorials() => launchUrl(Uri.parse("https://github.com/Auties00/reboot_launcher/blob/master/documentation/$currentLocale"));
|
||||
|
||||
Future<void> openPortTutorial() => launchUrl(Uri.parse("https://github.com/Auties00/reboot_launcher/blob/master/documentation/$currentLocale/PortForwarding.md"));
|
||||
|
||||
Future<void> openBugReport() => launchUrl(Uri.parse("https://github.com/Auties00/reboot_launcher/issues"));
|
||||
8
gui/lib/src/util/types.dart
Normal file
8
gui/lib/src/util/types.dart
Normal file
@@ -0,0 +1,8 @@
|
||||
extension IterableExtension<E> on Iterable<E> {
|
||||
E? firstWhereOrNull(bool test(E element)) {
|
||||
for (E element in this) {
|
||||
if (test(element)) return element;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user