mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
core: add FileTooLargeError
This commit is contained in:
1 parent
4a294f59a8
commit
1b53bfa2b4
8 files changed
+42
-27
No files matched your search
@@ -153,13 +153,12 @@ class ContestScoreboardRawHandler extends ContestHandler {
|
||||
|
||||
class ContestScoreboardDownloadHandler extends ContestHandler {
|
||||
@param('tid', Types.ObjectID)
|
||||
@param('ext', Types.String)
|
||||
@param('ext', Types.Range(['csv', 'html']))
|
||||
async get(domainId: string, tid: ObjectID, ext: string) {
|
||||
const getContent = {
|
||||
csv: async (rows) => `\uFEFF${rows.map((c) => (c.map((i) => i.value).join(','))).join('\n')}`,
|
||||
html: (rows) => this.renderHTML('contest_scoreboard_download_html.html', { rows }),
|
||||
};
|
||||
if (!getContent[ext]) throw new ValidationError('ext');
|
||||
const [tdoc, rows] = await this.getScoreboard(domainId, tid, true);
|
||||
this.binary(await getContent[ext](rows), `${tdoc.title}.${ext}`);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import {
|
||||
RoleAlreadyExistError, ValidationError, DomainJoinForbiddenError,
|
||||
DomainJoinAlreadyMemberError, InvalidJoinInvitationCodeError,
|
||||
} from '../error';
|
||||
import { log2 } from '../utils';
|
||||
import type { DomainDoc } from '../interface';
|
||||
import * as user from '../model/user';
|
||||
import * as domain from '../model/domain';
|
||||
import * as system from '../model/system';
|
||||
@@ -14,7 +16,6 @@ import paginate from '../lib/paginate';
|
||||
import {
|
||||
Route, Handler, Types, param,
|
||||
} from '../service/server';
|
||||
import { DomainDoc } from '../interface';
|
||||
|
||||
class DomainRankHandler extends Handler {
|
||||
@param('page', Types.PositiveInt, true)
|
||||
@@ -124,10 +125,6 @@ class DomainUserHandler extends ManageHandler {
|
||||
class DomainPermissionHandler extends ManageHandler {
|
||||
async get({ domainId }) {
|
||||
const roles = await domain.getRoles(domainId);
|
||||
const log2 = (val: bigint) => {
|
||||
// @ts-ignore
|
||||
for (let i = 0n; ; i++) if (!(val >> i)) return +i.toString() - 1;
|
||||
};
|
||||
const path = [
|
||||
['Hydro', 'homepage'],
|
||||
['domain', null],
|
||||
|
||||
Reference in new issue
Block a user