Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 47 additions & 3 deletions .github/workflows/smartbotweb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
workflow_dispatch:

permissions:
Expand All @@ -16,6 +18,7 @@ env:
PUBLISH_PATH: published
CONFIGURATION: Release
DOTNET_CORE_VERSION: 10.0.300
DOTNET_TEST_RUNTIME_VERSION: 8.0.34
PROJECT_PATH: src/server/SmartBotBlazorApp/SmartBotBlazorApp.csproj
SOLUTION_PATH: src/server/SmartBotBlazorApp.sln
jobs:
Expand All @@ -27,15 +30,56 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_CORE_VERSION }}
- name: Ensure .NET 8 test runtimes
shell: bash
run: |
set -euo pipefail
dotnet --list-runtimes
dotnet_dir="$(dirname "$(readlink -f "$(command -v dotnet)")")"
installer="$RUNNER_TEMP/dotnet-install.sh"
for runtime in dotnet aspnetcore; do
framework=Microsoft.NETCore.App
if [ "$runtime" = aspnetcore ]; then framework=Microsoft.AspNetCore.App; fi
if ! dotnet --list-runtimes | grep -F "$framework $DOTNET_TEST_RUNTIME_VERSION ["; then
if [ ! -f "$installer" ]; then
curl --fail --silent --show-error --location https://dot.net/v1/dotnet-install.sh --output "$installer"
fi
bash "$installer" --runtime "$runtime" --version "$DOTNET_TEST_RUNTIME_VERSION" \
--install-dir "$dotnet_dir" --skip-non-versioned-files --no-path
fi
dotnet --list-runtimes | grep -F "$framework $DOTNET_TEST_RUNTIME_VERSION ["
done
- name: Restore
run: dotnet restore "${{ env.SOLUTION_PATH }}" --locked-mode
- name: Verify formatting
run: dotnet format "${{ env.SOLUTION_PATH }}" --verify-no-changes --no-restore
- name: Audit NuGet packages
shell: bash
run: |
dotnet list "${{ env.SOLUTION_PATH }}" package --vulnerable --include-transitive --format json > vulnerable-packages.json
test "$(jq '[.projects[]?.frameworks[]? | ((.topLevelPackages // []) + (.transitivePackages // []))[]] | length' vulnerable-packages.json)" -eq 0
set -euo pipefail
dotnet list "${{ env.SOLUTION_PATH }}" package --vulnerable --include-transitive --no-restore --format json --output-version 1 > vulnerable-packages.json
# NuGet reports source failures in problems, even when package lists are empty.
# A clean project may omit frameworks; require every solution project instead.
jq -e '
def optional_array(key): if has(key) then .[key] else [] end;
.version == 1 and
(.sources | type == "array" and length > 0 and all(.[]; type == "string" and length > 0)) and
(optional_array("problems") | type == "array" and length == 0) and
(.projects | type == "array" and length == 3) and
([.projects[].path | split("/") | last] | sort == [
"SmartBotBlazorApp.Client.csproj",
"SmartBotBlazorApp.Tests.csproj",
"SmartBotBlazorApp.csproj"
]) and
all(.projects[];
(optional_array("frameworks") | type == "array") and
all((.frameworks // [])[];
(.framework | type == "string" and length > 0) and
(optional_array("topLevelPackages") | type == "array" and length == 0) and
(optional_array("transitivePackages") | type == "array" and length == 0)
)
)
' vulnerable-packages.json
- name: Build
run: dotnet build "${{ env.SOLUTION_PATH }}" --configuration ${{ env.CONFIGURATION }} --no-restore
- name: Test
Expand All @@ -58,4 +102,4 @@ jobs:
vulnerable-packages.json
if-no-files-found: warn
- name: Build container image
run: docker build --file src/server/SmartBotBlazorApp/Dockerfile --tag smartbotapi:ci .
run: docker build --pull --file src/server/SmartBotBlazorApp/Dockerfile --tag smartbotapi:ci .
4 changes: 3 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ Service**. Robot firmware is an Arduino sketch that connects to the SignalR hub.
- `other/media/` — README screenshots, photos, and demo video.

## Build / run / test
- Build/run with the **.NET 8 SDK** (`dotnet build` / `dotnet run`).
- Build/run with the SDK selected by **`global.json`** (10.0.300, `latestPatch`)
(`dotnet build` / `dotnet run`). The projects target **`net8.0`** and use EF Core 9;
install the .NET 8 and ASP.NET Core 8 runtimes for local execution/tests.
- Tests: `dotnet test` (see `docs/getting-started.md`).

## Conventions & good practices
Expand Down
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,17 +125,19 @@ mixing equations, dead zones, timing, key mapping, and safety behavior.

| Layer | Technology |
|---|---|
| Web framework | ASP.NET Core 8.0, Blazor (Interactive Server + WebAssembly hybrid) |
| Web framework | ASP.NET Core 8.0, Blazor (Interactive Server + WebAssembly hybrid); explicit ASP.NET Core packages 8.0.34 |
| UI components | MudBlazor 7, Bootstrap 5 |
| Real-time transport | SignalR (JSON protocol) over WebSocket/TLS |
| Data | Entity Framework Core 9, SQL Server (LocalDB in development) |
| Image processing | SixLabors.ImageSharp (heatmap rendering, bilinear interpolation) |
| Data | Entity Framework Core 9, Microsoft.Data.SqlClient 6.1.8, SQL Server (LocalDB in development) |
| Image processing | SixLabors.ImageSharp 3.2.0 (heatmap rendering, bilinear interpolation) |
| Identity | ASP.NET Core Identity |
| Firmware | Arduino framework on ESP32-C3 (Arduino IDE 2.x) |
| Firmware libraries | ArduinoJson, SparkFun VL53L5CX, Adafruit MPU6050, WebSockets (Markus Sattler) |
| Hardware | ESP32-C3 DevKitM-1, VL53L5CX ToF sensor, MPU6050 IMU, TB6612FNG motor driver, NeoPixel status LED |
| DevOps | Docker, GitHub Actions, Azure App Service (presentation deployment) |

**Platform support:** [.NET 8](https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-core) and [EF Core 9](https://learn.microsoft.com/en-us/ef/core/what-is-new/) reached end of support on November 10, 2026. This repair retains `net8.0` and EF Core 9; updating packages does not restore platform support. Migration to .NET 10 LTS, including EF Core and database regression testing, is a separate follow-up.

## Repository Structure

```
Expand Down Expand Up @@ -164,7 +166,9 @@ SmartBotAPI/

### Web Server

**Prerequisites:** [.NET SDK 10.0](https://dotnet.microsoft.com/download/dotnet/10.0) (the application targets .NET 8), SQL Server LocalDB on Windows (installed with Visual Studio) or any reachable SQL Server instance.
**Prerequisites:** [.NET SDK 10.0.300](https://dotnet.microsoft.com/download/dotnet/10.0) as selected by `global.json` (`latestPatch`), .NET 8 and ASP.NET Core 8 runtimes (8.0.34) for execution/tests, and SQL Server LocalDB on Windows (installed with Visual Studio) or any reachable SQL Server instance. The application targets `net8.0`; SDK 10 alone does not provide its runtime.

**Release-build license:** ImageSharp 3.2.0 requires an issued Six Labors license, including for qualifying open-source projects. Request an assembly-scoped community license for `SmartBotBlazorApp`; see [setup instructions](docs/getting-started.md#imagesharp-release-build-license). Only that public assembly-scoped license may be committed; unrestricted or commercial keys must remain private.

```powershell
cd src/server/SmartBotBlazorApp
Expand Down Expand Up @@ -235,7 +239,7 @@ The [firmware and hardware reference](docs/firmware.md) links to the manufacture

## Deployment

Pushing to `main` or opening a pull request against it triggers the GitHub Actions workflow (`.github/workflows/smartbotweb.yml`), which performs a locked restore, verifies formatting, audits NuGet packages, builds and tests with coverage, builds the container image, and publishes a deployable web-app artifact. It does not deploy to an external environment automatically.
Pushing to `main` or `develop`, or opening a pull request against either branch, triggers the GitHub Actions workflow (`.github/workflows/smartbotweb.yml`). It uses SDK 10.0.300 and checks/installs the .NET 8 and ASP.NET Core 8 runtimes at 8.0.34 on Linux, then performs a locked restore, verifies formatting, audits all NuGet dependencies including transitive packages, builds and tests with coverage, publishes a deployable web-app artifact, and builds the container image. It does not deploy to an external environment automatically.

For the project presentation, the application was deployed to the **smartbotweb** Azure App Service and the firmware targeted `smartbotweb.azurewebsites.net:443`. That service is no longer hosted; the current firmware configuration uses an explicit placeholder that must be replaced with the address of the current server before use.

Expand Down
14 changes: 9 additions & 5 deletions README.pl.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,17 +126,19 @@ klawiszy i zabezpieczenia opisano w

| Warstwa | Technologia |
|---|---|
| Framework web | ASP.NET Core 8.0, Blazor (Interactive Server + WebAssembly) |
| Framework web | ASP.NET Core 8.0, Blazor (Interactive Server + WebAssembly); jawne pakiety ASP.NET Core 8.0.34 |
| Komponenty UI | MudBlazor 7, Bootstrap 5 |
| Transport real-time | SignalR (protokół JSON) po WebSocket/TLS |
| Dane | Entity Framework Core 9, SQL Server (LocalDB w dev) |
| Przetwarzanie obrazu | SixLabors.ImageSharp (mapa ciepła, interpolacja dwuliniowa) |
| Dane | Entity Framework Core 9, Microsoft.Data.SqlClient 6.1.8, SQL Server (LocalDB w dev) |
| Przetwarzanie obrazu | SixLabors.ImageSharp 3.2.0 (mapa ciepła, interpolacja dwuliniowa) |
| Tożsamość | ASP.NET Core Identity |
| Firmware | Arduino na ESP32-C3 (Arduino IDE 2.x) |
| Biblioteki firmware | ArduinoJson, SparkFun VL53L5CX, Adafruit MPU6050, WebSockets (Markus Sattler) |
| Sprzęt | ESP32-C3 DevKitM-1, czujnik ToF VL53L5CX, IMU MPU6050, sterownik silników TB6612FNG, dioda statusu NeoPixel |
| DevOps | Docker, GitHub Actions, Azure App Service (wdrożenie prezentacyjne) |

**Wsparcie platformy:** [.NET 8](https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-core) i [EF Core 9](https://learn.microsoft.com/en-us/ef/core/what-is-new/) zakończyły okres wsparcia 10 listopada 2026 r. Ta naprawa zachowuje `net8.0` i EF Core 9; aktualizacja pakietów nie przywraca wsparcia platformy. Migracja do .NET 10 LTS, obejmująca EF Core i testy regresji bazy danych, pozostaje osobnym kolejnym zadaniem.

## Struktura repozytorium

```
Expand Down Expand Up @@ -165,7 +167,9 @@ SmartBotAPI/

### Serwer webowy

**Wymagania:** [.NET SDK 10.0](https://dotnet.microsoft.com/download/dotnet/10.0) (aplikacja jest kierowana na .NET 8), SQL Server LocalDB w systemie Windows (instalowany z Visual Studio) lub dowolna dostępna instancja SQL Server.
**Wymagania:** [.NET SDK 10.0.300](https://dotnet.microsoft.com/download/dotnet/10.0) wybierany przez `global.json` (`latestPatch`), środowiska uruchomieniowe .NET 8 i ASP.NET Core 8 (8.0.34) do uruchamiania aplikacji/testów oraz SQL Server LocalDB w systemie Windows (instalowany z Visual Studio) lub dowolna dostępna instancja SQL Server. Aplikacja ma target `net8.0`; sam SDK 10 nie dostarcza wymaganego środowiska uruchomieniowego.

**Licencja do kompilacji Release:** ImageSharp 3.2.0 wymaga wydanej licencji Six Labors, także dla kwalifikujących się projektów open source. Uzyskaj licencję community ograniczoną do assembly `SmartBotBlazorApp`; zobacz [instrukcję konfiguracji](docs/getting-started.md#imagesharp-release-build-license). Tylko tę publiczną licencję ograniczoną do assembly można commitować; klucze bez tego ograniczenia i komercyjne muszą pozostać prywatne.

```powershell
cd src/server/SmartBotBlazorApp
Expand Down Expand Up @@ -236,7 +240,7 @@ Po połączeniu robot pojawia się na stronie **Live View Image** zalogowanego p

## Wdrożenie

Push do `main` lub otwarcie pull requesta do tej gałęzi uruchamia workflow GitHub Actions (`.github/workflows/smartbotweb.yml`), który wykonuje odtwarzalny restore, sprawdza formatowanie i podatności pakietów, buduje i testuje rozwiązanie z pomiarem pokrycia, buduje obraz kontenera oraz publikuje artefakt aplikacji webowej. Workflow nie wdraża automatycznie do środowiska zewnętrznego.
Push do `main` lub `develop` albo otwarcie pull requesta do jednej z tych gałęzi uruchamia workflow GitHub Actions (`.github/workflows/smartbotweb.yml`). Workflow używa SDK 10.0.300 i sprawdza/instaluje środowiska uruchomieniowe .NET 8 oraz ASP.NET Core 8 w wersji 8.0.34 na Linuksie, następnie wykonuje restore w trybie locked, sprawdza formatowanie i podatności wszystkich zależności NuGet, w tym pośrednich, buduje i testuje rozwiązanie z pomiarem pokrycia, publikuje artefakt aplikacji webowej oraz buduje obraz kontenera. Workflow nie wdraża automatycznie do środowiska zewnętrznego.

Na potrzeby prezentacji projektu aplikacja była wdrożona na Azure App Service **smartbotweb**, a firmware łączył się z `smartbotweb.azurewebsites.net:443`. Usługa nie jest już hostowana; aktualna konfiguracja firmware zawiera jawny placeholder, który przed użyciem trzeba zastąpić adresem bieżącego serwera.

Expand Down
32 changes: 20 additions & 12 deletions THIRD_PARTY_NOTICES.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,33 @@ the transitive dependencies carrying nonstandard Microsoft terms are:

| Package or package group | Version | License |
|---|---:|---|
| Microsoft.AspNetCore.Components.WebAssembly, .Authentication, .Server; Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore; Microsoft.AspNetCore.Identity.EntityFrameworkCore; Microsoft.AspNetCore.SignalR.Client | 8.0.29 | [MIT](https://licenses.nuget.org/MIT) |
| Microsoft.AspNetCore.Components.WebAssembly, .Authentication, .Server; Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore; Microsoft.AspNetCore.Identity.EntityFrameworkCore; Microsoft.AspNetCore.SignalR.Client | 8.0.34 | [MIT](https://licenses.nuget.org/MIT) |
| Microsoft.EntityFrameworkCore.SqlServer, Microsoft.EntityFrameworkCore.Tools | 9.0.18 | [MIT](https://licenses.nuget.org/MIT) |
| Microsoft.Data.SqlClient | 6.1.6 | [MIT](https://licenses.nuget.org/MIT) |
| Microsoft.Data.SqlClient | 6.1.8 | [MIT](https://licenses.nuget.org/MIT) |
| MudBlazor | 7.16.0 | [MIT](https://licenses.nuget.org/MIT) |
| Newtonsoft.Json | 13.0.4 | [MIT](https://licenses.nuget.org/MIT) |
| SixLabors.ImageSharp | 3.1.12 | Apache-2.0 grant for qualifying open-source use under the [Six Labors Split License 1.0](https://sixlabors.com/posts/license-changes/) |
| Microsoft.Data.SqlClient.SNI.runtime (transitive runtime component) | 6.0.2 | [Microsoft Software License Terms](https://www.nuget.org/packages/Microsoft.Data.SqlClient.SNI.runtime/6.0.2) |
| SixLabors.ImageSharp | 3.2.0 | Apache-2.0 grant for qualifying open-source use under the [Six Labors Split License 1.0](https://sixlabors.com/posts/license-changes/) |
| Microsoft.Data.SqlClient.SNI.runtime (transitive runtime component) | 6.0.3 | [Microsoft Software License Terms](https://www.nuget.org/packages/Microsoft.Data.SqlClient.SNI.runtime/6.0.3) |
| Microsoft.Identity.Client.NativeInterop (transitive runtime component) | 0.20.6 | [Microsoft Software License Terms](https://www.nuget.org/packages/Microsoft.Identity.Client.NativeInterop/0.20.6) |
| coverlet.collector, Microsoft.NET.Test.Sdk | 10.0.1, 18.8.1 | [MIT](https://licenses.nuget.org/MIT) |
| xunit.v3, xunit.runner.visualstudio | 3.2.2, 3.1.5 | [Apache-2.0](https://licenses.nuget.org/Apache-2.0) |

The restore verified on July 15, 2026 resolves 140 unique package/version pairs
across the server, client, and test projects. Their NuGet metadata consists of
127 MIT license expressions, 10 Apache-2.0 expressions, no legacy upstream
license URLs, and 3 embedded license files. The embedded licenses are the SNI
runtime, Microsoft Identity native interop, and ImageSharp listed above.
Together, these entries account for the complete restored graph at that date.
Exact transitive versions can change after a future restore, so each
package's `.nuspec` metadata and included license file remain authoritative.
The three checked-in `packages.lock.json` files, regenerated and inspected on
November 16, 2026, resolve 140 unique NuGet package/version pairs across the
server, client, and test projects. Their package `.nuspec` license declarations
comprise 127 MIT expressions, 10 Apache-2.0 expressions, and 3 embedded license
files. The embedded licenses are the SNI runtime, Microsoft Identity native
interop, and ImageSharp listed above; their included files were also inspected.
These counts exclude project references and cover the complete locked package
graph, including build and test dependencies. The lock files record exact
transitive versions; each package's `.nuspec` metadata and included license
file remain authoritative when the graph is updated.

ImageSharp 3.2.0 also requires a vendor-issued license key when building a project
that directly references it. Eligible public projects can request an
assembly-scoped community key and include that key in their repository;
unrestricted and commercial keys must remain private. See the upstream
[license configuration documentation](https://docs-v3.sixlabors.com/articles/imagesharp/index.html#how-to-use-the-license-file).

## Firmware libraries installed separately

Expand Down
4 changes: 2 additions & 2 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ sequenceDiagram
participant D as Dashboard (browser)

R->>H: ReceiveRobotData(user, measurements[7], rawMatrix[64], avgDistance)
H->>S: round, save to DB (throttled ≤ 1/s)
H->>S: round, save to DB (throttled per robot ≤ 1/s)
H->>S: render heatmap PNG + interpolate 8×8 → 32×32
H-->>D: ReceiveBase64Frame(user, measurements, heatmapBase64, avgDistance)
H-->>D: ReceiveMatrix(user, measurements, interpolated[1024], avgDistance)
Expand Down Expand Up @@ -117,7 +117,7 @@ Both transformations live in `ImageProcessor.cs` and run per incoming frame:
1. **Heatmap generation** — the 8×8 depth frame is normalized to the 10–3500 mm range and mapped onto a red → yellow → green → blue → purple gradient, rendered with ImageSharp and returned as a base64-encoded PNG (displayed at 512×512 in the browser).
2. **Bilinear interpolation** — the same frame is upsampled to 32×32 (`ushort[1024]`) for the interactive matrix view, where each cell is colored client-side.

`MeasurementService.cs` rounds measurements to 2 decimal places for display and uses one static timestamp to throttle database writes to approximately one insert per second for the whole server process. The throttle is shared by all robots and service instances; it is not maintained per stream. The timestamp check is not protected by a concurrency lock, so it is a load-reduction mechanism rather than a strict rate-limit guarantee.
`MeasurementService.cs` rounds measurements to 2 decimal places for display. Database writes use the singleton `RobotMeasurementThrottle`, which synchronizes timestamp checks and updates with a lock and permits one save attempt per second for each tracked robot ID. Elapsed time is compared in UTC; stored measurements retain local timestamps for the existing chart filters. Tracking is bounded to 256 robot IDs, evicting the oldest entry when a new ID exceeds that capacity. This throttle is local to one server process, so separate server instances do not share its state.

## Persistence

Expand Down
Loading
Loading