mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: fix UA filter
This commit is contained in:
1 parent
2143e2989d
commit
04685ef864
3 files changed
+4
-4
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "3.4.2",
|
||||
"version": "3.4.3",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "src/loader",
|
||||
"module": "src/loader",
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in new issue
Block a user