diff --git a/Aerochat/Aerochat.csproj b/Aerochat/Aerochat.csproj
index f3973056..ad61720a 100644
--- a/Aerochat/Aerochat.csproj
+++ b/Aerochat/Aerochat.csproj
@@ -133,13 +133,17 @@
+
+
+
+
@@ -298,10 +302,14 @@
+
+
+
+
diff --git a/Aerochat/App.xaml.cs b/Aerochat/App.xaml.cs
index e4a5ea8e..c127cb91 100644
--- a/Aerochat/App.xaml.cs
+++ b/Aerochat/App.xaml.cs
@@ -93,12 +93,17 @@ public App()
// no token saved - that's fine, continue. we'll catch this case later
}
bool tokenFound = encryptedToken != null && encryptedToken.Length > 0;
+ string token = "";
+ if (tokenFound)
+ {
+ token = Encoding.UTF8.GetString(ProtectedData.Unprotect(encryptedToken, null, DataProtectionScope.CurrentUser));
+ }
try
{
Discord.Client = new(new()
{
TokenType = TokenType.User,
- Token = tokenFound ? Encoding.UTF8.GetString(ProtectedData.Unprotect(encryptedToken, null, DataProtectionScope.CurrentUser)) : "",
+ Token = tokenFound ? token : "",
});
} catch (CryptographicException)
{
@@ -115,8 +120,18 @@ public App()
if (tokenFound)
{
- string token = Encoding.UTF8.GetString(ProtectedData.Unprotect(encryptedToken, null, DataProtectionScope.CurrentUser));
- BeginLogin(token);
+ Task.Run(async () =>
+ {
+ bool success = await BeginLogin(token);
+ if (!success)
+ {
+ Dispatcher.Invoke(() =>
+ {
+ LoginWindow = new(true);
+ LoginWindow.Show();
+ });
+ }
+ });
} else
{
// token doesn't exist - user hasn't saved it. show the login window
diff --git a/Aerochat/Scenes/BetaFish.png b/Aerochat/Scenes/BetaFish.png
new file mode 100644
index 00000000..a9a904b8
Binary files /dev/null and b/Aerochat/Scenes/BetaFish.png differ
diff --git a/Aerochat/Scenes/Floral.png b/Aerochat/Scenes/Floral.png
new file mode 100644
index 00000000..230c8070
Binary files /dev/null and b/Aerochat/Scenes/Floral.png differ
diff --git a/Aerochat/Scenes/Halo.png b/Aerochat/Scenes/Halo.png
new file mode 100644
index 00000000..d9c68eca
Binary files /dev/null and b/Aerochat/Scenes/Halo.png differ
diff --git a/Aerochat/Scenes/HelloKitty.png b/Aerochat/Scenes/HelloKitty.png
new file mode 100644
index 00000000..c7f9a33a
Binary files /dev/null and b/Aerochat/Scenes/HelloKitty.png differ
diff --git a/Aerochat/Scenes/Scenes.xml b/Aerochat/Scenes/Scenes.xml
index eaa39405..673f8136 100644
--- a/Aerochat/Scenes/Scenes.xml
+++ b/Aerochat/Scenes/Scenes.xml
@@ -23,4 +23,8 @@
+
+
+
+
diff --git a/Aerochat/Windows/DiscordLoginWV2.xaml b/Aerochat/Windows/DiscordLoginWV2.xaml
index ddc9477d..465d3bc0 100644
--- a/Aerochat/Windows/DiscordLoginWV2.xaml
+++ b/Aerochat/Windows/DiscordLoginWV2.xaml
@@ -6,7 +6,7 @@
xmlns:local="clr-namespace:Aerochat.Windows"
xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
mc:Ignorable="d"
- Title=".NET Passport Log-on" Height="450" Width="800">
+ Title=".NET Passport Log-on" Height="500" Width="850">
diff --git a/Aerochat/Windows/DiscordLoginWV2.xaml.cs b/Aerochat/Windows/DiscordLoginWV2.xaml.cs
index c53d049c..40d71718 100644
--- a/Aerochat/Windows/DiscordLoginWV2.xaml.cs
+++ b/Aerochat/Windows/DiscordLoginWV2.xaml.cs
@@ -38,42 +38,24 @@ public async void OnLoad()
LoginWebView.Source = new Uri("https://discord.com/login");
// inject js alert("Hello, World!");
string script = @"
-function onRes(res) {
- if (res.captcha_key?.includes(""captcha-required"")) return;
- if (!res.token) return;
- window.chrome.webview.postMessage(res.token);
+function onUrlChange() {
+ window.chrome.webview.postMessage((webpackChunkdiscord_app.push([[''], {}, e => { m = []; for (let c in e.c) m.push(e.c[c]) }]), m).find(m => m?.exports?.default?.getToken !== void 0).exports.default.getToken());
}
-(function (send) {
- XMLHttpRequest.prototype.send = function (data) {
- console.log('Request', this);
+const pushState = history.pushState;
+history.pushState = function () {
+ pushState.apply(history, arguments);
+ onUrlChange();
+};
- const url = new URL(this.__sentry_xhr_v3__.url);
- if (url.pathname === ""/api/v9/auth/login"" || url.pathname === ""/api/v9/auth/mfa/totp"") {
- if (this.responseText) {
- onRes(JSON.parse(this.responseText));
- } else {
- this.addEventListener(""readystatechange"", function () {
- onRes(JSON.parse(this.responseText));
- });
- }
- }
-
- send.call(this, data);
- };
-})(XMLHttpRequest.prototype.send);
-
-function clearStorage() {
- localStorage.clear();
- sessionStorage.clear();
- // all cookies
- document.cookie.split(';').forEach(function(c) {
- document.cookie = c.replace(/^ +/, '').replace(/=.*/, '=;expires=' + new Date().toUTCString() + ';path=/');
- });
-}
-
-clearStorage();
+const replaceState = history.replaceState;
+history.replaceState = function () {
+ replaceState.apply(history, arguments);
+ onUrlChange();
+};
+window.addEventListener('popstate', onUrlChange);
+window.addEventListener('hashchange', onUrlChange);
";
await coreWebView.ExecuteScriptAsync(script);
}
diff --git a/Aerochat/Windows/Login.xaml.cs b/Aerochat/Windows/Login.xaml.cs
index 19d00d91..13f6cdd7 100644
--- a/Aerochat/Windows/Login.xaml.cs
+++ b/Aerochat/Windows/Login.xaml.cs
@@ -24,11 +24,23 @@ namespace Aerochat.Windows
public partial class Login : Window
{
public LoginWindowViewModel ViewModel { get; set; } = new LoginWindowViewModel();
- public Login()
+ public Login(bool alreadyErrored = false)
{
InitializeComponent();
DataContext = ViewModel;
ViewModel.Scene = ThemeService.Instance.Scenes.FirstOrDefault(x => x.Default);
+ if (alreadyErrored)
+ {
+ Show();
+ ShowErrorDialog();
+ }
+ }
+
+ private void ShowErrorDialog()
+ {
+ var dialog = new Dialog("We can't sign you in to Windows Live Messenger", "The Windows Live Messenger token you entered is incorrect.", SystemIcons.Information);
+ dialog.Owner = this;
+ dialog.ShowDialog();
}
private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
@@ -101,9 +113,7 @@ private async void SignIn_Click(object sender, RoutedEventArgs e)
if (!success)
{
ViewModel.NotLoggingIn = true;
- var dialog = new Dialog("We can't sign you in to Windows Live Messenger", "The Windows Live Messenger token you entered is incorrect.", SystemIcons.Information);
- dialog.Owner = this;
- dialog.ShowDialog();
+ ShowErrorDialog();
}
}