mirror of https://github.com/jetkvm/kvm.git
Compare commits
15 Commits
3549722c4b
...
60819463b2
Author | SHA1 | Date |
---|---|---|
|
60819463b2 | |
|
0cee284561 | |
|
2272247668 | |
|
21e30c60ea | |
|
25e30f6420 | |
|
57fbee1490 | |
|
0e65c0a9a9 | |
|
2dafb5c9c1 | |
|
566305549f | |
|
1505c37e4c | |
|
564eee9b00 | |
|
fab575dbe0 | |
|
97958e7b86 | |
|
2f7042df18 | |
|
2cadda4e00 |
|
@ -0,0 +1,126 @@
|
|||
name: Push
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: read
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-22.04]
|
||||
go: [1.21, 1.23.4]
|
||||
node: [21]
|
||||
goos: [linux]
|
||||
goarch: [arm]
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
|
||||
- name: Install Dependencies
|
||||
working-directory: ui
|
||||
run: npm ci
|
||||
|
||||
- name: Build UI
|
||||
working-directory: ui
|
||||
run: npm run build:device
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ matrix.go }}
|
||||
|
||||
- name: Install Go Dependencies
|
||||
run: |
|
||||
go mod download
|
||||
|
||||
- name: Build Binaries
|
||||
env:
|
||||
GOOS: ${{ matrix.goos }}
|
||||
GOARCH: ${{ matrix.goarch }}
|
||||
run: |
|
||||
GOOS=linux GOARCH=arm GOARM=7 go build -ldflags="-s -w -X kvm.builtAppVersion=dev-${GIT_COMMIT:0:7}" -o bin/jetkvm_app cmd/main.go
|
||||
chmod 755 bin/jetkvm_app
|
||||
|
||||
- name: Upload Debug Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
if: ${{ (github.ref == 'refs/heads/main' || github.event_name == 'pull_request') && matrix.go == '1.21' }}
|
||||
with:
|
||||
name: jetkvm_app_debug
|
||||
path: bin/jetkvm_app
|
||||
|
||||
comment:
|
||||
name: Comment
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Generate Links
|
||||
id: linksa
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
ARTIFACT_ID=$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts --jq '.artifacts[0].id')
|
||||
echo "ARTIFACT_URL=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/$ARTIFACT_ID" >> $GITHUB_ENV
|
||||
echo "LATEST_COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
|
||||
|
||||
- name: Comment on PR
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
||||
TITLE="${{ github.event.pull_request.title }}"
|
||||
PR_NUMBER=${{ github.event.pull_request.number }}
|
||||
else
|
||||
TITLE="main branch"
|
||||
fi
|
||||
|
||||
COMMENT=$(cat << EOF
|
||||
✅ **Build successfully for $TITLE!**
|
||||
|
||||
| Name | Link |
|
||||
|------------------|----------------------------------------------------------------------|
|
||||
| 🔗 Debug Binary | [Download](${{ env.ARTIFACT_URL }}) |
|
||||
| 🔗 Latest commit | [${{ env.LATEST_COMMIT }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }}) |
|
||||
EOF
|
||||
)
|
||||
|
||||
# Post Comment
|
||||
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
||||
# Look for an existing comment
|
||||
COMMENT_ID=$(gh api repos/${{ github.repository }}/issues/$PR_NUMBER/comments \
|
||||
--jq '.[] | select(.body | contains("✅ **Build successfully for")) | .id')
|
||||
|
||||
if [ -z "$COMMENT_ID" ]; then
|
||||
# Create a new comment if none exists
|
||||
gh pr comment $PR_NUMBER --body "$COMMENT"
|
||||
else
|
||||
# Update the existing comment
|
||||
gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID \
|
||||
--method PATCH \
|
||||
-f body="$COMMENT"
|
||||
fi
|
||||
else
|
||||
# Log the comment for main branch
|
||||
echo "$COMMENT"
|
||||
fi
|
|
@ -0,0 +1,91 @@
|
|||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Release
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 21
|
||||
|
||||
- name: Install Dependencies
|
||||
working-directory: ui
|
||||
run: npm ci
|
||||
|
||||
- name: Build UI
|
||||
working-directory: ui
|
||||
run: npm run build:device
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.21
|
||||
|
||||
- name: Build Release Binaries
|
||||
env:
|
||||
REF: ${{ github.ref }}
|
||||
run: |
|
||||
GOOS=linux GOARCH=arm GOARM=7 go build -ldflags="-s -w -X kvm.builtAppVersion=${REF:11}" -o bin/jetkvm_app cmd/main.go
|
||||
chmod 755 bin/jetkvm_app
|
||||
|
||||
- name: Create checksum
|
||||
env:
|
||||
REF: ${{ github.ref }}
|
||||
run: |
|
||||
SUM=$(shasum -a 256 bin/jetkvm_app | cut -d ' ' -f 1)
|
||||
echo -e "\n#### SHA256 Checksum\n\`\`\`\n$SUM bin/jetkvm_app\n\`\`\`\n" >> ./RELEASE_CHANGELOG
|
||||
echo -e "$SUM bin/jetkvm_app\n" > checksums.txt
|
||||
|
||||
- name: Create Release Branch
|
||||
env:
|
||||
REF: ${{ github.ref }}
|
||||
run: |
|
||||
BRANCH=release/${REF:10}
|
||||
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git config --local user.name "github-actions[bot]"
|
||||
git checkout -b ${BRANCH}
|
||||
git push -u origin ${BRANCH}
|
||||
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: softprops/action-gh-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
draft: true
|
||||
prerelease: ${{ contains(github.ref, 'rc') || contains(github.ref, 'beta') || contains(github.ref, 'alpha') }}
|
||||
body_path: ./RELEASE_CHANGELOG
|
||||
|
||||
- name: Upload JetKVM binary
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: bin/jetkvm_app
|
||||
asset_name: jetkvm_app
|
||||
asset_content_type: application/octet-stream
|
||||
|
||||
- name: Upload checksum
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./checksums.txt
|
||||
asset_name: checksums.txt
|
||||
asset_content_type: text/plain
|
|
@ -4,6 +4,7 @@ linters:
|
|||
- forbidigo
|
||||
- misspell
|
||||
- whitespace
|
||||
- gochecknoinits
|
||||
settings:
|
||||
forbidigo:
|
||||
forbid:
|
||||
|
@ -22,6 +23,9 @@ linters:
|
|||
- linters:
|
||||
- errcheck
|
||||
path: _test.go
|
||||
- linters:
|
||||
- gochecknoinits
|
||||
path: internal/logging/sse.go
|
||||
paths:
|
||||
- third_party$
|
||||
- builtin$
|
||||
|
|
4
Makefile
4
Makefile
|
@ -2,8 +2,8 @@ BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
|
|||
BUILDDATE ?= $(shell date -u +%FT%T%z)
|
||||
BUILDTS ?= $(shell date -u +%s)
|
||||
REVISION ?= $(shell git rev-parse HEAD)
|
||||
VERSION_DEV := 0.4.1-dev$(shell date +%Y%m%d%H%M)
|
||||
VERSION := 0.4.0
|
||||
VERSION_DEV := 0.4.2-dev$(shell date +%Y%m%d%H%M)
|
||||
VERSION := 0.4.1
|
||||
|
||||
PROMETHEUS_TAG := github.com/prometheus/common/version
|
||||
KVM_PKG_NAME := github.com/jetkvm/kvm
|
||||
|
|
|
@ -370,9 +370,7 @@ func startBacklightTickers() {
|
|||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
ensureConfigLoaded()
|
||||
|
||||
func initDisplay() {
|
||||
go func() {
|
||||
waitCtrlClientConnected()
|
||||
displayLogger.Info().Msg("setting initial display contents")
|
||||
|
|
|
@ -15,9 +15,7 @@ func rpcGetJigglerState() bool {
|
|||
return jigglerEnabled
|
||||
}
|
||||
|
||||
func init() {
|
||||
ensureConfigLoaded()
|
||||
|
||||
func initJiggler() {
|
||||
go runJiggler()
|
||||
}
|
||||
|
||||
|
|
6
main.go
6
main.go
|
@ -75,8 +75,8 @@ func Main() {
|
|||
}
|
||||
}()
|
||||
|
||||
// initialize usb gadget
|
||||
initUsbGadget()
|
||||
|
||||
if err := setInitialVirtualMediaState(); err != nil {
|
||||
logger.Warn().Err(err).Msg("failed to set initial virtual media state")
|
||||
}
|
||||
|
@ -84,6 +84,10 @@ func Main() {
|
|||
if err := initImagesFolder(); err != nil {
|
||||
logger.Warn().Err(err).Msg("failed to init images folder")
|
||||
}
|
||||
initJiggler()
|
||||
|
||||
// initialize display
|
||||
initDisplay()
|
||||
|
||||
go func() {
|
||||
time.Sleep(15 * time.Minute)
|
||||
|
|
|
@ -674,7 +674,6 @@ export default function WebRTCVideo() {
|
|||
<div className="grid grow grid-rows-(--grid-bodyFooter) overflow-hidden">
|
||||
<div className="relative mx-4 my-2 flex items-center justify-center overflow-hidden">
|
||||
<div className="relative flex h-full w-full items-center justify-center">
|
||||
<div className="relative inline-block">
|
||||
{/* In relative mouse mode and under https, we enable the pointer lock, and to do so we need a bar to show the user to click on the video to enable mouse control */}
|
||||
<PointerLockBar show={showPointerLockBar} />
|
||||
<video
|
||||
|
@ -688,7 +687,7 @@ export default function WebRTCVideo() {
|
|||
disablePictureInPicture
|
||||
controlsList="nofullscreen"
|
||||
className={cx(
|
||||
"z-30 max-h-full min-h-[384px] max-w-full min-w-[512px] bg-black/50 object-contain transition-all duration-1000",
|
||||
"max-h-full min-h-[384px] max-w-full min-w-[512px] bg-black/50 object-contain transition-all duration-1000",
|
||||
{
|
||||
"cursor-none": settings.isCursorHidden,
|
||||
"opacity-0":
|
||||
|
@ -718,7 +717,6 @@ export default function WebRTCVideo() {
|
|||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<VirtualKeyboard />
|
||||
|
|
|
@ -11,7 +11,7 @@ import { chars as chars_sv_SE, name as name_sv_SE } from "@/keyboardLayouts/sv_S
|
|||
import { chars as chars_fr_CH, name as name_fr_CH } from "@/keyboardLayouts/fr_CH"
|
||||
import { chars as chars_de_CH, name as name_de_CH } from "@/keyboardLayouts/de_CH"
|
||||
|
||||
type KeyInfo = { key: string | number; shift?: boolean, altRight?: boolean }
|
||||
interface KeyInfo { key: string | number; shift?: boolean, altRight?: boolean }
|
||||
export type KeyCombo = KeyInfo & { deadKey?: boolean, accentKey?: KeyInfo }
|
||||
|
||||
export const layouts: Record<string, string> = {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { KeyCombo } from "../keyboardLayouts"
|
||||
|
||||
import { chars as chars_de_CH } from "./de_CH"
|
||||
|
||||
export const name = "Français de Suisse";
|
||||
|
|
|
@ -25,7 +25,7 @@ export default function SettingsKeyboardRoute() {
|
|||
if ("error" in resp) return;
|
||||
setKeyboardLayout(resp.result as string);
|
||||
});
|
||||
}, []);
|
||||
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
const onKeyboardLayoutChange = useCallback(
|
||||
(e: React.ChangeEvent<HTMLSelectElement>) => {
|
||||
|
|
|
@ -20,8 +20,8 @@ import { LinkButton } from "@/components/Button";
|
|||
import LoadingSpinner from "@/components/LoadingSpinner";
|
||||
import { useUiStore } from "@/hooks/stores";
|
||||
import useKeyboard from "@/hooks/useKeyboard";
|
||||
import { FeatureFlag } from "../components/FeatureFlag";
|
||||
|
||||
import { FeatureFlag } from "../components/FeatureFlag";
|
||||
import { cx } from "../cva.config";
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue