Phases two and three ship together, because their code grew in the same files. With consent the app asks the router to open 80, 443 and a high port for ten minutes (UPnP, NAT-PMP or PCP), and the server, holding a single-use ticket bound to the caller's own address, connects back and must get an HMAC only the app can give; the mappings are removed after the run and remembered until then, so a crash cannot leave one open. Hairpin is tried from inside. Two STUN servers, the outside one first, tell easy from hard NAT. Mail gets port 25 to Gmail and Outlook, the reverse name and five blocklists through the user's own resolver, network-wide UCEPROTECT listings counted as a caution. DNS, speed against the server (four at a time, twelve an hour per address) and the device follow, and six uses (website, home from outside, files, game server, fediverse, mail) close the run as possible, possible with a named workaround, or can't tell. Findings can be shared after reading the exact JSON: a file per submission under the unit's state directory, ten a day per address, deletable by the token the app keeps, swept after twelve months; /privacy says all of it in English and Italian. QR codes lead to the downloads. Every language carries every string. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012CzABvBkbcFqoHdmi8b9WB
42 lines
1.7 KiB
C#
42 lines
1.7 KiB
C#
using MeWeb.App.ViewModels;
|
|
using MeWeb.Core.Checks;
|
|
using MeWeb.Core.History;
|
|
using MeWeb.Core.Knowledge;
|
|
using MeWeb.Core.Net;
|
|
using MeWeb.Core.Router;
|
|
using MeWeb.Shared;
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace MeWeb.App;
|
|
|
|
public static class AppServices
|
|
{
|
|
public const string Secure = "secure";
|
|
public const string Plain = "plain";
|
|
|
|
public static IServiceCollection AddMeWebApp(this IServiceCollection services, IPlatform platform)
|
|
{
|
|
var agent = $"me-web/{BuildInfo.Version}";
|
|
services.AddHttpClient(Secure, http => http.DefaultRequestHeaders.UserAgent.ParseAdd(agent));
|
|
services.AddHttpClient(Plain, http => http.DefaultRequestHeaders.UserAgent.ParseAdd(agent))
|
|
.ConfigurePrimaryHttpMessageHandler(() => new SocketsHttpHandler { AllowAutoRedirect = false });
|
|
services.AddSingleton(platform);
|
|
services.AddSingleton(sp =>
|
|
{
|
|
var factory = sp.GetRequiredService<IHttpClientFactory>();
|
|
return new ServerProbe(factory.CreateClient(Secure), factory.CreateClient(Plain));
|
|
});
|
|
services.AddSingleton<KnowledgeBase>();
|
|
var folder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "MeWeb");
|
|
services.AddSingleton(new HistoryStore(folder));
|
|
services.AddSingleton(new Leftovers(folder));
|
|
services.AddSingleton(new Submissions(folder));
|
|
services.AddSingleton(sp => new CheckRunner(sp.GetRequiredService<IPlatform>(), sp.GetRequiredService<ServerProbe>(), sp.GetRequiredService<KnowledgeBase>(),
|
|
sp.GetRequiredService<HistoryStore>(), sp.GetRequiredService<IHttpClientFactory>().CreateClient(Secure), folder));
|
|
services.AddSingleton<Reach>();
|
|
services.AddTransient<MainViewModel>();
|
|
return services;
|
|
}
|
|
}
|