MCPcopy Create free account
hub / github.com/hydro-dev/Hydro / get

Method get

packages/hydrooj/src/handler/problem.ts:644–657  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

642
643export class ProblemConfigHandler extends ProblemManageHandler {
644 async get() {
645 if (this.pdoc.reference) throw new ProblemIsReferencedError('edit config');
646 this.response.body.testdata = sortFiles(this.pdoc.data || []);
647 const configFile = (this.pdoc.data || []).filter((i) => i.name.toLowerCase() === 'config.yaml');
648 this.response.body.config = '';
649 if (configFile.length > 0) {
650 try {
651 this.response.body.config = (await streamToBuffer(
652 await storage.get(`problem/${this.pdoc.domainId}/${this.pdoc.docId}/testdata/${configFile[0].name}`),
653 )).toString();
654 } catch (e) { /* ignore */ }
655 }
656 this.response.template = 'problem_config.html';
657 }
658}
659
660export class ProblemFilesHandler extends ProblemDetailHandler {

Callers

nothing calls this directly

Calls 3

sortFilesFunction · 0.90
streamToBufferFunction · 0.90
getMethod · 0.45

Tested by

no test coverage detected