Skip to content
This repository has been archived by the owner on Jun 25, 2024. It is now read-only.

v3.10.4 (branch-v3.10) #176

Merged
merged 8 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=kael \

WORKDIR /opt

ARG WISP_VERSION=v0.1.17
ARG WISP_VERSION=v0.1.19
RUN set -ex \
&& wget https://github.com/jumpserver/wisp/releases/download/${WISP_VERSION}/wisp-${WISP_VERSION}-linux-${TARGETARCH}.tar.gz \
&& tar -xf wisp-${WISP_VERSION}-linux-${TARGETARCH}.tar.gz -C /usr/local/bin/ --strip-components=1 \
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ all: kael-ui
$(call make_artifact_full,darwin,arm64)
$(call make_artifact_full,linux,amd64)
$(call make_artifact_full,linux,arm64)
$(call make_artifact_full,linux,mips64le)
$(call make_artifact_full,linux,ppc64le)
$(call make_artifact_full,linux,s390x)
$(call make_artifact_full,linux,riscv64)
Expand All @@ -66,6 +67,9 @@ linux-arm64: kael-ui
linux-loong64: kael-ui
$(call make_artifact_full,linux,loong64)

linux-mips64le: kael-ui
$(call make_artifact_full,linux,mips64le)

linux-ppc64le: kael-ui
$(call make_artifact_full,linux,ppc64le)

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/gin-gonic/gin v1.9.1
github.com/google/uuid v1.4.0
github.com/gorilla/websocket v1.5.1
github.com/jumpserver/wisp v0.1.17
github.com/jumpserver/wisp v0.1.19
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible
github.com/sashabaranov/go-openai v1.17.9
github.com/spf13/viper v1.17.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ github.com/jonboulle/clockwork v0.4.0 h1:p4Cf1aMWXnXAUh8lVfewRBx1zaTSYKrKMF2g3ST
github.com/jonboulle/clockwork v0.4.0/go.mod h1:xgRqUGwRcjKCO1vbZUEtSLrqKoPSsUpK7fnezOII0kc=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/jumpserver/wisp v0.1.17 h1:i41iDwyz3MpCIIMEaNI43pKP5+lpzfqUSrVo3OnOq50=
github.com/jumpserver/wisp v0.1.17/go.mod h1:6EHU3fk0PJoDE+Qmj89YJrDb1K8HPcj/sowltmYbKVg=
github.com/jumpserver/wisp v0.1.19 h1:EEQLjgJApA6Le8CIAZF0ufuBQOnkDUybPAlYdz1dKxU=
github.com/jumpserver/wisp v0.1.19/go.mod h1:6EHU3fk0PJoDE+Qmj89YJrDb1K8HPcj/sowltmYbKVg=
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg=
github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
Expand Down
11 changes: 11 additions & 0 deletions pkg/jms/jms_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ func (jmss *JMSSession) ActiveSession() {
jmss.CommandHandler = NewCommandHandler(
jmss.Websocket, jmss.Session, jmss.CommandACLs, jmss.JMSState,
)
go jmss.SessionHandler.recordSessionLife(
jmss.Session,
protobuf.SessionLifecycleLogRequest_AssetConnectSuccess,
"",
)
go jmss.MaximumIdleTimeDetection()
go jmss.MaxSessionTimeDetection()
}
Expand Down Expand Up @@ -79,11 +84,17 @@ func (jmss *JMSSession) MaxSessionTimeDetection() {

func (jmss *JMSSession) Close(reason string) {
jmss.CurrentAskInterrupt = true
go jmss.SessionHandler.recordSessionLife(
jmss.Session,
protobuf.SessionLifecycleLogRequest_AssetConnectFinished,
"",
)
time.Sleep(1 * time.Second)
jmss.ReplayHandler.Upload()
jmss.SessionHandler.closeSession(jmss.Session)
GlobalSessionManager.UnregisterSession(jmss)
jmss.NotifyToClose(reason)

}

func (jmss *JMSSession) NotifyToClose(reason string) {
Expand Down
19 changes: 19 additions & 0 deletions pkg/jms/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,22 @@ func (sh *SessionHandler) closeSession(session *protobuf.Session) {
logger.GlobalLogger.Error(errorMessage)
}
}

func (sh *SessionHandler) recordSessionLife(
session *protobuf.Session,
event protobuf.SessionLifecycleLogRequest_EventType,
reason string,
) {
ctx := context.Background()
req := &protobuf.SessionLifecycleLogRequest{
SessionId: session.Id,
Event: event,
Reason: reason,
}

resp, _ := grpc.GlobalGrpcClient.Client.RecordSessionLifecycleLog(ctx, req)
if !resp.Status.Ok {
errorMessage := fmt.Sprintf("Failed to record session: %s", resp.Status.Err)
logger.GlobalLogger.Error(errorMessage)
}
}
7 changes: 6 additions & 1 deletion ui/src/utils/luna.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@ export const MESSAGES = {
PONG: 'PONG',
PING: 'PING',
CLOSE: 'CLOSE',
CONNECTED: 'CONNECTED'
CONNECTED: 'CONNECTED',
KEYBOARDEVENT: 'KEYBOARDEVENT'
}

export class LunaEvent {
constructor() {
this.init()
}

init() {
window.addEventListener('message',
this.handleEventFromLuna.bind(this),
Expand Down
3 changes: 3 additions & 0 deletions ui/src/views/chat/components/Footer/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
import { ref, computed, nextTick } from 'vue'
import { useChatStore } from '@/store'
import { useChat } from '../../hooks/useChat.js'
import { LunaEvent, MESSAGES } from '@/utils/luna'

const lunaEvent = new LunaEvent()
const chatStore = useChatStore()
const { setLoading, getInputFocus } = useChat()

Expand All @@ -29,6 +31,7 @@ const onStopHandle = () => {
}

const onKeyEnter = (event) => {
lunaEvent.sendEventToLuna(MESSAGES.KEYBOARDEVENT)
if (!isIM.value) {
if (event.key === 'Enter' && !event.shiftKey) {
event.preventDefault()
Expand Down
1 change: 0 additions & 1 deletion ui/src/views/chat/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const onSwitchSidebar = () => {
}

onMounted(() => {
lunaEvent.init()
if (isMobile()) {
isShowMobile.value = true
}
Expand Down