Rip out the mod download function because steamcmd is shit
This commit is contained in:
parent
f043e3ee99
commit
f2f0df0f17
5 changed files with 14 additions and 70 deletions
|
@ -1,18 +0,0 @@
|
|||
import 'package:hive/hive.dart';
|
||||
|
||||
part 'credentials.g.dart';
|
||||
|
||||
@HiveType(typeId: 1)
|
||||
class Credentials {
|
||||
@HiveField(0)
|
||||
String username;
|
||||
|
||||
@HiveField(1)
|
||||
String password;
|
||||
|
||||
@HiveField(2)
|
||||
String secret;
|
||||
|
||||
Credentials(
|
||||
{required this.username, required this.password, required this.secret});
|
||||
}
|
|
@ -9,43 +9,6 @@ import 'package:servermanager/serversettings.dart';
|
|||
import 'package:servermanager/settings.dart';
|
||||
import 'package:servermanager/statemachine.dart';
|
||||
|
||||
Future<void> doDownloadMods(String modsFolder) async {
|
||||
Settings settings = Settings();
|
||||
|
||||
// Now, invoke SteamCmd to download the workshop mods. This is an authenticated action, and does require Scmd2fa
|
||||
var result = await Process.run(settings.getSteamCmd2FA(),
|
||||
["--raw", "--secret", settings.inst!.steam_creds!.secret]);
|
||||
var code = result.stdout as String;
|
||||
|
||||
// Build download command
|
||||
List<String> manifest = [
|
||||
"+@sSteamCmdForcePlatformType",
|
||||
"windows",
|
||||
"+force_install_dir",
|
||||
modsFolder,
|
||||
"+login",
|
||||
settings.inst!.steam_creds!.username,
|
||||
settings.inst!.steam_creds!.password,
|
||||
code.trim()
|
||||
];
|
||||
for (Mod M in settings.inst!.mods) {
|
||||
manifest.add("+workshop_download_item");
|
||||
manifest.add("440900");
|
||||
manifest.add("${M.mod_id}");
|
||||
}
|
||||
|
||||
await settings.createModFolderIfNotExists();
|
||||
|
||||
manifest.add("+quit");
|
||||
|
||||
//print(
|
||||
// "Running command: ${settings.getSteamCmd()} ${manifest.join(" ")}");
|
||||
|
||||
result = await Process.run(settings.getSteamCmd(), manifest);
|
||||
|
||||
print(result.stdout);
|
||||
}
|
||||
|
||||
Future<List<Mod>> doScanMods(String modsFolder) async {
|
||||
Settings settings = Settings();
|
||||
|
||||
|
@ -179,14 +142,15 @@ class GameServerPageState extends State<GameServerPage> {
|
|||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text("Download Mods"),
|
||||
subtitle: Text("Downloads the mods"),
|
||||
title: Text("Check Mods"),
|
||||
subtitle: Text("Checks the local mod copies against Steam"),
|
||||
leading: Icon(Icons.download_sharp),
|
||||
onTap: () async {
|
||||
setState(() {
|
||||
downloading = true;
|
||||
});
|
||||
await doDownloadMods(settings.getModPath());
|
||||
|
||||
// TODO: Insert the copy function from the configured mod location
|
||||
|
||||
setState(() {
|
||||
downloading = false;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:hive_flutter/adapters.dart';
|
||||
import 'package:servermanager/autorestart.dart';
|
||||
import 'package:servermanager/credentials.dart';
|
||||
import 'package:servermanager/game.dart';
|
||||
import 'package:servermanager/home.dart';
|
||||
import 'package:servermanager/mod.dart';
|
||||
|
@ -9,11 +8,9 @@ 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();
|
||||
Hive.registerAdapter(CredentialsAdapter());
|
||||
Hive.registerAdapter(ModAdapter());
|
||||
Hive.registerAdapter(SettingsEntryAdapter());
|
||||
Hive.registerAdapter(AutomaticRestartInfoAdapter());
|
||||
|
@ -36,15 +33,15 @@ 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()
|
||||
//"/steamcmd/creds": (context) => CredentialsPrompt()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import 'package:hive/hive.dart';
|
||||
import 'package:servermanager/autorestart.dart';
|
||||
import 'package:servermanager/credentials.dart';
|
||||
import 'package:servermanager/mod.dart';
|
||||
import 'package:servermanager/serversettings.dart';
|
||||
|
||||
|
@ -11,9 +10,6 @@ class SettingsEntry {
|
|||
@HiveField(0, defaultValue: [])
|
||||
List<Mod> mods = [];
|
||||
|
||||
@HiveField(3)
|
||||
Credentials? steam_creds;
|
||||
|
||||
@HiveField(4, defaultValue: AutomaticRestartInfo())
|
||||
AutomaticRestartInfo timer = AutomaticRestartInfo();
|
||||
|
||||
|
@ -28,4 +24,7 @@ class SettingsEntry {
|
|||
RconPort: 7779,
|
||||
GamePort: 7780,
|
||||
QueryPort: 7782);
|
||||
|
||||
@HiveField(6, defaultValue: "")
|
||||
String conanExilesInstallLocation = "";
|
||||
}
|
||||
|
|
|
@ -46,7 +46,9 @@ class StateMachine {
|
|||
// Server startup in progress
|
||||
Settings settings = Settings();
|
||||
await settings.RunUpdate(valid: false);
|
||||
await doDownloadMods(settings.getModPath());
|
||||
|
||||
// TODO: Insert mod copy from mod location function
|
||||
|
||||
settings.inst!.mods = await doScanMods(settings.getModPath());
|
||||
|
||||
await settings.writeOutModListFile();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue