mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-05 19:20:12 +08:00
feat: disable quest locks when testing
This commit is contained in:
1 parent
c7fb0997b7
commit
3f8bcb5446
3 files changed
+4
-4
No files matched your search
@@ -1,3 +1,2 @@
|
|||||||
title: Read the File
|
title: 建立檔案與資料夾
|
||||||
instruction: |
|
instruction: |
|
||||||
閱讀檔案
|
|
||||||
+1
-1
@@ -3,8 +3,8 @@ quests:
|
|||||||
- cast
|
- cast
|
||||||
- discover
|
- discover
|
||||||
- read
|
- read
|
||||||
- create
|
|
||||||
- transport
|
- transport
|
||||||
|
- create
|
||||||
- copy
|
- copy
|
||||||
- move
|
- move
|
||||||
- remove
|
- remove
|
||||||
@@ -6,6 +6,7 @@ import {
|
|||||||
isQuestUnlocked,
|
isQuestUnlocked,
|
||||||
} from '../../models/sessionManager.js'
|
} from '../../models/sessionManager.js'
|
||||||
import { asyncHandler } from '../../middleware/error.js'
|
import { asyncHandler } from '../../middleware/error.js'
|
||||||
|
import config from '../../config.js'
|
||||||
|
|
||||||
function sessionSummary(session) {
|
function sessionSummary(session) {
|
||||||
return {
|
return {
|
||||||
@@ -65,7 +66,7 @@ export const getSessionById = asyncHandler(async (req, res) => {
|
|||||||
|
|
||||||
export const getOrCreateSession = asyncHandler(async (req, res) => {
|
export const getOrCreateSession = asyncHandler(async (req, res) => {
|
||||||
const { questId } = matchedData(req)
|
const { questId } = matchedData(req)
|
||||||
if (await isQuestUnlocked(req.user, questId)) {
|
if ((await isQuestUnlocked(req.user, questId)) || config.testing.enable) {
|
||||||
const session = await getOrCreateActiveSession(req.user, questId)
|
const session = await getOrCreateActiveSession(req.user, questId)
|
||||||
res.json(sessionDetail(session))
|
res.json(sessionDetail(session))
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in new issue
Block a user