@@ -174,7 +174,7 @@ public class ConfigV1
|
|||||||
{
|
{
|
||||||
[JsonProperty("Token")] public string Token { get; set; } = Guid.NewGuid().ToString();
|
[JsonProperty("Token")] public string Token { get; set; } = Guid.NewGuid().ToString();
|
||||||
|
|
||||||
[JsonProperty("ReCaptcha")] public ReCaptchaData ReCaptcha { get; set; }
|
[JsonProperty("ReCaptcha")] public ReCaptchaData ReCaptcha { get; set; } = new();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ReCaptchaData
|
public class ReCaptchaData
|
||||||
|
|||||||
@@ -243,6 +243,7 @@ public class WingsConsole : IDisposable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(JsonReaderException){}
|
catch(JsonReaderException){}
|
||||||
|
catch(JsonSerializationException){}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
if (!Disconnecting)
|
if (!Disconnecting)
|
||||||
|
|||||||
@@ -1,21 +1,40 @@
|
|||||||
using CurrieTechnologies.Razor.SweetAlert2;
|
using CurrieTechnologies.Razor.SweetAlert2;
|
||||||
|
using Microsoft.JSInterop;
|
||||||
|
|
||||||
namespace Moonlight.App.Services.Interop;
|
namespace Moonlight.App.Services.Interop;
|
||||||
|
|
||||||
public class AlertService
|
public class AlertService
|
||||||
{
|
{
|
||||||
private readonly SweetAlertService SweetAlertService;
|
|
||||||
private readonly SmartTranslateService SmartTranslateService;
|
private readonly SmartTranslateService SmartTranslateService;
|
||||||
|
private readonly IJSRuntime JsRuntime;
|
||||||
|
private SweetAlertService? SweetAlertService;
|
||||||
|
|
||||||
public AlertService(SweetAlertService service, SmartTranslateService smartTranslateService)
|
public AlertService(SmartTranslateService smartTranslateService, IJSRuntime jsRuntime)
|
||||||
{
|
{
|
||||||
SweetAlertService = service;
|
|
||||||
SmartTranslateService = smartTranslateService;
|
SmartTranslateService = smartTranslateService;
|
||||||
|
JsRuntime = jsRuntime;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We create the swal service here and not using the dependency injection
|
||||||
|
// because it initializes when instantiated which leads to js invoke errors
|
||||||
|
private Task EnsureService()
|
||||||
|
{
|
||||||
|
if (SweetAlertService == null)
|
||||||
|
{
|
||||||
|
SweetAlertService = new(JsRuntime, new()
|
||||||
|
{
|
||||||
|
Theme = SweetAlertTheme.Dark
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task Info(string title, string desciption)
|
public async Task Info(string title, string desciption)
|
||||||
{
|
{
|
||||||
await SweetAlertService.FireAsync(new SweetAlertOptions()
|
await EnsureService();
|
||||||
|
|
||||||
|
await SweetAlertService!.FireAsync(new SweetAlertOptions()
|
||||||
{
|
{
|
||||||
Title = title,
|
Title = title,
|
||||||
Text = desciption,
|
Text = desciption,
|
||||||
@@ -30,7 +49,9 @@ public class AlertService
|
|||||||
|
|
||||||
public async Task Success(string title, string desciption)
|
public async Task Success(string title, string desciption)
|
||||||
{
|
{
|
||||||
await SweetAlertService.FireAsync(new SweetAlertOptions()
|
await EnsureService();
|
||||||
|
|
||||||
|
await SweetAlertService!.FireAsync(new SweetAlertOptions()
|
||||||
{
|
{
|
||||||
Title = title,
|
Title = title,
|
||||||
Text = desciption,
|
Text = desciption,
|
||||||
@@ -45,7 +66,9 @@ public class AlertService
|
|||||||
|
|
||||||
public async Task Warning(string title, string desciption)
|
public async Task Warning(string title, string desciption)
|
||||||
{
|
{
|
||||||
await SweetAlertService.FireAsync(new SweetAlertOptions()
|
await EnsureService();
|
||||||
|
|
||||||
|
await SweetAlertService!.FireAsync(new SweetAlertOptions()
|
||||||
{
|
{
|
||||||
Title = title,
|
Title = title,
|
||||||
Text = desciption,
|
Text = desciption,
|
||||||
@@ -60,7 +83,9 @@ public class AlertService
|
|||||||
|
|
||||||
public async Task Error(string title, string desciption)
|
public async Task Error(string title, string desciption)
|
||||||
{
|
{
|
||||||
await SweetAlertService.FireAsync(new SweetAlertOptions()
|
await EnsureService();
|
||||||
|
|
||||||
|
await SweetAlertService!.FireAsync(new SweetAlertOptions()
|
||||||
{
|
{
|
||||||
Title = title,
|
Title = title,
|
||||||
Text = desciption,
|
Text = desciption,
|
||||||
@@ -75,7 +100,9 @@ public class AlertService
|
|||||||
|
|
||||||
public async Task<bool> YesNo(string title, string desciption, string yesText, string noText)
|
public async Task<bool> YesNo(string title, string desciption, string yesText, string noText)
|
||||||
{
|
{
|
||||||
var result = await SweetAlertService.FireAsync(new SweetAlertOptions()
|
await EnsureService();
|
||||||
|
|
||||||
|
var result = await SweetAlertService!.FireAsync(new SweetAlertOptions()
|
||||||
{
|
{
|
||||||
Title = title,
|
Title = title,
|
||||||
Text = desciption,
|
Text = desciption,
|
||||||
@@ -91,7 +118,9 @@ public class AlertService
|
|||||||
|
|
||||||
public async Task<string?> Text(string title, string desciption, string setValue)
|
public async Task<string?> Text(string title, string desciption, string setValue)
|
||||||
{
|
{
|
||||||
var result = await SweetAlertService.FireAsync(new SweetAlertOptions()
|
await EnsureService();
|
||||||
|
|
||||||
|
var result = await SweetAlertService!.FireAsync(new SweetAlertOptions()
|
||||||
{
|
{
|
||||||
Title = title,
|
Title = title,
|
||||||
Text = desciption,
|
Text = desciption,
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ public class StatisticsCaptureService
|
|||||||
{
|
{
|
||||||
while (await Timer.WaitForNextTickAsync())
|
while (await Timer.WaitForNextTickAsync())
|
||||||
{
|
{
|
||||||
Logger.Warn("Creating statistics");
|
|
||||||
|
|
||||||
using var scope = ServiceScopeFactory.CreateScope();
|
using var scope = ServiceScopeFactory.CreateScope();
|
||||||
|
|
||||||
var statisticsRepo = scope.ServiceProvider.GetRequiredService<Repository<StatisticsData>>();
|
var statisticsRepo = scope.ServiceProvider.GetRequiredService<Repository<StatisticsData>>();
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
<PackageReference Include="BlazorMonaco" Version="2.1.0" />
|
<PackageReference Include="BlazorMonaco" Version="2.1.0" />
|
||||||
<PackageReference Include="BlazorTable" Version="1.17.0" />
|
<PackageReference Include="BlazorTable" Version="1.17.0" />
|
||||||
<PackageReference Include="CloudFlare.Client" Version="6.1.4" />
|
<PackageReference Include="CloudFlare.Client" Version="6.1.4" />
|
||||||
<PackageReference Include="CurrieTechnologies.Razor.SweetAlert2" Version="5.4.0" />
|
<PackageReference Include="CurrieTechnologies.Razor.SweetAlert2" Version="5.5.0" />
|
||||||
<PackageReference Include="Discord.Net" Version="3.10.0" />
|
<PackageReference Include="Discord.Net" Version="3.10.0" />
|
||||||
<PackageReference Include="Discord.Net.Webhook" Version="3.10.0" />
|
<PackageReference Include="Discord.Net.Webhook" Version="3.10.0" />
|
||||||
<PackageReference Include="DnsClient" Version="1.7.0" />
|
<PackageReference Include="DnsClient" Version="1.7.0" />
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ using Moonlight.App.Services.SupportChat;
|
|||||||
using Sentry;
|
using Sentry;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
using Serilog.Sinks.SystemConsole.Themes;
|
|
||||||
|
|
||||||
namespace Moonlight
|
namespace Moonlight
|
||||||
{
|
{
|
||||||
@@ -249,7 +248,6 @@ namespace Moonlight
|
|||||||
|
|
||||||
// Third party services
|
// Third party services
|
||||||
builder.Services.AddBlazorTable();
|
builder.Services.AddBlazorTable();
|
||||||
builder.Services.AddSweetAlert2(options => { options.Theme = SweetAlertTheme.Dark; });
|
|
||||||
builder.Services.AddBlazorContextMenu();
|
builder.Services.AddBlazorContextMenu();
|
||||||
builder.Services.AddBlazorDownloadFile();
|
builder.Services.AddBlazorDownloadFile();
|
||||||
|
|
||||||
|
|||||||
@@ -38,9 +38,17 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async void Dispose()
|
public async void Dispose()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
await Xterm.DisposeAsync();
|
await Xterm.DisposeAsync();
|
||||||
}
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
// ignore dispose errors. They occur when the tab closes unexpectedly
|
||||||
|
// so we can ignore them
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async void OnFirstRender()
|
private async void OnFirstRender()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -163,13 +163,11 @@
|
|||||||
|
|
||||||
private bool IsIpBanned = false;
|
private bool IsIpBanned = false;
|
||||||
|
|
||||||
protected override void OnInitialized()
|
|
||||||
{
|
|
||||||
AddBodyAttribute("data-kt-app-page-loading", "on");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnAfterRender(bool firstRender)
|
protected override void OnAfterRender(bool firstRender)
|
||||||
{
|
{
|
||||||
|
if(firstRender)
|
||||||
|
AddBodyAttribute("data-kt-app-page-loading", "on");
|
||||||
|
|
||||||
//Initialize classes and attributes for layout with dark sidebar
|
//Initialize classes and attributes for layout with dark sidebar
|
||||||
AddBodyAttribute("data-kt-app-reset-transition", "true");
|
AddBodyAttribute("data-kt-app-reset-transition", "true");
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
host: 0.0.0.0<br/>
|
host: 0.0.0.0<br/>
|
||||||
port: @(Node.HttpPort)<br/>
|
port: @(Node.HttpPort)<br/>
|
||||||
ssl:<br/>
|
ssl:<br/>
|
||||||
enabled: false<br/>
|
enabled: @(Node.Ssl ? "true" : "false")<br/>
|
||||||
cert: /etc/letsencrypt/live/@(Node.Fqdn)/fullchain.pem<br/>
|
cert: /etc/letsencrypt/live/@(Node.Fqdn)/fullchain.pem<br/>
|
||||||
key: /etc/letsencrypt/live/@(Node.Fqdn)/privkey.pem<br/>
|
key: /etc/letsencrypt/live/@(Node.Fqdn)/privkey.pem<br/>
|
||||||
disable_remote_download: false<br/>
|
disable_remote_download: false<br/>
|
||||||
|
|||||||
Reference in New Issue
Block a user