mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: cross-domain file id
This commit is contained in:
1 parent
a988445597
commit
bf4d0d6fdd
4 files changed
+6
-4
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "3.1.6",
|
"version": "3.1.7",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "src/loader",
|
"main": "src/loader",
|
||||||
"module": "src/loader",
|
"module": "src/loader",
|
||||||
|
|||||||
@@ -444,6 +444,7 @@ export class ProblemFilesHandler extends ProblemDetailHandler {
|
|||||||
if (type === 'testdata' && !this.user.own(this.pdoc)) {
|
if (type === 'testdata' && !this.user.own(this.pdoc)) {
|
||||||
if (!this.user.hasPriv(PRIV.PRIV_READ_PROBLEM_DATA)) this.checkPerm(PERM.PERM_READ_PROBLEM_DATA);
|
if (!this.user.hasPriv(PRIV.PRIV_READ_PROBLEM_DATA)) this.checkPerm(PERM.PERM_READ_PROBLEM_DATA);
|
||||||
}
|
}
|
||||||
|
if (this.pdoc.reference) this.pdoc = await problem.get(this.pdoc.reference.domainId, this.pdoc.reference.pid);
|
||||||
const links = {};
|
const links = {};
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
// eslint-disable-next-line no-await-in-loop
|
// eslint-disable-next-line no-await-in-loop
|
||||||
@@ -536,7 +537,7 @@ export class ProblemFileDownloadHandler extends ProblemDetailHandler {
|
|||||||
if (type === 'testdata' && !this.user.own(this.pdoc)) {
|
if (type === 'testdata' && !this.user.own(this.pdoc)) {
|
||||||
if (!this.user.hasPriv(PRIV.PRIV_READ_PROBLEM_DATA)) this.checkPerm(PERM.PERM_READ_PROBLEM_DATA);
|
if (!this.user.hasPriv(PRIV.PRIV_READ_PROBLEM_DATA)) this.checkPerm(PERM.PERM_READ_PROBLEM_DATA);
|
||||||
}
|
}
|
||||||
const target = `problem/${domainId}/${this.pdoc.docId}/${type}/${filename}`;
|
const target = `problem/${this.pdoc.domainId}/${this.pdoc.docId}/${type}/${filename}`;
|
||||||
const file = await storage.getMeta(target);
|
const file = await storage.getMeta(target);
|
||||||
if (!file) {
|
if (!file) {
|
||||||
this.response.redirect = await storage.signDownloadLink(
|
this.response.redirect = await storage.signDownloadLink(
|
||||||
|
|||||||
@@ -245,7 +245,9 @@ const oi: ContestRule = {
|
|||||||
for (const pid of tdoc.pids) {
|
for (const pid of tdoc.pids) {
|
||||||
const index = `${tsdoc.uid}/${tdoc.domainId}/${pid}`;
|
const index = `${tsdoc.uid}/${tdoc.domainId}/${pid}`;
|
||||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||||
const node: ScoreboardNode = (!isExport && isDone(tdoc) && tsddict[pid]?.rid?.toHexString() !== psdict[index]?.rid?.toHexString())
|
const node: ScoreboardNode = (!isExport && isDone(tdoc)
|
||||||
|
&& psdict[index]?.rid
|
||||||
|
&& tsddict[pid]?.rid?.toHexString() !== psdict[index]?.rid?.toHexString())
|
||||||
? {
|
? {
|
||||||
type: 'records',
|
type: 'records',
|
||||||
value: '',
|
value: '',
|
||||||
|
|||||||
@@ -311,7 +311,6 @@ async function discussionNode(src: Db, report: Function) {
|
|||||||
function addSpace(content: string) {
|
function addSpace(content: string) {
|
||||||
const lines = content.split('\r\n');
|
const lines = content.split('\r\n');
|
||||||
for (let i = 0; i < lines.length; i++) {
|
for (let i = 0; i < lines.length; i++) {
|
||||||
// eslint-disable-next-line no-continue
|
|
||||||
if (lines[i].endsWith('|')) continue; // Markdown table;
|
if (lines[i].endsWith('|')) continue; // Markdown table;
|
||||||
if (!lines[i].endsWith(' ')) lines[i] = `${lines[i]} `;
|
if (!lines[i].endsWith(' ')) lines[i] = `${lines[i]} `;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user