mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: problem_receive提供来源显示
This commit is contained in:
1 parent
006f969de6
commit
0babd5b821
2 files changed
+13
-2
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.20.6",
|
"version": "2.20.7",
|
||||||
"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",
|
||||||
|
|||||||
@@ -86,9 +86,20 @@ export class ProblemSendHandler extends Handler {
|
|||||||
export class ProblemReceiveHandler extends Handler {
|
export class ProblemReceiveHandler extends Handler {
|
||||||
async get({ domainId }) {
|
async get({ domainId }) {
|
||||||
this.checkPerm(PERM.PERM_CREATE_PROBLEM);
|
this.checkPerm(PERM.PERM_CREATE_PROBLEM);
|
||||||
const requests = await token.getMulti(token.TYPE_IMPORT, { domainId }).toArray();
|
let requests = await token.getMulti(token.TYPE_IMPORT, { domainId }).toArray();
|
||||||
|
requests = requests.map((request) => {
|
||||||
|
const url = new URL(request.source);
|
||||||
|
request.display = `${url.host}/${url.pathname.split('/')[2]}/`;
|
||||||
|
request.url = `${url.origin}/d/${url.pathname.split('/')[2]}/p/`;
|
||||||
|
return request;
|
||||||
|
});
|
||||||
this.response.template = 'problem_receive.html';
|
this.response.template = 'problem_receive.html';
|
||||||
this.response.body = { requests };
|
this.response.body = { requests };
|
||||||
|
this.response.body.path = [
|
||||||
|
['Hydro', 'homepage'],
|
||||||
|
['problem_main', 'problem_main'],
|
||||||
|
['problem_receive', null],
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@post('url', Types.String)
|
@post('url', Types.String)
|
||||||
|
|||||||
Reference in new issue
Block a user