Skip to content

Commit

Permalink
Remove spaces from IP on RegisterAsync
Browse files Browse the repository at this point in the history
  • Loading branch information
michielpost committed Sep 12, 2023
1 parent 2662170 commit 0be423b
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 52 deletions.
6 changes: 3 additions & 3 deletions HueLightDJ.Blazor.Controls/HueLightDJ.Blazor.Controls.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Blazored.LocalStorage" Version="4.3.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.9" />
<PackageReference Include="MudBlazor" Version="6.8.0" />
<PackageReference Include="Blazored.LocalStorage" Version="4.4.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.10" />
<PackageReference Include="MudBlazor" Version="6.9.0" />
</ItemGroup>

<ItemGroup>
Expand Down
10 changes: 5 additions & 5 deletions HueLightDJ.BlazorWeb/Client/HueLightDJ.BlazorWeb.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="7.0.9" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="7.0.10" />
<PackageReference Include="protobuf-net.Grpc" Version="1.1.1" />
<PackageReference Include="Grpc.Net.Client" Version="2.55.0" />
<PackageReference Include="Grpc.Net.Client.Web" Version="2.55.0" />
<PackageReference Include="Grpc.Net.Client" Version="2.57.0" />
<PackageReference Include="Grpc.Net.Client.Web" Version="2.57.0" />
<PackageReference Include="System.ServiceModel.Primitives" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.9" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.9" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.10" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.10" PrivateAssets="all" />
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
</ItemGroup>

Expand Down
27 changes: 27 additions & 0 deletions HueLightDJ.BlazorWeb/Server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /src
COPY ["HueLightDJ.BlazorWeb/Server/HueLightDJ.BlazorWeb.Server.csproj", "HueLightDJ.BlazorWeb/Server/"]
COPY ["HueLightDJ.Services/HueLightDJ.Services.csproj", "HueLightDJ.Services/"]
COPY ["HueLightDJ.Effects/HueLightDJ.Effects.csproj", "HueLightDJ.Effects/"]
COPY ["HueLightDJ.Services.Interfaces/HueLightDJ.Services.Interfaces.csproj", "HueLightDJ.Services.Interfaces/"]
COPY ["HueLightDJ.BlazorWeb/Client/HueLightDJ.BlazorWeb.Client.csproj", "HueLightDJ.BlazorWeb/Client/"]
COPY ["HueLightDJ.Blazor.Controls/HueLightDJ.Blazor.Controls.csproj", "HueLightDJ.Blazor.Controls/"]
RUN dotnet restore "HueLightDJ.BlazorWeb/Server/HueLightDJ.BlazorWeb.Server.csproj"
COPY . .
WORKDIR "/src/HueLightDJ.BlazorWeb/Server"
RUN dotnet build "HueLightDJ.BlazorWeb.Server.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "HueLightDJ.BlazorWeb.Server.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "HueLightDJ.BlazorWeb.Server.dll"]
15 changes: 10 additions & 5 deletions HueLightDJ.BlazorWeb/Server/HueLightDJ.BlazorWeb.Server.csproj
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<WarningsAsErrors>nullable</WarningsAsErrors>
<DockerTargetOS>Linux</DockerTargetOS>
<UserSecretsId>5558375b-2d23-432c-b33e-8788f019585e</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Grpc.AspNetCore" Version="2.55.0" />
<PackageReference Include="Grpc.AspNetCore.Web" Version="2.55.0" />
<PackageReference Include="Grpc.AspNetCore" Version="2.57.0" />
<PackageReference Include="Grpc.AspNetCore.Web" Version="2.57.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.4" />
<PackageReference Include="protobuf-net.Grpc.AspNetCore" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="7.0.9" />
<PackageReference Include="HueApi" Version="1.3.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="7.0.10" />
<PackageReference Include="HueApi" Version="1.4.0" />
<PackageReference Include="HueApi.ColorConverters" Version="1.0.0" />
<PackageReference Include="HueApi.Entertainment" Version="1.4.0" />
</ItemGroup>
Expand Down
73 changes: 39 additions & 34 deletions HueLightDJ.BlazorWeb/Server/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,45 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:41377",
"sslPort": 44361
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:41377",
"sslPort": 44361
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "http://localhost:5052",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:7249;http://localhost:5052",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "http://localhost:5052",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:7249;http://localhost:5052",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://localhost:{ServicePort}"
}
}
}
2 changes: 1 addition & 1 deletion HueLightDJ.Effects/HueLightDJ.Effects.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="HueApi" Version="1.3.0" />
<PackageReference Include="HueApi" Version="1.4.0" />
<PackageReference Include="HueApi.ColorConverters" Version="1.0.0" />
<PackageReference Include="HueApi.Entertainment" Version="1.4.0" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion HueLightDJ.Services/HueLightDJ.Services.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="HueApi" Version="1.3.0" />
<PackageReference Include="HueApi" Version="1.4.0" />
<PackageReference Include="HueApi.ColorConverters" Version="1.0.0" />
<PackageReference Include="HueApi.Entertainment" Version="1.4.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
Expand Down
5 changes: 5 additions & 0 deletions HueLightDJ.Services/HueSetupService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ public async Task<IEnumerable<LocatedBridge>> LocateBridgesAsync(CallContext con

public async Task<Interfaces.Models.RegisterEntertainmentResult?> RegisterAsync(HueSetupRequest request, CallContext context = default)
{
request.Ip = request.Ip.Trim();

if (request.Ip.Contains(":") || request.Ip.Contains("/"))
throw new Exception($"Not a valid ip: {request.Ip}");

var result = await LocalHueApi.RegisterAsync(request.Ip, "HueLightDJ", "Web", generateClientKey: true);
if (result == null)
return null;
Expand Down
6 changes: 3 additions & 3 deletions HueLightDJ.Web/HueLightDJ.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.18.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="7.0.8" />
<PackageReference Include="HueApi" Version="1.3.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="7.0.9" />
<PackageReference Include="HueApi" Version="1.4.0" />
<PackageReference Include="HueApi.ColorConverters" Version="1.0.0" />
<PackageReference Include="HueApi.Entertainment" Version="1.4.0" />
</ItemGroup>
Expand Down

0 comments on commit 0be423b

Please sign in to comment.