• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Aldaviva / FreshPager / 19227176152

10 Nov 2025 09:37AM UTC coverage: 76.087% (-0.3%) from 76.389%
19227176152

push

github

Aldaviva
Fix locked dependency hashes

34 of 108 branches covered (31.48%)

175 of 230 relevant lines covered (76.09%)

5.63 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

97.14
/FreshPager/Program.cs
1
using Bom.Squad;
2
using FreshPager;
3
using FreshPager.API;
4
using FreshPager.API.Toast;
5
using FreshPager.Data;
6
using Kasa;
7
using Microsoft.Extensions.Options;
8
using Pager.Duty;
9
using Pager.Duty.Webhooks;
10
using RuntimeUpgrade.Notifier;
11
using RuntimeUpgrade.Notifier.Data;
12
using Options = Kasa.Options;
13

14
BomSquad.DefuseUtf8Bom();
5✔
15

16
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
5✔
17

18
builder.Host
5✔
19
    .UseWindowsService()
5✔
20
    .UseSystemd();
5✔
21

22
builder.Services
5✔
23
    .Configure<Configuration>(builder.Configuration, options => options.BindNonPublicProperties = true)
5✔
24
    .AddSingleton<PagerDutyFactory>(provider => key => new PagerDuty(key) { HttpClient = provider.GetRequiredService<HttpClient>() })
×
25
    .AddSingleton<KasaParameters>(provider =>
5✔
26
        provider.GetRequiredService<IOptions<Configuration>>().Value is
10!
27
            { alarmLightUrl: not "<TCP URL of Kasa outlet with optional 0-indexed socket number as path, like 'tcp://192.168.1.100/0'>" and { } url }
10✔
28
            ? new Uri(url, UriKind.Absolute) is var alarmLightUrl && alarmLightUrl.Host.HasText()
10✔
29
                ? new KasaParameters(alarmLightUrl.Host, alarmLightUrl.Segments.ElementAtOrDefault(1) is { } socket && int.TryParse(socket.TrimEnd('/'), out int socketId) ? socketId : null)
10✔
30
                : throw new UriFormatException($"{nameof(Configuration.alarmLightUrl)} has an empty hostname, ensure there is a // between the scheme and hostname (like 'tcp://192.168.1.100')")
10✔
31
            : null!)
10✔
32
    .AddSingleton<IKasaOutlet>(provider =>
5✔
33
        provider.GetService<KasaParameters>() is { } kasaParameters && new Options { LoggerFactory = provider.GetService<ILoggerFactory>() } is var kasaOptions ?
5!
34
            kasaParameters.socketId is not null ? new MultiSocketKasaOutlet(kasaParameters.hostname, kasaOptions) : new KasaOutlet(kasaParameters.hostname, kasaOptions) : null!)
5✔
35
    .AddSingleton<WebhookResource>(provider => provider.GetRequiredService<IOptions<Configuration>>().Value is { pagerDutyWebhookSecrets: not ["<My PagerDuty webhook secret>"] and { } secrets }
5!
36
        ? new WebhookResource(secrets) : null!)
5✔
37
    .AddHttpClient()
5✔
38
    .AddSingleton<WebResource, FreshpingResource>()
5✔
39
    .AddSingleton<WebResource, PagerDutyResource>()
5✔
40
    .AddSingleton<WebResource, ToastResource>()
5✔
41
    .AddSingleton<ToastDispatcher, ToastDispatcherImpl>()
5✔
42
    .AddSignalR(options => options.DisableImplicitFromServicesParameters = true);
10✔
43

44
builder.Logging.AmplifyMessageLevels(options => options.Amplify("Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher", LogLevel.Warning, 2, 3, 5, 11, 13, 14, 15, 19, 21, 22, 23, 24));
10✔
45

46
await using WebApplication webapp = builder.Build();
5✔
47

48
foreach (WebResource resource in webapp.Services.GetServices<WebResource>()) {
40✔
49
    resource.map(webapp);
15✔
50
}
51

52
using RuntimeUpgradeNotifier runtimeUpgrades = new() {
5✔
53
    LoggerFactory   = webapp.Services.GetRequiredService<ILoggerFactory>(),
5✔
54
    RestartStrategy = RestartStrategy.AutoRestartService
5✔
55
};
5✔
56

57
await webapp.RunAsync();
5✔
58

59
namespace FreshPager {
60

61
    internal delegate IPagerDuty PagerDutyFactory(string integrationKey);
62

63
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc