wancat 3cea54ce71 feat: add new API for recording executed commands
- Add the `jsonwebtoken` dependency to the server's `package.json`
- Add a new file `commandController.js` to the server's API controllers
- Add a new route `/commands` to the server's API routes
- Add a new file `commands.js` to the server's API routes
- Modify the `index.js` file in the server's API routes to import and use the `commands.js` route
- Add a `newCommand` function to the `commandController.js` file
- Add a `Command` model to the `command.js` file in the server's models
- Add the `genSessionJWT` and `verifySessionJWT` functions to the `auth.js` file in the server's utils
- Modify the `attachContainer` function in the `docker.js` file in the server's utils to include a `token` parameter
- Modify the `swagger.yaml` file to include a new route `/commands` for recording executed commands in a session

Signed-off-by: wancat <wancat@wancat.cc>
2023-07-24 16:39:04 +08:00
2023-07-15 15:30:42 +08:00
2023-07-19 15:30:36 +08:00
2023-07-20 17:05:01 +08:00
2023-07-21 11:27:01 +08:00
2023-07-20 17:05:01 +08:00

Linux Odyssey

Requirements

  • NodeJS
  • Docker
  • Yarn

Installation

git clone https://github.com/lancatlin/linux-odyssey.git
cd linux-odyssey
yarn install

Create database

docker compose up -d

Server

Source: server/

yarn server
# Open http://localhost:3000

App

Source: app/

yarn app
# Open http://localhost:5173/

CLI terminal client

Open server first, then create a session by POST /api/v1/sessions

curl -X 'POST' \
  'http://localhost:3000/api/v1/sessions' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "quest_id": "helloworld"
}'

Then use the _id field in response

yarn cli [_id]
# example
yarn cli 64be226a39c0043cd1cdf7c2
S
Description
No description provided
Readme GPL-3.0
8.1 MiB
0 Stars 1 Watchers 0 Forks
Languages
TypeScript 64%
Vue 24.2%
Go 4.2%
Shell 2.1%
Handlebars 2.1%
Other 3.3%