diff --git a/framework/framework/package.json b/framework/framework/package.json index e08bb0b7f..665bd3a9a 100644 --- a/framework/framework/package.json +++ b/framework/framework/package.json @@ -9,7 +9,7 @@ }, "dependencies": { "@hydrooj/utils": "workspace:^", - "@koa/router": "^15.1.0", + "@koa/router": "^15.1.1", "@mongodb-js/saslprep": "^1.4.4", "emoji-regex": "^10.6.0", "fs-extra": "^11.3.2", diff --git a/packages/hydrooj/src/handler/record.ts b/packages/hydrooj/src/handler/record.ts index 6543cb5e2..e23094270 100644 --- a/packages/hydrooj/src/handler/record.ts +++ b/packages/hydrooj/src/handler/record.ts @@ -190,12 +190,12 @@ export class RecordDetailHandler extends ContestDetailBaseHandler { canViewCode ||= this.user.hasPerm(PERM.PERM_READ_RECORD_CODE); canViewCode ||= this.user.hasPerm(PERM.PERM_READ_RECORD_CODE_ACCEPT) && self?.status === STATUS.STATUS_ACCEPTED; if (this.tdoc) { - const tsdoc = await contest.getStatus(domainId, this.tdoc.docId, this.user._id); + this.tsdoc = await contest.getStatus(domainId, this.tdoc.docId, this.user._id); canViewCode ||= this.user.own(this.tdoc); if (this.tdoc.allowViewCode && contest.isDone(this.tdoc)) { - canViewCode ||= tsdoc?.attend; + canViewCode ||= this.tsdoc?.attend; } - if (!tsdoc?.attend && pdoc && !problem.canViewBy(pdoc, this.user)) throw new PermissionError(PERM.PERM_VIEW_PROBLEM_HIDDEN); + if (!this.tsdoc?.attend && pdoc && !problem.canViewBy(pdoc, this.user)) throw new PermissionError(PERM.PERM_VIEW_PROBLEM_HIDDEN); } else if (pdoc && !problem.canViewBy(pdoc, this.user)) throw new PermissionError(PERM.PERM_VIEW_PROBLEM_HIDDEN); if (!canViewCode) { rdoc.code = ''; diff --git a/packages/hydrooj/src/service/server.ts b/packages/hydrooj/src/service/server.ts index 79159f924..db97e7a77 100644 --- a/packages/hydrooj/src/service/server.ts +++ b/packages/hydrooj/src/service/server.ts @@ -135,7 +135,7 @@ export async function apply(ctx: Context) { for (const kwargs of kwargsList) { for (const key in kwargs) { if (kwargs[key] instanceof ObjectId) args[key] = kwargs[key].toHexString(); - else args[key] = kwargs[key].toString().replace(/\//g, '%2F'); + else if (key !== 'query') args[key] = kwargs[key].toString().replace(/\//g, '%2F'); } for (const key in kwargs.query || {}) { if (query[key] instanceof ObjectId) query[key] = kwargs.query[key].toHexString(); @@ -153,6 +153,7 @@ export async function apply(ctx: Context) { ? (!host.includes(this.request.host)) : this.request.host !== host) )) withDomainId ||= domainId; + delete args.query; res = server.router.url(name, args, { query }).toString(); if (anchor) res = `${res}#${anchor}`; if (withDomainId) res = `/d/${withDomainId}${res}`; diff --git a/packages/ui-default/components/contest/contest.page.styl b/packages/ui-default/components/contest/contest.page.styl index 3a1229523..1d84da592 100644 --- a/packages/ui-default/components/contest/contest.page.styl +++ b/packages/ui-default/components/contest/contest.page.styl @@ -64,6 +64,9 @@ for key, value in $contest-color padding-bottom: 0.5rem; width: rem(180px); + +mobile() + display: none; + > a text-decoration: none; background-color: transparent; diff --git a/packages/ui-default/templates/problem_detail.html b/packages/ui-default/templates/problem_detail.html index d68c08486..30c2c9874 100644 --- a/packages/ui-default/templates/problem_detail.html +++ b/packages/ui-default/templates/problem_detail.html @@ -63,15 +63,16 @@ {% endif %} + {%- if not tdoc or tdoc.pids|length > 1 -%} {%- if tdoc -%} {{ utils.getAlphabeticId(tdoc.pids.indexOf(pdoc.docId)) }} {%- elif pdoc.pid and pdoc.pid.includes('-') -%} {{ pdoc.pid.split('-').join('#') }} {%- else -%} #{{ pdoc.pid|default(pdoc.docId) }} - {%- endif -%}. {{ pdoc.title }} + {%- endif -%}. {% endif %}{{ pdoc.title }} - {% if tdoc and tdoc.pids|length <= 26 %} + {% if tdoc and tdoc.pids|length <= 26 and tdoc.pids|length > 1 %}
{% for pid in tdoc.pids -%} {% set status = tsdoc.detail[pid].status %}