core: fix UA filter

This commit is contained in:
undefined committed 2022-02-02 03:03:38 +08:00
1 parent 2143e2989d
commit 04685ef864
3 files changed
+4 -4

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "3.4.2",
"version": "3.4.3",
"bin": "bin/hydrooj.js",
"main": "src/loader",
"module": "src/loader",
+2 -2
View File
@@ -135,7 +135,7 @@ async function runInDomain(id: string, isSub: boolean, report: Function) {
for (const dudoc of dudocs) deltaudict[dudoc.uid] = dudoc.rpdelta;
// TODO pagination
const problems = await problem.getMulti('', { domainId, nSubmit: { $gt: 0 }, hidden: false }).toArray();
await report({ message: `Found ${problems.length} problems in ${id}` });
if (problems.length) await report({ message: `Found ${problems.length} problems in ${id}` });
for (const i in problems) {
const pdoc = problems[i];
await runProblem(pdoc, udict);
@@ -147,7 +147,7 @@ async function runInDomain(id: string, isSub: boolean, report: Function) {
}
const contests: Tdoc<30 | 60>[] = await contest.getMulti('', { domainId, rated: true })
.toArray() as any;
await report({ message: `Found ${contests.length} contests in ${id}` });
if (contests.length) await report({ message: `Found ${contests.length} contests in ${id}` });
for (const i in contests) {
const tdoc = contests[i];
await runContest(tdoc, udict, report);
+1 -1
View File
@@ -634,7 +634,7 @@ export class Handler extends HandlerCommon {
async saveCookie() {
const ua = this.request.headers['user-agent'] || '';
if (!this.session.uid && system.get('server.ignoreUA').split('\n').filter((i) => i && ua.includes(i)).length) return;
if (!this.session.uid && system.get('server.ignoreUA').replace(/\r/g, '').split('\n').filter((i) => i && ua.includes(i)).length) return;
const expireSeconds = this.session.save
? system.get('session.saved_expire_seconds')
: system.get('session.unsaved_expire_seconds');