0
0
mirror of https://github.com/sp-tarkov/launcher.git synced 2025-02-12 17:10:44 -05:00

add server endpoints and classes

This commit is contained in:
IsWaffle 2023-08-13 11:00:10 -04:00
parent 0e4ea9cba7
commit 4dd1a3c50a
8 changed files with 192 additions and 1 deletions

View File

@ -94,5 +94,15 @@ namespace Aki.Launcher
{
return request.GetJson("/launcher/profile/compatibleTarkovVersion");
}
public static string RequestLoadedServerMods()
{
return request.GetJson("/launcher/server/loadedServerMods");
}
public static string RequestProfileMods()
{
return request.GetJson("/launcher/server/serverModsUsedByProfile");
}
}
}

View File

@ -7,7 +7,10 @@
*/
using Aki.Launch.Models.Aki;
using Aki.Launcher.MiniCommon;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Aki.Launcher
@ -62,6 +65,34 @@ namespace Aki.Launcher
}
}
public static Dictionary<string, AkiServerModInfo> GetLoadedServerMods()
{
try
{
string json = RequestHandler.RequestLoadedServerMods();
return Json.Deserialize<Dictionary<string, AkiServerModInfo>>(json);
}
catch
{
return new Dictionary<string, AkiServerModInfo>();
}
}
public static AkiProfileModInfo[] GetProfileMods()
{
try
{
string json = RequestHandler.RequestProfileMods();
return Json.Deserialize<AkiProfileModInfo[]>(json);
}
catch
{
return new AkiProfileModInfo[] { };
}
}
public static void LoadServer(string backendUrl)
{
string json = "";

View File

@ -0,0 +1,20 @@
using System;
namespace Aki.Launch.Models.Aki
{
public class AkiProfileModInfo
{
public string Author { get; set; }
public string Name { get; set; }
public DateTime DateAdded { get; set; }
public string Version { get; set; }
}
}
/*
"author": "Boop",
"dateAdded": 1687150604114,
"name": "Boop's Quest Zone API",
"version": "1.0.0"
*/

View File

@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
namespace Aki.Launch.Models.Aki
{
public class AkiServerModInfo
{
public string Name { get; set; }
public string Version { get; set; }
public string Main { get; set; }
public string License { get; set; }
public string Author { get; set; }
public string AkiVersion { get; set; }
public Dictionary<string, string> Scripts { get; set; }
public DevDependencies DevDependencies { get; set; }
}
}
/*
{
"wafflelord-ZeroToHeroPlus-1.0.0": {
"name": "ZeroToHeroPlus",
"version": "1.0.0",
"main": "src/mod.ts",
"license": "MIT",
"author": "waffle.lord",
"akiVersion": "~3.6",
"scripts": {
"setup": "npm i",
"build": "node ./packageBuild.ts"
},
"devDependencies": {
"@types/node": "16.18.10",
"@typescript-eslint/eslint-plugin": "5.46.1",
"@typescript-eslint/parser": "5.46.1",
"bestzip": "2.2.1",
"eslint": "8.30.0",
"fs-extra": "11.1.0",
"glob": "8.0.3",
"tsyringe": "4.7.0",
"typescript": "4.9.4"
}
}
}
*/

View File

@ -0,0 +1,37 @@
using Newtonsoft.Json;
namespace Aki.Launch.Models.Aki
{
public class DevDependencies
{
[JsonProperty("@types/node")]
public string TypesNode { get; set; }
[JsonProperty("@typescript-eslint/eslint-plugin")]
public string EslintPlugin { get; set; }
[JsonProperty("@typescript-eslint/parser")]
public string EslintParser { get; set; }
public string BestZip { get; set; }
public string Eslint { get; set; }
[JsonProperty("fs-extra")]
public string FsExtra { get; set; }
public string Glob { get; set; }
public string Tsyringe { get; set; }
public string Typescript { get; set; }
}
}
/*
"@types/node": "16.18.10",
"@typescript-eslint/eslint-plugin": "5.46.1",
"@typescript-eslint/parser": "5.46.1",
"bestzip": "2.2.1",
"eslint": "8.30.0",
"fs-extra": "11.1.0",
"glob": "8.0.3",
"tsyringe": "4.7.0",
"typescript": "4.9.4"
*/

View File

@ -4,10 +4,13 @@
xmlns:rxui="using:Avalonia.ReactiveUI"
>
<Design.PreviewWith>
<StackPanel Spacing="5" Background="{StaticResource AKI_Background_Dark}">
<StackPanel Spacing="5" Background="{StaticResource AKI_Background_Dark}" Margin="50">
<Button Content="Blah"/>
<TextBox Text="Some cool text here" Margin="5"/>
<TextBox Watermark="This is a watermark" Margin="5"/>
<Expander Header="Test Header" Margin="10">
<TextBlock Text="test"/>
</Expander>
</StackPanel>
</Design.PreviewWith>
@ -473,4 +476,13 @@
<Setter Property="TextBlock.Foreground" Value="{StaticResource AKI_Background_Dark}" />
</Style>
<!-- Expander Styles -->
<Style Selector="Expander">
<Setter Property="Background" Value="{StaticResource AKI_Background_Dark}"/>
<Setter Property="CornerRadius" Value="5"/>
</Style>
<Style Selector="Expander:expanded /template/ Border#ExpanderContent">
<Setter Property="Background" Value="Red"/>
</Style>
</Styles>

View File

@ -12,6 +12,8 @@ using System.Reactive.Disposables;
using System.Diagnostics;
using System.IO;
using Aki.Launcher.Models.Aki;
using Aki.Launch.Models.Aki;
using System.Collections.Generic;
namespace Aki.Launcher.ViewModels
{
@ -33,6 +35,9 @@ namespace Aki.Launcher.ViewModels
public ImageHelper SideImage { get; } = new ImageHelper();
public Dictionary<string, AkiServerModInfo> ServerMods { get; set; }
public AkiProfileModInfo[] ProfileMods { get; set; }
private GameStarter gameStarter = new GameStarter(new GameStarterFrontend());
private ProcessMonitor monitor { get; set; }
@ -62,6 +67,9 @@ namespace Aki.Launcher.ViewModels
CurrentEdition = AccountManager.SelectedAccount.edition;
CurrentID = AccountManager.SelectedAccount.id;
ServerMods = ServerManager.GetLoadedServerMods();
ProfileMods = ServerManager.GetProfileMods();
}
private async Task GameVersionCheck()

View File

@ -54,6 +54,34 @@
Command="{Binding ChangeEditionCommand}"/>
</Grid>
</Border>
<!-- Mods bar -->
<Expander Grid.Row="2" Grid.Column="1" Margin="0 10"
Header="3 Server Mods - 3 Profile Mods"
Background="{StaticResource AKI_Background_Dark}"
CornerRadius="5">
<ItemsControl Background="{StaticResource AKI_Background_Dark}">
<ItemsControl.Items>
<Label Content="Testing 0"/>
<Label Content="Testing 0"/>
<Label Content="Testing 0"/>
<Label Content="Testing"/>
<Label Content="Testing"/>
<Label Content="Testing"/>
<Label Content="Testing"/>
<Label Content="Testing 1"/>
<Label Content="Testing 1"/>
<Label Content="Testing 1"/>
<Label Content="Testing"/>
<Label Content="Testing"/>
<Label Content="Testing"/>
<Label Content="Testing"/>
<Label Content="Testing 2"/>
<Label Content="Testing 2"/>
<Label Content="Testing 2"/>
</ItemsControl.Items>
</ItemsControl>
</Expander>
<!-- Bottom bar -->
<Border Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2" CornerRadius="5"