File tree Expand file tree Collapse file tree
HomeSpeaker.WebAssembly/Pages Expand file tree Collapse file tree Original file line number Diff line number Diff line change 103103app . MapGrpcService < GreeterService > ( ) ;
104104app . MapGrpcService < HomeSpeakerService > ( ) ;
105105app . MapGet ( "/ns" , ( IConfiguration config ) => config [ "NIGHTSCOUT_URL" ] ?? string . Empty ) ;
106+ app . MapGet ( "/api/features" , ( IConfiguration config ) => new
107+ {
108+ TemperatureEnabled = ! string . IsNullOrEmpty ( config [ "Temperature:ApiBaseUrl" ] ) ,
109+ BloodSugarEnabled = ! string . IsNullOrEmpty ( config [ "NIGHTSCOUT_URL" ] )
110+ } ) ;
106111
107112// Temperature API endpoint
108113app . MapGet ( "/api/temperature" , async ( TemperatureService temperatureService , CancellationToken cancellationToken ) =>
Original file line number Diff line number Diff line change 1212 "OTEL_EXPORTER_OTLP_PROTOCOL" : " grpc" ,
1313 "OTEL_EXPORTER_OTLP_ENDPOINT" : " http://localhost:4317" ,
1414 "Temperature" : {
15- "ApiBaseUrl" : " https://openapi.api.govee.com/router/api/v1/ "
15+ "ApiBaseUrl" : " "
1616 },
1717 "TemperatureThreshold" : 2 ,
18- "NIGHTSCOUT_URL" : " https://janedoe.azurewebsites.net "
18+ "NIGHTSCOUT_URL" : " "
1919}
Original file line number Diff line number Diff line change 11@page " /"
22@inject HomeSpeakerService svc ;
33@inject ILogger <Index > logger
4+ @inject HttpClient Http
45@using Microsoft .Fast .Components .FluentUI
56
6- <div class =" row g-2 mb-2" >
7- <div class =" col-md-6 col-12" >
8- <TemperatureMonitor />
9- </div >
10- <div class =" col-md-6 col-12" >
11- <BloodSugarMonitor />
7+ @if (showTemperature || showBloodSugar )
8+ {
9+ <div class =" row g-2 mb-2" >
10+ @if (showTemperature )
11+ {
12+ <div class =" col-md-6 col-12" >
13+ <TemperatureMonitor />
14+ </div >
15+ }
16+ @if (showBloodSugar )
17+ {
18+ <div class =" col-md-6 col-12" >
19+ <BloodSugarMonitor />
20+ </div >
21+ }
1222 </div >
13- </ div >
23+ }
1424
1525<div class =" row" >
1626 <div class =" col" >
6373 private int numPages = 0 ;
6474 private int artistCount ;
6575 private string ? filterValue ;
76+ private bool showTemperature ;
77+ private bool showBloodSugar ;
78+
6679 public string ? FilterValue
6780 {
6881 get => filterValue ;
7992
8093 protected override async Task OnInitializedAsync ()
8194 {
95+ try
96+ {
97+ var features = await Http .GetFromJsonAsync <FeaturesResponse >(" /api/features" );
98+ showTemperature = features ? .TemperatureEnabled ?? false ;
99+ showBloodSugar = features ? .BloodSugarEnabled ?? false ;
100+ }
101+ catch (Exception ex )
102+ {
103+ logger .LogWarning (ex , " Failed to load feature flags" );
104+ }
82105 await reloadSongsAsync ();
83106 }
84107
108+ private record FeaturesResponse (bool TemperatureEnabled , bool BloodSugarEnabled );
109+
85110 async Task reloadSongsAsync ()
86111 {
87112 songs = null ;
Original file line number Diff line number Diff line change 1111You have to create a certificate on the host machine
1212
1313``` bash
14- dotnet dev-certs https -ep %USERPROFILE%\ . aspnet\ h ttps\ a spnetapp.pfx -p $CREDENTIAL_PLACEHOLDER $
14+ dotnet dev-certs https -ep %USERPROFILE%/ .aspnet/ https/ aspnetapp.pfx -p $CREDENTIAL_PLACEHOLDER $
1515dotnet dev-certs https --trust
1616```
1717
You can’t perform that action at this time.
0 commit comments