Commit Graph
97 Commits
Author SHA1 Message Date
wancat 34d5ace664 feat: use minimist to refactor cli 2023-08-21 20:40:05 +08:00
wancat 6ace18475b refactor: move client to sperate packages, rename cli to container 2023-08-21 20:40:05 +08:00
wancat 41a12c9aa8 feat: collect 2 level files info when ls
* change cli dir to /usr/local/lib/cli
* refactor cli to multiple files
* add handleCommand and listeners pattern
2023-08-21 20:40:05 +08:00
Lin, Hung-Shin e6d6036cd0 Merge pull request #10 from lancatlin/app-terminal
Connect web terminal to server
2023-08-21 20:38:00 +08:00
wancat ed9b584093 fix: rename "reconnect" to "bindListeners" 2023-08-21 20:34:41 +08:00
wancat 4efce2c6b8 fix: remove cors 2023-08-21 20:27:44 +08:00
wancat 5d9951a3a2 refactor: use SocketWrapper to wrap the instance 2023-08-18 21:19:11 +08:00
wancat 313d30edda feat: add reset function 2023-08-17 21:17:48 +08:00
wancat e122800c81 feat: add sessionManagerto connect session 2023-08-17 20:21:32 +08:00
Annie Huang 5326fb30b4 try: manage session 2023-08-17 19:45:20 +08:00
Annie Huang 9b5b5571ef try to manage session 2023-08-17 19:45:20 +08:00
wancat 7fa5ab5bc6 Create a pty cli, not useful 2023-08-17 19:45:18 +08:00
Annie Huang 211b4e08e8 delete useless code 2023-08-17 19:43:55 +08:00
Annie Huang b66baa2070 try to merge from origin but seemed not working properly, it couldn't display message given from backend, and only able to connect to session while odyssey.wancat.cc 2023-08-17 19:43:55 +08:00
Annie Huang 6e0682881b fix 2023-08-17 19:43:55 +08:00
Annie Huang dee7e6975e fix 2023-08-17 19:43:55 +08:00
Annie Huang 19303aad90 fix 2023-08-17 19:43:55 +08:00
wancat a74233d7f9 feat: connect to localhost 2023-08-17 19:43:55 +08:00
Annie Huang 577352e51d connect to docker, trying to emit message 2023-08-17 19:43:55 +08:00
Annie Huang 0195305d0e tried several container id 2023-08-17 19:43:55 +08:00
Annie Huang 9b4335a628 changed WidgetTerminal to TerminalPart, add xterm attach but seemed not fit to use on http://localhost:3000 2023-08-17 19:43:55 +08:00
Lin, Hung-Shin d2daa5193a Merge pull request #7 from lancatlin/server-quest-helloworld
Game architecture design
2023-08-11 16:35:52 +08:00
wancat 0ba823b432 feat: print hints 2023-08-09 21:16:43 +08:00
wancat a151d2d667 feat: add type and color to response 2023-08-09 21:14:57 +08:00
wancat 5cad3ecc12 fix: mark progress to stage.next directly 2023-08-08 20:38:27 +08:00
wancat a73aa8b461 fix: prevent execute command twice 2023-08-08 20:38:27 +08:00
wancat 41a090ce73 doc: update README 2023-08-08 20:38:27 +08:00
wancat 6f368f761e feat: add hints to session, update API 2023-08-08 20:38:27 +08:00
wancat ae61bfc768 Update eslint rule 2023-08-08 20:38:27 +08:00
wancat 094332da53 feat: add commandHandler 2023-08-08 20:38:27 +08:00
wancat 0de4b6ac9d feat: design game file and parse it to mongo
* 取消用 README 來寫關卡說明
2023-08-08 20:38:27 +08:00
wancat 6204bd0b17 feat: change to use Zsh
* show message from server response
* send output and error to server
2023-08-08 20:38:27 +08:00
wancat 0153eae673 feat: new cli client to send and receive msg from api 2023-08-08 20:38:27 +08:00
wancat e2e585329f Create a pty cli, not useful 2023-08-08 20:38:27 +08:00
wancat 12a42d117c feat: write story of the game 2023-08-08 20:38:27 +08:00
Lin, Hung-Shin edfe197e51 Merge pull request #8 from lancatlin/hot-fix-server-socket
fix: send string
2023-08-08 20:37:08 +08:00
wancat 06ee53f194 fix: send string 2023-08-08 20:36:49 +08:00
Lin, Hung-Shin fb826c2f0e Merge pull request #6 from lancatlin/app-neil
Front-end update
2023-08-01 20:56:20 +08:00
wancat d26e68098a fix: use PascalCase 2023-08-01 20:54:49 +08:00
Chen, Tai-Lin 8b151c443d Revise variable names and file names 2023-08-01 20:54:49 +08:00
wancat 66cc1036b4 feat: use axios, extract api to another file 2023-08-01 20:54:49 +08:00
Chen, Tai-Lin a40e9eb3a9 Reorganize front-end code 2023-08-01 20:54:05 +08:00
Chen, Tai-Lin 06220e6b30 import fontawesome api 2023-08-01 20:54:05 +08:00
Chen, Tai-Lin 5e6cb7be37 fetch quest api 2023-08-01 20:54:05 +08:00
Lin, Hung-Shin b729e30e0b Merge pull request #5 from lancatlin/server-commands-api
Server commands api
2023-07-31 17:22:36 +08:00
wancat c3030b22be feat: add mongo init script, use root in app image 2023-07-31 17:19:03 +08:00
wancat ec90c484b4 feat: add parameters and subcommand to client.js
- Added `"commander": "^11.0.0"` as a dependency in the `package.json` file
- Added an `import { program } from 'commander'` statement in the `client.js` file
- Modified the `createdSession` function in the `client.js` file to use `program.opts().host` instead of `API_ENDPOINT`
- Added a `getSessionList` function in the `client.js` file to fetch the list of sessions
- Added a `lastSession` function in the `client.js` file to get the last session from the session list
- Added a `connect` function in the `client.js` file to establish a socket connection
- Modified the `main` function in the `client.js` file to use `program.opts().session` instead of `process.argv[2]` to get the session ID
- Modified the `main` function in the `client.js` file to use `program.opts().host` instead of `API_ENDPOINT` to initialize the socket connection
- Added a `program` object with options and actions in the `client.js` file
- Added `.bash_history` to the `.gitignore` file
- Added `.viminfo` to the `.gitignore` file
- Added `*.swp` to the `.gitignore` file

Signed-off-by: wancat <wancat@wancat.cc>
2023-07-31 15:42:58 +08:00
wancat b9643e7d5c feat: capture output and exit code of commands
+ ignore interactive commands like vim, top or nano
2023-07-27 17:56:32 +08:00
wancat d997a061a9 feat: send command typed in container to API
- Modify the Dockerfile in the `server/quests/helloworld` directory to add a user and change the working directory
- Rename the file `server/quests/helloworld/entrypoint.sh` to `server/quests/helloworld/home/.bashrc`
- Modify the `server/src/config.js` file to add the `isProduction` flag
- Modify the `server/src/utils/docker.js` file to add a `HostConfig` option and bind a directory if not in production mode
- Modify the Dockerfile to add an argument `DOCKER_GID` and create a group and user with the specified `DOCKER_GID`
- Add a new Dockerfile.dev file with the same modifications as the Dockerfile
- Add a new file `inspect.sh`
- Modify the `server/src/client.js` file to use the `API_ENDPOINT` variable instead of a hardcoded URL

Signed-off-by: wancat <wancat@wancat.cc>
2023-07-26 20:54:01 +08:00
wancat 9376e16f72 Success to send command to api
+ require sourcing entrypoint.sh manually
2023-07-26 00:12:10 +08:00