mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
fix: socket & terminal states across quests
This commit is contained in:
1 parent
3398d18055
commit
94ef3749f5
2 files changed
+4
No files matched your search
@@ -8,6 +8,7 @@ import { Session, StageResponse } from '../types'
|
||||
|
||||
const socket = new Socket()
|
||||
const term = new SocketTerminal(40, 80)
|
||||
let hasSetup = false
|
||||
|
||||
interface Store {
|
||||
session: Session | null
|
||||
@@ -65,6 +66,7 @@ const useSession = defineStore('session', {
|
||||
this.$reset()
|
||||
},
|
||||
setup() {
|
||||
if (hasSetup) return
|
||||
socket.on('terminal', (data: string) => {
|
||||
term.write(data)
|
||||
})
|
||||
@@ -77,6 +79,7 @@ const useSession = defineStore('session', {
|
||||
socket.on('response', (response: StageResponse) => {
|
||||
this.newResponse(response)
|
||||
})
|
||||
hasSetup = true
|
||||
},
|
||||
setStatus(status: string) {
|
||||
if (!this.session) return
|
||||
|
||||
Reference in new issue
Block a user