diff --git a/LentiaLauncher.csproj b/LentiaLauncher.csproj
index cbb5e2b..06f562b 100644
--- a/LentiaLauncher.csproj
+++ b/LentiaLauncher.csproj
@@ -8,6 +8,16 @@
LentiaLauncher
./src/resources/icon.ico
+
+
+ $(ProjectDir)wwwroot
+ $(OutputPath)root.dat
+ 66
+
+
+
+
+
@@ -15,6 +25,7 @@
+
diff --git a/src/main/Program.cs b/src/main/Program.cs
index 172a433..9d89a00 100644
--- a/src/main/Program.cs
+++ b/src/main/Program.cs
@@ -1,14 +1,19 @@
-using Lentia.Core.Auth.OAuth2;
+using AzuresPackager;
+using Lentia.Core.Auth.OAuth2;
using Lentia.Core.Constants;
using Lentia.Core.Game;
using Lentia.Utils;
using Photino.NET;
+using System.Reflection;
+using System.Text;
using System.Text.Json;
using LentRules = Lentia.Core.Auth.Yggdrasil;
namespace Lentia;
class Program {
+
+ private static readonly string __dirname = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!;
private static LentRules.AuthenticateResponse? _authenticatedPlayer;
private static readonly string appData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
private static readonly string gameRoot = Path.Combine(appData, ".lentia2");
@@ -21,18 +26,33 @@ class Program {
}
public static PhotinoWindow CreateLoginWindow() {
+ AzuresPackage azp = new AzuresPackage(Path.Combine(__dirname, "root.dat"), 66);
+ List entries = azp.ListEntries();
var window = new PhotinoWindow()
.SetUseOsDefaultLocation(false)
.SetUseOsDefaultSize(false)
.SetContextMenuEnabled(false)
- .SetChromeless(true);
+ .SetChromeless(true)
+ .RegisterCustomSchemeHandler("http", (object sender, string scheme, string url, out string contentType) =>{
+ Uri uri = new Uri(url);
+ if (uri.Host == "internal") {
+ string internalPath = uri.AbsolutePath;
+ contentType = MimeHelper.GetMimeType(uri.AbsolutePath);
+ byte[] fileData = azp.GetFileBytes(internalPath.TrimStart('/'));
+ return fileData != null ? new MemoryStream(fileData) : null;
+ }
+ contentType = null;
+ return null;
+ });
window.WindowCreated += (sender, e) => {
+ SetupBridge(window);
WindowHelper.MakeLoginWindow(window);
};
- SetupBridge(window);
- window.Load("wwwroot/login.html");
+
+ window.Load("http://internal/login.html");
+
return window;
}
@@ -71,7 +91,7 @@ class Program {
if (lentiaAuthResult.Success) {
_authenticatedPlayer = lentiaAuthResult.Player;
- WindowHelper.MakeStandardWindow(pw, 1356, 720, "wwwroot/logged.html");
+ WindowHelper.MakeStandardWindow(pw, 1356, 720, "http://internal/logged.html");
payload = new { success = true };
} else {
payload = new { success = false, error = lentiaAuthResult.Error };
@@ -80,7 +100,7 @@ class Program {
case "auth::logout":
_authenticatedPlayer = null;
- pw.Load("wwwroot/login.html");
+ pw.Load("http://internal/login.html");
WindowHelper.MakeLoginWindow(pw);
payload = true;
break;
@@ -201,7 +221,7 @@ class Program {
if (discordLoginResult.Success) {
_authenticatedPlayer = discordLoginResult.Player;
- WindowHelper.MakeStandardWindow(pw, 1356, 720, "wwwroot/logged.html");
+ WindowHelper.MakeStandardWindow(pw, 1356, 720, "http://internal/logged.html");
payload = new { success = true };
} else {
Console.WriteLine(discordLoginResult);