parent
6df0356bd6
commit
a33a74a4e8
2 changed files with 138 additions and 8 deletions
|
@ -8,7 +8,6 @@ import 'package:servermanager/proton.dart';
|
||||||
import 'package:servermanager/serversettings.dart';
|
import 'package:servermanager/serversettings.dart';
|
||||||
import 'package:servermanager/settings.dart';
|
import 'package:servermanager/settings.dart';
|
||||||
import 'package:servermanager/settingsEntry.dart';
|
import 'package:servermanager/settingsEntry.dart';
|
||||||
import 'package:servermanager/steamcmd.dart';
|
|
||||||
|
|
||||||
Future<void> main() async {
|
Future<void> main() async {
|
||||||
await Hive.initFlutter();
|
await Hive.initFlutter();
|
||||||
|
@ -34,14 +33,15 @@ class MyApp extends StatelessWidget {
|
||||||
routes: {
|
routes: {
|
||||||
"/home": (context) => HomePage(settings: appSettings),
|
"/home": (context) => HomePage(settings: appSettings),
|
||||||
"/proton": (context) => Proton(settings: appSettings),
|
"/proton": (context) => Proton(settings: appSettings),
|
||||||
"/steamcmd": (context) => SteamCMD(
|
//"/steamcmd": (context) => SteamCMD(
|
||||||
settings: appSettings,
|
// settings: appSettings,
|
||||||
),
|
// ),
|
||||||
"/server": (context) => GameServerPage(settings: appSettings),
|
"/server": (context) => GameServerPage(settings: appSettings),
|
||||||
"/server/autorestart": (context) => AutoRestartPage(),
|
"/server/autorestart": (context) => AutoRestartPage(),
|
||||||
"/server/ports": (context) => ServerSettingsPage(),
|
"/server/ports": (context) => ServerSettingsPage(),
|
||||||
"/server/mods": (context) => ModManager(settings: appSettings),
|
"/server/mods": (context) => ModManager(settings: appSettings),
|
||||||
"/server/mods/edit": (context) => ModPage(),
|
"/server/mods/edit": (context) => ModPage(),
|
||||||
|
//"/steamcmd/creds": (context) => CredentialsPrompt()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import 'package:archive/archive_io.dart';
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:servermanager/credentials.dart';
|
||||||
import 'package:servermanager/dialogbox.dart';
|
import 'package:servermanager/dialogbox.dart';
|
||||||
import 'package:servermanager/settings.dart';
|
import 'package:servermanager/settings.dart';
|
||||||
|
|
||||||
|
@ -66,8 +67,7 @@ class SteamCMDState extends State<SteamCMD> {
|
||||||
|
|
||||||
if (Platform.isWindows) {
|
if (Platform.isWindows) {
|
||||||
// Download zip file
|
// Download zip file
|
||||||
final path =
|
final path = "${settings.steamcmd_path}${Platform.pathSeparator}windows.zip";
|
||||||
"${settings.steamcmd_path}${Platform.pathSeparator}windows.zip";
|
|
||||||
final reply = await dio.download(windows, path);
|
final reply = await dio.download(windows, path);
|
||||||
|
|
||||||
final bytes = File(path).readAsBytesSync();
|
final bytes = File(path).readAsBytesSync();
|
||||||
|
@ -91,8 +91,7 @@ class SteamCMDState extends State<SteamCMD> {
|
||||||
await Process.start("steamcmd.exe", ["+quit"]);
|
await Process.start("steamcmd.exe", ["+quit"]);
|
||||||
} else {
|
} else {
|
||||||
// Download tgz file
|
// Download tgz file
|
||||||
final path =
|
final path = "${settings.steamcmd_path}${Platform.pathSeparator}linux.tgz";
|
||||||
"${settings.steamcmd_path}${Platform.pathSeparator}linux.tgz";
|
|
||||||
final reply = await dio.download(linux, path);
|
final reply = await dio.download(linux, path);
|
||||||
|
|
||||||
final bytes = File(path).readAsBytesSync();
|
final bytes = File(path).readAsBytesSync();
|
||||||
|
@ -148,8 +147,139 @@ class SteamCMDState extends State<SteamCMD> {
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
ListTile(
|
||||||
|
title: Text("Credentials"),
|
||||||
|
leading: Icon(Icons.key_sharp),
|
||||||
|
subtitle: Text("Steam Credentials"),
|
||||||
|
onTap: () async {
|
||||||
|
var creds = await Navigator.pushNamed(context, "/steamcmd/creds",
|
||||||
|
arguments: settings.inst!.steam_creds);
|
||||||
|
if (creds != null) {
|
||||||
|
Credentials cred = creds as Credentials;
|
||||||
|
setState(() {
|
||||||
|
settings.inst!.steam_creds = cred;
|
||||||
|
settings.Write();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns a Credentials Object
|
||||||
|
class CredentialsPrompt extends StatelessWidget {
|
||||||
|
TextEditingController username = TextEditingController();
|
||||||
|
TextEditingController password = TextEditingController();
|
||||||
|
TextEditingController secret = TextEditingController();
|
||||||
|
bool initialInitDone = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final args = ModalRoute.of(context)!.settings.arguments as Credentials?;
|
||||||
|
|
||||||
|
if (args != null) {
|
||||||
|
if (!initialInitDone) {
|
||||||
|
username.text = args.username;
|
||||||
|
password.text = args.password;
|
||||||
|
secret.text = args.secret;
|
||||||
|
initialInitDone = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title:
|
||||||
|
Text("Conan Exiles Server Manager - Steam Command - Credentials"),
|
||||||
|
backgroundColor: Color.fromARGB(255, 100, 0, 0),
|
||||||
|
),
|
||||||
|
body: WillPopScope(
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
padding: EdgeInsets.all(16),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 150,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Icon(Icons.person),
|
||||||
|
Text("Username:"),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
Expanded(
|
||||||
|
child: TextField(
|
||||||
|
controller: username,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(4))),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 16,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 150,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Icon(Icons.key),
|
||||||
|
Text("Password:"),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
Expanded(
|
||||||
|
child: TextField(
|
||||||
|
controller: password,
|
||||||
|
keyboardType: TextInputType.visiblePassword,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(4))),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 16,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 150,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Icon(Icons.dangerous),
|
||||||
|
Text("Secret:"),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
Expanded(
|
||||||
|
child: TextField(
|
||||||
|
controller: secret,
|
||||||
|
keyboardType: TextInputType.visiblePassword,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(4)),
|
||||||
|
hintText:
|
||||||
|
"2FA Shared Secret Code (Do Not Share With Others!)"),
|
||||||
|
))
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
onWillPop: () async {
|
||||||
|
Navigator.pop(
|
||||||
|
context,
|
||||||
|
Credentials(
|
||||||
|
username: username.text,
|
||||||
|
password: password.text,
|
||||||
|
secret: secret.text));
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue