me-web? skeleton: Avalonia 12 app, server, packaging and CI
Build / Desktop, server and tools (push) Successful in 1m7s
Build / Desktop, server and tools (push) Successful in 1m7s
The first screen (online or not, a Check button, every language with a draft notice), the desktop and Android heads, the server's /api/info and /api/ip, a release tool that builds deb, rpm, a Windows exe, macOS zips, a signed APK and the server, and the Gitea workflows that run it. Rules adapted from passolo; AGPL-3.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012CzABvBkbcFqoHdmi8b9WB
This commit is contained in:
commit
7589121846
76 files changed
+3082
No files matched your search
@@ -0,0 +1,16 @@
|
||||
using Android.App;
|
||||
using Android.Content.PM;
|
||||
|
||||
using Avalonia.Android;
|
||||
|
||||
namespace MeWeb.Android;
|
||||
|
||||
[Activity(
|
||||
Label = "me-web?",
|
||||
Theme = "@style/MeWebTheme.NoActionBar",
|
||||
Icon = "@drawable/icon",
|
||||
MainLauncher = true,
|
||||
ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.UiMode | ConfigChanges.Locale | ConfigChanges.LayoutDirection)]
|
||||
public class MainActivity : AvaloniaMainActivity
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using Android.App;
|
||||
using Android.Runtime;
|
||||
|
||||
using Avalonia;
|
||||
using Avalonia.Android;
|
||||
|
||||
namespace MeWeb.Android;
|
||||
|
||||
[Application]
|
||||
public class MainApplication : AvaloniaAndroidApplication<MeWeb.App.App>
|
||||
{
|
||||
protected MainApplication(nint javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
|
||||
{
|
||||
}
|
||||
|
||||
protected override AppBuilder CustomizeAppBuilder(AppBuilder builder) => base.CustomizeAppBuilder(builder).WithInterFont();
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0-android</TargetFramework>
|
||||
<SupportedOSPlatformVersion>24</SupportedOSPlatformVersion>
|
||||
<RootNamespace>MeWeb.Android</RootNamespace>
|
||||
<ApplicationId>software.arasaka.meweb</ApplicationId>
|
||||
<ApplicationTitle>me-web?</ApplicationTitle>
|
||||
<ApplicationDisplayVersion>$(Version)</ApplicationDisplayVersion>
|
||||
<VersionMajor>$([System.Version]::Parse('$(Version)').Major)</VersionMajor>
|
||||
<VersionMinor>$([System.Version]::Parse('$(Version)').Minor)</VersionMinor>
|
||||
<VersionPatch>$([System.Version]::Parse('$(Version)').Build)</VersionPatch>
|
||||
<ApplicationVersion>$([MSBuild]::Add($([MSBuild]::Multiply($(VersionMajor), 10000)), $([MSBuild]::Add($([MSBuild]::Multiply($(VersionMinor), 100)), $(VersionPatch)))))</ApplicationVersion>
|
||||
<AndroidPackageFormats>apk</AndroidPackageFormats>
|
||||
<AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
|
||||
<JsonSerializerIsReflectionEnabledByDefault>false</JsonSerializerIsReflectionEnabledByDefault>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia.Android" />
|
||||
<PackageReference Include="Xamarin.AndroidX.Core.SplashScreen" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MeWeb.App\MeWeb.App.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto">
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
|
||||
<application android:label="me-web?" android:icon="@drawable/icon" android:supportsRtl="true" />
|
||||
</manifest>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<color android:color="@color/splash_background" />
|
||||
</item>
|
||||
<item android:drawable="@drawable/icon" android:width="120dp" android:height="120dp" android:gravity="center" />
|
||||
</layer-list>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="MeWebTheme" />
|
||||
<style name="MeWebTheme.NoActionBar" parent="@style/Theme.AppCompat.NoActionBar">
|
||||
<item name="android:windowActionBar">false</item>
|
||||
<item name="android:windowBackground">@null</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:windowSplashScreenBackground">@color/splash_background</item>
|
||||
<item name="android:windowSplashScreenAnimatedIcon">@drawable/icon</item>
|
||||
<item name="postSplashScreenTheme">@style/MeWebTheme.Main</item>
|
||||
</style>
|
||||
<style name="MeWebTheme.Main" parent="MeWebTheme.NoActionBar">
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="splash_background">#1B141C</color>
|
||||
</resources>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="MeWebTheme" />
|
||||
<style name="MeWebTheme.NoActionBar" parent="@style/Theme.AppCompat.NoActionBar">
|
||||
<item name="android:windowActionBar">false</item>
|
||||
<item name="android:windowBackground">@drawable/splash_screen</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -0,0 +1,29 @@
|
||||
<Application xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="MeWeb.App.App"
|
||||
Name="me-web?"
|
||||
RequestedThemeVariant="Dark">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceInclude Source="avares://MeWeb.App/Resources/Colors.axaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
|
||||
<Application.Styles>
|
||||
<FluentTheme>
|
||||
<FluentTheme.Palettes>
|
||||
<ColorPaletteResources x:Key="Dark"
|
||||
Accent="#E04A55"
|
||||
RegionColor="#1B141C"
|
||||
AltHigh="#1B141C"
|
||||
BaseHigh="#F0EAEF"
|
||||
ChromeMediumLow="#2C222D"
|
||||
ChromeMedium="#352A36"
|
||||
ChromeLow="#231B24" />
|
||||
</FluentTheme.Palettes>
|
||||
</FluentTheme>
|
||||
<StyleInclude Source="avares://MeWeb.App/Resources/Styles.axaml" />
|
||||
</Application.Styles>
|
||||
</Application>
|
||||
@@ -0,0 +1,43 @@
|
||||
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 Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace MeWeb.App;
|
||||
|
||||
public partial class App : Application
|
||||
{
|
||||
public static IServiceProvider Services { get; private set; }
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
#if DEBUG
|
||||
this.AttachDeveloperTools();
|
||||
#endif
|
||||
}
|
||||
|
||||
public override void OnFrameworkInitializationCompleted()
|
||||
{
|
||||
Services = new ServiceCollection().AddMeWebApp().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>() };
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using MeWeb.App.Services;
|
||||
using MeWeb.App.ViewModels;
|
||||
using MeWeb.Shared;
|
||||
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace MeWeb.App;
|
||||
|
||||
public static class AppServices
|
||||
{
|
||||
public static IServiceCollection AddMeWebApp(this IServiceCollection services)
|
||||
{
|
||||
services.AddHttpClient(ServerClient.Name, http =>
|
||||
{
|
||||
http.BaseAddress = new Uri(Endpoints.Base);
|
||||
http.DefaultRequestHeaders.UserAgent.ParseAdd($"me-web/{BuildInfo.Version}");
|
||||
});
|
||||
services.AddSingleton<ServerClient>();
|
||||
services.AddTransient<MainViewModel>();
|
||||
return services;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 44 KiB |
@@ -0,0 +1,30 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<RootNamespace>MeWeb.App</RootNamespace>
|
||||
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
||||
<JsonSerializerIsReflectionEnabledByDefault>false</JsonSerializerIsReflectionEnabledByDefault>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AvaloniaResource Include="Assets\**" />
|
||||
<EmbeddedResource Include="..\..\data\languages.json" LogicalName="languages.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" />
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" />
|
||||
<PackageReference Include="Avalonia.Fonts.Inter" />
|
||||
<PackageReference Include="AvaloniaUI.DiagnosticsSupport">
|
||||
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
|
||||
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MeWeb.Shared\MeWeb.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,26 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Color x:Key="BrandRed">#E04A55</Color>
|
||||
<Color x:Key="BrandRedDark">#B23640</Color>
|
||||
<Color x:Key="BrandRedLight">#EC7A82</Color>
|
||||
<Color x:Key="Ground">#1B141C</Color>
|
||||
<Color x:Key="Surface">#2C222D</Color>
|
||||
<Color x:Key="SurfaceRaised">#352A36</Color>
|
||||
<Color x:Key="Line">#3A2E3B</Color>
|
||||
<Color x:Key="TextStrong">#F0EAEF</Color>
|
||||
<Color x:Key="TextSoft">#A79AA6</Color>
|
||||
<Color x:Key="Good">#6FCF97</Color>
|
||||
<Color x:Key="Caution">#F2C14E</Color>
|
||||
<Color x:Key="Bad">#E85D6C</Color>
|
||||
|
||||
<SolidColorBrush x:Key="BrandRedBrush" Color="{StaticResource BrandRed}" />
|
||||
<SolidColorBrush x:Key="GroundBrush" Color="{StaticResource Ground}" />
|
||||
<SolidColorBrush x:Key="SurfaceBrush" Color="{StaticResource Surface}" />
|
||||
<SolidColorBrush x:Key="SurfaceRaisedBrush" Color="{StaticResource SurfaceRaised}" />
|
||||
<SolidColorBrush x:Key="LineBrush" Color="{StaticResource Line}" />
|
||||
<SolidColorBrush x:Key="TextStrongBrush" Color="{StaticResource TextStrong}" />
|
||||
<SolidColorBrush x:Key="TextSoftBrush" Color="{StaticResource TextSoft}" />
|
||||
<SolidColorBrush x:Key="GoodBrush" Color="{StaticResource Good}" />
|
||||
<SolidColorBrush x:Key="CautionBrush" Color="{StaticResource Caution}" />
|
||||
<SolidColorBrush x:Key="BadBrush" Color="{StaticResource Bad}" />
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,56 @@
|
||||
<Styles xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Style Selector="TextBlock.title">
|
||||
<Setter Property="FontSize" Value="34" />
|
||||
<Setter Property="FontWeight" Value="Bold" />
|
||||
<Setter Property="Foreground" Value="{StaticResource TextStrongBrush}" />
|
||||
</Style>
|
||||
<Style Selector="TextBlock.lead">
|
||||
<Setter Property="FontSize" Value="18" />
|
||||
<Setter Property="Foreground" Value="{StaticResource TextSoftBrush}" />
|
||||
<Setter Property="TextWrapping" Value="Wrap" />
|
||||
<Setter Property="TextAlignment" Value="Center" />
|
||||
</Style>
|
||||
<Style Selector="TextBlock.status">
|
||||
<Setter Property="FontSize" Value="22" />
|
||||
<Setter Property="FontWeight" Value="SemiBold" />
|
||||
<Setter Property="Foreground" Value="{StaticResource TextStrongBrush}" />
|
||||
<Setter Property="TextAlignment" Value="Center" />
|
||||
</Style>
|
||||
<Style Selector="TextBlock.small">
|
||||
<Setter Property="FontSize" Value="13" />
|
||||
<Setter Property="Foreground" Value="{StaticResource TextSoftBrush}" />
|
||||
</Style>
|
||||
<Style Selector="Button.primary">
|
||||
<Setter Property="Background" Value="{StaticResource BrandRedBrush}" />
|
||||
<Setter Property="Foreground" Value="{StaticResource TextStrongBrush}" />
|
||||
<Setter Property="FontSize" Value="20" />
|
||||
<Setter Property="FontWeight" Value="SemiBold" />
|
||||
<Setter Property="Padding" Value="40,14" />
|
||||
<Setter Property="CornerRadius" Value="28" />
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
</Style>
|
||||
<Style Selector="Button.link">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Foreground" Value="{StaticResource BrandRedBrush}" />
|
||||
<Setter Property="Padding" Value="4,2" />
|
||||
<Setter Property="FontSize" Value="13" />
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
</Style>
|
||||
<Style Selector="Ellipse.pulse">
|
||||
<Style.Animations>
|
||||
<Animation Duration="0:0:1.6" IterationCount="Infinite">
|
||||
<KeyFrame Cue="0%">
|
||||
<Setter Property="Opacity" Value="0.85" />
|
||||
<Setter Property="ScaleTransform.ScaleX" Value="0.8" />
|
||||
<Setter Property="ScaleTransform.ScaleY" Value="0.8" />
|
||||
</KeyFrame>
|
||||
<KeyFrame Cue="100%">
|
||||
<Setter Property="Opacity" Value="0" />
|
||||
<Setter Property="ScaleTransform.ScaleX" Value="1.5" />
|
||||
<Setter Property="ScaleTransform.ScaleY" Value="1.5" />
|
||||
</KeyFrame>
|
||||
</Animation>
|
||||
</Style.Animations>
|
||||
</Style>
|
||||
</Styles>
|
||||
@@ -0,0 +1,11 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace MeWeb.App.Services;
|
||||
|
||||
[JsonSourceGenerationOptions(JsonSerializerDefaults.Web, WriteIndented = true)]
|
||||
[JsonSerializable(typeof(List<Language>))]
|
||||
[JsonSerializable(typeof(StoredSettings))]
|
||||
public partial class AppJsonContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using System.Text.Json;
|
||||
|
||||
namespace MeWeb.App.Services;
|
||||
|
||||
public class StoredSettings
|
||||
{
|
||||
public string Language { get; set; }
|
||||
}
|
||||
|
||||
public static class AppSettings
|
||||
{
|
||||
static readonly string Folder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "MeWeb");
|
||||
static readonly string FilePath = Path.Combine(Folder, "settings.json");
|
||||
|
||||
public static StoredSettings Read()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!File.Exists(FilePath)) return new StoredSettings();
|
||||
using var stream = File.OpenRead(FilePath);
|
||||
return JsonSerializer.Deserialize(stream, AppJsonContext.Default.StoredSettings) ?? new StoredSettings();
|
||||
}
|
||||
catch (Exception ex) when (ex is IOException or JsonException or UnauthorizedAccessException)
|
||||
{
|
||||
return new StoredSettings();
|
||||
}
|
||||
}
|
||||
|
||||
public static void Write(StoredSettings settings)
|
||||
{
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory(Folder);
|
||||
var temporary = FilePath + ".tmp";
|
||||
using (var stream = File.Create(temporary))
|
||||
JsonSerializer.Serialize(stream, settings, AppJsonContext.Default.StoredSettings);
|
||||
File.Move(temporary, FilePath, overwrite: true);
|
||||
}
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using System.Globalization;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace MeWeb.App.Services;
|
||||
|
||||
public class Language
|
||||
{
|
||||
public string Code { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Status { get; set; }
|
||||
|
||||
public bool IsDraft => Status == "draft";
|
||||
}
|
||||
|
||||
public static class Languages
|
||||
{
|
||||
public static Language Fallback { get; } = new() { Code = "en", Name = "English", Status = "reviewed" };
|
||||
|
||||
public static IReadOnlyList<Language> All { get; } = Load();
|
||||
|
||||
public static Language Find(string code) =>
|
||||
string.IsNullOrEmpty(code) ? null : All.FirstOrDefault(l => string.Equals(l.Code, code, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
public static Language ForCulture(CultureInfo culture)
|
||||
{
|
||||
for (var current = culture; current is not null && !string.IsNullOrEmpty(current.Name); current = current.Parent)
|
||||
{
|
||||
var found = Find(current.Name);
|
||||
if (found is not null) return found;
|
||||
}
|
||||
return Fallback;
|
||||
}
|
||||
|
||||
static List<Language> Load()
|
||||
{
|
||||
using var stream = typeof(Languages).Assembly.GetManifestResourceStream("languages.json");
|
||||
if (stream is null) return [Fallback];
|
||||
var list = JsonSerializer.Deserialize(stream, AppJsonContext.Default.ListLanguage) ?? [];
|
||||
return list.Count == 0 ? [Fallback] : list.OrderBy(l => l.Name, StringComparer.Create(CultureInfo.InvariantCulture, CompareOptions.IgnoreCase)).ToList();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Resources;
|
||||
|
||||
using Avalonia.Data;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.Markup.Xaml.MarkupExtensions;
|
||||
|
||||
namespace MeWeb.App.Services;
|
||||
|
||||
public sealed class Localizer : INotifyPropertyChanged
|
||||
{
|
||||
readonly ResourceManager resources = new("MeWeb.App.Strings.Strings", typeof(Localizer).Assembly);
|
||||
|
||||
public static Localizer Instance { get; } = new();
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public Language Language { get; private set; } = Languages.Fallback;
|
||||
|
||||
public CultureInfo Culture { get; private set; } = CultureInfo.GetCultureInfo(Languages.Fallback.Code);
|
||||
|
||||
public bool IsRightToLeft => Culture.TextInfo.IsRightToLeft;
|
||||
|
||||
public string this[string key] => resources.GetString(key, Culture) ?? key;
|
||||
|
||||
public string Format(string key, params object[] args) => string.Format(Culture, this[key], args);
|
||||
|
||||
public void SetLanguage(Language language)
|
||||
{
|
||||
Language = language ?? Languages.Fallback;
|
||||
Culture = CultureInfo.GetCultureInfo(Language.Code);
|
||||
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.DefaultThreadCurrentUICulture = Culture;
|
||||
CultureInfo.CurrentCulture = CultureInfo.CurrentUICulture = Culture;
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Item[]"));
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(string.Empty));
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class TrExtension : MarkupExtension
|
||||
{
|
||||
public TrExtension()
|
||||
{
|
||||
}
|
||||
|
||||
public TrExtension(string key) => Key = key;
|
||||
|
||||
public string Key { get; set; }
|
||||
|
||||
public override object ProvideValue(IServiceProvider serviceProvider) =>
|
||||
new ReflectionBindingExtension($"[{Key}]") { Mode = BindingMode.OneWay, Source = Localizer.Instance }.ProvideValue(serviceProvider);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System.Net.Http.Json;
|
||||
|
||||
using MeWeb.Shared;
|
||||
|
||||
namespace MeWeb.App.Services;
|
||||
|
||||
public enum Reachability
|
||||
{
|
||||
Unknown,
|
||||
Online,
|
||||
Offline,
|
||||
}
|
||||
|
||||
public class ServerClient(IHttpClientFactory factory)
|
||||
{
|
||||
public const string Name = "server";
|
||||
|
||||
public async Task<(Reachability State, ViewInfo Info)> Probe(CancellationToken ct)
|
||||
{
|
||||
try
|
||||
{
|
||||
var http = factory.CreateClient(Name);
|
||||
using var timeout = CancellationTokenSource.CreateLinkedTokenSource(ct);
|
||||
timeout.CancelAfter(TimeSpan.FromSeconds(6));
|
||||
var info = await http.GetFromJsonAsync(Endpoints.Server.GET_Info, MeWebJsonContext.Default.ViewInfo, timeout.Token);
|
||||
return (Reachability.Online, info);
|
||||
}
|
||||
catch (Exception ex) when (ex is HttpRequestException or TaskCanceledException && !ct.IsCancellationRequested)
|
||||
{
|
||||
return (Reachability.Offline, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="AppTagline" xml:space="preserve">
|
||||
<value>Scopra se da questa connessione può ospitare un server suo, e che cosa lo impedisce.</value>
|
||||
</data>
|
||||
<data name="Check" xml:space="preserve">
|
||||
<value>Verifica</value>
|
||||
</data>
|
||||
<data name="DraftNotice" xml:space="preserve">
|
||||
<value>Questa traduzione è una bozza automatica.</value>
|
||||
</data>
|
||||
<data name="Language" xml:space="preserve">
|
||||
<value>Lingua</value>
|
||||
</data>
|
||||
<data name="StatusChecking" xml:space="preserve">
|
||||
<value>Verifico la connessione…</value>
|
||||
</data>
|
||||
<data name="StatusOffline" xml:space="preserve">
|
||||
<value>Non connesso a internet</value>
|
||||
</data>
|
||||
<data name="StatusOnline" xml:space="preserve">
|
||||
<value>Connesso a internet</value>
|
||||
</data>
|
||||
<data name="SuggestCorrection" xml:space="preserve">
|
||||
<value>Proponi una correzione</value>
|
||||
</data>
|
||||
<data name="VersionLine" xml:space="preserve">
|
||||
<value>me-web? {0} · software libero (AGPL-3.0)</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="AppTagline" xml:space="preserve">
|
||||
<value>Find out whether you can run your own server from this connection, and what stands in the way.</value>
|
||||
</data>
|
||||
<data name="Check" xml:space="preserve">
|
||||
<value>Check</value>
|
||||
</data>
|
||||
<data name="DraftNotice" xml:space="preserve">
|
||||
<value>This translation is a machine draft.</value>
|
||||
</data>
|
||||
<data name="Language" xml:space="preserve">
|
||||
<value>Language</value>
|
||||
</data>
|
||||
<data name="StatusChecking" xml:space="preserve">
|
||||
<value>Checking the connection…</value>
|
||||
</data>
|
||||
<data name="StatusOffline" xml:space="preserve">
|
||||
<value>Not connected to the internet</value>
|
||||
</data>
|
||||
<data name="StatusOnline" xml:space="preserve">
|
||||
<value>Connected to the internet</value>
|
||||
</data>
|
||||
<data name="SuggestCorrection" xml:space="preserve">
|
||||
<value>Suggest a correction</value>
|
||||
</data>
|
||||
<data name="VersionLine" xml:space="preserve">
|
||||
<value>me-web? {0} · free software (AGPL-3.0)</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,70 @@
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Platform.Storage;
|
||||
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
|
||||
using MeWeb.App.Services;
|
||||
using MeWeb.Shared;
|
||||
|
||||
namespace MeWeb.App.ViewModels;
|
||||
|
||||
public partial class MainViewModel(ServerClient server) : ObservableObject
|
||||
{
|
||||
public const string CorrectionsUrl = "https://git.thepra.dev/Arasaka/MeWeb/issues";
|
||||
|
||||
public IReadOnlyList<Language> Languages { get; } = Services.Languages.All;
|
||||
|
||||
public ILauncher Launcher { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyPropertyChangedFor(nameof(StatusFormatted), nameof(ShowOnline), nameof(ShowOffline), nameof(ShowChecking))]
|
||||
public partial Reachability Status { get; set; } = Reachability.Unknown;
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyPropertyChangedFor(nameof(ShowDraftNotice), nameof(Flow))]
|
||||
public partial Language SelectedLanguage { get; set; } = Localizer.Instance.Language;
|
||||
|
||||
public bool ShowChecking => Status == Reachability.Unknown;
|
||||
public bool ShowOnline => Status == Reachability.Online;
|
||||
public bool ShowOffline => Status == Reachability.Offline;
|
||||
public bool ShowDraftNotice => SelectedLanguage?.IsDraft == true;
|
||||
|
||||
public FlowDirection Flow => Localizer.Instance.IsRightToLeft ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
|
||||
|
||||
public string StatusFormatted => Status switch
|
||||
{
|
||||
Reachability.Online => Localizer.Instance["StatusOnline"],
|
||||
Reachability.Offline => Localizer.Instance["StatusOffline"],
|
||||
_ => Localizer.Instance["StatusChecking"],
|
||||
};
|
||||
|
||||
public string VersionFormatted => Localizer.Instance.Format("VersionLine", BuildInfo.Version);
|
||||
|
||||
[RelayCommand]
|
||||
async Task Refresh(CancellationToken ct)
|
||||
{
|
||||
Status = Reachability.Unknown;
|
||||
var (state, _) = await server.Probe(ct);
|
||||
Status = state;
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
async Task OpenCorrections()
|
||||
{
|
||||
if (Launcher is null) return;
|
||||
await Launcher.LaunchUriAsync(new Uri(CorrectionsUrl));
|
||||
}
|
||||
|
||||
partial void OnSelectedLanguageChanged(Language value)
|
||||
{
|
||||
if (value is null || value.Code == Localizer.Instance.Language.Code) return;
|
||||
Localizer.Instance.SetLanguage(value);
|
||||
var settings = AppSettings.Read();
|
||||
settings.Language = value.Code;
|
||||
AppSettings.Write(settings);
|
||||
OnPropertyChanged(nameof(StatusFormatted));
|
||||
OnPropertyChanged(nameof(VersionFormatted));
|
||||
OnPropertyChanged(nameof(Flow));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:MeWeb.App.ViewModels"
|
||||
xmlns:s="using:MeWeb.App.Services"
|
||||
x:Class="MeWeb.App.Views.MainView"
|
||||
x:DataType="vm:MainViewModel"
|
||||
FlowDirection="{Binding Flow}"
|
||||
Background="{StaticResource GroundBrush}">
|
||||
<DockPanel Margin="24,18">
|
||||
<Grid DockPanel.Dock="Top" ColumnDefinitions="*,Auto">
|
||||
<TextBlock Grid.Column="0" Classes="title" Text="me-web?" VerticalAlignment="Center" />
|
||||
<ComboBox Grid.Column="1" MinWidth="180" VerticalAlignment="Center"
|
||||
AutomationProperties.AutomationId="main-language"
|
||||
AutomationProperties.Name="{s:Tr Language}"
|
||||
ItemsSource="{Binding Languages}"
|
||||
SelectedItem="{Binding SelectedLanguage}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate x:DataType="s:Language">
|
||||
<TextBlock Text="{Binding Name}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</Grid>
|
||||
|
||||
<StackPanel DockPanel.Dock="Bottom" Spacing="6" HorizontalAlignment="Center">
|
||||
<StackPanel Orientation="Horizontal" Spacing="8" HorizontalAlignment="Center" IsVisible="{Binding ShowDraftNotice}">
|
||||
<TextBlock Classes="small" Text="{s:Tr DraftNotice}" VerticalAlignment="Center" />
|
||||
<Button Classes="link" Content="{s:Tr SuggestCorrection}"
|
||||
AutomationProperties.AutomationId="main-suggest-correction"
|
||||
Command="{Binding OpenCorrectionsCommand}" />
|
||||
</StackPanel>
|
||||
<TextBlock Classes="small" Text="{Binding VersionFormatted}" HorizontalAlignment="Center" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Spacing="22" VerticalAlignment="Center" HorizontalAlignment="Center" MaxWidth="560">
|
||||
<Grid Width="140" Height="140" HorizontalAlignment="Center">
|
||||
<Ellipse Classes="pulse" Width="140" Height="140" Fill="{StaticResource BrandRedBrush}" IsVisible="{Binding ShowChecking}" />
|
||||
<Ellipse Width="112" Height="112" Fill="{StaticResource SurfaceRaisedBrush}" Stroke="{StaticResource LineBrush}" StrokeThickness="2" />
|
||||
<Ellipse Width="64" Height="64" Fill="{StaticResource GoodBrush}" IsVisible="{Binding ShowOnline}" />
|
||||
<Ellipse Width="64" Height="64" Fill="{StaticResource BadBrush}" IsVisible="{Binding ShowOffline}" />
|
||||
<Ellipse Width="64" Height="64" Fill="{StaticResource TextSoftBrush}" Opacity="0.4" IsVisible="{Binding ShowChecking}" />
|
||||
</Grid>
|
||||
<TextBlock Classes="status" Text="{Binding StatusFormatted}" />
|
||||
<TextBlock Classes="lead" Text="{s:Tr AppTagline}" />
|
||||
<Button Classes="primary" Content="{s:Tr Check}"
|
||||
AutomationProperties.AutomationId="main-check"
|
||||
Command="{Binding RefreshCommand}" />
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,21 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
|
||||
using MeWeb.App.ViewModels;
|
||||
|
||||
namespace MeWeb.App.Views;
|
||||
|
||||
public partial class MainView : UserControl
|
||||
{
|
||||
public MainView() => InitializeComponent();
|
||||
|
||||
protected override void OnLoaded(RoutedEventArgs e)
|
||||
{
|
||||
base.OnLoaded(e);
|
||||
if (DataContext is MainViewModel model)
|
||||
{
|
||||
model.Launcher = TopLevel.GetTopLevel(this)?.Launcher;
|
||||
model.RefreshCommand.Execute(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="MeWeb.App.Views.MainWindow"
|
||||
Title="me-web?"
|
||||
Icon="/Assets/meweb.png"
|
||||
Width="1100" Height="760" MinWidth="380" MinHeight="560"
|
||||
Background="{StaticResource GroundBrush}"
|
||||
WindowStartupLocation="CenterScreen" />
|
||||
@@ -0,0 +1,8 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace MeWeb.App.Views;
|
||||
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow() => InitializeComponent();
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<RootNamespace>MeWeb.Desktop</RootNamespace>
|
||||
<AssemblyName>meweb</AssemblyName>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<ApplicationIcon>..\..\branding\meweb.ico</ApplicationIcon>
|
||||
<BuiltInComInteropSupport>false</BuiltInComInteropSupport>
|
||||
<JsonSerializerIsReflectionEnabledByDefault>false</JsonSerializerIsReflectionEnabledByDefault>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia.Desktop" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MeWeb.App\MeWeb.App.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,14 @@
|
||||
using Avalonia;
|
||||
|
||||
namespace MeWeb.Desktop;
|
||||
|
||||
static class Program
|
||||
{
|
||||
[STAThread]
|
||||
public static void Main(string[] args) => BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
|
||||
|
||||
public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure<MeWeb.App.App>()
|
||||
.UsePlatformDetect()
|
||||
.WithInterFont()
|
||||
.LogToTrace();
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<assemblyIdentity version="1.0.0.0" name="MeWeb.Desktop"/>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
|
||||
</application>
|
||||
</compatibility>
|
||||
</assembly>
|
||||
@@ -0,0 +1,31 @@
|
||||
using System.Net;
|
||||
|
||||
using MeWeb.Shared;
|
||||
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
|
||||
namespace MeWeb.Server;
|
||||
|
||||
public static class Hosting
|
||||
{
|
||||
public static IServiceCollection AddMeWebHosting(this IServiceCollection services)
|
||||
{
|
||||
services.Configure<ForwardedHeadersOptions>(options =>
|
||||
{
|
||||
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
|
||||
options.ForwardLimit = 1;
|
||||
options.KnownProxies.Clear();
|
||||
options.KnownIPNetworks.Clear();
|
||||
options.KnownProxies.Add(IPAddress.Loopback);
|
||||
options.KnownProxies.Add(IPAddress.IPv6Loopback);
|
||||
});
|
||||
services.ConfigureHttpJsonOptions(options => options.SerializerOptions.TypeInfoResolverChain.Insert(0, MeWebJsonContext.Default));
|
||||
return services;
|
||||
}
|
||||
|
||||
public static WebApplication UseMeWebHosting(this WebApplication app)
|
||||
{
|
||||
app.UseForwardedHeaders();
|
||||
return app;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<RootNamespace>MeWeb.Server</RootNamespace>
|
||||
<JsonSerializerIsReflectionEnabledByDefault>false</JsonSerializerIsReflectionEnabledByDefault>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MeWeb.Shared\MeWeb.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,9 @@
|
||||
using MeWeb.Server;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Services.AddMeWebHosting();
|
||||
|
||||
var app = builder.Build();
|
||||
app.UseMeWebHosting();
|
||||
app.MapMeWebApi();
|
||||
app.Run();
|
||||
@@ -0,0 +1,26 @@
|
||||
using System.Net.Sockets;
|
||||
|
||||
using MeWeb.Shared;
|
||||
|
||||
namespace MeWeb.Server;
|
||||
|
||||
public static class ServerApi
|
||||
{
|
||||
public static WebApplication MapMeWebApi(this WebApplication app)
|
||||
{
|
||||
app.MapGet(Endpoints.Server.GET_Info, Info);
|
||||
app.MapGet(Endpoints.Server.GET_Ip, Ip);
|
||||
return app;
|
||||
}
|
||||
|
||||
static ViewInfo Info() => new() { Version = BuildInfo.Version, Commit = BuildInfo.Commit, BuiltAt = BuildInfo.BuiltAt };
|
||||
|
||||
static IResult Ip(HttpContext context)
|
||||
{
|
||||
var address = context.Connection.RemoteIpAddress;
|
||||
if (address is null) return Results.BadRequest();
|
||||
if (address.IsIPv4MappedToIPv6) address = address.MapToIPv4();
|
||||
var family = address.AddressFamily == AddressFamily.InterNetworkV6 ? "ipv6" : "ipv4";
|
||||
return Results.Ok(new ViewIp { Address = address.ToString(), Family = family });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
namespace MeWeb.Shared;
|
||||
|
||||
public static class Endpoints
|
||||
{
|
||||
public const string Host = "meweb.arasaka.software";
|
||||
public const string HostV4 = "v4.meweb.arasaka.software";
|
||||
public const string HostV6 = "v6.meweb.arasaka.software";
|
||||
|
||||
public static string Base => $"https://{Host}";
|
||||
public static string BaseV4 => $"https://{HostV4}";
|
||||
public static string BaseV6 => $"https://{HostV6}";
|
||||
|
||||
public const string Api = "/api";
|
||||
|
||||
public static class Server
|
||||
{
|
||||
public const string GET_Info = $"{Api}/info";
|
||||
public const string GET_Ip = $"{Api}/ip";
|
||||
}
|
||||
|
||||
public static class Downloads
|
||||
{
|
||||
public const string GET_Platform = "/download/{platform}";
|
||||
|
||||
public static string GET_M_Platform(string platform) => $"/download/{platform}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<RootNamespace>MeWeb.Shared</RootNamespace>
|
||||
<BuildCommit Condition="'$(BuildCommit)' == ''">dev</BuildCommit>
|
||||
<BuildTimeUtc Condition="'$(BuildTimeUtc)' == ''">2000-01-01T00:00:00Z</BuildTimeUtc>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="GenerateBuildInfo" BeforeTargets="BeforeCompile">
|
||||
<PropertyGroup>
|
||||
<BuildInfoPath>$(IntermediateOutputPath)BuildInfo.g.cs</BuildInfoPath>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<BuildInfoLine Include="namespace MeWeb.Shared%3B" />
|
||||
<BuildInfoLine Include="public static class BuildInfo" />
|
||||
<BuildInfoLine Include="{" />
|
||||
<BuildInfoLine Include=" public const string Version = "$(Version)"%3B" />
|
||||
<BuildInfoLine Include=" public const string Commit = "$(BuildCommit)"%3B" />
|
||||
<BuildInfoLine Include=" public const string BuiltAt = "$(BuildTimeUtc)"%3B" />
|
||||
<BuildInfoLine Include="}" />
|
||||
</ItemGroup>
|
||||
<WriteLinesToFile File="$(BuildInfoPath)" Lines="@(BuildInfoLine)" Overwrite="true" WriteOnlyWhenDifferent="true" />
|
||||
<ItemGroup>
|
||||
<Compile Include="$(BuildInfoPath)" />
|
||||
<FileWrites Include="$(BuildInfoPath)" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -0,0 +1,11 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace MeWeb.Shared;
|
||||
|
||||
[JsonSourceGenerationOptions(JsonSerializerDefaults.Web)]
|
||||
[JsonSerializable(typeof(ViewInfo))]
|
||||
[JsonSerializable(typeof(ViewIp))]
|
||||
public partial class MeWebJsonContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace MeWeb.Shared;
|
||||
|
||||
public class ViewInfo
|
||||
{
|
||||
public string Version { get; set; }
|
||||
public string Commit { get; set; }
|
||||
public string BuiltAt { get; set; }
|
||||
}
|
||||
|
||||
public class ViewIp
|
||||
{
|
||||
public string Address { get; set; }
|
||||
public string Family { get; set; }
|
||||
}
|
||||
Reference in new issue
Block a user