core: limit export contest code

This commit is contained in:
undefined committed 2021-06-30 17:59:08 +08:00
1 parent 3761a5c77d
commit c2cef76663
4 files changed
+10 -5

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "hydrooj", "name": "hydrooj",
"version": "2.29.8", "version": "2.29.9",
"bin": "bin/hydrooj.js", "bin": "bin/hydrooj.js",
"main": "dist/loader.js", "main": "dist/loader.js",
"typings": "dist/loader.d.ts", "typings": "dist/loader.d.ts",
+3
View File
@@ -382,6 +382,9 @@ export class ContestCodeHandler extends Handler {
} }
await this.limitRate('homework_code', 3600, 60); await this.limitRate('homework_code', 3600, 60);
const [tdoc, tsdocs] = await contest.getAndListStatus(domainId, tid); const [tdoc, tsdocs] = await contest.getAndListStatus(domainId, tid);
if (!contest.canShowRecord.call(this, tdoc as any, true)) {
throw new PermissionError(PERM.PERM_VIEW_CONTEST_HIDDEN_SCOREBOARD);
}
const rnames = {}; const rnames = {};
for (const tsdoc of tsdocs) { for (const tsdoc of tsdocs) {
for (const pid in tsdoc.detail || {}) { for (const pid in tsdoc.detail || {}) {
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@hydrooj/ui-default", "name": "@hydrooj/ui-default",
"version": "4.12.2", "version": "4.12.3",
"author": "undefined <i@undefined.moe>", "author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"main": "hydro.js", "main": "hydro.js",
@@ -58,9 +58,11 @@
</a></li> </a></li>
{% endif %} {% endif %}
{% if handler.user.hasPriv(PRIV.PRIV_READ_RECORD_CODE) or handler.user.hasPerm(perm.PERM_READ_RECORD_CODE) %} {% if handler.user.hasPriv(PRIV.PRIV_READ_RECORD_CODE) or handler.user.hasPerm(perm.PERM_READ_RECORD_CODE) %}
<li class="menu__item"><a class="menu__link" href="{{ url('contest_code', tid=tdoc.docId) }}"> {% if model.contest.canShowRecord.call(handler, tdoc, true) %}
<span class="icon icon-download"></span> {{ _('Export All Code') }} <li class="menu__item"><a class="menu__link" href="{{ url('contest_code', tid=tdoc.docId) }}">
</a></li> <span class="icon icon-download"></span> {{ _('Export All Code') }}
</a></li>
{% endif %}
{% endif %} {% endif %}
<li class="menu__item"><a class="menu__link" href="{{ url('record_main', query={tid:tdoc.docId}) }}"> <li class="menu__item"><a class="menu__link" href="{{ url('record_main', query={tid:tdoc.docId}) }}">
<span class="icon icon-flag"></span> {{ _('All Submissions') }} <span class="icon icon-flag"></span> {{ _('All Submissions') }}