Merge branch 'main' into main

This commit is contained in:
wenjie
2025-02-06 17:46:44 +08:00
committed by GitHub
28 changed files with 156 additions and 31 deletions

View File

@@ -18,11 +18,13 @@ English | [中文](./README_ZH.md) | [日本語](./README_JA.md)
> Your NanoKVM Power by RISC-V !
> If you have any issues or suggestions, creating issue here, or tell us with [MaixHub Discussion](https://maixhub.com/discussion/nanokvm).
## Opensource & Contribution & Shipping
## Opensource & Contribution
The star is coming to 2K! We will organize and opensource backend source code in Mid October!(and it is also the time all preoreders (before 10.1) ship out)
### Update 2025.02.05
For users concerned about security, you can read this issue: https://github.com/sipeed/NanoKVM/issues/301 , you will find explanations addressing all security concerns.
GitHub, as an open and transparent platform, provides a space for discussing so-called "backdoor" concerns. Open-source makes products more secure!
### Update 10.18
### Update 2024.10.18
We have opensourced the backend code in 10.8, and thank you for Civil PR it immediately, we will give you newest NanoKVM-PCIe as a reward!
The mid-Oct batch is starting testing and packaging, most order before 10.1 will ship out next and next next week.
@@ -77,6 +79,28 @@ Note: Out of the 256MB memory in SG2002, 158MB is currently allocated for the mu
+ [NanoKVM-B Schematic](https://cn.dl.sipeed.com/fileList/KVM/nanoKVM/HDK/02_Schematic/SCH_HDMI_MIPI_31011.pdf)
+ [NanoKVM img](https://github.com/sipeed/NanoKVM/releases/tag/NanoKVM)
## Roadmap
### Q1 2025
**Enhancements:**
- [ ] Refactor the HDMI module and remove the libmaixcam_lib.so dependency
- [ ] Disable SSH by default and add an enable/disable toggle in the web UI
- [ ] Disable Tailscale by default and add an enable/disable toggle in the web UI
- [ ] Add JWT configuration options to the configuration file
**Distribution:**
- [ ] Distribute applications via GitHub
- [ ] Implement integrity checks for online updates
- [ ] Support offline updates
**Bug Fixes:**
- [ ] Fix the DNS issue
- [ ] Fix the CSRF vulnerability
## Where to buy
* [Aliexpress(global except USA&Russia)](https://www.aliexpress.com/item/1005007369816019.html)

View File

@@ -47,6 +47,15 @@ authentication: enable
# JWT secret key configuration
# If left empty, a random key will be generated on each server start
secretKey: ""
# Address for custom STUN server
stun: stun.l.google.com:19302
# Address and authentication for custom TURN server
turn:
turnAddr: turn.cloudflare.com:3478
turnUser: example_user
turnCred: example_cred
```

View File

@@ -47,6 +47,13 @@ authentication: enable
# JWT 秘密鍵の設定
# 空のままにすると、サーバー起動時にランダムな鍵が生成されます
secretKey: ""
stun: stun.l.google.com:19302
turn:
turnAddr: turn.cloudflare.com:3478
turnUser: example_user
turnCred: example_cred
```
## コンパイルとデプロイ

View File

@@ -45,6 +45,13 @@ authentication: enable
# JWT 密钥
# 如果不设置,则每次服务启动时使用随机生成的密钥。
secretKey: ""
stun: stun.l.google.com:19302
turn:
turnAddr: turn.cloudflare.com:3478
turnUser: example_user
turnCred: example_cred
```
## 编译部署

View File

@@ -14,5 +14,11 @@ var defaultConfig = &Config{
Level: "info",
File: "stdout",
},
Stun: "stun.l.google.com:19302",
Turn: Turn{
TurnAddr: "turn.cloudflare.com:3478",
TurnUser: "",
TurnCred: "",
},
Authentication: "enable",
}

View File

@@ -7,6 +7,8 @@ type Config struct {
Logger Logger `yaml:"logger"`
Authentication string `yaml:"authentication"`
SecretKey string `yaml:"secretKey"`
Stun string `yaml:"stun"`
Turn Turn `yaml:"turn"`
Hardware Hardware `yaml:"-"`
}
@@ -26,6 +28,12 @@ type Cert struct {
Key string `yaml:"key"`
}
type Turn struct {
TurnAddr string `yaml:"turnAddr"`
TurnUser string `yaml:"turnUser"`
TurnCred string `yaml:"turnCred"`
}
type Hardware struct {
Version HWVersion `yaml:"-"`
GPIOReset string `yaml:"-"`

View File

@@ -1,6 +1,7 @@
package h264
import (
"NanoKVM-Server/config"
"net/http"
"sync"
@@ -34,18 +35,29 @@ func Connect(c *gin.Context) {
log.Debugf("h264 websocket disconnected")
}()
config := webrtc.Configuration{
ICEServers: []webrtc.ICEServer{
{
URLs: []string{
"stun:stun.l.google.com:19302",
"stun:turn.cloudflare.com:3478",
},
},
},
conf := config.GetInstance()
var iceServers []webrtc.ICEServer
if conf.Stun != "" {
iceServers = append(iceServers, webrtc.ICEServer{
URLs: []string{"stun:" + conf.Stun},
})
}
peerConn, err := webrtc.NewPeerConnection(config)
if conf.Turn.TurnAddr != "" && conf.Turn.TurnUser != "" && conf.Turn.TurnCred != "" {
iceServers = append(iceServers, webrtc.ICEServer{
URLs: []string{"turn:" + conf.Turn.TurnAddr},
Username: conf.Turn.TurnUser,
Credential: conf.Turn.TurnCred,
})
}
rtc_config := webrtc.Configuration{
ICEServers: iceServers,
}
peerConn, err := webrtc.NewPeerConnection(rtc_config)
if err != nil {
log.Errorf("failed to create PeerConnection: %s", err)
return

View File

@@ -71,7 +71,8 @@ const cz = {
tips: 'Podporovány jsou pouze standardní písmena a symboly klávesnice',
placeholder: 'Zadejte text',
submit: 'Odeslat',
virtual: 'Klávesnice'
virtual: 'Klávesnice',
ctrlaltdel: 'Ctrl+Alt+Del'
},
mouse: {
default: 'Výchozí kurzor',

View File

@@ -70,7 +70,8 @@ const da = {
tips: 'Kun standard bogstaver og symboler er understøttet',
placeholder: 'Indtast tekst',
submit: 'Send',
virtual: 'Tastatur'
virtual: 'Tastatur',
ctrlaltdel: 'Ctrl+Alt+Del'
},
mouse: {
default: 'Standard-markør',

View File

@@ -71,7 +71,8 @@ const de = {
tips: 'Nur Standard-Tastaturbuchstaben und Symbole werden unterstützt.',
placeholder: 'Bitte eingeben',
submit: 'Senden',
virtual: 'Virtuelle Tastatur'
virtual: 'Virtuelle Tastatur',
ctrlaltdel: 'Ctrl+Alt+Del'
},
mouse: {
default: 'Standard Cursor',

View File

@@ -69,7 +69,8 @@ const en = {
tips: 'Only standard keyboard letters and symbols are supported',
placeholder: 'Please input',
submit: 'Submit',
virtual: 'Keyboard'
virtual: 'Keyboard',
ctrlaltdel: 'Ctrl+Alt+Del'
},
mouse: {
default: 'Default cursor',

View File

@@ -71,7 +71,8 @@ const en = {
tips: 'Solo están soportadas las letras y símbolos estándar del teclado',
placeholder: 'Por favor, introduce el texto',
submit: 'Enviar',
virtual: 'Teclado virtual'
virtual: 'Teclado virtual',
ctrlaltdel: 'Ctrl+Alt+Del'
},
mouse: {
default: 'Cursor por defecto',

View File

@@ -71,7 +71,8 @@ const fr = {
tips: 'Seuls les caractères et symboles standard du clavier sont pris en charge',
placeholder: 'Veuillez saisir',
submit: 'Soumettre',
virtual: 'Clavier'
virtual: 'Clavier',
ctrlaltdel: 'Ctrl+Alt+Del'
},
mouse: {
default: 'Curseur par défaut',

View File

@@ -71,7 +71,8 @@ const hu = {
tips: 'Csak a szabványos billentyűzet betűi és szimbólumai támogatottak',
placeholder: 'Írja be',
submit: 'Elküldés',
virtual: 'Billentyűzet'
virtual: 'Billentyűzet',
ctrlaltdel: 'Ctrl+Alt+Del'
},
mouse: {
default: 'Alapértelmezett kurzor',

View File

@@ -70,7 +70,8 @@ const id = {
tips: 'Hanya huruf dan simbol keyboard standar yang didukung',
placeholder: 'Silahkan isi',
submit: 'Kirimkan',
virtual: 'Keyboard'
virtual: 'Keyboard',
ctrlaltdel: 'Ctrl+Alt+Del'
},
mouse: {
default: 'Kursor bawaan',

View File

@@ -71,7 +71,8 @@ const it = {
tips: 'Sono supportati solo lettere e simboli standard della tastiera',
placeholder: 'Inserisci testo',
submit: 'Invia',
virtual: 'Tastiera'
virtual: 'Tastiera',
ctrlaltdel: 'Ctrl+Alt+Del'
},
mouse: {
default: 'Cursore predefinito',

View File

@@ -71,7 +71,8 @@ const ja = {
tips: '標準的なキーボードの文字と記号のみがサポートされています',
placeholder: '入力してください',
submit: '送信',
virtual: 'キーボード'
virtual: 'キーボード',
ctrlaltdel: 'Ctrl+Alt+Del'
},
mouse: {
default: 'デフォルトカーソル',

View File

@@ -70,6 +70,7 @@ const ko = {
placeholder: '입력하세요',
submit: '전송',
virtual: '키보드'
ctrlaltdel: 'Ctrl+Alt+Del'
},
mouse: {
default: '기본 커서',

View File

@@ -71,7 +71,8 @@ const nb = {
tips: 'Kun vanlige tegn på tastatur er støttet',
placeholder: 'Vennligst angi teksten du vil lime inn',
submit: 'Lim inn',
virtual: 'Åpne tastatur'
virtual: 'Åpne tastatur',
ctrlaltdel: 'Ctrl+Alt+Del'
},
mouse: {
default: 'Vanlig',

View File

@@ -71,7 +71,8 @@ const nl = {
tips: 'Alleen standaard toetsenbordletters en symbolen worden ondersteund',
placeholder: 'Voer tekst in',
submit: 'Verzenden',
virtual: 'Toetsenbord'
virtual: 'Toetsenbord',
ctrlaltdel: 'Ctrl+Alt+Del'
},
mouse: {
default: 'Standaard cursor',

View File

@@ -63,7 +63,8 @@ const pl = {
tips: 'Tylko standardowe klawiaturowe znaki i symbole są obsługiwane.',
placeholder: 'Proszę wprowadzić coś',
submit: 'Prześlij',
virtual: 'Klawiatura'
virtual: 'Klawiatura',
ctrlaltdel: 'Ctrl+Alt+Del'
},
mouse: {
default: 'Domyślny kursor',

View File

@@ -71,7 +71,8 @@ const ru = {
tips: 'Только стандартные буквы и символы клавиатуры поддерживаются',
placeholder: 'Пожалуйста, введите',
submit: 'подтверждать',
virtual: 'Клавиатура'
virtual: 'Клавиатура',
ctrlaltdel: 'Ctrl+Alt+Del'
},
mouse: {
default: 'Курсор по умолчанию',

View File

@@ -71,7 +71,8 @@ const uk = {
tips: 'Підтримуються лише стандартні літери та символи клавіатури',
placeholder: 'Будь ласка, введіть',
submit: 'Надіслати',
virtual: 'Клавіатура'
virtual: 'Клавіатура',
ctrlaltdel: 'Ctrl+Alt+Del'
},
mouse: {
default: 'Курсор за замовчуванням',

View File

@@ -70,7 +70,8 @@ const vi = {
tips: 'Chỉ hỗ trợ các chữ cái và ký hiệu bàn phím tiêu chuẩn',
placeholder: 'Vui lòng nhập',
submit: 'Gửi',
virtual: 'Bàn phím'
virtual: 'Bàn phím',
ctrlaltdel: 'Ctrl+Alt+Del'
},
mouse: {
default: 'Con trỏ mặc định',

View File

@@ -67,7 +67,8 @@ const zh = {
tips: '仅支持标准键盘的字母和符号',
placeholder: '请输入内容',
submit: '确定',
virtual: '虚拟键盘'
virtual: '虚拟键盘',
ctrlaltdel: 'Ctrl+Alt+Del'
},
mouse: {
default: '默认指针',

View File

@@ -67,7 +67,8 @@ const zh_tw = {
tips: '僅支援標準鍵盤字母和符號',
placeholder: '請輸入內容',
submit: '送出',
virtual: '虛擬鍵盤'
virtual: '虛擬鍵盤',
ctrlaltdel: 'Ctrl+Alt+Del'
},
mouse: {
default: '預設游標',

View File

@@ -0,0 +1,31 @@
import clsx from 'clsx';
import { useTranslation } from 'react-i18next';
import { OctagonMinus } from 'lucide-react';
import { KeyboardCodes, ModifierCodes } from '@/pages/desktop/keyboard/mappings.ts';
import { client } from '@/lib/websocket.ts';
export const CtrlAltDel = () => {
const { t } = useTranslation();
function sendCtrlAltDel() {
const ctrl = ModifierCodes.get('ControlLeft')!;
const alt = ModifierCodes.get('AltLeft')!;
const del = KeyboardCodes.get('Delete')!;
client.send([1, del, ctrl, 0, alt, 0]);
client.send([1, 0, 0, 0, 0, 0]);
};
return (
<div
className={clsx(
"flex cursor-pointer select-none items-center space-x-2 rounded py-1 pl-2 pr-5 hover:bg-neutral-700/70"
)}
onClick={sendCtrlAltDel}
>
<OctagonMinus size={18} />
<span>{t('keyboard.ctrlaltdel')}</span>
</div>
);
}

View File

@@ -4,6 +4,7 @@ import { KeyboardIcon } from 'lucide-react';
import { Paste } from './paste.tsx';
import { VirtualKeyboard } from './virtual-keyboard.tsx';
import { CtrlAltDel } from './ctrl-alt-del.tsx';
export const Keyboard = () => {
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
@@ -12,6 +13,7 @@ export const Keyboard = () => {
<>
<Paste setIsPopoverOpen={setIsPopoverOpen} />
<VirtualKeyboard />
<CtrlAltDel />
</>
);