修改拼写错误的单词 (#230)
* 优化图标和LOGO * 修改登录页面动画的速度为3 * 增加对websocket的异常处理 * 修复了用户组和用户名唯一判断错误的问题 * 提示版本号 * 修复readme错别字 * 修复单词拼写错误的问题 * 修复代码格式
This commit is contained in:
parent
11daa8bd4e
commit
aa3a6af4ea
@ -58,7 +58,7 @@ https://next.typesafe.cn/ 账号:test 密码:test
|
|||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Next Terminal 使用 [AGPL-3.0](./LICENSE) 开源协议,请自觉准守。
|
Next Terminal 使用 [AGPL-3.0](./LICENSE) 开源协议,请自觉遵守。
|
||||||
|
|
||||||
## 赞助支持
|
## 赞助支持
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ func (api SessionApi) SessionPagingEndpoint(c echo.Context) error {
|
|||||||
if status == constant.Disconnected && len(items[i].Recording) > 0 {
|
if status == constant.Disconnected && len(items[i].Recording) > 0 {
|
||||||
|
|
||||||
var recording string
|
var recording string
|
||||||
if items[i].Mode == constant.Naive || items[i].Mode == constant.Terminal {
|
if items[i].Mode == constant.Native || items[i].Mode == constant.Terminal {
|
||||||
recording = items[i].Recording
|
recording = items[i].Recording
|
||||||
} else {
|
} else {
|
||||||
recording = items[i].Recording + "/recording"
|
recording = items[i].Recording + "/recording"
|
||||||
@ -170,8 +170,8 @@ func (api SessionApi) SessionCreateEndpoint(c echo.Context) error {
|
|||||||
assetId := c.QueryParam("assetId")
|
assetId := c.QueryParam("assetId")
|
||||||
mode := c.QueryParam("mode")
|
mode := c.QueryParam("mode")
|
||||||
|
|
||||||
if mode == constant.Naive {
|
if mode == constant.Native {
|
||||||
mode = constant.Naive
|
mode = constant.Native
|
||||||
} else {
|
} else {
|
||||||
mode = constant.Guacd
|
mode = constant.Guacd
|
||||||
}
|
}
|
||||||
@ -526,7 +526,7 @@ func (api SessionApi) SessionRecordingEndpoint(c echo.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var recording string
|
var recording string
|
||||||
if s.Mode == constant.Naive || s.Mode == constant.Terminal {
|
if s.Mode == constant.Native || s.Mode == constant.Terminal {
|
||||||
recording = s.Recording
|
recording = s.Recording
|
||||||
} else {
|
} else {
|
||||||
recording = s.Recording + "/recording"
|
recording = s.Recording + "/recording"
|
||||||
|
@ -70,6 +70,14 @@ func (app App) InitDBData() (err error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 修复数据
|
||||||
|
if err := service.AssetService.FixSshMode(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := service.SessionService.FixSshMode(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ const (
|
|||||||
Disconnected = "disconnected" // 会话状态:已断开连接
|
Disconnected = "disconnected" // 会话状态:已断开连接
|
||||||
|
|
||||||
Guacd = "guacd" // 接入模式:guacd
|
Guacd = "guacd" // 接入模式:guacd
|
||||||
Naive = "naive" // 接入模式:原生
|
Native = "native" // 接入模式:原生
|
||||||
Terminal = "terminal" // 接入模式:终端
|
Terminal = "terminal" // 接入模式:终端
|
||||||
|
|
||||||
TypeUser = "user" // 普通用户
|
TypeUser = "user" // 普通用户
|
||||||
|
@ -345,3 +345,8 @@ func (r assetRepository) FindAssetAttrMapByAssetId(c context.Context, assetId st
|
|||||||
}
|
}
|
||||||
return attributeMap, nil
|
return attributeMap, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r assetRepository) UpdateAttrs(c context.Context, name, value, newValue string) error {
|
||||||
|
sql := "update asset_attributes set value = ? where name = ? and value = ?"
|
||||||
|
return r.GetDB(c).Exec(sql, newValue, name, value).Error
|
||||||
|
}
|
||||||
|
@ -168,3 +168,8 @@ func (r sessionRepository) FindAllUnReviewed(c context.Context) (o []model.Sessi
|
|||||||
err = r.GetDB(c).Where("reviewed = false or reviewed is null").Find(&o).Error
|
err = r.GetDB(c).Where("reviewed = false or reviewed is null").Find(&o).Error
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r sessionRepository) UpdateMode(c context.Context) error {
|
||||||
|
sql := "update sessions set mode = 'native' where mode = 'naive'"
|
||||||
|
return r.GetDB(c).Exec(sql).Error
|
||||||
|
}
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
"next-terminal/server/config"
|
"next-terminal/server/config"
|
||||||
|
"next-terminal/server/constant"
|
||||||
"next-terminal/server/env"
|
"next-terminal/server/env"
|
||||||
"next-terminal/server/model"
|
"next-terminal/server/model"
|
||||||
"next-terminal/server/repository"
|
"next-terminal/server/repository"
|
||||||
@ -260,3 +261,7 @@ func (s assetService) UpdateById(id string, m echo.Map) error {
|
|||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s assetService) FixSshMode() error {
|
||||||
|
return repository.AssetRepository.UpdateAttrs(context.TODO(), "ssh-mode", "naive", constant.Native)
|
||||||
|
}
|
||||||
|
@ -118,7 +118,7 @@ func (service sessionService) WriteCloseMessage(ws *websocket.Conn, mode string,
|
|||||||
disconnect := guacd.NewInstruction("disconnect")
|
disconnect := guacd.NewInstruction("disconnect")
|
||||||
_ = ws.WriteMessage(websocket.TextMessage, []byte(disconnect.String()))
|
_ = ws.WriteMessage(websocket.TextMessage, []byte(disconnect.String()))
|
||||||
}
|
}
|
||||||
case constant.Naive:
|
case constant.Native:
|
||||||
if ws != nil {
|
if ws != nil {
|
||||||
msg := `0` + reason
|
msg := `0` + reason
|
||||||
_ = ws.WriteMessage(websocket.TextMessage, []byte(msg))
|
_ = ws.WriteMessage(websocket.TextMessage, []byte(msg))
|
||||||
@ -354,3 +354,7 @@ func (service sessionService) Create(clientIp, assetId, mode string, user *model
|
|||||||
}
|
}
|
||||||
return s, nil
|
return s, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (service sessionService) FixSshMode() error {
|
||||||
|
return repository.SessionRepository.UpdateMode(context.TODO())
|
||||||
|
}
|
||||||
|
@ -8,6 +8,6 @@ export const PROTOCOL_COLORS = {
|
|||||||
|
|
||||||
export const MODE_COLORS = {
|
export const MODE_COLORS = {
|
||||||
'guacd': 'green',
|
'guacd': 'green',
|
||||||
'naive': 'orange',
|
'native': 'orange',
|
||||||
'terminal': 'purple',
|
'terminal': 'purple',
|
||||||
}
|
}
|
@ -124,7 +124,7 @@ class BatchCommandTerm extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async createSession(assetsId) {
|
async createSession(assetsId) {
|
||||||
let result = await request.post(`/sessions?assetId=${assetsId}&mode=naive`);
|
let result = await request.post(`/sessions?assetId=${assetsId}&mode=native`);
|
||||||
if (result['code'] !== 1) {
|
if (result['code'] !== 1) {
|
||||||
this.showMessage(result['message']);
|
this.showMessage(result['message']);
|
||||||
return null;
|
return null;
|
||||||
|
@ -210,7 +210,7 @@ class Term extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async createSession(assetsId) {
|
async createSession(assetsId) {
|
||||||
let result = await request.post(`/sessions?assetId=${assetsId}&mode=naive`);
|
let result = await request.post(`/sessions?assetId=${assetsId}&mode=native`);
|
||||||
if (result['code'] !== 1) {
|
if (result['code'] !== 1) {
|
||||||
this.showMessage(result['message']);
|
this.showMessage(result['message']);
|
||||||
return undefined;
|
return undefined;
|
||||||
|
@ -558,7 +558,7 @@ class Asset extends Component {
|
|||||||
const name = record['name'];
|
const name = record['name'];
|
||||||
const sshMode = record['sshMode'];
|
const sshMode = record['sshMode'];
|
||||||
let url = '';
|
let url = '';
|
||||||
if (protocol === 'ssh' && sshMode === 'naive') {
|
if (protocol === 'ssh' && sshMode === 'native') {
|
||||||
url = `#/term?assetId=${id}&assetName=${name}`;
|
url = `#/term?assetId=${id}&assetName=${name}`;
|
||||||
} else {
|
} else {
|
||||||
url = `#/access?assetId=${id}&assetName=${name}&protocol=${protocol}`;
|
url = `#/access?assetId=${id}&assetName=${name}&protocol=${protocol}`;
|
||||||
|
@ -456,7 +456,7 @@ Windows需要对远程应用程序的名称使用特殊的符号。
|
|||||||
setSshMode(value)
|
setSshMode(value)
|
||||||
}}>
|
}}>
|
||||||
<Option value="">guacd</Option>
|
<Option value="">guacd</Option>
|
||||||
<Option value="naive">原生</Option>
|
<Option value="native">原生</Option>
|
||||||
</Select>
|
</Select>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Panel>
|
</Panel>
|
||||||
|
@ -280,7 +280,7 @@ class MyAsset extends Component {
|
|||||||
const name = item['name'];
|
const name = item['name'];
|
||||||
const sshMode = item['sshMode'];
|
const sshMode = item['sshMode'];
|
||||||
let url = '';
|
let url = '';
|
||||||
if (protocol === 'ssh' && sshMode === 'naive') {
|
if (protocol === 'ssh' && sshMode === 'native') {
|
||||||
url = `#/term?assetId=${id}&assetName=${name}`;
|
url = `#/term?assetId=${id}&assetName=${name}`;
|
||||||
} else {
|
} else {
|
||||||
url = `#/access?assetId=${id}&assetName=${name}&protocol=${protocol}`;
|
url = `#/access?assetId=${id}&assetName=${name}&protocol=${protocol}`;
|
||||||
|
@ -654,7 +654,7 @@ class OfflineSession extends Component {
|
|||||||
maskClosable={false}
|
maskClosable={false}
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
this.state.selectedRow['mode'] === 'naive' || this.state.selectedRow['mode'] === 'terminal' ?
|
this.state.selectedRow['mode'] === 'native' || this.state.selectedRow['mode'] === 'terminal' ?
|
||||||
<iframe
|
<iframe
|
||||||
title='recording'
|
title='recording'
|
||||||
style={{
|
style={{
|
||||||
|
Loading…
Reference in New Issue
Block a user