diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index a7cb7c77..5d3b94b6 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -8,7 +8,8 @@ } }, "mounts": [ - "source=${localEnv:HOME}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached" + "source=${localEnv:HOME}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached", + "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ], "onCreateCommand": ".devcontainer/install-deps.sh", "customizations": { @@ -31,8 +32,11 @@ // Frontend "esbenp.prettier-vscode", "dbaeumer.vscode-eslint", - "bradlc.vscode-tailwindcss" + "bradlc.vscode-tailwindcss", + "codeandstuff.package-json-upgrade", + // Localization + "inlang.vs-code-extension" ] } } -} +} \ No newline at end of file diff --git a/.devcontainer/install-deps.sh b/.devcontainer/install-deps.sh index 4435d25b..079c8cdc 100755 --- a/.devcontainer/install-deps.sh +++ b/.devcontainer/install-deps.sh @@ -32,4 +32,5 @@ wget https://github.com/jetkvm/rv1106-system/releases/download/${BUILDKIT_VERSIO sudo mkdir -p /opt/jetkvm-native-buildkit && \ sudo tar --use-compress-program="unzstd --long=31" -xvf buildkit.tar.zst -C /opt/jetkvm-native-buildkit && \ rm buildkit.tar.zst -popd \ No newline at end of file +popd +rm -rf "${BUILDKIT_TMPDIR}" \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000..d89bc64c --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,25 @@ +{ + "recommendations": [ + // coding styles + "chrislajoie.vscode-modelines", + "editorconfig.editorconfig", + // GitHub + "GitHub.vscode-pull-request-github", + "github.vscode-github-actions", + // Golang + "golang.go", + // C / C++ + "ms-vscode.cpptools", + "ms-vscode.cpptools-extension-pack", + // CMake / Makefile + "ms-vscode.makefile-tools", + "ms-vscode.cmake-tools", + // Frontend + "esbenp.prettier-vscode", + "dbaeumer.vscode-eslint", + "bradlc.vscode-tailwindcss", + "codeandstuff.package-json-upgrade", + // Localization + "inlang.vs-code-extension" + ] +} \ No newline at end of file diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 80f9f37a..84b4d305 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -97,21 +97,42 @@ tail -f /var/log/jetkvm.log ``` /kvm/ -├── main.go # App entry point -├── config.go # Settings & configuration -├── web.go # API endpoints -├── ui/ # React frontend -│ ├── src/routes/ # Pages (login, settings, etc.) -│ └── src/components/ # UI components -├── internal/ # Internal Go packages -│ ├── native/ # CGO / Native code glue layer -│ ├── native/cgo/ # C files for the native library (HDMI, Touchscreen, etc.) -│ ├── native/eez/ # EEZ Studio Project files (for Touchscreen) -│ ├── hidrpc/ # HIDRPC implementation for HID devices (keyboard, mouse, etc.) -│ ├── logging/ # Logging implementation -│ ├── usbgadget/ # USB gadget -│ └── websecurity/ # TLS certificate management -└── resource # netboot iso and other resources +├── main.go # App entry point +├── config.go # Settings & configuration +├── display.go # Device UI control +├── web.go # API endpoints +├── cmd/ # Command line main +├── internal/ # Internal Go packages +│ ├── confparser/ # Configuration file implementation +│ ├── hidrpc/ # HIDRPC implementation for HID devices (keyboard, mouse, etc.) +│ ├── logging/ # Logging implementation +│ ├── mdns/ # mDNS implementation +│ ├── native/ # CGO / Native code glue layer (on-device hardware) +│ │ ├── cgo/ # C files for the native library (HDMI, Touchscreen, etc.) +│ │ └── eez/ # EEZ Studio Project files (for Touchscreen) +│ ├── network/ # Network implementation +│ ├── timesync/ # Time sync/NTP implementation +│ ├── tzdata/ # Timezone data and generation +│ ├── udhcpc/ # DHCP implementation +│ ├── usbgadget/ # USB gadget +│ ├── utils/ # SSH handling +│ └── websecure/ # TLS certificate management +├── resource/ # netboot iso and other resources +├── scripts/ # Bash shell scripts for building and deploying +└── static/ # (react client build output) +└── ui/ # React frontend + ├── localization/ # Client UI localization (i18n) + │ ├── jetKVM.UI.inlang/ # Settings for inlang + │ └── messages/ # Messages localized + ├── public/ # UI website static images and fonts + └── src/ # Client React UI + ├── assets/ # UI in-page images + ├── components/ # UI components + ├── hooks/ # Hooks (stores, RPC handling, virtual devices) + ├── keyboardLayouts/ # Keyboard layout definitions + │ ├── paraglide/ # (localization compiled messages output) + ├── providers/ # Feature flags + └── routes/ # Pages (login, settings, etc.) ``` **Key files for beginners:** @@ -252,6 +273,47 @@ rm -rf node_modules npm install ``` +### "Device UI Fails to Build" + +If while trying to build you run into an error message similar to : +```plaintext +In file included from /workspaces/kvm/internal/native/cgo/ctrl.c:15: +/workspaces/kvm/internal/native/cgo/ui_index.h:4:10: fatal error: ui/ui.h: No such file or directory + #include "ui/ui.h" + ^~~~~~~~~ +compilation terminated. +``` +This means that your system didn't create the directory-link to from _./internal/native/cgo/ui_ to ./internal/native/eez/src/ui when the repository was checked out. You can verify this is the case if _./internal/native/cgo/ui_ appears as a plain text file with only the textual contents: +```plaintext +../eez/src/ui +``` + +If this happens to you need to [enable git creation of symbolic links](https://stackoverflow.com/a/59761201/2076) either globally or for the KVM repository: +```bash + # Globally enable git to create symlinks + git config --global core.symlinks true + git restore internal/native/cgo/ui +``` +```bash + # Enable git to create symlinks only in this project + git config core.symlinks true + git restore internal/native/cgo/ui +``` + +Or if you want to manually create the symlink use: +```bash + # linux + cd internal/native/cgo + rm ui + ln -s ui ../eez/src/ui +``` +```dos + rem Windows + cd internal/native/cgo + del ui + mklink /d ui ../eez/src/ui +``` + --- ## Next Steps diff --git a/ui/eslint.config.cjs b/ui/eslint.config.cjs index 6e972586..8c6d57d6 100644 --- a/ui/eslint.config.cjs +++ b/ui/eslint.config.cjs @@ -66,7 +66,7 @@ module.exports = defineConfig([{ groups: ["builtin", "external", "internal", "parent", "sibling"], "newlines-between": "always", }], - + "@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }], @@ -81,7 +81,10 @@ module.exports = defineConfig([{ map: [ ["@components", "./src/components"], ["@routes", "./src/routes"], + ["@hooks", "./src/hooks"], + ["@providers", "./src/providers"], ["@assets", "./src/assets"], + ["@localizations", "./localization/paraglide"], ["@", "./src"], ], diff --git a/ui/index.html b/ui/index.html index 3c6c5606..77936233 100644 --- a/ui/index.html +++ b/ui/index.html @@ -45,31 +45,39 @@ - + - +
- +