update web README.md

This commit is contained in:
wj-xiao
2024-08-26 16:16:18 +08:00
parent 9c336dbda4
commit ef84874b99
2 changed files with 65 additions and 1 deletions

View File

@@ -20,6 +20,39 @@ src
└── types // types
```
## Development
Here are some steps you can follow to develop based on your needs:
- Log in to NanoKVM via SSH: `ssh root@your-nanokvm-ip` (default password is root);
- Stop the current service: `killall NanoKVM-Server`.
1. Build the frontend project: `pnpm build`;
2. Remove the files in NanoKVM: `rm -rf /kvmapp/server/web`;
3. Upload the new files: `scp -r dist root@your-nanokvm-ip:/kvmapp/server/web`;
4. Start the service: `/kvmapp/server/NanoKVM-Server`.
Then, refresh the page in the browser to see the changes.
### Configuration
**Note: Do not enable these settings in production environment unless you fully understand their purpose!**
In development mode, you can edit the configuration file `/etc/kvm/server.yaml` for easier development:
- Add `log: debug` to print service logs. This option may cause service slowdowns, so avoid using it in production.
- Add `authentication: disable` to disable all authentication, so don't need to log in again after restarting the service. This option should not be enabled in production!
### Browser
It's recommended to disable browser caching to avoid access issues during development:
1. Open the browser Developer Tools;
2. Go to the `Network` tab;
3. Check `Disable cache` option;
4. Refresh the page.
## Deployment
Build:

View File

@@ -20,6 +20,38 @@ src
└── types // 类型定义
```
## 开发
这里给出一些参考,你可以根据自己的情况来开发。
- 首先通过 ssh 登录到 NanoKVM`ssh root@your-nanokvm-ip`(默认密码为 root
- 停止当前服务:`killall NanoKVM-Server`
1. 编译前端项目:`pnpm build`
2. 删除 NanoKVM 中前端文件:`rm -rf /kvmapp/server/web`
3. 重新上传前端文件:`scp -r dist root@your-nanokvm-ip:/kvmapp/server/web`
4. 启动服务:`/kvmapp/server/NanoKVM-Server`
最后,在浏览器中刷新页面即可。
### 配置文件
**注意:请勿在生产环境中开启这些配置项!除非你了解每个配置的用途。**
在开发模式下,为了更方便的开发,可以修改配置文件 `/etc/kvm/server.yaml`
- 添加 `log: debug`,会打印服务日志。该选项可能导致服务卡顿,生产环境中请勿开启。
- 添加 `authentication: disable`,会禁用所有鉴权,服务重启后也不再需要重新登录。生产环境请勿开启该选项!
### 浏览器设置
建议在浏览器中禁用缓存,防止在开发过程中出现无法访问的情况。
1. 打开开发者工具;
2. 点击 `Network` 选项卡;
3. 勾选 `Disable cache` 选项;
4. 刷新页面。
## 部署
编译:
@@ -37,4 +69,3 @@ pnpm build
注意:更新 web 目录后,浏览器可能会有缓存。如果遇到打不开页面的情况,请强制刷新或清空缓存。