Contest rule: ACM/ICPC

This commit is contained in:
masnn committed 2020-04-15 18:48:17 +08:00
1 parent d1ec9064fc
commit e06283c0cc
43 files changed
+158 -891

No files matched your search

+8
View File
@@ -115,6 +115,13 @@ class Handler {
this.response.redirect = this.request.headers.referer || '/';
}
binary(data, name) {
this.response.body = data;
this.response.template = null;
this.response.type = 'application/octet-stream';
this.response.disposition = `attachment; filename="${name}"`;
}
async ___prepare() {
this.now = new Date();
this._handler.sid = this.request.cookies.get('sid');
@@ -170,6 +177,7 @@ class Handler {
}
async putResponse() {
if (this.response.disposition) this.ctx.set('Content-Disposition', this.response.disposition);
if (this.response.redirect && !this.preferJson) {
this.ctx.response.type = 'application/octet-stream';
this.ctx.response.status = 302;