Removes mod download

This commit is contained in:
zontreck 2023-11-08 05:19:38 -07:00
parent f2f0df0f17
commit 6df0356bd6
2 changed files with 8 additions and 138 deletions

View file

@ -8,6 +8,7 @@ import 'package:servermanager/proton.dart';
import 'package:servermanager/serversettings.dart';
import 'package:servermanager/settings.dart';
import 'package:servermanager/settingsEntry.dart';
import 'package:servermanager/steamcmd.dart';
Future<void> main() async {
await Hive.initFlutter();
@ -33,15 +34,14 @@ class MyApp extends StatelessWidget {
routes: {
"/home": (context) => HomePage(settings: appSettings),
"/proton": (context) => Proton(settings: appSettings),
//"/steamcmd": (context) => SteamCMD(
// settings: appSettings,
// ),
"/steamcmd": (context) => SteamCMD(
settings: appSettings,
),
"/server": (context) => GameServerPage(settings: appSettings),
"/server/autorestart": (context) => AutoRestartPage(),
"/server/ports": (context) => ServerSettingsPage(),
"/server/mods": (context) => ModManager(settings: appSettings),
"/server/mods/edit": (context) => ModPage(),
//"/steamcmd/creds": (context) => CredentialsPrompt()
});
}
}

View file

@ -4,7 +4,6 @@ import 'package:archive/archive_io.dart';
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:servermanager/credentials.dart';
import 'package:servermanager/dialogbox.dart';
import 'package:servermanager/settings.dart';
@ -67,7 +66,8 @@ class SteamCMDState extends State<SteamCMD> {
if (Platform.isWindows) {
// Download zip file
final path = "${settings.steamcmd_path}${Platform.pathSeparator}windows.zip";
final path =
"${settings.steamcmd_path}${Platform.pathSeparator}windows.zip";
final reply = await dio.download(windows, path);
final bytes = File(path).readAsBytesSync();
@ -91,7 +91,8 @@ class SteamCMDState extends State<SteamCMD> {
await Process.start("steamcmd.exe", ["+quit"]);
} else {
// Download tgz file
final path = "${settings.steamcmd_path}${Platform.pathSeparator}linux.tgz";
final path =
"${settings.steamcmd_path}${Platform.pathSeparator}linux.tgz";
final reply = await dio.download(linux, path);
final bytes = File(path).readAsBytesSync();
@ -147,139 +148,8 @@ 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;
},
));
}
}