|
|
@ -257,6 +257,7 @@ app.get('/problem/:id/export', async (req, res) => { |
|
|
|
limit_and_hint: problem.limit_and_hint, |
|
|
|
limit_and_hint: problem.limit_and_hint, |
|
|
|
time_limit: problem.time_limit, |
|
|
|
time_limit: problem.time_limit, |
|
|
|
memory_limit: problem.memory_limit, |
|
|
|
memory_limit: problem.memory_limit, |
|
|
|
|
|
|
|
additional_file_id: problem.additional_file_id, |
|
|
|
file_io: problem.file_io, |
|
|
|
file_io: problem.file_io, |
|
|
|
file_io_input_name: problem.file_io_input_name, |
|
|
|
file_io_input_name: problem.file_io_input_name, |
|
|
|
file_io_output_name: problem.file_io_output_name, |
|
|
|
file_io_output_name: problem.file_io_output_name, |
|
|
@ -465,6 +466,11 @@ app.post('/problem/:id/import', async (req, res) => { |
|
|
|
let data = await download(req.body.url + (req.body.url.endsWith('/') ? 'testdata/download' : '/testdata/download')); |
|
|
|
let data = await download(req.body.url + (req.body.url.endsWith('/') ? 'testdata/download' : '/testdata/download')); |
|
|
|
await fs.writeFileAsync(tmpFile.path, data); |
|
|
|
await fs.writeFileAsync(tmpFile.path, data); |
|
|
|
await problem.updateTestdata(tmpFile.path, await res.locals.user.hasPrivilege('manage_problem')); |
|
|
|
await problem.updateTestdata(tmpFile.path, await res.locals.user.hasPrivilege('manage_problem')); |
|
|
|
|
|
|
|
if (json.obj.additional_file_id != null) { |
|
|
|
|
|
|
|
let additional_file = await download(req.body.url + (req.body.url.endsWith('/') ? 'download/additional_file' : '/download/additional_file')); |
|
|
|
|
|
|
|
await fs.writeFileAsync(tmpFile.path, additional_file); |
|
|
|
|
|
|
|
await problem.updateFile(tmpFile.path, 'additional_file', await res.locals.user.hasPrivilege('manage_problem')); |
|
|
|
|
|
|
|
} |
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|
syzoj.log(e); |
|
|
|
syzoj.log(e); |
|
|
|
} |
|
|
|
} |
|
|
|