From 6df0356bd65ca7f281abe39abc95e3b611bb7ff3 Mon Sep 17 00:00:00 2001 From: zontreck Date: Wed, 8 Nov 2023 05:19:38 -0700 Subject: [PATCH] Removes mod download --- lib/main.dart | 8 +-- lib/steamcmd.dart | 138 ++-------------------------------------------- 2 files changed, 8 insertions(+), 138 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 7d204a3..8f59a5e 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -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 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() }); } } diff --git a/lib/steamcmd.dart b/lib/steamcmd.dart index 38204c5..06e28af 100644 --- a/lib/steamcmd.dart +++ b/lib/steamcmd.dart @@ -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 { 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 { 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 { ]); } }), - 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; - }, - )); - } -}