-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from seionmoya/basic-persistance
Basic persistance
- Loading branch information
Showing
42 changed files
with
899 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
@using Fuyu.Platform.Launcher.Services; | ||
|
||
@inject NavigationManager Navigation | ||
|
||
@page "/" | ||
@page "/login" | ||
|
||
<FluentStack Orientation="Orientation.Vertical"> | ||
|
||
<!-- server settings --> | ||
<FluentAccordionItem Heading="Login" Expanded=true Style="width: 100%;"> | ||
<FluentLabel>Username:</FluentLabel> | ||
<FluentTextField TextFieldType="TextFieldType.Text" @bind-Value="username" Style="width: 100%;"></FluentTextField> | ||
<FluentLabel>Password:</FluentLabel> | ||
<FluentTextField TextFieldType="TextFieldType.Password" @bind-Value="password" Style="width: 100%;"></FluentTextField> | ||
<br /> | ||
<br /> | ||
<FluentButton Appearance="Appearance.Accent" OnClick="Login_Clicked">Login</FluentButton> | ||
<a href="/register"><FluentLabel>Register</FluentLabel></a> | ||
</FluentAccordionItem> | ||
|
||
</FluentStack> | ||
|
||
@code | ||
{ | ||
string username = string.Empty; | ||
string password = string.Empty; | ||
|
||
private void Login_Clicked(EventArgs e) | ||
{ | ||
var hashedPassword = HashService.GetSHA256(password); | ||
var sessionId = RequestService.LoginAccount(username, hashedPassword); | ||
|
||
if (sessionId == string.Empty) | ||
{ | ||
// TODO: | ||
// * show error | ||
// -- seionmoya, 2024/09/02 | ||
} | ||
else | ||
{ | ||
Navigation.NavigateTo($"/account?sessionid={sessionId}"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
@using Fuyu.Platform.Common.Models.Fuyu.Accounts | ||
@using Fuyu.Platform.Launcher.Services; | ||
|
||
@inject NavigationManager Navigation | ||
|
||
@page "/register" | ||
|
||
<FluentStack Orientation="Orientation.Vertical"> | ||
|
||
<!-- server settings --> | ||
<FluentAccordionItem Heading="Register" Expanded=true Style="width: 100%;"> | ||
<FluentLabel>Username:</FluentLabel> | ||
<FluentTextField TextFieldType="TextFieldType.Text" @bind-Value="username" Style="width: 100%;"></FluentTextField> | ||
<FluentLabel>Password:</FluentLabel> | ||
<FluentTextField TextFieldType="TextFieldType.Text" @bind-Value="password" Style="width: 100%;"></FluentTextField> | ||
<FluentLabel>Edition:</FluentLabel> | ||
<FluentTextField TextFieldType="TextFieldType.Text" @bind-Value="edition" Style="width: 100%;"></FluentTextField> | ||
<br /> | ||
<br /> | ||
<FluentButton Appearance="Appearance.Accent" OnClick="Register_Clicked">Register</FluentButton> | ||
<a href="/login"><FluentLabel>Login</FluentLabel></a> | ||
</FluentAccordionItem> | ||
|
||
</FluentStack> | ||
|
||
@code | ||
{ | ||
string username = string.Empty; | ||
string password = string.Empty; | ||
string edition = "unheard"; | ||
|
||
private void Register_Clicked(EventArgs e) | ||
{ | ||
var hashedPassword = HashService.GetSHA256(password); | ||
var registerStatus = RequestService.RegisterAccount(username, hashedPassword, edition); | ||
|
||
switch (registerStatus) | ||
{ | ||
case ERegisterStatus.Success: | ||
Navigation.NavigateTo("/login"); | ||
break; | ||
|
||
case ERegisterStatus.AlreadyExists: | ||
// TODO: | ||
// * show error | ||
// -- seionmoya, 2024/09/02 | ||
break; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,63 @@ | ||
@using Fuyu.Launcher.Services; | ||
@using Fuyu.Platform.Launcher.Services; | ||
|
||
@page "/settings" | ||
|
||
<FluentStack Orientation="Orientation.Vertical"> | ||
|
||
<!-- server settings --> | ||
<FluentAccordionItem Heading="Server" Style="width: 100%;"> | ||
<FluentLabel>Path to installation:</FluentLabel> | ||
<FluentTextField TextFieldType="TextFieldType.Text" @oninput="ServerDirectory_TextChanged" @bind-Value="serverDirectory" Style="width: 100%;"></FluentTextField> | ||
<!-- fuyu --> | ||
<FluentAccordionItem Heading="Fuyu" Style="width: 100%;"> | ||
<FluentLabel>Server address:</FluentLabel> | ||
<FluentTextField TextFieldType="TextFieldType.Url" @oninput="FuyuAddress_TextChanged" @bind-Value="fuyuAddress" Style="width: 100%;"></FluentTextField> | ||
</FluentAccordionItem> | ||
|
||
<!-- client settings --> | ||
<FluentAccordionItem Heading="Client" Style="width: 100%;"> | ||
<FluentLabel>Path to installation:</FluentLabel> | ||
<FluentTextField TextFieldType="TextFieldType.Text" @oninput="ClientDirectory_TextChanged" @bind-Value="clientDirectory" Style="width: 100%;"></FluentTextField> | ||
<!-- eft --> | ||
<FluentAccordionItem Heading="Escape From Tarkov" Style="width: 100%;"> | ||
<FluentLabel>Server address:</FluentLabel> | ||
<FluentTextField TextFieldType="TextFieldType.Url" @oninput="Address_TextChanged" @bind-Value="address" Style="width: 100%;"></FluentTextField> | ||
<FluentTextField TextFieldType="TextFieldType.Url" @oninput="EftAddress_TextChanged" @bind-Value="eftAddress" Style="width: 100%;"></FluentTextField> | ||
<FluentLabel>Client location:</FluentLabel> | ||
<FluentTextField TextFieldType="TextFieldType.Text" @oninput="EftDirectory_TextChanged" @bind-Value="eftDirectory" Style="width: 100%;"></FluentTextField> | ||
</FluentAccordionItem> | ||
|
||
<!-- arena --> | ||
<FluentAccordionItem Heading="Escape From Tarkov: Arena" Style="width: 100%;"> | ||
<FluentLabel>Server address:</FluentLabel> | ||
<FluentTextField TextFieldType="TextFieldType.Url" @oninput="ArenaAddress_TextChanged" @bind-Value="arenaAddress" Style="width: 100%;"></FluentTextField> | ||
<FluentLabel>Client location:</FluentLabel> | ||
<FluentTextField TextFieldType="TextFieldType.Text" @oninput="ArenaDirectory_TextChanged" @bind-Value="arenaDirectory" Style="width: 100%;"></FluentTextField> | ||
</FluentAccordionItem> | ||
|
||
</FluentStack> | ||
|
||
@code | ||
{ | ||
string serverDirectory = SettingsService.ServerDirectory; | ||
string clientDirectory = SettingsService.ClientDirectory; | ||
string address = SettingsService.Address; | ||
string fuyuAddress = SettingsService.FuyuAddress; | ||
string eftAddress = SettingsService.EftAddress; | ||
string arenaAddress = SettingsService.ArenaAddress; | ||
string eftDirectory = SettingsService.EftDirectory; | ||
string arenaDirectory = SettingsService.EftDirectory; | ||
|
||
private void FuyuAddress_TextChanged(ChangeEventArgs e) | ||
{ | ||
SettingsService.FuyuAddress = (string)e.Value; | ||
} | ||
|
||
private void EftAddress_TextChanged(ChangeEventArgs e) | ||
{ | ||
SettingsService.EftAddress = (string)e.Value; | ||
} | ||
|
||
private void ServerDirectory_TextChanged(ChangeEventArgs e) | ||
private void ArenaAddress_TextChanged(ChangeEventArgs e) | ||
{ | ||
SettingsService.ServerDirectory = (string)e.Value; | ||
SettingsService.ArenaAddress = (string)e.Value; | ||
} | ||
|
||
private void ClientDirectory_TextChanged(ChangeEventArgs e) | ||
private void EftDirectory_TextChanged(ChangeEventArgs e) | ||
{ | ||
SettingsService.ClientDirectory = (string)e.Value; | ||
SettingsService.EftDirectory = (string)e.Value; | ||
} | ||
|
||
private void Address_TextChanged(ChangeEventArgs e) | ||
private void ArenaDirectory_TextChanged(ChangeEventArgs e) | ||
{ | ||
SettingsService.Address = (string)e.Value; | ||
SettingsService.ArenaDirectory = (string)e.Value; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
Fuyu.Platform.Common/Models/Fuyu/Account.cs → ...rm.Common/Models/Fuyu/Accounts/Account.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace Fuyu.Platform.Common.Models.Fuyu.Accounts | ||
{ | ||
public enum ERegisterStatus | ||
{ | ||
AlreadyExists, | ||
Success | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...Common/Models/Fuyu/Savegame/EftProfile.cs → ...Common/Models/Fuyu/Accounts/EftProfile.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...rm.Common/Models/Fuyu/Savegame/EftSave.cs → ...rm.Common/Models/Fuyu/Accounts/EftSave.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.