diff --git a/app/index.html b/app/index.html
index 6cf91bd..0ff4559 100644
--- a/app/index.html
+++ b/app/index.html
@@ -5,7 +5,12 @@
Vite + Vue
-
+
diff --git a/docker-compose.yml b/docker-compose.yml
index a6483c9..edfe197a 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -34,7 +34,7 @@ services:
- BASE_URL=http://localhost:5173
- MONGO_URL=mongodb://db:27017/odyssey-test
- DOCKER_NETWORK=linux-odyssey-players
- - HOST_PWD=${PWD}
+ # - HOST_PWD=${PWD}
- GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_ID}
- GOOGLE_CLIENT_SECRET=${GOOGLE_CLIENT_SECRET}
- GITHUB_CLIENT_ID=${GITHUB_CLIENT_ID}
diff --git a/quests/Dockerfile b/quests/Dockerfile
index 10571f8..9eeb5ae 100644
--- a/quests/Dockerfile
+++ b/quests/Dockerfile
@@ -30,7 +30,7 @@ COPY ./packages/container/package.json ./yarn.lock ./
RUN yarn install --modules-folder /usr/src/node_modules
ENV NODE_PATH=/usr/src/node_modules
COPY ./packages/container /usr/local/lib/container
-COPY ./quests/.includes/zshrc /etc/zshrc
+COPY ./quests/.includes/zshrc /etc/zsh/zshrc
ENV USERNAME=commander
diff --git a/quests/helloworld/game.yml b/quests/helloworld/game.yml
index c9e7fb7..c223747 100644
--- a/quests/helloworld/game.yml
+++ b/quests/helloworld/game.yml
@@ -1,5 +1,4 @@
title: Hello, Linux World!
-order: 1
instruction: |
你身在一個漆黑的房間裡,沒有任何的光線或聲音。你想不起來為什麼自己會來到這裡。但你的腦中隱約感到某個聲音跟你說:
diff --git a/quests/spell/game.yml b/quests/spell/game.yml
index 2a4fc41..83c0d30 100644
--- a/quests/spell/game.yml
+++ b/quests/spell/game.yml
@@ -1,10 +1,14 @@
-title: Hello, Linux World!
-order: 2
+title: Learn to spell
instruction: |
你身在一個漆黑的房間裡,沒有任何的光線或聲音。你想不起來為什麼自己會來到這裡。但你的腦中隱約感到某個聲音跟你說:
「輸入 echo Hello World!」
+conditions:
+ pwd_home: &pwd_home
+ pwd:
+ - '^/home/commander$'
+
stages:
- id: helloworld
task: 使用 `echo Hello World!` 召喚精靈
@@ -38,8 +42,7 @@ stages:
requirements:
- helloworld
condition:
- pwd:
- - '^/home/commander$'
+ <<: *pwd_home
command:
- ls
responses:
diff --git a/server/nodemon.json b/server/nodemon.json
index cc2ba22..7544261 100644
--- a/server/nodemon.json
+++ b/server/nodemon.json
@@ -1,4 +1,4 @@
{
- "watch": ["src", "swagger.yaml"],
+ "watch": ["src", "swagger.yaml", "../quests"],
"ext": "js,yaml"
}
diff --git a/server/src/utils/quest.js b/server/src/utils/quest.js
index 58d4c00..61866b0 100644
--- a/server/src/utils/quest.js
+++ b/server/src/utils/quest.js
@@ -10,35 +10,39 @@ export default async function loadAndUpdateQuests() {
const questNames = await fs.readdir(questDirectory)
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, 'game.yml')
+ questNames
+ .filter((name) => !name.startsWith('.'))
+ .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, 'game.yml')
- try {
- // Read and parse the README.md file.
- const body = await fs.readFile(fullPath, 'utf-8')
+ try {
+ // Read and parse the README.md file.
+ const body = await fs.readFile(fullPath, 'utf-8')
- const quest = yaml.parse(body)
+ const quest = yaml.parse(body, {
+ merge: true,
+ })
- return Quest.findByIdAndUpdate(
- id,
- {
+ return Quest.findByIdAndUpdate(
id,
- ...quest,
- },
- {
- upsert: true,
- }
- )
- } catch (error) {
- console.error(`Error parsing quest ${id}:`, error)
- throw error
- }
- })
+ {
+ id,
+ ...quest,
+ },
+ {
+ upsert: true,
+ }
+ )
+ } catch (error) {
+ console.error(`Error parsing quest ${id}:`, error)
+ throw error
+ }
+ })
)
return quests