Files
MeWeb/src/MeWeb.App/App.axaml.cs
T
thepraandClaude Opus 5.5 0dffbc27d6 The checks engine, the path and the cards: me-web? 0.1 reads the connection
MeWeb.Core runs seven checks concurrently and reports each as it settles:
online or behind a login page, this connection, the public IPv4 and IPv6
seen from v4./v6.meweb, the provider from a built-in map, the router
(UPnP IGD, NAT-PMP and PCP, read-only), address sharing (router WAN
against the echo, TTL hops only as a hint), and the history kept on the
device. The app draws the path from this device to the internet and lights
it node by node, with a card per check and a sheet listing every host it
contacts.

The provider map is iptoasn's table compressed to 2.1 MB by
tools/knowledge.cs and built before every app release; eleven Italian
provider profiles carry each fact with who said it, the source and the
month. The server gains a download page (en, it) and /download/{platform}
from the latest Gitea release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012CzABvBkbcFqoHdmi8b9WB
2026-10-15 04:39:03 +02:00

47 lines
1.5 KiB
C#

using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using MeWeb.App.Services;
using MeWeb.App.ViewModels;
using MeWeb.App.Views;
using MeWeb.Core.Net;
using Microsoft.Extensions.DependencyInjection;
namespace MeWeb.App;
public partial class App : Application
{
public static IServiceProvider Services { get; private set; }
public static IPlatform Platform { get; set; } = new SystemPlatform();
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
#if DEBUG
this.AttachDeveloperTools();
#endif
}
public override void OnFrameworkInitializationCompleted()
{
Services = new ServiceCollection().AddMeWebApp(Platform).BuildServiceProvider();
var stored = AppSettings.Read();
Localizer.Instance.SetLanguage(Languages.Find(stored.Language) ?? Languages.ForCulture(System.Globalization.CultureInfo.CurrentUICulture));
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
desktop.MainWindow = new MainWindow { Content = CreateMainView() };
else if (ApplicationLifetime is IActivityApplicationLifetime activity)
activity.MainViewFactory = CreateMainView;
else if (ApplicationLifetime is ISingleViewApplicationLifetime single)
single.MainView = CreateMainView();
base.OnFrameworkInitializationCompleted();
}
static Control CreateMainView() => new MainView { DataContext = Services.GetRequiredService<MainViewModel>() };
}