mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
vjudge: support enableOn option
This commit is contained in:
1 parent
333b96f34c
commit
ba187a168a
3 files changed
+4
-1
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/vjudge",
|
||||
"version": "1.5.0-next.12",
|
||||
"version": "1.5.0-next.13",
|
||||
"description": "Submit problems to remote oj",
|
||||
"main": "package.json",
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
|
||||
@@ -11,6 +11,7 @@ export interface RemoteAccount {
|
||||
query?: string;
|
||||
frozen?: string;
|
||||
problemLists?: string[];
|
||||
enableOn?: string[];
|
||||
}
|
||||
declare module 'hydrooj/src/interface' {
|
||||
interface Collections {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/* eslint-disable no-await-in-loop */
|
||||
import os from 'os';
|
||||
import { sleep } from '@hydrooj/utils/lib/utils';
|
||||
import * as Judge from 'hydrooj/src/handler/judge';
|
||||
import { Logger } from 'hydrooj/src/logger';
|
||||
@@ -131,6 +132,7 @@ async function loadAccounts() {
|
||||
const accounts = await coll.find().toArray();
|
||||
for (const account of accounts) {
|
||||
if (!providers[account.type]) continue;
|
||||
if (account.enableOn && !account.enableOn.includes(os.hostname())) continue;
|
||||
Pool[`${account.type}/${account.handle}`] = new Service(providers[account.type], account);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user