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" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<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>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
+1
-1
@@ -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}
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
title: Hello, Linux World!
|
||||
order: 1
|
||||
instruction: |
|
||||
你身在一個漆黑的房間裡,沒有任何的光線或聲音。你想不起來為什麼自己會來到這裡。但你的腦中隱約感到某個聲音跟你說:
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"watch": ["src", "swagger.yaml"],
|
||||
"watch": ["src", "swagger.yaml", "../quests"],
|
||||
"ext": "js,yaml"
|
||||
}
|
||||
+29
-25
@@ -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
|
||||
|
||||
Reference in new issue
Block a user