mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-05 19:20:12 +08:00
fix: remove order in game schema
This commit is contained in:
1 parent
f864cecfa4
commit
b4a37f7606
7 files changed
+45
-34
No files matched your search
+6
-1
@@ -5,7 +5,12 @@
|
|||||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Vite + Vue</title>
|
<title>Vite + Vue</title>
|
||||||
<script async defer data-domain="linuxodyssey.xyz" src="https://analytics.indie.tw/js/script.js"></script>
|
<script
|
||||||
|
async
|
||||||
|
defer
|
||||||
|
data-domain="linuxodyssey.xyz"
|
||||||
|
src="https://analytics.indie.tw/js/script.js"
|
||||||
|
></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
|||||||
+1
-1
@@ -34,7 +34,7 @@ services:
|
|||||||
- BASE_URL=http://localhost:5173
|
- BASE_URL=http://localhost:5173
|
||||||
- MONGO_URL=mongodb://db:27017/odyssey-test
|
- MONGO_URL=mongodb://db:27017/odyssey-test
|
||||||
- DOCKER_NETWORK=linux-odyssey-players
|
- DOCKER_NETWORK=linux-odyssey-players
|
||||||
- HOST_PWD=${PWD}
|
# - HOST_PWD=${PWD}
|
||||||
- GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_ID}
|
- GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_ID}
|
||||||
- GOOGLE_CLIENT_SECRET=${GOOGLE_CLIENT_SECRET}
|
- GOOGLE_CLIENT_SECRET=${GOOGLE_CLIENT_SECRET}
|
||||||
- GITHUB_CLIENT_ID=${GITHUB_CLIENT_ID}
|
- GITHUB_CLIENT_ID=${GITHUB_CLIENT_ID}
|
||||||
|
|||||||
+1
-1
@@ -30,7 +30,7 @@ COPY ./packages/container/package.json ./yarn.lock ./
|
|||||||
RUN yarn install --modules-folder /usr/src/node_modules
|
RUN yarn install --modules-folder /usr/src/node_modules
|
||||||
ENV NODE_PATH=/usr/src/node_modules
|
ENV NODE_PATH=/usr/src/node_modules
|
||||||
COPY ./packages/container /usr/local/lib/container
|
COPY ./packages/container /usr/local/lib/container
|
||||||
COPY ./quests/.includes/zshrc /etc/zshrc
|
COPY ./quests/.includes/zshrc /etc/zsh/zshrc
|
||||||
|
|
||||||
ENV USERNAME=commander
|
ENV USERNAME=commander
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
title: Hello, Linux World!
|
title: Hello, Linux World!
|
||||||
order: 1
|
|
||||||
instruction: |
|
instruction: |
|
||||||
你身在一個漆黑的房間裡,沒有任何的光線或聲音。你想不起來為什麼自己會來到這裡。但你的腦中隱約感到某個聲音跟你說:
|
你身在一個漆黑的房間裡,沒有任何的光線或聲音。你想不起來為什麼自己會來到這裡。但你的腦中隱約感到某個聲音跟你說:
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
title: Hello, Linux World!
|
title: Learn to spell
|
||||||
order: 2
|
|
||||||
instruction: |
|
instruction: |
|
||||||
你身在一個漆黑的房間裡,沒有任何的光線或聲音。你想不起來為什麼自己會來到這裡。但你的腦中隱約感到某個聲音跟你說:
|
你身在一個漆黑的房間裡,沒有任何的光線或聲音。你想不起來為什麼自己會來到這裡。但你的腦中隱約感到某個聲音跟你說:
|
||||||
|
|
||||||
「輸入 echo Hello World!」
|
「輸入 echo Hello World!」
|
||||||
|
|
||||||
|
conditions:
|
||||||
|
pwd_home: &pwd_home
|
||||||
|
pwd:
|
||||||
|
- '^/home/commander$'
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- id: helloworld
|
- id: helloworld
|
||||||
task: 使用 `echo Hello World!` 召喚精靈
|
task: 使用 `echo Hello World!` 召喚精靈
|
||||||
@@ -38,8 +42,7 @@ stages:
|
|||||||
requirements:
|
requirements:
|
||||||
- helloworld
|
- helloworld
|
||||||
condition:
|
condition:
|
||||||
pwd:
|
<<: *pwd_home
|
||||||
- '^/home/commander$'
|
|
||||||
command:
|
command:
|
||||||
- ls
|
- ls
|
||||||
responses:
|
responses:
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"watch": ["src", "swagger.yaml"],
|
"watch": ["src", "swagger.yaml", "../quests"],
|
||||||
"ext": "js,yaml"
|
"ext": "js,yaml"
|
||||||
}
|
}
|
||||||
+29
-25
@@ -10,35 +10,39 @@ export default async function loadAndUpdateQuests() {
|
|||||||
const questNames = await fs.readdir(questDirectory)
|
const questNames = await fs.readdir(questDirectory)
|
||||||
|
|
||||||
const quests = Promise.all(
|
const quests = Promise.all(
|
||||||
questNames.map(async (id) => {
|
questNames
|
||||||
// Check if id is directory
|
.filter((name) => !name.startsWith('.'))
|
||||||
const stat = await fs.stat(path.join(questDirectory, id))
|
.map(async (id) => {
|
||||||
if (!stat.isDirectory()) {
|
// Check if id is directory
|
||||||
return null
|
const stat = await fs.stat(path.join(questDirectory, id))
|
||||||
}
|
if (!stat.isDirectory()) {
|
||||||
const fullPath = path.join(questDirectory, id, 'game.yml')
|
return null
|
||||||
|
}
|
||||||
|
const fullPath = path.join(questDirectory, id, 'game.yml')
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Read and parse the README.md file.
|
// Read and parse the README.md file.
|
||||||
const body = await fs.readFile(fullPath, 'utf-8')
|
const body = await fs.readFile(fullPath, 'utf-8')
|
||||||
|
|
||||||
const quest = yaml.parse(body)
|
const quest = yaml.parse(body, {
|
||||||
|
merge: true,
|
||||||
|
})
|
||||||
|
|
||||||
return Quest.findByIdAndUpdate(
|
return Quest.findByIdAndUpdate(
|
||||||
id,
|
|
||||||
{
|
|
||||||
id,
|
id,
|
||||||
...quest,
|
{
|
||||||
},
|
id,
|
||||||
{
|
...quest,
|
||||||
upsert: true,
|
},
|
||||||
}
|
{
|
||||||
)
|
upsert: true,
|
||||||
} catch (error) {
|
}
|
||||||
console.error(`Error parsing quest ${id}:`, error)
|
)
|
||||||
throw error
|
} catch (error) {
|
||||||
}
|
console.error(`Error parsing quest ${id}:`, error)
|
||||||
})
|
throw error
|
||||||
|
}
|
||||||
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
return quests
|
return quests
|
||||||
|
|||||||
Reference in new issue
Block a user