Compare commits
2 Commits
dd6a6a04eb
...
d3365ecb32
| Author | SHA1 | Date | |
|---|---|---|---|
| d3365ecb32 | |||
| 75dd9bfa42 |
9
.github/workflows/deploy.yml
vendored
9
.github/workflows/deploy.yml
vendored
@@ -39,14 +39,17 @@ jobs:
|
|||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v7
|
||||||
|
|
||||||
- uses: oven-sh/setup-bun@v2
|
- uses: oven-sh/setup-bun@v2
|
||||||
with:
|
with:
|
||||||
bun-version: latest
|
bun-version: latest
|
||||||
|
|
||||||
# 依赖装到 ~/.bun/install/cache,命中的话 install 只剩几秒
|
# 依赖装到 ~/.bun/install/cache,命中的话 install 只剩几秒。
|
||||||
- uses: actions/cache@v4
|
# v6 起跑在 node24 上(v4 还是 node20,GitHub 正在退役 node20 runtime),
|
||||||
|
# 和上面两个 action 一致。v5+ 要求 runner >= 2.327.1,ubuntu-latest 是
|
||||||
|
# GitHub 托管的、始终满足;换自建 runner 的话要留意这条。
|
||||||
|
- uses: actions/cache@v6
|
||||||
with:
|
with:
|
||||||
path: ~/.bun/install/cache
|
path: ~/.bun/install/cache
|
||||||
key: bun-${{ runner.os }}-${{ hashFiles('bun.lock') }}
|
key: bun-${{ runner.os }}-${{ hashFiles('bun.lock') }}
|
||||||
|
|||||||
@@ -413,6 +413,8 @@ async function submissionDetail(id: string, user: AuthUser) {
|
|||||||
// 首轮修复只处理了 info 与 ip,这里补齐。
|
// 首轮修复只处理了 info 与 ip,这里补齐。
|
||||||
contestId: full ? row.submission.contestId : null,
|
contestId: full ? row.submission.contestId : null,
|
||||||
problemId: row.submission.problemId,
|
problemId: row.submission.problemId,
|
||||||
|
// problem 表本来就 join 了,不额外查库
|
||||||
|
problemDisplayId: row.problem.displayId,
|
||||||
showLink: true,
|
showLink: true,
|
||||||
canUnshare: canViewSubmission(user, row.submission, row.problem, row.contest, false),
|
canUnshare: canViewSubmission(user, row.submission, row.problem, row.contest, false),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -78,10 +78,13 @@ function copyToCat() {
|
|||||||
|
|
||||||
function copyToProblem() {
|
function copyToProblem() {
|
||||||
const { code, language, contestId } = submission.value!
|
const { code, language, contestId } = submission.value!
|
||||||
// 编辑器的 storageKey 用 display id(problem._id),等于 props.problemID,
|
// 编辑器的 storageKey 用 display id(problem._id),不是 submission.problemId
|
||||||
// 而非 submission.problem(内部数字 id)
|
// (内部数字 id)。**不能只靠 props.problemID** —— 独立的 /submission/:id 路由
|
||||||
|
// 只喂 submissionID,那个 prop 是 undefined,原来会一路带进 router.push 抛
|
||||||
|
// `Missing required param "problemID"`。响应里的 problemDisplayId 就是干这个的。
|
||||||
|
const problemID = props.problemID ?? submission.value!.problemDisplayId
|
||||||
const contestIDForKey = contestId || null
|
const contestIDForKey = contestId || null
|
||||||
const storageKey = `problem_${props.problemID}_contest_${contestIDForKey}_lang_${language}`
|
const storageKey = `problem_${problemID}_contest_${contestIDForKey}_lang_${language}`
|
||||||
storage.set(storageKey, code)
|
storage.set(storageKey, code)
|
||||||
// 设置语言 + 代码:localStorage 覆盖全新挂载的编辑器,
|
// 设置语言 + 代码:localStorage 覆盖全新挂载的编辑器,
|
||||||
// setCode 覆盖已挂载(同页 modal)的编辑器
|
// setCode 覆盖已挂载(同页 modal)的编辑器
|
||||||
@@ -92,17 +95,17 @@ function copyToProblem() {
|
|||||||
if (contestId) {
|
if (contestId) {
|
||||||
router.push({
|
router.push({
|
||||||
name: "contest problem",
|
name: "contest problem",
|
||||||
params: { contestID: String(contestId), problemID: props.problemID },
|
params: { contestID: String(contestId), problemID },
|
||||||
})
|
})
|
||||||
} else if (problemSetId) {
|
} else if (problemSetId) {
|
||||||
router.push({
|
router.push({
|
||||||
name: "problemset problem",
|
name: "problemset problem",
|
||||||
params: { problemSetId, problemID: props.problemID },
|
params: { problemSetId, problemID },
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
router.push({
|
router.push({
|
||||||
name: "problem",
|
name: "problem",
|
||||||
params: { problemID: props.problemID },
|
params: { problemID },
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,13 @@ export const submissionDetailSchema = z.object({
|
|||||||
ip: z.string().nullable(),
|
ip: z.string().nullable(),
|
||||||
contestId: z.number().int().nullable(),
|
contestId: z.number().int().nullable(),
|
||||||
problemId: z.number().int(),
|
problemId: z.number().int(),
|
||||||
|
/**
|
||||||
|
* 题目的展示编号(problem._id)。**独立的 /submission/:id 页面要靠它** ——
|
||||||
|
* 那条路由只喂 submissionID,组件拿不到 display id,而「复制回到题目」要用它
|
||||||
|
* 拼路由。原来只给内部数字 id,于是那个按钮在这条路由上一点就抛
|
||||||
|
* `Missing required param "problemID"`。
|
||||||
|
*/
|
||||||
|
problemDisplayId: z.string(),
|
||||||
showLink: z.boolean(),
|
showLink: z.boolean(),
|
||||||
canUnshare: z.boolean(),
|
canUnshare: z.boolean(),
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user