mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 11:30:13 +08:00
feat: connect terminal service to backend
feat: put terminal service into container refactor: separate main into terminal and websocket feat: create zsh using commander in home feat: pass backendUrl to container feat: pass token to ws server to cmd-hook feat: gen terminal access token for frontend feat: success to connect through traefik fix: handle invalid jwt feat: connect to session container via traefik
This commit is contained in:
1 parent
0b08a9a5d9
commit
5e81db2759
20 files changed
+281
-209
No files matched your search
@@ -6,10 +6,11 @@ import { createNewSession, isQuestUnlocked } from '../models/sessionManager.js'
|
||||
import config from '../config.js'
|
||||
import { protectedProcedure, router } from '../trpc.js'
|
||||
import { questManager } from '../models/quest.js'
|
||||
import { genJWT } from '../utils/auth'
|
||||
|
||||
export type SessionDetail = Awaited<ReturnType<typeof sessionDetail>>
|
||||
|
||||
function sessionDetail(session: ISession) {
|
||||
async function sessionDetail(session: ISession) {
|
||||
const quest = questManager.get(session.quest)
|
||||
if (!quest) {
|
||||
throw new TRPCError({
|
||||
@@ -22,6 +23,10 @@ function sessionDetail(session: ISession) {
|
||||
quest,
|
||||
new VoidFileExistenceChecker()
|
||||
)
|
||||
const token = await genJWT({
|
||||
sessionId: session._id.toString(),
|
||||
})
|
||||
|
||||
return {
|
||||
_id: session._id.toString(),
|
||||
user: session.user.toString(),
|
||||
@@ -33,6 +38,7 @@ function sessionDetail(session: ISession) {
|
||||
responses: gameSession.getResponses(),
|
||||
tasks: gameSession.getTasks(),
|
||||
graph: gameSession.getGraph(),
|
||||
token,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user