feat: change to use Zsh

* show message from server response
* send output and error to server
This commit is contained in:
wancat committed 2023-08-08 20:38:27 +08:00
1 parent 0153eae673
commit 6204bd0b17
10 files changed
+96 -104

No files matched your search

@@ -7,6 +7,11 @@ export async function newCommand(req, res) {
console.log('new command:', req.body)
const { token, command, pwd, exit_code, output } = req.body
if (!command) {
res.status(400).json({ message: 'command is required' })
return
}
let sessionId
try {
const decoded = await verifySessionJWT(token)
@@ -33,5 +38,7 @@ export async function newCommand(req, res) {
await c.save()
res.status(201).end()
res.status(201).json({
responses: ['Hello, world!', 'How are you?'],
})
}
+1 -2
View File
@@ -11,7 +11,6 @@ const containerOptions = {
AttachStdout: true,
AttachStderr: true,
Tty: true,
Cmd: ['/bin/bash'],
OpenStdin: true,
StdinOnce: false,
HostConfig: {
@@ -59,7 +58,7 @@ export async function attachContainer(container, { token }) {
AttachStdin: true,
AttachStdout: true,
AttachStderr: true,
Cmd: ['/bin/bash'],
Cmd: ['/bin/zsh'],
Tty: true,
Env: [`TOKEN=${token}`, `API_ENDPOINT=http://app:3000`],
})
+5
View File
@@ -17,6 +17,11 @@ export default async function loadAndUpdateQuests() {
const quests = Promise.all(
questNames.map(async (id) => {
// Check if id is directory
const stat = await fs.stat(path.join(questDirectory, id))
if (!stat.isDirectory()) {
return null
}
const fullPath = path.join(questDirectory, id, 'README.md')
try {