Skip to content

Commit

Permalink
update CHANGELOG.md and README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
XZB-1248 committed Mar 22, 2022
1 parent 78df9e5 commit e8053cb
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 32 deletions.
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
*

* 这是第一个发行版。
26 changes: 13 additions & 13 deletions README.ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`目录,放入上文提到的配置文件,选择对应平台的服务端运行即可。

---

## 截图
Expand Down
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions client/service/terminal/terminal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
}
Expand Down
1 change: 1 addition & 0 deletions server/handler/terminal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
21 changes: 13 additions & 8 deletions web/src/components/terminal.js
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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) {
data = ab2str(hex2buf(data?.data?.output));
if (data === buffer) {
buffer = '';
if (data?.act === 'outputTerminal') {
data = ab2str(hex2buf(data?.data?.output));
if (data === buffer) {
buffer = '';
return;
}
this.term.write(data);
return;
}
this.term.write(data);
if (data?.act === 'warn') {
message.warn(data.msg??'未知错误');
}
}
}
this.ws.onclose = (e) => {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit e8053cb

Please sign in to comment.