update CHANGELOG.md and README.md

This commit is contained in:
XZB
2022-03-21 21:09:20 +08:00
parent 78df9e589a
commit e8053cb41d
6 changed files with 51 additions and 32 deletions

View File

@@ -6,6 +6,12 @@
* BREAKING-CHANGE: module `Device` has changed.
* THIS RELEASE IS **NOT** COMPATIBLE WITH LAST RELEASE.
* 新增网络IO速度监控。
* 新增:客户端自行升级。
* 修复在类Unix系统中使用terminal时中文乱码。
* 破坏性变动:`Device`类型已更改。
* 本版本**不**兼容上一版本,暂时仍需要手动升级客户端。
## v0.0.2
@@ -15,9 +21,15 @@
* BREAKING-CHANGE: module `Device` has changed.
* THIS RELEASE IS **NOT** COMPATIBLE WITH LAST RELEASE.
* 新增:网络延迟检测。
* 新增CPU使用率进度、内存使用进度、硬盘使用进度。
* 破坏性变动:`Device`类型已更改。
* 本版本**不**兼容上一版本,暂时仍需要手动升级客户端。
## v0.0.1
* First release.
*
* 这是第一个发行版。

View File

@@ -82,40 +82,40 @@
### 指南
```bash
# Clone this repository
# Clone该项目
$ git clone https://github.com/XZB-1248/Spark
$ cd ./Spark
# Here we're going to build front-end pages.
# 开始编译前端页面
$ cd ./web
# Install all dependencies and build.
# 安装所有的依赖,然后编译。
$ npm install
$ npm run build-prod
# Embed all static resources into one single file by using statik.
# 通过statik将前端文件嵌入到服务端里。
$ cd ..
$ go install github.com/rakyll/statik
$ statik -m -src="./web/dist" -f -dest="./server/embed" -p web -ns web
# Now we should build client.
$ mkdir ./built
# Use this when you're using windows.
$ ./build.client.bat
# When you're using unix-like OS, you can use this.
# 开始编译客户端。
# 在使用类Unix系统时运行以下命令。
$ go mod tidy
$ go mod download
$ ./build.client.sh
$ statik -m -src="./built" -f -dest="./server/embed" -include=* -p built -ns built
# Finally we're compiling the server side.
$ go build -ldflags "-s -w" -o Spark Spark/Server
# 最终开始编译服务端。
$ ./build.server.sh
```
然后打开`releases`目录,放入上文提到的配置文件,选择对应平台的服务端运行即可。
---
## 截图

View File

@@ -98,19 +98,21 @@ $ statik -m -src="./web/dist" -f -dest="./server/embed" -p web -ns web
# Now we should build client.
$ mkdir ./built
# Use this when you're using windows.
$ ./build.client.bat
# When you're using unix-like OS, you can use this.
$ go mod tidy
$ go mod download
$ ./build.client.sh
$ statik -m -src="./built" -f -dest="./server/embed" -include=* -p built -ns built
# Finally we're compiling the server side.
$ go build -ldflags "-s -w" -o Spark Spark/Server
$ ./build.server.sh
```
Then you can find executable files in `releases` directory.
Copy configuration file mentioned above into this dir, and then you can execute server.
---
## Screenshots

View File

@@ -183,11 +183,10 @@ func getTerminal() string {
if runtime.GOOS == `windows` {
return `cmd.exe`
}
sh := []string{`bash`, `zsh`, `sh`}
sh := []string{`/bin/bash`, `/bin/zsh`, `/bin/sh`}
for i := 0; i < len(sh); i++ {
f, err := os.Open(sh[i])
if err == nil {
f.Close()
_, err := os.Stat(sh[i])
if !errors.Is(err, os.ErrNotExist) {
return sh[i]
}
}

View File

@@ -146,6 +146,7 @@ func eventWrapper(terminal *terminal) common.EventCallback {
simpleSendPack(modules.Packet{Act: `warn`, Msg: msg}, terminal.session)
terminals.Remove(terminal.termUUID)
common.RemoveEvent(terminal.eventUUID)
terminal.session.Close()
}
return
}

View File

@@ -1,5 +1,5 @@
import React, {createRef} from "react";
import {Modal} from "antd";
import {message, Modal} from "antd";
import {Terminal} from "xterm";
import {WebLinksAddon} from "xterm-addon-web-links";
import {FitAddon} from "xterm-addon-fit";
@@ -160,15 +160,20 @@ class TerminalModal extends React.Component {
let data = this.decrypt(e.data);
try {
data = JSON.parse(data);
} catch (_) {
}
} catch (_) {}
if (this.conn) {
if (data?.act === 'outputTerminal') {
data = ab2str(hex2buf(data?.data?.output));
if (data === buffer) {
buffer = '';
return;
}
this.term.write(data);
return;
}
if (data?.act === 'warn') {
message.warn(data.msg??'未知错误');
}
}
}
this.ws.onclose = (e) => {
@@ -230,7 +235,7 @@ class TerminalModal extends React.Component {
if (this.conn) {
this.ws.close();
}
this.termEv.dispose();
this?.termEv?.dispose();
this.termEv = null;
} else {
if (this.props.visible) {