mirror of
https://github.com/DorkSquadRR/DorkNet.git
synced 2026-10-26 15:38:45 -07:00
feat: Initial commit for DorkNet Admin Mobile app
- Implemented main application structure using .NET MAUI. - Added App class to manage navigation between Login and Admin pages. - Created AppDesign class for consistent UI styling. - Developed pages: LoginPage, DashboardPage, PlayersPage, RoomsPage, SettingsPage, and AdminTabbedPage. - Integrated AdminApiClient for API interactions and SecureAdminSettings for secure storage of sensitive data. - Configured Android and iOS platform-specific files including manifest and app delegate. - Added README with build instructions and authentication details.
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
using Microsoft.Maui.Storage;
|
||||
|
||||
namespace DorkNet.AdminMobile.Services;
|
||||
|
||||
public sealed record AdminConnectionSettings(
|
||||
string BaseUrl,
|
||||
string CloudflareAccessClientId,
|
||||
string CloudflareAccessClientSecret,
|
||||
string CloudflareAccessJwt);
|
||||
|
||||
public sealed class SecureAdminSettings
|
||||
{
|
||||
private const string BaseUrlKey = "admin.baseUrl";
|
||||
private const string JwtKey = "admin.jwt";
|
||||
private const string RefreshKey = "admin.refresh";
|
||||
private const string CfClientIdKey = "cf.access.clientId";
|
||||
private const string CfClientSecretKey = "cf.access.clientSecret";
|
||||
private const string CfJwtKey = "cf.access.jwt";
|
||||
|
||||
public async Task<AdminConnectionSettings> LoadConnectionAsync()
|
||||
{
|
||||
var baseUrl = await SecureStorage.GetAsync(BaseUrlKey) ?? "https://admin.rec.net";
|
||||
var cfId = await SecureStorage.GetAsync(CfClientIdKey) ?? string.Empty;
|
||||
var cfSecret = await SecureStorage.GetAsync(CfClientSecretKey) ?? string.Empty;
|
||||
var cfJwt = await SecureStorage.GetAsync(CfJwtKey) ?? string.Empty;
|
||||
return new AdminConnectionSettings(baseUrl, cfId, cfSecret, cfJwt);
|
||||
}
|
||||
|
||||
public async Task SaveConnectionAsync(AdminConnectionSettings settings)
|
||||
{
|
||||
await SecureStorage.SetAsync(BaseUrlKey, settings.BaseUrl.TrimEnd('/'));
|
||||
await SecureStorage.SetAsync(CfClientIdKey, settings.CloudflareAccessClientId.Trim());
|
||||
await SecureStorage.SetAsync(CfClientSecretKey, settings.CloudflareAccessClientSecret.Trim());
|
||||
await SecureStorage.SetAsync(CfJwtKey, settings.CloudflareAccessJwt.Trim());
|
||||
}
|
||||
|
||||
public Task<string?> GetJwtAsync() => SecureStorage.GetAsync(JwtKey);
|
||||
|
||||
public async Task SaveSessionAsync(string accessToken, string refreshToken)
|
||||
{
|
||||
await SecureStorage.SetAsync(JwtKey, accessToken);
|
||||
await SecureStorage.SetAsync(RefreshKey, refreshToken);
|
||||
}
|
||||
|
||||
public void ClearSession()
|
||||
{
|
||||
SecureStorage.Remove(JwtKey);
|
||||
SecureStorage.Remove(RefreshKey);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user